Author: dchapyshev Date: Sat Sep 17 20:03:13 2016 New Revision: 72708 URL: http://svn.reactos.org/svn/reactos?rev=72708&view=rev Log: [TXT2NLS] TransUniDefaultChar has to be received from WideCharTable. TransDefaultChar has to be received from MultiByteTable (or from DBCS table)
Modified: trunk/rosapps/applications/devutils/txt2nls/nls.c trunk/rosapps/applications/devutils/txt2nls/precomp.h trunk/rosapps/applications/devutils/txt2nls/txt.c Modified: trunk/rosapps/applications/devutils/txt2nls/nls.c URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/devutils/txt2nls/nls.c?rev=72708&r1=72707&r2=72708&view=diff ============================================================================== --- trunk/rosapps/applications/devutils/txt2nls/nls.c [iso-8859-1] (original) +++ trunk/rosapps/applications/devutils/txt2nls/nls.c [iso-8859-1] Sat Sep 17 20:03:13 2016 @@ -131,6 +131,21 @@ /* 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); Modified: trunk/rosapps/applications/devutils/txt2nls/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/devutils/txt2nls/precomp.h?rev=72708&r1=72707&r2=72708&view=diff ============================================================================== --- trunk/rosapps/applications/devutils/txt2nls/precomp.h [iso-8859-1] (original) +++ trunk/rosapps/applications/devutils/txt2nls/precomp.h [iso-8859-1] Sat Sep 17 20:03:13 2016 @@ -14,6 +14,8 @@ #include <string.h> #include <ctype.h> #include <memory.h> + +#define LOBYTE(w) ((uint8_t)((uint32_t)(w) & 0xff)) #define MAXIMUM_LEADBYTES 12 Modified: trunk/rosapps/applications/devutils/txt2nls/txt.c URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/devutils/txt2nls/txt.c?rev=72708&r1=72707&r2=72708&view=diff ============================================================================== --- trunk/rosapps/applications/devutils/txt2nls/txt.c [iso-8859-1] (original) +++ trunk/rosapps/applications/devutils/txt2nls/txt.c [iso-8859-1] Sat Sep 17 20:03:13 2016 @@ -96,6 +96,7 @@ /* Convert string to uint32_t */ val = strtoul(p, &p, 16); header->DefaultChar = (uint16_t)val; + /* By default set value as DefaultChar */ header->TransDefaultChar = (uint16_t)val; /* Skip all spaces after default char */ @@ -104,6 +105,7 @@ /* Convert string to uint32_t */ val = strtoul(p, &p, 16); header->UniDefaultChar = (uint16_t)val; + /* By default set value as UniDefaultChar */ header->TransUniDefaultChar = (uint16_t)val; found = 1;