ICU-900 Fixed some compiler warnings.

X-SVN-Rev: 4861
This commit is contained in:
George Rhoten 2001-06-01 00:34:42 +00:00
parent ef66e4dfc2
commit 569d7ec827

View File

@ -12,16 +12,17 @@
* Madhu Katragadda Creation * Madhu Katragadda Creation
********************************************************************************* *********************************************************************************
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "cintltst.h" #include "cintltst.h"
#include "ccolltst.h" #include "ccolltst.h"
#include "unicode/ucol.h" #include "unicode/ucol.h"
#include "unicode/ustring.h" #include "unicode/ustring.h"
#include "cmemory.h"
UChar U_CALLCONV testInc(void *context); UChar U_CALLCONV testInc(void *context);
void addCollTest(TestNode** root);
void addCollTest(TestNode** root) void addCollTest(TestNode** root)
{ {
addCollAPITest(root); addCollAPITest(root);
@ -67,8 +68,8 @@ void reportCResult( const UChar source[], const UChar target[],
UCollationResult expectedResult ) UCollationResult expectedResult )
{ {
UChar *sResult, *sExpect; UChar *sResult, *sExpect;
sResult=(UChar*)malloc(sizeof(UChar) * 10); sResult=(UChar*)uprv_malloc(sizeof(UChar) * 10);
sExpect=(UChar*)malloc(sizeof(UChar) * 10); sExpect=(UChar*)uprv_malloc(sizeof(UChar) * 10);
if (expectedResult < -1 || expectedResult > 1) if (expectedResult < -1 || expectedResult > 1)
{ {
log_err("***** invalid call to reportCResult ****\n"); log_err("***** invalid call to reportCResult ****\n");
@ -124,8 +125,8 @@ void reportCResult( const UChar source[], const UChar target[],
log_verbose("SortKey2: %s\n", dumpSk(targetKey, sk)); log_verbose("SortKey2: %s\n", dumpSk(targetKey, sk));
} }
free(sExpect); uprv_free(sExpect);
free(sResult); uprv_free(sResult);
} }
UChar* appendCompareResult(UCollationResult result, UChar* target) UChar* appendCompareResult(UCollationResult result, UChar* target)
@ -153,7 +154,7 @@ UChar* appendCompareResult(UCollationResult result, UChar* target)
UChar* CharsToUChars(const char* str) { UChar* CharsToUChars(const char* str) {
/* Might be faster to just use uprv_strlen() as the preflight len - liu */ /* Might be faster to just use uprv_strlen() as the preflight len - liu */
int32_t len = u_unescape(str, 0, 0); /* preflight */ int32_t len = u_unescape(str, 0, 0); /* preflight */
UChar *buf = (UChar*) malloc(sizeof(UChar) * len); UChar *buf = (UChar*) uprv_malloc(sizeof(UChar) * len);
u_unescape(str, buf, len); u_unescape(str, buf, len);
return buf; return buf;
} }