diff --git a/icu4c/source/tools/genrb/genrb.c b/icu4c/source/tools/genrb/genrb.c index 35f137cdb8..2988943348 100644 --- a/icu4c/source/tools/genrb/genrb.c +++ b/icu4c/source/tools/genrb/genrb.c @@ -187,7 +187,6 @@ processFile(const char *filename, const char *cp, const char *inputDir, const ch if(inputDir == NULL) { in = T_FileStream_open(filename, "rb"); } else { - char *openFileName = NULL; int32_t dirlen = uprv_strlen(inputDir); int32_t filelen = uprv_strlen(filename); if(inputDir[dirlen-1] != U_FILE_SEP_CHAR) { diff --git a/icu4c/source/tools/genrb/parse.c b/icu4c/source/tools/genrb/parse.c index 92a5235b4f..3afd2da6aa 100644 --- a/icu4c/source/tools/genrb/parse.c +++ b/icu4c/source/tools/genrb/parse.c @@ -110,13 +110,6 @@ static uint32_t inputdirLength; static struct SResource *parseResource(char *tag, UErrorCode *status); -static char *u2c(UChar *str) -{ - static char buffer[1024]; - u_austrcpy(buffer, str); - return buffer; -} - void initParser(void) { uint32_t i; @@ -324,8 +317,11 @@ parseResourceType(UErrorCode *status) } else if (u_strcmp(tokenValue->fChars, k_type_reserved) == 0) { result = RT_RESERVED; } else { + char tokenBuffer[1024]; + u_austrncpy(tokenBuffer, tokenValue->fChars, sizeof(tokenBuffer)); + tokenBuffer[sizeof(tokenBuffer)] = 0; *status = U_INVALID_FORMAT_ERROR; - error(line, "unknown resource type '%s'", u2c(tokenValue->fChars)); + error(line, "unknown resource type '%s'", tokenBuffer); } return result;