From 898fd409f9a9ae3660943c9d5471855c3a804442 Mon Sep 17 00:00:00 2001 From: Eric Mader Date: Mon, 1 Jul 2002 18:04:55 +0000 Subject: [PATCH] ICU-1953 remove // comments from C code. Fix indentation, removed tabs. X-SVN-Rev: 8984 --- icu4c/source/common/ucmp8.c | 22 ++++++--- icu4c/source/common/ucnvhz.c | 4 +- icu4c/source/common/uresbund.c | 70 +++++++++++++++----------- icu4c/source/common/ushape.c | 71 ++++++++++++++------------- icu4c/source/tools/gencmn/gencmn.c | 12 +++-- icu4c/source/tools/genrb/genrb.c | 38 ++++++++------ icu4c/source/tools/genrb/parse.c | 56 ++++++++++++--------- icu4c/source/tools/genrb/wrtjava.c | 26 ++++++---- icu4c/source/tools/pkgdata/pkgtypes.c | 6 ++- 9 files changed, 172 insertions(+), 133 deletions(-) diff --git a/icu4c/source/common/ucmp8.c b/icu4c/source/common/ucmp8.c index 5f1a1981c28..3875a0c0435 100644 --- a/icu4c/source/common/ucmp8.c +++ b/icu4c/source/common/ucmp8.c @@ -176,9 +176,12 @@ ucmp8_openAdopt(uint16_t *indexArray, int32_t count) { CompactByteArray* this_obj = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray)); - //test for NULL - if(this_obj == NULL) - return NULL; + + /* test for NULL */ + if(this_obj == NULL) { + return NULL; + } + ucmp8_initAdopt(this_obj, indexArray, newValues, count); this_obj->fIAmOwned = FALSE; return this_obj; @@ -189,11 +192,14 @@ ucmp8_openAlias(uint16_t *indexArray, int8_t *newValues, int32_t count) { - CompactByteArray* this_obj = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray)); - //test for NULL - if(this_obj == NULL) - return NULL; - ucmp8_initAlias(this_obj, indexArray, newValues, count); + CompactByteArray* this_obj = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray)); + + /* test for NULL */ + if(this_obj == NULL) { + return NULL; + } + + ucmp8_initAlias(this_obj, indexArray, newValues, count); this_obj->fIAmOwned = FALSE; return this_obj; } diff --git a/icu4c/source/common/ucnvhz.c b/icu4c/source/common/ucnvhz.c index ee1af7554f0..04f56ca8e09 100644 --- a/icu4c/source/common/ucnvhz.c +++ b/icu4c/source/common/ucnvhz.c @@ -74,9 +74,7 @@ _HZOpen(UConverter *cnv, const char *name,const char *locale,uint32_t options, U ((UConverterDataHZ*)cnv->extraInfo)->targetIndex = 0; ((UConverterDataHZ*)cnv->extraInfo)->sourceIndex = 0; ((UConverterDataHZ*)cnv->extraInfo)->isTargetUCharDBCS = FALSE; - } - //test for NULL - else { + } else { /* test for NULL */ *errorCode = U_MEMORY_ALLOCATION_ERROR; return; } diff --git a/icu4c/source/common/uresbund.c b/icu4c/source/common/uresbund.c index 402c4e85e14..13cb0206d60 100644 --- a/icu4c/source/common/uresbund.c +++ b/icu4c/source/common/uresbund.c @@ -516,11 +516,13 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r, char *chAlias = NULL, *path = NULL, *locale = NULL, *keyPath = NULL; int32_t pathLen = 0, localeLen = 0, keyPathLen = 0; chAlias = (char *)uprv_malloc((len+1)*sizeof(char)); - //test for NULL + + /* test for NULL */ if(chAlias == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } + return NULL; + } + u_UCharsToChars(alias, chAlias, len); chAlias[len] = 0; @@ -620,11 +622,13 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r, } if(resB == NULL) { resB = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle)); - //test for NULL - if (resB == NULL) { - *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } + + /* test for NULL */ + if (resB == NULL) { + *status = U_MEMORY_ALLOCATION_ERROR; + return NULL; + } + ures_setIsStackObject(resB, FALSE); resB->fResPath = NULL; } else { @@ -677,11 +681,12 @@ UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle *origin if(r == NULL) { isStackObject = FALSE; r = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle)); - //test for NULL - if (r == NULL) { - *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } + + /* test for NULL */ + if (r == NULL) { + *status = U_MEMORY_ALLOCATION_ERROR; + return NULL; + } } else { isStackObject = ures_isStackObject(r); if(U_FAILURE(*status)) { @@ -690,11 +695,12 @@ UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle *origin ures_close(r); if(isStackObject == FALSE) { r = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle)); - //test for NULL - if (r == NULL) { - *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } + + /* test for NULL */ + if (r == NULL) { + *status = U_MEMORY_ALLOCATION_ERROR; + return NULL; + } } } uprv_memcpy(r, original, sizeof(UResourceBundle)); @@ -1047,11 +1053,13 @@ ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status) return result; } pathToResource = (char *)uprv_malloc((uprv_strlen(path)+1)*sizeof(char)); - //test for NULL + + /*test for NULL */ if(pathToResource == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; return result; - } + } + uprv_strcpy(pathToResource, path); locale = pathToResource; if(*pathToResource == RES_PATH_SEPARATOR) { /* there is a path specification */ @@ -1478,11 +1486,12 @@ ures_openW(const wchar_t* myPath, UResourceBundle *r; size_t pathSize = (uprv_wcslen(myPath) + 1) * sizeof(int32_t); char *path = (char *)uprv_malloc(pathSize); - //test for NULL - if (path == NULL) { - *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } + + /* test for NULL */ + if (path == NULL) { + *status = U_MEMORY_ALLOCATION_ERROR; + return NULL; + } uprv_wcstombs(path, myPath, pathSize); @@ -1506,11 +1515,12 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_openU(const UChar* myPath, UResourceBundle *r; int32_t pathSize = u_strlen(myPath) + 1; char *path = (char *)uprv_malloc(pathSize); - //test for NULL - if(path == NULL) { - *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } + + /* test for NULL */ + if(path == NULL) { + *status = U_MEMORY_ALLOCATION_ERROR; + return NULL; + } u_UCharsToChars(myPath, path, pathSize); diff --git a/icu4c/source/common/ushape.c b/icu4c/source/common/ushape.c index 6f5f9af4f8c..d69b1f494f2 100644 --- a/icu4c/source/common/ushape.c +++ b/icu4c/source/common/ushape.c @@ -501,11 +501,12 @@ removeLamAlefSpaces(UChar *dest, int32_t sourceLength, switch(options&U_SHAPE_LENGTH_MASK) { case U_SHAPE_LENGTH_GROW_SHRINK : tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR); - //Test for NULL - if(tempbuffer == NULL) { - *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - return 0; - } + + /* Test for NULL */ + if(tempbuffer == NULL) { + *pErrorCode = U_MEMORY_ALLOCATION_ERROR; + return 0; + } uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR); @@ -545,11 +546,11 @@ removeLamAlefSpaces(UChar *dest, int32_t sourceLength, case U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING : tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR); - //Test for NULL - if(tempbuffer == NULL) { - *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - return 0; - } + /* Test for NULL */ + if(tempbuffer == NULL) { + *pErrorCode = U_MEMORY_ALLOCATION_ERROR; + return 0; + } uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR); @@ -574,11 +575,11 @@ removeLamAlefSpaces(UChar *dest, int32_t sourceLength, case U_SHAPE_LENGTH_FIXED_SPACES_AT_END : tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR); - //Test for NULL - if(tempbuffer == NULL) { - *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - return 0; - } + /* Test for NULL */ + if(tempbuffer == NULL) { + *pErrorCode = U_MEMORY_ALLOCATION_ERROR; + return 0; + } uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR); @@ -643,11 +644,11 @@ expandLamAlef(UChar *dest, int32_t sourceLength, destSize = calculateSize(dest,sourceLength,destSize,options); tempbuffer = (UChar *)uprv_malloc((destSize+1)*U_SIZEOF_UCHAR); - //Test for NULL - if(tempbuffer == NULL) { - *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - return 0; - } + /* Test for NULL */ + if(tempbuffer == NULL) { + *pErrorCode = U_MEMORY_ALLOCATION_ERROR; + return 0; + } uprv_memset(tempbuffer, 0, (destSize+1)*U_SIZEOF_UCHAR); @@ -685,11 +686,11 @@ expandLamAlef(UChar *dest, int32_t sourceLength, case U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING : tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR); - //Test for NULL - if(tempbuffer == NULL) { - *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - return 0; - } + /* Test for NULL */ + if(tempbuffer == NULL) { + *pErrorCode = U_MEMORY_ALLOCATION_ERROR; + return 0; + } uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR); @@ -726,11 +727,11 @@ expandLamAlef(UChar *dest, int32_t sourceLength, */ tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR); - //Test for NULL - if(tempbuffer == NULL) { - *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - return 0; - } + /* Test for NULL */ + if(tempbuffer == NULL) { + *pErrorCode = U_MEMORY_ALLOCATION_ERROR; + return 0; + } uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR); @@ -1025,11 +1026,11 @@ u_shapeArabic(const UChar *source, int32_t sourceLength, } else { tempbuffer = (UChar *)uprv_malloc(outputSize*U_SIZEOF_UCHAR); - //Test for NULL - if(tempbuffer == NULL) { - *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - return 0; - } + /* Test for NULL */ + if(tempbuffer == NULL) { + *pErrorCode = U_MEMORY_ALLOCATION_ERROR; + return 0; + } } uprv_memcpy(tempbuffer, source, sourceLength*U_SIZEOF_UCHAR); if(sourceLengthu.fString.fChars,res->u.fString.fLength,status); if(uprv_strcmp(srBundle->fKeys+res->fKey,"Rule")==0){ UChar* buf = (UChar*) uprv_malloc(sizeof(UChar)*res->u.fString.fLength); - //test for NULL - if(buf == NULL) { - *status = U_MEMORY_ALLOCATION_ERROR; - return; - } + + /* test for NULL */ + if(buf == NULL) { + *status = U_MEMORY_ALLOCATION_ERROR; + return; + } + uprv_memcpy(buf,res->u.fString.fChars,res->u.fString.fLength); uprv_free(buf); } @@ -525,7 +528,8 @@ bin_write_java( struct SResource *res, UErrorCode *status) { /***************** Test Roundtripping *********************/ int32_t myTargetLen = rleStringToUCharArray(target,tgtLen,NULL,0,status); uint16_t* myTarget = (uint16_t*) malloc(sizeof(uint16_t) * myTargetLen); - //test for NULL + + /* test for NULL */ if(myTarget == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; return; @@ -570,11 +574,13 @@ bin_write_java( struct SResource *res, UErrorCode *status) { { int32_t myTargetLen = rleStringToByteArray(target,tgtLen,NULL,0,status); uint8_t* myTarget = (uint8_t*) malloc(sizeof(uint8_t) * myTargetLen); - //test for NULL + + /* test for NULL */ if(myTarget == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; return; } + int i=0; int32_t retVal=0; diff --git a/icu4c/source/tools/pkgdata/pkgtypes.c b/icu4c/source/tools/pkgdata/pkgtypes.c index 9050b039523..07cd848301a 100644 --- a/icu4c/source/tools/pkgdata/pkgtypes.c +++ b/icu4c/source/tools/pkgdata/pkgtypes.c @@ -128,10 +128,12 @@ CharList *pkg_prependToList(CharList *l, const char *str) { CharList *newList; newList = uprv_malloc(sizeof(CharList)); - //test for NULL + + /* test for NULL */ if(newList == NULL) { - return NULL; + return NULL; } + newList->str = str; newList->next = l; return newList;