Skip to content

Commit

Permalink
ICU-21360 Fix false true in ICU-demos (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-oly authored Nov 18, 2020
1 parent 79976ea commit 0d7f863
Show file tree
Hide file tree
Showing 86 changed files with 752 additions and 754 deletions.
32 changes: 16 additions & 16 deletions XMLConverter/XMLConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef unsigned char BYTE;

char firstLine[128];
char encodingNameInFile[256];
UBool verbose = FALSE;
UBool verbose = false;

extern void convertFile(char*, char*, char*, UConverter*);
extern void usage();
Expand Down Expand Up @@ -140,7 +140,7 @@ int main(int argc, char** argv)
exit(1);
}
if (!strcmp( argv[i], "-v"))
verbose = TRUE;
verbose = true;
if (!strcmp( argv[i], "-e"))
{
if ( argc == i+4)
Expand Down Expand Up @@ -364,7 +364,7 @@ void convertFile(char* encName, char* iFN, char* oFN, UConverter* outConvrtr)

char *outBuf = new char[RAWBUFSIZE];
int outBufSize = RAWBUFSIZE;
UBool tFlush = FALSE;
UBool tFlush = false;
err = U_ZERO_ERROR;

if (verbose)
Expand Down Expand Up @@ -420,7 +420,7 @@ void convertFile(char* encName, char* iFN, char* oFN, UConverter* outConvrtr)
}
toRead = (RAWBUFSIZE > bytesLeft) ? bytesLeft : RAWBUFSIZE;
if (toRead < RAWBUFSIZE)
tFlush = TRUE;
tFlush = true;
if (err == U_BUFFER_OVERFLOW_ERROR)
err = U_ZERO_ERROR;
}
Expand Down Expand Up @@ -591,11 +591,11 @@ long convertFirstLine( FILE* inF, char* inEncName,
exit(1);
}

UBool encString = TRUE;
UBool stdString = TRUE;
UBool encInsertMid = FALSE;
UBool encInsertLast = FALSE;
UBool dQuote = TRUE;
UBool encString = true;
UBool stdString = true;
UBool encInsertMid = false;
UBool encInsertLast = false;
UBool dQuote = true;
const char* doubleQuote = "\"";
const char* singleQuote = "\'";

Expand All @@ -608,14 +608,14 @@ long convertFirstLine( FILE* inF, char* inEncName,
fclose(outF);
exit(1);
}
dQuote = FALSE;
dQuote = false;
}

char* newString = strstr( pFLB, "encoding");
char* stringWithEnc = 0;

if (!newString)
encString = FALSE;
encString = false;
else
{
stringWithEnc = new char[strlen(newString)+1];
Expand All @@ -625,17 +625,17 @@ long convertFirstLine( FILE* inF, char* inEncName,
newString = (char*)strstr( (const char*) pFLB, "standalone");
char* stringWithStd = 0;
if (!newString)
stdString = FALSE;
stdString = false;
else
{
stringWithStd = new char[strlen(newString)+1];
strcpy(stringWithStd, newString);
}

if (!encString && !stdString)
encInsertLast = TRUE;
encInsertLast = true;
if (!encString && stdString)
encInsertMid = TRUE;
encInsertMid = true;

//Encodingname for the rest of the input file could be different.
//If its not specified in the first line then assume it to be UTF8
Expand Down Expand Up @@ -990,7 +990,7 @@ void XMLU_fromCodepageToCodepage( UConverter* outConverter,
&out_chunk_alias2,
out_chunk_alias,
&consumed_UChars,
FALSE,
false,
err);

}
Expand Down Expand Up @@ -1046,7 +1046,7 @@ void XMLU_fromCodepageToCodepage( UConverter* outConverter,
&out_chunk_alias2,
out_chunk_alias,
NULL,
TRUE,
true,
err);
}
}
Expand Down
22 changes: 11 additions & 11 deletions convexp/convexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ static UBool containsAmbiguousAliases() {
alias = ucnv_getAlias(gCurrConverter, idx, &status);
ucnv_getStandardName(alias, "", &status);
if (status == U_AMBIGUOUS_ALIAS_WARNING) {
return TRUE;
return true;
}
}
return FALSE;
return false;
}

