ICU-894 reimplemented u_strncpy

X-SVN-Rev: 4120
This commit is contained in:
George Rhoten 2001-03-16 00:05:20 +00:00
parent 3f65d7ce09
commit 49859364a4
2 changed files with 7 additions and 4 deletions

View File

@ -550,12 +550,12 @@ unum_getSymbols(const UNumberFormat* fmt,
dfs->getCurrencySymbol(temp);
len = uprv_min(temp.length(), UNFSYMBOLSMAXSIZE);
u_strncpy(syms->currency, temp.getUChars(), len);
syms->currency[len > 0 ? len + 1 : 0] = 0x0000;
syms->currency[len > 0 ? len : 0] = 0x0000;
dfs->getInternationalCurrencySymbol(temp);
len = uprv_min(temp.length(), UNFSYMBOLSMAXSIZE);
u_strncpy(syms->intlCurrency, temp.getUChars(), len);
syms->intlCurrency[len > 0 ? len + 1 : 0] = 0x0000;
syms->intlCurrency[len > 0 ? len : 0] = 0x0000;
syms->monetarySeparator = dfs->getMonetaryDecimalSeparator();
syms->exponential = dfs->getExponentialSymbol();
@ -565,12 +565,12 @@ unum_getSymbols(const UNumberFormat* fmt,
dfs->getInfinity(temp);
len = uprv_min(temp.length(), UNFSYMBOLSMAXSIZE);
u_strncpy(syms->infinity, temp.getUChars(), len);
syms->infinity[len > 0 ? len + 1 : 0] = 0x0000;
syms->infinity[len > 0 ? len : 0] = 0x0000;
dfs->getNaN(temp);
len = uprv_min(temp.length(), UNFSYMBOLSMAXSIZE);
u_strncpy(syms->naN, temp.getUChars(), len);
syms->naN[len > 0 ? len + 1 : 0] = 0x0000;
syms->naN[len > 0 ? len : 0] = 0x0000;
}
U_CAPI void

View File

@ -821,10 +821,12 @@ static void TestConvert()
uchar1=(UChar*)malloc(sizeof(UChar) * (i+1));
u_uastrcpy(uchar1,"");
u_strncpy(uchar1,ucs_file_buffer,i);
uchar1[i] = 0;
uchar3=(UChar*)malloc(sizeof(UChar)*(i+1));
u_uastrcpy(uchar3,"");
u_strncpy(uchar3,ucs_file_buffer,i);
uchar3[i] = 0;
/*Calls the Conversion Routine */
testLong1 = MAX_FILE_LEN;
@ -967,6 +969,7 @@ static void TestConvert()
u_strncpy(uchar3, my_ucs_file_buffer,i);
uchar3[i] = 0;
if(u_strcmp(uchar1,uchar3)==0)
log_verbose("Equality test o.k.\n");