ICU-3185 added uprv_ to some function calls

X-SVN-Rev: 13733
This commit is contained in:
Vladimir Weinstein 2003-11-14 23:01:06 +00:00
parent 708f6e7141
commit 3e87dc487c
10 changed files with 42 additions and 42 deletions

View file

@ -213,7 +213,7 @@ U_CAPI int32_t U_EXPORT2
T_CString_stringToInteger(const char *integerString, int32_t radix)
{
char *end;
return strtoul(integerString, &end, radix);
return uprv_strtoul(integerString, &end, radix);
}
@ -299,7 +299,7 @@ T_CString_strnicmp(const char *str1, const char *str2, uint32_t n) {
U_CAPI char* U_EXPORT2
uprv_strdup(const char *src) {
size_t len = strlen(src) + 1;
size_t len = uprv_strlen(src) + 1;
char *dup = (char *) uprv_malloc(len);
if (dup) {

View file

@ -1246,7 +1246,7 @@ Locale::getBaseName() const
((Locale *)this)->baseName = ((Locale *)this)->baseNameBuffer;
int32_t baseNameSize = uloc_getBaseName(fullName, baseName, ULOC_FULLNAME_CAPACITY, &status);
if(baseNameSize >= ULOC_FULLNAME_CAPACITY) {
((Locale *)this)->baseName = (char *)malloc(sizeof(char) * baseNameSize + 1);
((Locale *)this)->baseName = (char *)uprv_malloc(sizeof(char) * baseNameSize + 1);
uloc_getBaseName(fullName, baseName, baseNameSize+1, &status);
}
baseName[baseNameSize] = 0;

View file

@ -234,14 +234,14 @@ uprv_getUTCtime()
time_t t, t1, t2;
struct tm tmrec;
memset( &tmrec, 0, sizeof(tmrec) );
uprv_memset( &tmrec, 0, sizeof(tmrec) );
tmrec.tm_year = 70;
tmrec.tm_mon = 0;
tmrec.tm_mday = 1;
t1 = mktime(&tmrec); /* seconds of 1/1/1970*/
time(&t);
memcpy( &tmrec, gmtime(&t), sizeof(tmrec) );
uprv_memcpy( &tmrec, gmtime(&t), sizeof(tmrec) );
t2 = mktime(&tmrec); /* seconds of current GMT*/
return t2 - t1; /* GMT (or UTC) in seconds since 1970*/
#else
@ -981,12 +981,12 @@ static const char* detectWindowsTimeZone() {
/* Obtain TIME_ZONE_INFORMATION from the API, and then convert it
to TZI. We could also interrogate the registry directly; we do
this below if needed. */
memset(&apiTZI, 0, sizeof(apiTZI));
uprv_memset(&apiTZI, 0, sizeof(apiTZI));
GetTimeZoneInformation(&apiTZI);
tziKey.Bias = apiTZI.Bias;
memcpy((char *)&tziKey.StandardDate, (char*)&apiTZI.StandardDate,
uprv_memcpy((char *)&tziKey.StandardDate, (char*)&apiTZI.StandardDate,
sizeof(apiTZI.StandardDate));
memcpy((char *)&tziKey.DaylightDate, (char*)&apiTZI.DaylightDate,
uprv_memcpy((char *)&tziKey.DaylightDate, (char*)&apiTZI.DaylightDate,
sizeof(apiTZI.DaylightDate));
/* For each zone that can be identified by Offset+Rules, see if we
@ -1018,7 +1018,7 @@ static const char* detectWindowsTimeZone() {
these unreliable fields. */
tziKey.StandardBias = tziReg.StandardBias;
tziKey.DaylightBias = tziReg.DaylightBias;
if (memcmp((char *)&tziKey, (char*)&tziReg,
if (uprv_memcmp((char *)&tziKey, (char*)&tziReg,
sizeof(tziKey)) == 0) {
if (firstMatch < 0) {
firstMatch = j;
@ -1072,7 +1072,7 @@ static const char* detectWindowsTimeZone() {
RegCloseKey(hkey);
if (result == ERROR_SUCCESS &&
stdRegNameSize == stdNameSize &&
memcmp(stdName, stdRegName, stdNameSize) == 0) {
uprv_memcmp(stdName, stdRegName, stdNameSize) == 0) {
firstMatch = j; /* record the match */
break;
}
@ -1104,18 +1104,18 @@ static LONG openTZRegKey(HKEY *hkey, const char* winid, int winType) {
char* name;
int i;
strcpy(subKeyName, TZ_REGKEY[(winType == WIN_9X_ME_TYPE) ? 0 : 1]);
uprv_strcpy(subKeyName, TZ_REGKEY[(winType == WIN_9X_ME_TYPE) ? 0 : 1]);
name = &subKeyName[strlen(subKeyName)];
strcat(subKeyName, winid);
uprv_strcat(subKeyName, winid);
if (winType != WIN_9X_ME_TYPE) {
/* Don't modify "Mexico Standard Time 2", which does not occur
on WIN_9X_ME_TYPE. Also, if the type is WIN_NT_TYPE, then
in practice this means the GMT key is not followed by
" Standard Time", so don't append in that case. */
int isMexico2 = (winid[strlen(winid)- 1] == '2');
int isMexico2 = (winid[uprv_strlen(winid)- 1] == '2');
if (!isMexico2 &&
!(winType == WIN_NT_TYPE && strcmp(winid, "GMT") == 0)) {
strcat(subKeyName, STANDARD_TIME_REGKEY);
!(winType == WIN_NT_TYPE && uprv_strcmp(winid, "GMT") == 0)) {
uprv_strcat(subKeyName, STANDARD_TIME_REGKEY);
}
}
result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
@ -1128,11 +1128,11 @@ static LONG openTZRegKey(HKEY *hkey, const char* winid, int winType) {
/* If the primary lookup fails, try to remap the Windows zone
ID, according to the remapping table. */
for (i=0; ZONE_REMAP[i].winid; ++i) {
if (strcmp(winid, ZONE_REMAP[i].winid) == 0) {
strcpy(name, ZONE_REMAP[i].altwinid + 1);
if (uprv_strcmp(winid, ZONE_REMAP[i].winid) == 0) {
uprv_strcpy(name, ZONE_REMAP[i].altwinid + 1);
if (*(ZONE_REMAP[i].altwinid) == '+' &&
winType != WIN_9X_ME_TYPE) {
strcat(subKeyName, STANDARD_TIME_REGKEY);
uprv_strcat(subKeyName, STANDARD_TIME_REGKEY);
}
result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
subKeyName,
@ -1174,10 +1174,10 @@ uprv_timezone()
int32_t tdiff = 0;
time(&t);
memcpy( &tmrec, localtime(&t), sizeof(tmrec) );
uprv_memcpy( &tmrec, localtime(&t), sizeof(tmrec) );
dst_checked = (tmrec.tm_isdst != 0); /* daylight savings time is checked*/
t1 = mktime(&tmrec); /* local time in seconds*/
memcpy( &tmrec, gmtime(&t), sizeof(tmrec) );
uprv_memcpy( &tmrec, gmtime(&t), sizeof(tmrec) );
t2 = mktime(&tmrec); /* GMT (or UTC) in seconds*/
tdiff = t2 - t1;
/* imitate NT behaviour, which returns same timezone offset to GMT for
@ -1240,7 +1240,7 @@ uprv_tzname(int n)
ret = readlink(TZZONELINK, gTimeZoneBuffer, MAXPATHLEN + 2);
if (0 < ret) {
gTimeZoneBuffer[ret] = '\0';
if (strncmp(gTimeZoneBuffer, TZZONEINFO, sizeof(TZZONEINFO) - 1) == 0) {
if (uprv_strncmp(gTimeZoneBuffer, TZZONEINFO, sizeof(TZZONEINFO) - 1) == 0) {
return (gTimeZoneBuffer += sizeof(TZZONEINFO) - 1);
}
}

View file

@ -368,7 +368,7 @@ _ISO2022Open(UConverter *cnv, const char *name, const char *locale,uint32_t opti
myConverterData->version =options & UCNV_OPTIONS_VERSION_MASK;
uprv_strcpy(myConverterData->name,"ISO_2022,locale=ja,version=");
len=strlen(myConverterData->name);
len = uprv_strlen(myConverterData->name);
myConverterData->name[len]=(char)(myConverterData->version+(int)'0');
myConverterData->name[len+1]='\0';
}

View file

@ -480,7 +480,7 @@ FindLMBCSLocale(const char *LocaleID)
if (*pTable->LocaleID == *LocaleID) /* Check only first char for speed */
{
/* First char matches - check whole name, for entry-length */
if (strncmp(pTable->LocaleID, LocaleID, strlen(pTable->LocaleID)) == 0)
if (uprv_strncmp(pTable->LocaleID, LocaleID, strlen(pTable->LocaleID)) == 0)
return pTable->OptGroup;
}
else
@ -826,7 +826,7 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
}
if (!bytes_written) /* the ambiguous group cases (Strategy 3) */
{
memset(groups_tried, 0, sizeof(groups_tried));
uprv_memset(groups_tried, 0, sizeof(groups_tried));
/* check for non-default optimization group (Strategy 3A )*/
if (extraInfo->OptGroup != 1

View file

@ -815,7 +815,7 @@ locale_getKeywords(const char *localeID,
}
keywordList[numKeywords].valueStart = nextSeparator;
startSearchHere = strchr(nextSeparator, ULOC_KEYWORD_ITEM_SEPARATOR);
startSearchHere = uprv_strchr(nextSeparator, ULOC_KEYWORD_ITEM_SEPARATOR);
i = 0;
if(startSearchHere) {
while(*(startSearchHere - i - 1) == ' ') {
@ -1245,7 +1245,7 @@ uloc_canonicalize(const char* localeID,
}
/* convert the POSIX euro variant */
euroVariant = (char *)uprv_strstr(localeBuffer, "_EURO");
if (euroVariant && strlen(euroVariant) == 5) {
if (euroVariant && uprv_strlen(euroVariant) == 5) {
int32_t euroKeyLen = 13; /* strlen("@currency=EUR")13 */
int32_t euroDiff = 8; /* strlen("@currency=EUR")13 - strlen("_EURO")5 */
len += euroDiff;
@ -2130,7 +2130,7 @@ uloc_getKeywordValue(const char* localeID,
}
localeKeywordNameBuffer[i] = 0;
startSearchHere = strchr(nextSeparator, ULOC_KEYWORD_ITEM_SEPARATOR);
startSearchHere = uprv_strchr(nextSeparator, ULOC_KEYWORD_ITEM_SEPARATOR);
if(uprv_strcmp(keywordNameBuffer, localeKeywordNameBuffer) == 0) {
nextSeparator++;

View file

@ -1219,7 +1219,7 @@ ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status)
}
}
localeEnd = strchr(locale, RES_PATH_SEPARATOR);
localeEnd = uprv_strchr(locale, RES_PATH_SEPARATOR);
if(localeEnd != NULL) {
*localeEnd = 0;
}
@ -1790,7 +1790,7 @@ U_CFUNC UBool ures_isStackObject(UResourceBundle* resB) {
U_CFUNC void ures_initStackObject(UResourceBundle* resB) {
memset(resB, 0, sizeof(UResourceBundle));
uprv_memset(resB, 0, sizeof(UResourceBundle));
ures_setIsStackObject(resB, TRUE);
}

View file

@ -250,7 +250,7 @@ usprep_getProfile(const char* path,
profile->refCount = 0;
/* initialize the key memebers */
key->name = (char*) uprv_malloc(strlen(name)+1);
key->name = (char*) uprv_malloc(uprv_strlen(name)+1);
if(key->name == NULL){
*status = U_MEMORY_ALLOCATION_ERROR;
uprv_free(key);
@ -263,7 +263,7 @@ usprep_getProfile(const char* path,
key->path=NULL;
if(path != NULL){
key->path = (char*) uprv_malloc(strlen(path)+1);
key->path = (char*) uprv_malloc(uprv_strlen(path)+1);
if(key->path == NULL){
*status = U_MEMORY_ALLOCATION_ERROR;
uprv_free(key->path);

View file

@ -93,7 +93,7 @@ DigitList::operator=(const DigitList& other)
fDecimalAt = other.fDecimalAt;
fCount = other.fCount;
fIsPositive = other.fIsPositive;
strncpy(fDigits, other.fDigits, fCount);
uprv_strncpy(fDigits, other.fDigits, fCount);
}
return *this;
}
@ -107,7 +107,7 @@ DigitList::operator==(const DigitList& that) const
(fDecimalAt == that.fDecimalAt &&
fCount == that.fCount &&
fIsPositive == that.fIsPositive &&
strncmp(fDigits, that.fDigits, fCount) == 0));
uprv_strncmp(fDigits, that.fDigits, fCount) == 0));
}
// -------------------------------------

View file

@ -3148,10 +3148,10 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
{
numTempBufSize *= 2;
if (numTempBuf == stackNumTempBuf){
numTempBuf = (uint8_t *)malloc(sizeof(uint8_t) * numTempBufSize);
memcpy(numTempBuf, stackNumTempBuf, UCOL_MAX_BUFFER);
numTempBuf = (uint8_t *)uprv_malloc(sizeof(uint8_t) * numTempBufSize);
uprv_memcpy(numTempBuf, stackNumTempBuf, UCOL_MAX_BUFFER);
}else
realloc(numTempBuf, numTempBufSize);
uprv_realloc(numTempBuf, numTempBufSize);
}
// Skipping over leading zeroes.
@ -3281,7 +3281,7 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
}
if (numTempBuf != stackNumTempBuf)
free(numTempBuf);
uprv_free(numTempBuf);
} else {
// no numeric mode, we'll just switch to whatever we stashed and continue
CEOffset = (uint32_t *)coll->image+getExpansionOffset(CE); /* find the offset to expansion table */
@ -3826,10 +3826,10 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
{
numTempBufSize *= 2;
if (numTempBuf == stackNumTempBuf){
numTempBuf = (uint8_t *)malloc(sizeof(uint8_t) * numTempBufSize);
memcpy(numTempBuf, stackNumTempBuf, UCOL_MAX_BUFFER);
numTempBuf = (uint8_t *)uprv_malloc(sizeof(uint8_t) * numTempBufSize);
uprv_memcpy(numTempBuf, stackNumTempBuf, UCOL_MAX_BUFFER);
}else
realloc(numTempBuf, numTempBufSize);
uprv_realloc(numTempBuf, numTempBufSize);
}
// Skipping over "trailing" zeroes but we still add to digIndx.
@ -3950,7 +3950,7 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
*(source->CEpos++) = (primWeight << UCOL_PRIMARYORDERSHIFT) | UCOL_CONTINUATION_MARKER;
}
if (numTempBuf != stackNumTempBuf)
free(numTempBuf);
uprv_free(numTempBuf);
source->toReturn = source->CEpos -1;
return *(source->toReturn);
@ -6650,7 +6650,7 @@ U_CAPI char* U_EXPORT2 ucol_sortKeyToString(const UCollator *coll, const uint8_t
while(strength <= UCOL_QUATERNARY && strength <= coll->strength) {
if(strength > UCOL_PRIMARY) {
strcat(current, " . ");
uprv_strcat(current, " . ");
}
while(*currentSk != 0x01 && *currentSk != 0x00) { /* print a level */
uprv_appendByteToHexString(current, *currentSk++);