/* Is 0x20-7F always the same? */
Expand All @@ -347,12 +347,12 @@ static UBool isASCIIcompatible(UConverter *cnv) {
ucnv_toUnicode(cnv,
&target, target+sizeof(output)/sizeof(output[0]),
&source, source+sizeof(ascii),
NULL, TRUE, &status);
NULL, true, &status);
ucnv_reset(cnv);
if (U_SUCCESS(status) && memcmp(expected, output, sizeof(expected)) == 0) {
return TRUE;
return true;
}
return FALSE;
return false;
}

/*
Expand Down Expand Up @@ -401,7 +401,7 @@ static void printUnicodeSet(USet *cnvSet, UErrorCode *status, UBool alwaysShowSe
char setStrBuf[64];
UChar setUStrBuf[sizeof(setStrBuf)];
UErrorCode myStatus = U_ZERO_ERROR;
patLen = uset_toPattern(cnvSet, NULL, 0, TRUE, &myStatus) + 1;
patLen = uset_toPattern(cnvSet, NULL, 0, true, &myStatus) + 1;
if (alwaysShowSet || patLen < (int32_t)(sizeof(setUStrBuf)/sizeof(setUStrBuf[0]))) {
if (patLen < (int32_t)(sizeof(setUStrBuf)/sizeof(setUStrBuf[0]))) {
patBuffer = setUStrBuf;
Expand All @@ -413,7 +413,7 @@ static void printUnicodeSet(USet *cnvSet, UErrorCode *status, UBool alwaysShowSe
}
if (U_SUCCESS(*status) && patBuffer && patBufferUTF8) {
myStatus = U_ZERO_ERROR;
patLen = uset_toPattern(cnvSet, patBuffer, patLen, TRUE, &myStatus) + 1;
patLen = uset_toPattern(cnvSet, patBuffer, patLen, true, &myStatus) + 1;
u_strToUTF8(patBufferUTF8, patLen, NULL, patBuffer, patLen, &myStatus);

/*
Expand Down Expand Up @@ -456,7 +456,7 @@ static void printLanguages(UConverter * /*cnv*/, USet *cnvSet, UErrorCode *statu
int32_t patLen;
int32_t locCount = uloc_countAvailable();
int32_t locIndex;
UBool localeFound = FALSE;
UBool localeFound = false;
UErrorCode myStatus = U_ZERO_ERROR;

