X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=rosapps%2Fapplications%2Fdevutils%2Ftxt2nls%2Fnls.c;h=02d84bab89a0a56bc876e5b34d1d34d5af7dd7cf;hp=550e04c0d8fee2d850e5d7d6875480a4b2e6ab72;hb=40a137dfa84cab9f63cf6667e83567f2b71aa733;hpb=942c4eff2d847a43a2744a8b7f0ab82eef691c4f diff --git a/rosapps/applications/devutils/txt2nls/nls.c b/rosapps/applications/devutils/txt2nls/nls.c index 550e04c0d8f..02d84bab89a 100644 --- a/rosapps/applications/devutils/txt2nls/nls.c +++ b/rosapps/applications/devutils/txt2nls/nls.c @@ -131,6 +131,21 @@ nls_from_txt(const char *txt_file_path, const char *nls_file_path) /* GLYPHTABLE optionally. We do not leave if it is absent */ glyph_table = txt_get_glyph_table(txt_file_path, header.UniDefaultChar); + if (is_dbcs) + { + /* DBCS codepage */ + uint16_t *table = (uint16_t*)wc_table; + header.TransUniDefaultChar = table[header.UniDefaultChar]; + /* TODO: TransDefaultChar for DBCS codepages */ + } + else + { + /* SBCS codepage */ + uint8_t *table = (uint8_t*)wc_table; + header.TransUniDefaultChar = table[header.UniDefaultChar]; + header.TransDefaultChar = mb_table[LOBYTE(header.DefaultChar)]; + } + #ifdef _NLS_DEBUG_PRINT nls_print_header(&header); nls_print_mb_table(mb_table, header.UniDefaultChar); @@ -178,7 +193,7 @@ nls_from_txt(const char *txt_file_path, const char *nls_file_path) } /* OEM glyph table size in words */ - size = (glyph_table ? (256 * sizeof(uint16_t)) : 0); + size = (glyph_table ? 256 : 0); if (fwrite(&size, 1, sizeof(size), file) != sizeof(size)) { @@ -213,7 +228,7 @@ nls_from_txt(const char *txt_file_path, const char *nls_file_path) } /* Write wide char table */ - if (fwrite(wc_table, 1, (65535 * header.MaximumCharacterSize), file) != (65535 * header.MaximumCharacterSize)) + if (fwrite(wc_table, 1, (65536 * header.MaximumCharacterSize), file) != (65536 * header.MaximumCharacterSize)) { printf("Unable to write NLS file.\n"); goto Cleanup;