| 106 | } |
| 107 | |
| 108 | void SetCodePage(UINT aCodePage) |
| 109 | { |
| 110 | if (aCodePage == CP_ACP) |
| 111 | aCodePage = g_ACP; // Required by _create_locale. |
| 112 | //if (!IsValidCodePage(aCodePage)) // Returns FALSE for UTF-16 and possibly other valid code pages, so leave it up to the caller to validate. |
| 113 | //return; |
| 114 | |
| 115 | if (mCodePage != aCodePage) |
| 116 | { |
| 117 | // Resist temptation to do the following as a way to avoid having an odd number of bytes in |
| 118 | // the buffer, since it breaks non-seeking devices and actually isn't sufficient for cases |
| 119 | // where the caller uses raw I/O in addition to text I/O (e.g. read one byte then read text). |
| 120 | //RollbackFilePointer(); |
| 121 | |
| 122 | mCodePage = aCodePage; |
| 123 | if (!GetCPInfo(aCodePage, &mCodePageInfo)) |
| 124 | mCodePageInfo.LeadByte[0] = NULL; |
| 125 | } |
| 126 | } |
| 127 | UINT GetCodePage() { return mCodePage; } |
| 128 | DWORD GetFlags() { return mFlags; } |
| 129 | |