mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:35:41 +00:00
[TXT2NLS] TransUniDefaultChar has to be received from WideCharTable. TransDefaultChar has to be received from MultiByteTable (or from DBCS table)
svn path=/trunk/; revision=72708
This commit is contained in:
parent
c75bd6ee1e
commit
40a137dfa8
3 changed files with 19 additions and 0 deletions
|
@ -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 */
|
/* GLYPHTABLE optionally. We do not leave if it is absent */
|
||||||
glyph_table = txt_get_glyph_table(txt_file_path, header.UniDefaultChar);
|
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
|
#ifdef _NLS_DEBUG_PRINT
|
||||||
nls_print_header(&header);
|
nls_print_header(&header);
|
||||||
nls_print_mb_table(mb_table, header.UniDefaultChar);
|
nls_print_mb_table(mb_table, header.UniDefaultChar);
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
|
||||||
|
#define LOBYTE(w) ((uint8_t)((uint32_t)(w) & 0xff))
|
||||||
|
|
||||||
#define MAXIMUM_LEADBYTES 12
|
#define MAXIMUM_LEADBYTES 12
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -96,6 +96,7 @@ txt_get_header(const char *file_path, NLS_FILE_HEADER *header)
|
||||||
/* Convert string to uint32_t */
|
/* Convert string to uint32_t */
|
||||||
val = strtoul(p, &p, 16);
|
val = strtoul(p, &p, 16);
|
||||||
header->DefaultChar = (uint16_t)val;
|
header->DefaultChar = (uint16_t)val;
|
||||||
|
/* By default set value as DefaultChar */
|
||||||
header->TransDefaultChar = (uint16_t)val;
|
header->TransDefaultChar = (uint16_t)val;
|
||||||
|
|
||||||
/* Skip all spaces after default char */
|
/* Skip all spaces after default char */
|
||||||
|
@ -104,6 +105,7 @@ txt_get_header(const char *file_path, NLS_FILE_HEADER *header)
|
||||||
/* Convert string to uint32_t */
|
/* Convert string to uint32_t */
|
||||||
val = strtoul(p, &p, 16);
|
val = strtoul(p, &p, 16);
|
||||||
header->UniDefaultChar = (uint16_t)val;
|
header->UniDefaultChar = (uint16_t)val;
|
||||||
|
/* By default set value as UniDefaultChar */
|
||||||
header->TransUniDefaultChar = (uint16_t)val;
|
header->TransUniDefaultChar = (uint16_t)val;
|
||||||
|
|
||||||
found = 1;
|
found = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue