ICU-11751 change genrb reslist.c & wrtjava.c to C++ (mostly just .c to .cpp)

X-SVN-Rev: 37610
This commit is contained in:
Markus Scherer 2015-06-23 07:07:27 +00:00
parent f6d079eba2
commit cfe9e72aec
4 changed files with 39 additions and 34 deletions

View File

@ -246,10 +246,10 @@
<ClCompile Include="prscmnts.cpp" /> <ClCompile Include="prscmnts.cpp" />
<ClCompile Include="rbutil.c" /> <ClCompile Include="rbutil.c" />
<ClCompile Include="read.c" /> <ClCompile Include="read.c" />
<ClCompile Include="reslist.c" /> <ClCompile Include="reslist.cpp" />
<ClCompile Include="rle.c" /> <ClCompile Include="rle.c" />
<ClCompile Include="ustr.c" /> <ClCompile Include="ustr.c" />
<ClCompile Include="wrtjava.c" /> <ClCompile Include="wrtjava.cpp" />
<ClCompile Include="wrtxml.cpp" /> <ClCompile Include="wrtxml.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -33,7 +33,7 @@
<ClCompile Include="read.c"> <ClCompile Include="read.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="reslist.c"> <ClCompile Include="reslist.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="rle.c"> <ClCompile Include="rle.c">
@ -42,7 +42,7 @@
<ClCompile Include="ustr.c"> <ClCompile Include="ustr.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="wrtjava.c"> <ClCompile Include="wrtjava.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="wrtxml.cpp"> <ClCompile Include="wrtxml.cpp">

View File

@ -1,12 +1,12 @@
/* /*
******************************************************************************* *******************************************************************************
* *
* Copyright (C) 2000-2014, International Business Machines * Copyright (C) 2000-2015, International Business Machines
* Corporation and others. All Rights Reserved. * Corporation and others. All Rights Reserved.
* *
******************************************************************************* *******************************************************************************
* *
* File reslist.c * File reslist.cpp
* *
* Modification History: * Modification History:
* *
@ -56,7 +56,12 @@ enum {
* for use in non-error cases when no resource is to be added to the bundle. * for use in non-error cases when no resource is to be added to the bundle.
* (NULL is used in error cases.) * (NULL is used in error cases.)
*/ */
static const struct SResource kNoResource = { URES_NONE }; static const struct SResource kNoResource = {
URES_NONE, FALSE, 0, 0, 0,
NULL, // fNext
{ NULL, 0, 0 }, // UString fComment
{}
};
static UDataInfo dataInfo= { static UDataInfo dataInfo= {
sizeof(UDataInfo), sizeof(UDataInfo),
@ -158,7 +163,7 @@ res_write(UNewDataMemory *mem, uint32_t *byteOffset,
static void static void
string_preflightStrings(struct SRBRoot *bundle, struct SResource *res, UHashtable *stringSet, string_preflightStrings(struct SRBRoot *bundle, struct SResource *res, UHashtable *stringSet,
UErrorCode *status) { UErrorCode *status) {
res->u.fString.fSame = uhash_get(stringSet, res); res->u.fString.fSame = static_cast<struct SResource *>(uhash_get(stringSet, res));
if (res->u.fString.fSame != NULL) { if (res->u.fString.fSame != NULL) {
return; /* This is a duplicate of an earlier-visited string. */ return; /* This is a duplicate of an earlier-visited string. */
} }
@ -317,7 +322,7 @@ makeKey16(struct SRBRoot *bundle, int32_t key) {
* and exits early. * and exits early.
*/ */
static void static void
string_write16(struct SRBRoot *bundle, struct SResource *res, UErrorCode *status) { string_write16(struct SRBRoot * /*bundle*/, struct SResource *res, UErrorCode * /*status*/) {
struct SResource *same; struct SResource *same;
if ((same = res->u.fString.fSame) != NULL) { if ((same = res->u.fString.fSame) != NULL) {
/* This is a duplicate. */ /* This is a duplicate. */
@ -471,8 +476,8 @@ res_write16(struct SRBRoot *bundle, struct SResource *res,
*/ */
static void static void
string_preWrite(uint32_t *byteOffset, string_preWrite(uint32_t *byteOffset,
struct SRBRoot *bundle, struct SResource *res, struct SRBRoot * /*bundle*/, struct SResource *res,
UErrorCode *status) { UErrorCode * /*status*/) {
/* Write the UTF-16 v1 string. */ /* Write the UTF-16 v1 string. */
res->fRes = URES_MAKE_RESOURCE(URES_STRING, *byteOffset >> 2); res->fRes = URES_MAKE_RESOURCE(URES_STRING, *byteOffset >> 2);
*byteOffset += 4 + (res->u.fString.fLength + 1) * U_SIZEOF_UCHAR; *byteOffset += 4 + (res->u.fString.fLength + 1) * U_SIZEOF_UCHAR;
@ -480,8 +485,8 @@ string_preWrite(uint32_t *byteOffset,
static void static void
bin_preWrite(uint32_t *byteOffset, bin_preWrite(uint32_t *byteOffset,
struct SRBRoot *bundle, struct SResource *res, struct SRBRoot * /*bundle*/, struct SResource *res,
UErrorCode *status) { UErrorCode * /*status*/) {
uint32_t pad = 0; uint32_t pad = 0;
uint32_t dataStart = *byteOffset + sizeof(res->u.fBinaryValue.fLength); uint32_t dataStart = *byteOffset + sizeof(res->u.fBinaryValue.fLength);
@ -588,8 +593,8 @@ res_preWrite(uint32_t *byteOffset,
* res_write() sees fWritten and exits early. * res_write() sees fWritten and exits early.
*/ */
static void string_write(UNewDataMemory *mem, uint32_t *byteOffset, static void string_write(UNewDataMemory *mem, uint32_t *byteOffset,
struct SRBRoot *bundle, struct SResource *res, struct SRBRoot * /*bundle*/, struct SResource *res,
UErrorCode *status) { UErrorCode * /*status*/) {
/* Write the UTF-16 v1 string. */ /* Write the UTF-16 v1 string. */
int32_t length = res->u.fString.fLength; int32_t length = res->u.fString.fLength;
udata_write32(mem, length); udata_write32(mem, length);
@ -599,8 +604,8 @@ static void string_write(UNewDataMemory *mem, uint32_t *byteOffset,
} }
static void alias_write(UNewDataMemory *mem, uint32_t *byteOffset, static void alias_write(UNewDataMemory *mem, uint32_t *byteOffset,
struct SRBRoot *bundle, struct SResource *res, struct SRBRoot * /*bundle*/, struct SResource *res,
UErrorCode *status) { UErrorCode * /*status*/) {
int32_t length = res->u.fString.fLength; int32_t length = res->u.fString.fLength;
udata_write32(mem, length); udata_write32(mem, length);
udata_writeUString(mem, res->u.fString.fChars, length + 1); udata_writeUString(mem, res->u.fString.fChars, length + 1);
@ -630,8 +635,8 @@ static void array_write(UNewDataMemory *mem, uint32_t *byteOffset,
} }
static void intvector_write(UNewDataMemory *mem, uint32_t *byteOffset, static void intvector_write(UNewDataMemory *mem, uint32_t *byteOffset,
struct SRBRoot *bundle, struct SResource *res, struct SRBRoot * /*bundle*/, struct SResource *res,
UErrorCode *status) { UErrorCode * /*status*/) {
uint32_t i = 0; uint32_t i = 0;
udata_write32(mem, res->u.fIntVector.fCount); udata_write32(mem, res->u.fIntVector.fCount);
for(i = 0; i<res->u.fIntVector.fCount; i++) { for(i = 0; i<res->u.fIntVector.fCount; i++) {
@ -641,8 +646,8 @@ static void intvector_write(UNewDataMemory *mem, uint32_t *byteOffset,
} }
static void bin_write(UNewDataMemory *mem, uint32_t *byteOffset, static void bin_write(UNewDataMemory *mem, uint32_t *byteOffset,
struct SRBRoot *bundle, struct SResource *res, struct SRBRoot * /*bundle*/, struct SResource *res,
UErrorCode *status) { UErrorCode * /*status*/) {
uint32_t pad = 0; uint32_t pad = 0;
uint32_t dataStart = *byteOffset + sizeof(res->u.fBinaryValue.fLength); uint32_t dataStart = *byteOffset + sizeof(res->u.fBinaryValue.fLength);
@ -1204,7 +1209,7 @@ static void intvector_close(struct SResource *intvector) {
} }
} }
static void int_close(struct SResource *intres) { static void int_close(struct SResource * /*intres*/) {
/* Intentionally left blank */ /* Intentionally left blank */
} }
@ -1253,7 +1258,7 @@ void res_close(struct SResource *res) {
} }
} }
void bundle_close(struct SRBRoot *bundle, UErrorCode *status) { void bundle_close(struct SRBRoot *bundle, UErrorCode * /*status*/) {
res_close(bundle->fRoot); res_close(bundle->fRoot);
uprv_free(bundle->fLocale); uprv_free(bundle->fLocale);
uprv_free(bundle->fKeys); uprv_free(bundle->fKeys);
@ -1393,7 +1398,7 @@ getKeyString(const struct SRBRoot *bundle, int32_t key) {
} }
const char * const char *
res_getKeyString(const struct SRBRoot *bundle, const struct SResource *res, char temp[8]) { res_getKeyString(const struct SRBRoot *bundle, const struct SResource *res, char /*temp*/[8]) {
if (res->fKey == -1) { if (res->fKey == -1) {
return NULL; return NULL;
} }
@ -1426,7 +1431,7 @@ bundle_addKeyBytes(struct SRBRoot *bundle, const char *keyBytes, int32_t length,
if (bundle->fKeysTop >= bundle->fKeysCapacity) { if (bundle->fKeysTop >= bundle->fKeysCapacity) {
/* overflow - resize the keys buffer */ /* overflow - resize the keys buffer */
bundle->fKeysCapacity += KEY_SPACE_SIZE; bundle->fKeysCapacity += KEY_SPACE_SIZE;
bundle->fKeys = uprv_realloc(bundle->fKeys, bundle->fKeysCapacity); bundle->fKeys = static_cast<char *>(uprv_realloc(bundle->fKeys, bundle->fKeysCapacity));
if(bundle->fKeys == NULL) { if(bundle->fKeys == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR; *status = U_MEMORY_ALLOCATION_ERROR;
return -1; return -1;
@ -1502,12 +1507,12 @@ compareKeySuffixes(const void *context, const void *l, const void *r) {
} }
static int32_t U_CALLCONV static int32_t U_CALLCONV
compareKeyNewpos(const void *context, const void *l, const void *r) { compareKeyNewpos(const void * /*context*/, const void *l, const void *r) {
return compareInt32(((const KeyMapEntry *)l)->newpos, ((const KeyMapEntry *)r)->newpos); return compareInt32(((const KeyMapEntry *)l)->newpos, ((const KeyMapEntry *)r)->newpos);
} }
static int32_t U_CALLCONV static int32_t U_CALLCONV
compareKeyOldpos(const void *context, const void *l, const void *r) { compareKeyOldpos(const void * /*context*/, const void *l, const void *r) {
return compareInt32(((const KeyMapEntry *)l)->oldpos, ((const KeyMapEntry *)r)->oldpos); return compareInt32(((const KeyMapEntry *)l)->oldpos, ((const KeyMapEntry *)r)->oldpos);
} }
@ -1632,7 +1637,7 @@ bundle_compactKeys(struct SRBRoot *bundle, UErrorCode *status) {
} }
static int32_t U_CALLCONV static int32_t U_CALLCONV
compareStringSuffixes(const void *context, const void *l, const void *r) { compareStringSuffixes(const void * /*context*/, const void *l, const void *r) {
struct SResource *left = *((struct SResource **)l); struct SResource *left = *((struct SResource **)l);
struct SResource *right = *((struct SResource **)r); struct SResource *right = *((struct SResource **)r);
const UChar *lStart = left->u.fString.fChars; const UChar *lStart = left->u.fString.fChars;
@ -1652,7 +1657,7 @@ compareStringSuffixes(const void *context, const void *l, const void *r) {
} }
static int32_t U_CALLCONV static int32_t U_CALLCONV
compareStringLengths(const void *context, const void *l, const void *r) { compareStringLengths(const void * /*context*/, const void *l, const void *r) {
struct SResource *left = *((struct SResource **)l); struct SResource *left = *((struct SResource **)l);
struct SResource *right = *((struct SResource **)r); struct SResource *right = *((struct SResource **)r);
int32_t diff; int32_t diff;

View File

@ -1,12 +1,12 @@
/* /*
******************************************************************************* *******************************************************************************
* *
* Copyright (C) 2000-2012, International Business Machines * Copyright (C) 2000-2015, International Business Machines
* Corporation and others. All Rights Reserved. * Corporation and others. All Rights Reserved.
* *
******************************************************************************* *******************************************************************************
* *
* File wrtjava.c * File wrtjava.cpp
* *
* Modification History: * Modification History:
* *
@ -380,7 +380,7 @@ array_write_java( struct SResource *res, UErrorCode *status) {
} }
static void static void
intvector_write_java( struct SResource *res, UErrorCode *status) { intvector_write_java(struct SResource *res, UErrorCode * /*status*/) {
uint32_t i = 0; uint32_t i = 0;
const char* intArr = "new int[] {\n"; const char* intArr = "new int[] {\n";
/* const char* intC = "new Integer("; */ /* const char* intC = "new Integer("; */
@ -422,7 +422,7 @@ intvector_write_java( struct SResource *res, UErrorCode *status) {
} }
static void static void
int_write_java(struct SResource *res,UErrorCode *status) { int_write_java(struct SResource *res,UErrorCode * /*status*/) {
const char* intC = "new Integer("; const char* intC = "new Integer(";
char buf[100]; char buf[100];
int len =0; int len =0;
@ -438,7 +438,7 @@ int_write_java(struct SResource *res,UErrorCode *status) {
} }
static void static void
bytes_write_java( struct SResource *res, UErrorCode *status) { bytes_write_java( struct SResource *res, UErrorCode * /*status*/) {
const char* type = "new byte[] {"; const char* type = "new byte[] {";
const char* byteDecl = "%i, "; const char* byteDecl = "%i, ";
char byteBuffer[100] = { 0 }; char byteBuffer[100] = { 0 };