/*
********************************************************************************
*
- * Copyright (C) 1998-2008, International Business Machines
+ * Copyright (C) 1998-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
********************************************************************************
*/
UBool VERBOSE = FALSE;
UBool SMALL = FALSE;
+UBool IGNORE_SISO_CHECK = FALSE;
static void
createConverter(ConvData *data, const char* converterName, UErrorCode *pErrorCode);
OPT_DESTDIR,
OPT_VERBOSE,
OPT_SMALL,
+ OPT_IGNORE_SISO_CHECK,
OPT_COUNT
};
UOPTION_VERSION,
UOPTION_DESTDIR,
UOPTION_VERBOSE,
- { "small", NULL, NULL, NULL, '\1', UOPT_NO_ARG, 0 }
+ { "small", NULL, NULL, NULL, '\1', UOPT_NO_ARG, 0 },
+ { "ignore-siso-check", NULL, NULL, NULL, '\1', UOPT_NO_ARG, 0 }
};
int main(int argc, char* argv[])
"\t --small Generate smaller .cnv files. They will be\n"
"\t significantly smaller but may not be compatible with\n"
"\t older versions of ICU and will require heap memory\n"
- "\t allocation when loaded.\n");
+ "\t allocation when loaded.\n"
+ "\t --ignore-siso-check Use SI/SO other than 0xf/0xe.\n");
return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;
}
if(options[OPT_VERSION].doesOccur) {
- printf("makeconv version %hu.%hu, ICU tool to read .ucm codepage mapping files and write .cnv files\n",
+ printf("makeconv version %u.%u, ICU tool to read .ucm codepage mapping files and write .cnv files\n",
dataInfo.formatVersion[0], dataInfo.formatVersion[1]);
printf("%s\n", U_COPYRIGHT_STRING);
exit(0);
VERBOSE = options[OPT_VERBOSE].doesOccur;
SMALL = options[OPT_SMALL].doesOccur;
+ if (options[OPT_IGNORE_SISO_CHECK].doesOccur) {
+ IGNORE_SISO_CHECK = TRUE;
+ }
+
if (destdir != NULL && *destdir != 0) {
uprv_strcpy(outFileName, destdir);
destdirlen = uprv_strlen(destdir);
arg = getLongPathname(*argv);
/* Check for potential buffer overflow */
- if(strlen(arg) > UCNV_MAX_FULL_FILE_NAME_LENGTH)
+ if(strlen(arg) >= UCNV_MAX_FULL_FILE_NAME_LENGTH)
{
fprintf(stderr, "%s\n", u_errorName(U_BUFFER_OVERFLOW_ERROR));
return U_BUFFER_OVERFLOW_ERROR;
FileStream* convFile,
const char* converterName,
UErrorCode *pErrorCode) {
- char line[200];
+ char line[1024];
char *s, *key, *value;
const UConverterStaticData *prototype;
UConverterStaticData *staticData;
static UBool
readFile(ConvData *data, const char* converterName,
UErrorCode *pErrorCode) {
- char line[200];
+ char line[1024];
char *end;
FileStream *convFile;
if(data->ucm->baseName[0]==0) {
dataIsBase=TRUE;
baseStates=&data->ucm->states;
- ucm_processStates(baseStates);
+ ucm_processStates(baseStates, IGNORE_SISO_CHECK);
} else {
dataIsBase=FALSE;
baseStates=NULL;
fprintf(stderr, " the substitution character byte sequence is illegal in this codepage structure!\n");
*pErrorCode=U_INVALID_TABLE_FORMAT;
- } else if(1!=ucm_countChars(baseStates, &staticData->subChar1, 1)) {
+ } else if(staticData->subChar1!=0 && 1!=ucm_countChars(baseStates, &staticData->subChar1, 1)) {
fprintf(stderr, " the subchar1 byte is illegal in this codepage structure!\n");
*pErrorCode=U_INVALID_TABLE_FORMAT;