if (U_FAILURE(*status)) {
Expand Down Expand Up @@ -491,7 +491,7 @@ static void printLanguages(UConverter * /*cnv*/, USet *cnvSet, UErrorCode *statu
u_strToUTF8(patBufferUTF8, sizeof(patBufferUTF8)/sizeof(patBufferUTF8[0]), NULL, patBuffer, patLen, &myStatus);
patBufferUTF8[sizeof(patBufferUTF8)/sizeof(patBufferUTF8[0])-1] = 0;
if (!localeFound) {
localeFound = TRUE;
localeFound = true;
puts("<tr><th>Locale</th><th>Locale Name</th></tr>");
}
printf("<tr><td>%s</td><td>%s</td></tr>\n",
Expand All @@ -501,7 +501,7 @@ static void printLanguages(UConverter * /*cnv*/, USet *cnvSet, UErrorCode *statu
/*else {
uset_removeAll(flatLocSet, cnvSet);
printf("<tr><td>%s</td><td>", locale);
printUnicodeSet(flatLocSet, status, TRUE);
printUnicodeSet(flatLocSet, status, true);
printf("</td></tr>\n");
}*/
/*else {
Expand All @@ -524,7 +524,7 @@ static void printLanguages(UConverter * /*cnv*/, USet *cnvSet, UErrorCode *statu
static void printConverterInfo(UErrorCode *status) {
char buffer[64]; // It would be insane if it were lager than 64 bytes
UBool starterBufferBool[256];
UBool ambiguousAlias = FALSE;
UBool ambiguousAlias = false;
char starterBuffer[sizeof(starterBufferBool)+1]; // Add one for the NULL
int8_t len;
UConverter *cnv = ucnv_open(gCurrConverter, status);
Expand Down
16 changes: 8 additions & 8 deletions convexp/params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
#include <ctype.h>

int32_t gMaxStandards;
UBool gShowStartBytes = FALSE;
UBool gShowStartBytes = false;
char gCurrConverter[UCNV_MAX_CONVERTER_NAME_LENGTH] = "";
char gStartBytes[MAX_BYTE_SIZE] = "";
std::set<std::string> *gStandardsSelected = NULL;
const char *gScriptName = NULL;
UBool gShowUnicodeSet = FALSE;
UBool gShowLanguages = FALSE;
UBool gShowUnavailable = FALSE;
UBool gShowUnicodeSet = false;
UBool gShowLanguages = false;
UBool gShowUnavailable = false;

const char ALL[]="ALL";

Expand Down Expand Up @@ -199,7 +199,7 @@ U_CFUNC void parseAllOptions(const char *queryStr, UErrorCode *status) {
strncpy(gStartBytes, nextVal, nextOpt - nextVal);
gStartBytes[sizeof(gStartBytes)-1] = 0; // NULL terminate for safety
gStartBytes[((strlen(gStartBytes)>>1)<<1)] = 0;// Make it an even number of chars
gShowStartBytes = TRUE;
gShowStartBytes = true;
while (*strItr) {
if (!isxdigit(*strItr)) {
// Bad data! Ignore the whole thing
Expand All @@ -211,15 +211,15 @@ U_CFUNC void parseAllOptions(const char *queryStr, UErrorCode *status) {
}
else if (strncmp(src, SHOW_UNICODESET, strlen(SHOW_UNICODESET)) == 0) {
/* Show the Unicode Set */
gShowUnicodeSet = TRUE;
gShowUnicodeSet = true;
}
else if (strncmp(src, SHOW_UNAVAILABLE, strlen(SHOW_UNAVAILABLE)) == 0) {
/* Show unavailable converters */
gShowUnavailable = TRUE;
gShowUnavailable = true;
}
else if (strncmp(src, SHOW_LOCALES, strlen(SHOW_LOCALES)) == 0) {
/* Show the list of languages */
gShowLanguages = TRUE;
gShowLanguages = true;
}
else {
// Woah! I don't know what this option is.
Expand Down
14 changes: 7 additions & 7 deletions convexp/printcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ static UBool isShortestUTF8(char *source, int32_t size) {
|| (source[0] == (char)0xF0 && source[1] < (char)0x90)
|| (source[0] == (char)0xF4 && source[1] > (char)0x8F))))
{
return FALSE;
return false;
}
return TRUE;
return true;
}

/* The CESU-8 converter will try to convert non-shortest form, but it will return a
Expand All @@ -192,9 +192,9 @@ static UBool isShortestCESU8(char *source, int32_t size) {
|| (size >= 3 && (source[3] == (char)0xc0 || source[3] == (char)0xc1 || source[3] > (char)0xef))
|| (size >= 4 && (source[3] == (char)0xE0 && source[4] < (char)0xA0)))
{
return FALSE;
return false;
}
return TRUE;
return true;
}

static inline void printUChars(const UChar *targetBuffer, int32_t targetSize, UErrorCode *status) {
Expand Down Expand Up @@ -277,7 +277,7 @@ void printCPTable(UConverter *cnv, char *startBytes, UErrorCode *status) {
UChar *target;
UChar *targetLimit;
int8_t cnvMaxCharSize;
UBool hideContinueBytes = FALSE;
UBool hideContinueBytes = false;
UErrorCode localStatus = U_ZERO_ERROR;

if (U_FAILURE(*status)) {
Expand Down Expand Up @@ -330,7 +330,7 @@ void printCPTable(UConverter *cnv, char *startBytes, UErrorCode *status) {
puts("<br /><p>Codepage layout information is not available for this converter at this time.</p>");
return;
}
hideContinueBytes = TRUE;
hideContinueBytes = true;
}
puts("<br /><br />\n"
"<table width=\"100%\" cellspacing=\"0\" class=\"data-table-2\" summary=\"A 16 by 16 table with headers on each side of the table representing the nibble of a byte.\">\n"
Expand Down Expand Up @@ -413,7 +413,7 @@ void printCPTable(UConverter *cnv, char *startBytes, UErrorCode *status) {
targetBuffer[0] = 0;
source = sourceBuffer;
target = targetBuffer;
ucnv_toUnicode(cnv, &target, targetLimit, (const char **)&source, (const char *)sourceLimit, NULL, TRUE, &localStatus);
ucnv_toUnicode(cnv, &target, targetLimit, (const char **)&source, (const char *)sourceLimit, NULL, true, &localStatus);
targetSize = (target - targetBuffer);

if (((convType == UCNV_UTF8 && !isShortestUTF8(sourceBuffer, source - sourceBuffer))
Expand Down
24 changes: 12 additions & 12 deletions datacustom/gendatadep/gendatadep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,16 @@ generateHTML(Package *pkg, UErrorCode &status) {
DependencyInfo depInfo(status);

ItemGroup catagorizedItems[] = {
ItemGroup(FALSE, ".+\\.cnv$", "conv", "Charset Mapping Tables", status),
ItemGroup(FALSE, "brkitr/.+", "brkiter", "Break Iterator", status),
ItemGroup(FALSE, "(coll/.+|ucadata.icu|invuca.icu)", "coll", "Collators", status),
ItemGroup(FALSE, "rbnf/.+", "rbnf", "Rule Based Number Format", status),
ItemGroup(FALSE, "translit/.+", "translit", "Transliterators", status),
//ItemGroup(TRUE, "zoneinfo.res", "zoneinfo", "Timezone Data", status), // Doesn't need to be a lone item?
ItemGroup(false, ".+\\.cnv$", "conv", "Charset Mapping Tables", status),
ItemGroup(false, "brkitr/.+", "brkiter", "Break Iterator", status),
ItemGroup(false, "(coll/.+|ucadata.icu|invuca.icu)", "coll", "Collators", status),
ItemGroup(false, "rbnf/.+", "rbnf", "Rule Based Number Format", status),
ItemGroup(false, "translit/.+", "translit", "Transliterators", status),
//ItemGroup(true, "zoneinfo.res", "zoneinfo", "Timezone Data", status), // Doesn't need to be a lone item?
// This next one should be the last one searching for .res locale files.
ItemGroup(FALSE, "(...?(_|\\.).*res|root.res)$", "format", "Formatting, Display Names and Other Localized Data", status),
ItemGroup(TRUE, "(pnames.icu|unames.icu|.+\\.spp|.+\\.res)", "misc", "Miscellaneous Data", status),
ItemGroup(FALSE, ".+", BASE_DATA, "Base Data", status)
ItemGroup(false, "(...?(_|\\.).*res|root.res)$", "format", "Formatting, Display Names and Other Localized Data", status),
ItemGroup(true, "(pnames.icu|unames.icu|.+\\.spp|.+\\.res)", "misc", "Miscellaneous Data", status),
ItemGroup(false, ".+", BASE_DATA, "Base Data", status)
};

if (U_FAILURE(status)) {
Expand Down Expand Up @@ -421,17 +421,17 @@ generateHTML(Package *pkg, UErrorCode &status) {
UBool hideItemForIndexing = currCategory->hiddenByDefault;

if (!inputID.endsWith(UnicodeString("_res"))) {
hideItemForIndexing = FALSE;
hideItemForIndexing = false;
}
if (hiddenItems->contains(currItem->name)) {
rowClass = " class=\"hide\"";
hideItemForIndexing = TRUE;
hideItemForIndexing = true;
}
else if (additionalItems->contains(&itemToFind)) {
rowClass = " class=\"unselected\"";
}
if (inputID.endsWith(UnicodeString("root_res"))) {
hideItemForIndexing = TRUE;
hideItemForIndexing = true;
}

variables += UnicodeString("gItems['") + inputID
Expand Down
8 changes: 4 additions & 4 deletions dumpdat/dumpdat.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ isAcceptable(void *context,
fprintf(stderr, "isAcceptable() called on:\n");
printInfo(pInfo);
fprintf(stderr, "\n");
return TRUE;
return true;
}

#if CAN_DYNAMIC_LOAD
Expand Down Expand Up @@ -280,7 +280,7 @@ void cmd_version(UBool noLoad)
u_versionToString(icu, str);
fprintf(stderr, "\nCompiled against ICU " U_ICU_VERSION ", currently running ICU %s\n", str);
fprintf(stderr, "Default locale is %s\n", uloc_getDefault());
if(noLoad == FALSE)
if(noLoad == false)
{
fprintf(stderr, "Default converter is %s.\n", ucnv_getDefaultName());
}
Expand Down Expand Up @@ -416,7 +416,7 @@ doInteractive()
char *rl;
#endif

cmd_version(TRUE);
cmd_version(true);
cmd_path("p");
fprintf(stderr, "\nEntering interactive mode. Typing ? gets help.\n");
#if CAN_DYNAMIC_LOAD
Expand Down Expand Up @@ -467,7 +467,7 @@ doInteractive()
break;

case 'v':
cmd_version(FALSE);
cmd_version(false);
break;

case 'l':
Expand Down
Loading

0 comments on commit 0d7f863

Please sign in to comment.