ICU-900 Fixed some compiler warnings.
X-SVN-Rev: 4860
This commit is contained in:
parent
8383c8f1b3
commit
ef66e4dfc2
@ -21,6 +21,8 @@ void addTestEuroRegression(TestNode** root);
|
||||
void addTestConverterFallBack(TestNode** root);
|
||||
void addExtraTests(TestNode** root);
|
||||
|
||||
void addConvert(TestNode** root);
|
||||
|
||||
void addConvert(TestNode** root)
|
||||
{
|
||||
addTestConvert(root);
|
||||
|
@ -15,9 +15,6 @@
|
||||
|
||||
/* C API TEST FOR DATE FORMAT */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "unicode/uloc.h"
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/udat.h"
|
||||
@ -27,6 +24,9 @@
|
||||
#include "cintltst.h"
|
||||
#include "cdattst.h"
|
||||
#include "cformtst.h"
|
||||
#include "cmemory.h"
|
||||
|
||||
void addDateForTest(TestNode** root);
|
||||
|
||||
|
||||
void addDateForTest(TestNode** root)
|
||||
@ -121,10 +121,10 @@ static void TestDateFormat()
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthneeded+1;
|
||||
if(result != NULL) {
|
||||
free(result);
|
||||
uprv_free(result);
|
||||
result = NULL;
|
||||
}
|
||||
result=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
result=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_format(def, d, result, resultlength, NULL, &status);
|
||||
}
|
||||
if(U_FAILURE(status))
|
||||
@ -141,7 +141,7 @@ static void TestDateFormat()
|
||||
|
||||
u_uastrcpy(temp, "10 juil. 96 16 h 05 GMT-07:00");
|
||||
if(result != NULL) {
|
||||
free(result);
|
||||
uprv_free(result);
|
||||
result = NULL;
|
||||
}
|
||||
result=myDateFormat(fr, d);
|
||||
@ -204,7 +204,7 @@ static void TestDateFormat()
|
||||
{
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthneeded + 1;
|
||||
result=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
result=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_toPattern(def1, FALSE, result, resultlength, &status);
|
||||
}
|
||||
if(U_FAILURE(status))
|
||||
@ -218,7 +218,7 @@ static void TestDateFormat()
|
||||
log_verbose("PASS: applyPattern and toPattern work fine\n");
|
||||
|
||||
if(result != NULL) {
|
||||
free(result);
|
||||
uprv_free(result);
|
||||
result = NULL;
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ static void TestDateFormat()
|
||||
log_verbose("PASS: getting and setting calendar successful\n");
|
||||
|
||||
if(result!=NULL) {
|
||||
free(result);
|
||||
uprv_free(result);
|
||||
}
|
||||
|
||||
/*Closing the UDateForamt */
|
||||
@ -353,7 +353,7 @@ static void TestSymbols()
|
||||
|
||||
/*testing getSymbols*/
|
||||
log_verbose("\nTesting getSymbols\n");
|
||||
pattern=(UChar*)malloc(sizeof(UChar) * 10);
|
||||
pattern=(UChar*)uprv_malloc(sizeof(UChar) * 10);
|
||||
u_uastrcpy(pattern, "jeudi");
|
||||
resultlength=0;
|
||||
resultlengthout=udat_getSymbols(fr, UDAT_WEEKDAYS, 5 , NULL, resultlength, &status);
|
||||
@ -362,10 +362,10 @@ static void TestSymbols()
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthout+1;
|
||||
if(result != NULL) {
|
||||
free(result);
|
||||
uprv_free(result);
|
||||
result = NULL;
|
||||
}
|
||||
result=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
result=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_getSymbols(fr, UDAT_WEEKDAYS, 5, result, resultlength, &status);
|
||||
|
||||
}
|
||||
@ -397,11 +397,11 @@ static void TestSymbols()
|
||||
VerifygetSymbols(def,UDAT_LOCALIZED_CHARS, 0, "GyMdkHmsSEDFwWahKzYe");
|
||||
|
||||
|
||||
if(result != NULL) {
|
||||
free(result);
|
||||
result = NULL;
|
||||
}
|
||||
free(pattern);
|
||||
if(result != NULL) {
|
||||
uprv_free(result);
|
||||
result = NULL;
|
||||
}
|
||||
uprv_free(pattern);
|
||||
|
||||
log_verbose("\nTesting setSymbols\n");
|
||||
/*applying the pattern so that setSymbolss works */
|
||||
@ -411,7 +411,7 @@ free(pattern);
|
||||
{
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthout + 1;
|
||||
pattern=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
pattern=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_toPattern(fr, FALSE, pattern, resultlength, &status);
|
||||
}
|
||||
if(U_FAILURE(status))
|
||||
@ -428,10 +428,10 @@ free(pattern);
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthout + 1;
|
||||
if(result != NULL) {
|
||||
free(result);
|
||||
uprv_free(result);
|
||||
result = NULL;
|
||||
}
|
||||
result=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
result=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_toPattern(fr, FALSE,result, resultlength, &status);
|
||||
}
|
||||
if(U_FAILURE(status))
|
||||
@ -444,7 +444,7 @@ free(pattern);
|
||||
else
|
||||
log_err("pattern could not be applied properly\n");
|
||||
|
||||
free(pattern);
|
||||
uprv_free(pattern);
|
||||
/*testing set symbols */
|
||||
resultlength=0;
|
||||
resultlengthout=udat_getSymbols(fr, UDAT_MONTHS, 11 , NULL, resultlength, &status);
|
||||
@ -452,10 +452,10 @@ free(pattern);
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthout+1;
|
||||
if(result != NULL) {
|
||||
free(result);
|
||||
uprv_free(result);
|
||||
result = NULL;
|
||||
}
|
||||
result=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
result=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_getSymbols(fr, UDAT_MONTHS, 11, result, resultlength, &status);
|
||||
|
||||
}
|
||||
@ -476,7 +476,7 @@ free(pattern);
|
||||
if(status==U_BUFFER_OVERFLOW_ERROR){
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthout+1;
|
||||
value=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
value=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_getSymbols(def, UDAT_MONTHS, 11, value, resultlength, &status);
|
||||
}
|
||||
if(U_FAILURE(status))
|
||||
@ -515,10 +515,10 @@ free(pattern);
|
||||
udat_close(fr);
|
||||
udat_close(def);
|
||||
if(result != NULL) {
|
||||
free(result);
|
||||
uprv_free(result);
|
||||
result = NULL;
|
||||
}
|
||||
free(value);
|
||||
uprv_free(value);
|
||||
|
||||
}
|
||||
|
||||
@ -531,7 +531,7 @@ static void VerifygetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, in
|
||||
int32_t resultlength, resultlengthout;
|
||||
|
||||
|
||||
pattern=(UChar*)malloc(sizeof(UChar) * (strlen(expected)+1));
|
||||
pattern=(UChar*)uprv_malloc(sizeof(UChar) * (strlen(expected)+1));
|
||||
u_uastrcpy(pattern, expected);
|
||||
resultlength=0;
|
||||
resultlengthout=udat_getSymbols(datfor, type, index , NULL, resultlength, &status);
|
||||
@ -539,7 +539,7 @@ static void VerifygetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, in
|
||||
{
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthout+1;
|
||||
result=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
result=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_getSymbols(datfor, type, index, result, resultlength, &status);
|
||||
|
||||
}
|
||||
@ -554,8 +554,8 @@ static void VerifygetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, in
|
||||
log_err("FAlL: getSymbols retrieved the wrong value\n Expected %s Got %s\n", austrdup(pattern),
|
||||
austrdup(result) );
|
||||
}
|
||||
free(result);
|
||||
free(pattern);
|
||||
uprv_free(result);
|
||||
uprv_free(pattern);
|
||||
}
|
||||
|
||||
static void VerifysetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, int32_t index, const char* expected)
|
||||
@ -565,7 +565,7 @@ static void VerifysetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, in
|
||||
int32_t resultlength, resultlengthout;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
value=(UChar*)malloc(sizeof(UChar) * (strlen(expected) + 1));
|
||||
value=(UChar*)uprv_malloc(sizeof(UChar) * (strlen(expected) + 1));
|
||||
u_uastrcpy(value, expected);
|
||||
udat_setSymbols(datfor, type, index, value, u_strlen(value), &status);
|
||||
if(U_FAILURE(status))
|
||||
@ -579,7 +579,7 @@ static void VerifysetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, in
|
||||
if(status==U_BUFFER_OVERFLOW_ERROR){
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthout+1;
|
||||
result=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
result=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_getSymbols(datfor, type, index, result, resultlength, &status);
|
||||
}
|
||||
if(U_FAILURE(status)){
|
||||
@ -595,8 +595,8 @@ static void VerifysetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, in
|
||||
else
|
||||
log_verbose("PASS: setSymbols successful\n");
|
||||
|
||||
free(value);
|
||||
free(result);
|
||||
uprv_free(value);
|
||||
uprv_free(result);
|
||||
}
|
||||
|
||||
|
||||
@ -612,7 +612,7 @@ static void VerifygetsetSymbols(UDateFormat* from, UDateFormat* to, UDateFormatS
|
||||
if(status==U_BUFFER_OVERFLOW_ERROR){
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthout+1;
|
||||
result=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
result=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_getSymbols(from, type, index, result, resultlength, &status);
|
||||
}
|
||||
if(U_FAILURE(status)){
|
||||
@ -633,7 +633,7 @@ static void VerifygetsetSymbols(UDateFormat* from, UDateFormat* to, UDateFormatS
|
||||
if(status==U_BUFFER_OVERFLOW_ERROR){
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthout+1;
|
||||
value=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
value=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_getSymbols(to, type, index, value, resultlength, &status);
|
||||
}
|
||||
if(U_FAILURE(status)){
|
||||
@ -649,8 +649,8 @@ static void VerifygetsetSymbols(UDateFormat* from, UDateFormat* to, UDateFormatS
|
||||
else
|
||||
log_verbose("PASS: setSymbols successful\n");
|
||||
|
||||
free(value);
|
||||
free(result);
|
||||
uprv_free(value);
|
||||
uprv_free(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,9 +14,6 @@
|
||||
*/
|
||||
/* INDEPTH TEST FOR DATE FORMAT */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "unicode/uloc.h"
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/udat.h"
|
||||
@ -27,6 +24,10 @@
|
||||
#include "cdtdptst.h"
|
||||
#include "cformtst.h"
|
||||
|
||||
#include "cmemory.h"
|
||||
|
||||
void addDtFrDepTest(TestNode** root);
|
||||
|
||||
void addDtFrDepTest(TestNode** root)
|
||||
{
|
||||
addTest(root, &TestTwoDigitYearDSTParse, "tsformat/cdtdptst/TestTwoDigitYearDSTParse");
|
||||
@ -49,7 +50,7 @@ void TestTwoDigitYearDSTParse()
|
||||
UChar *s;
|
||||
int32_t pos;
|
||||
|
||||
pattern=(UChar*)malloc(sizeof(UChar) * (strlen("EEE MMM dd HH:mm:ss.SSS zzz yyyy G")+1 ));
|
||||
pattern=(UChar*)uprv_malloc(sizeof(UChar) * (strlen("EEE MMM dd HH:mm:ss.SSS zzz yyyy G")+1 ));
|
||||
u_uastrcpy(pattern, "EEE MMM dd HH:mm:ss.SSS zzz yyyy G");
|
||||
fullFmt= udat_openPattern(pattern, u_strlen(pattern), "en_US", &status);
|
||||
if(U_FAILURE(status)) {
|
||||
@ -62,7 +63,7 @@ void TestTwoDigitYearDSTParse()
|
||||
fmt= udat_openPattern(pattern, u_strlen(pattern), "en_US", &status);
|
||||
|
||||
|
||||
s=(UChar*)malloc(sizeof(UChar) * (strlen("03-Apr-04 2:20:47 o'clock AM PST")+1) );
|
||||
s=(UChar*)uprv_malloc(sizeof(UChar) * (strlen("03-Apr-04 2:20:47 o'clock AM PST")+1) );
|
||||
u_uastrcpy(s, "03-Apr-04 2:20:47 o'clock AM PST");
|
||||
pos=0;
|
||||
d = udat_parse(fmt, s, u_strlen(s), &pos, &status);
|
||||
@ -88,8 +89,8 @@ void TestTwoDigitYearDSTParse()
|
||||
|
||||
udat_close(fullFmt);
|
||||
udat_close(fmt);
|
||||
free(pattern);
|
||||
free(s);
|
||||
uprv_free(pattern);
|
||||
uprv_free(s);
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +115,7 @@ void TestPartialParse994()
|
||||
if(U_FAILURE(status)){
|
||||
log_err("FAIL: ErrorCode received during test: %s\n", myErrorName(status));
|
||||
}
|
||||
s=(UChar*)malloc(sizeof(UChar) * (strlen("01/01/97 10:11:42 AM")+1) );
|
||||
s=(UChar*)uprv_malloc(sizeof(UChar) * (strlen("01/01/97 10:11:42 AM")+1) );
|
||||
u_uastrcpy(s, "01/01/97 10:11:42 AM");
|
||||
pos=0;
|
||||
d = udat_parse(f, s, u_strlen(s), &pos, &status);
|
||||
@ -125,7 +126,7 @@ void TestPartialParse994()
|
||||
tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/01 ", null);
|
||||
tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/01", null);
|
||||
udat_close(f);
|
||||
free(s);
|
||||
uprv_free(s);
|
||||
}
|
||||
|
||||
|
||||
@ -138,9 +139,9 @@ void tryPat994(UDateFormat* format, const char* pattern, const char* s, UDate ex
|
||||
UDate null=0;
|
||||
int32_t pos;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
str=(UChar*)malloc(sizeof(UChar) * (strlen(s) + 1) );
|
||||
str=(UChar*)uprv_malloc(sizeof(UChar) * (strlen(s) + 1) );
|
||||
u_uastrcpy(str, s);
|
||||
pat=(UChar*)malloc(sizeof(UChar) * (strlen(pattern) + 1) );
|
||||
pat=(UChar*)uprv_malloc(sizeof(UChar) * (strlen(pattern) + 1) );
|
||||
u_uastrcpy(pat, pattern);
|
||||
log_verbose("Pattern : %s ; String : %s\n", austrdup(pat), austrdup(str));
|
||||
udat_applyPattern(format, FALSE, pat, u_strlen(pat));
|
||||
@ -160,8 +161,8 @@ void tryPat994(UDateFormat* format, const char* pattern, const char* s, UDate ex
|
||||
if (u_strcmp(f, str) !=0) log_err("FAIL: Expected : %s\n", austrdup(str) );
|
||||
}
|
||||
|
||||
free(str);
|
||||
free(pat);
|
||||
uprv_free(str);
|
||||
uprv_free(pat);
|
||||
}
|
||||
|
||||
|
||||
@ -176,7 +177,7 @@ void TestRunTogetherPattern985()
|
||||
UDateFormat *format;
|
||||
UDate date1, date2;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
pattern=(UChar*)malloc(sizeof(UChar) * (strlen("yyyyMMddHHmmssSSS")+1) );
|
||||
pattern=(UChar*)uprv_malloc(sizeof(UChar) * (strlen("yyyyMMddHHmmssSSS")+1) );
|
||||
u_uastrcpy(pattern, "yyyyMMddHHmmssSSS");
|
||||
format = udat_openPattern(pattern, u_strlen(pattern), NULL, &status);
|
||||
if(U_FAILURE(status)){
|
||||
@ -193,7 +194,7 @@ void TestRunTogetherPattern985()
|
||||
if (!(date2 == date1)) log_err("FAIL\n");
|
||||
|
||||
udat_close(format);
|
||||
free(pattern);
|
||||
uprv_free(pattern);
|
||||
|
||||
}
|
||||
|
||||
@ -217,11 +218,11 @@ void TestCzechMonths459()
|
||||
lneed=udat_toPattern(fmt, TRUE, NULL, lneed, &status);
|
||||
if(status==U_BUFFER_OVERFLOW_ERROR){
|
||||
status=U_ZERO_ERROR;
|
||||
pattern=(UChar*)malloc(sizeof(UChar) * (lneed+1) );
|
||||
pattern=(UChar*)uprv_malloc(sizeof(UChar) * (lneed+1) );
|
||||
udat_toPattern(fmt, TRUE, pattern, lneed+1, &status);
|
||||
}
|
||||
if(U_FAILURE(status)){ log_err("Error in extracting the pattern\n"); }
|
||||
tzID=(UChar*)malloc(sizeof(UChar) * 4);
|
||||
tzID=(UChar*)uprv_malloc(sizeof(UChar) * 4);
|
||||
u_uastrcpy(tzID, "GMT");
|
||||
cal=ucal_open(tzID, u_strlen(tzID), "cs", UCAL_GREGORIAN, &status);
|
||||
if(U_FAILURE(status)){ log_err("error in ucal_open caldef : %s\n", myErrorName(status)); }
|
||||
@ -249,8 +250,8 @@ void TestCzechMonths459()
|
||||
|
||||
udat_close(fmt);
|
||||
ucal_close(cal);
|
||||
free(pattern);
|
||||
free(tzID);
|
||||
uprv_free(pattern);
|
||||
uprv_free(tzID);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -265,7 +266,7 @@ void TestQuotePattern161()
|
||||
UChar *dateString;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
const char* expStr = "04/13/1999 at 10:42:28 AM ";
|
||||
pattern=(UChar*)malloc(sizeof(UChar) * (strlen("MM/dd/yyyy 'at' hh:mm:ss a zzz")+1) );
|
||||
pattern=(UChar*)uprv_malloc(sizeof(UChar) * (strlen("MM/dd/yyyy 'at' hh:mm:ss a zzz")+1) );
|
||||
u_uastrcpy(pattern, "MM/dd/yyyy 'at' hh:mm:ss a zzz");
|
||||
|
||||
/* this is supposed to open default date format, but later on it treats it like it is "en_US"
|
||||
@ -273,7 +274,7 @@ void TestQuotePattern161()
|
||||
/* format= udat_openPattern(pattern, u_strlen(pattern), NULL, &status); */
|
||||
format= udat_openPattern(pattern, u_strlen(pattern), "en_US", &status);
|
||||
if(U_FAILURE(status)){ log_err("error in udat_openPattern : %s\n", myErrorName(status)); }
|
||||
tzID=(UChar*)malloc(sizeof(UChar) * 4);
|
||||
tzID=(UChar*)uprv_malloc(sizeof(UChar) * 4);
|
||||
u_uastrcpy(tzID, "PST");
|
||||
/* this is supposed to open default date format, but later on it treats it like it is "en_US"
|
||||
- very bad if you try to run the tests on machine where default locale is NOT "en_US" */
|
||||
@ -285,7 +286,7 @@ void TestQuotePattern161()
|
||||
currentTime_1 = ucal_getMillis(cal, &status);
|
||||
|
||||
dateString = myDateFormat(format, currentTime_1);
|
||||
exp=(UChar*)malloc(sizeof(UChar) * (strlen(expStr) + 1) );
|
||||
exp=(UChar*)uprv_malloc(sizeof(UChar) * (strlen(expStr) + 1) );
|
||||
u_uastrcpy(exp, expStr);
|
||||
|
||||
log_verbose("%s\n", austrdup(dateString) );
|
||||
@ -294,8 +295,8 @@ void TestQuotePattern161()
|
||||
|
||||
udat_close(format);
|
||||
ucal_close(cal);
|
||||
free(exp);
|
||||
free(tzID);
|
||||
free(pattern);
|
||||
uprv_free(exp);
|
||||
uprv_free(tzID);
|
||||
uprv_free(pattern);
|
||||
|
||||
}
|
||||
|
@ -15,9 +15,6 @@
|
||||
*/
|
||||
/* REGRESSION TEST FOR DATE FORMAT */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "unicode/uloc.h"
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/udat.h"
|
||||
@ -26,7 +23,9 @@
|
||||
#include "unicode/ustring.h"
|
||||
#include "cintltst.h"
|
||||
#include "cdtrgtst.h"
|
||||
#include "cmemory.h"
|
||||
|
||||
void addDateForRgrTest(TestNode** root);
|
||||
|
||||
void addDateForRgrTest(TestNode** root)
|
||||
{
|
||||
@ -68,7 +67,7 @@ void Test4029195()
|
||||
{
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthneeded + 1;
|
||||
pat=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
pat=(UChar*)uprv_malloc(sizeof(UChar) * resultlength);
|
||||
udat_toPattern(df, TRUE, pat, resultlength, &status);
|
||||
}
|
||||
|
||||
@ -78,7 +77,7 @@ void Test4029195()
|
||||
fmdt = myFormatit(df, today);
|
||||
log_verbose("today: %s\n", austrdup(fmdt));
|
||||
|
||||
temp=(UChar*)malloc(sizeof(UChar) * 10);
|
||||
temp=(UChar*)uprv_malloc(sizeof(UChar) * 10);
|
||||
u_uastrcpy(temp, "M yyyy dd");
|
||||
udat_applyPattern(df, TRUE, temp, u_strlen(temp));
|
||||
|
||||
@ -102,9 +101,9 @@ void Test4029195()
|
||||
else
|
||||
log_verbose("Pass: parse and format working fine\n");
|
||||
udat_close(df);
|
||||
free(temp);
|
||||
uprv_free(temp);
|
||||
if(pat != NULL) {
|
||||
free(pat);
|
||||
uprv_free(pat);
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +132,7 @@ void Test4056591()
|
||||
};
|
||||
|
||||
log_verbose("Testing s[get] 2 digit year start regressively\n");
|
||||
tzID=(UChar*)malloc(sizeof(UChar) * 4);
|
||||
tzID=(UChar*)uprv_malloc(sizeof(UChar) * 4);
|
||||
u_uastrcpy(tzID, "PST");
|
||||
cal=ucal_open(tzID, u_strlen(tzID), "en_US", UCAL_GREGORIAN, &status);
|
||||
if(U_FAILURE(status)){
|
||||
@ -181,7 +180,7 @@ void Test4056591()
|
||||
|
||||
udat_close(def);
|
||||
ucal_close(cal);
|
||||
free(tzID);
|
||||
uprv_free(tzID);
|
||||
|
||||
|
||||
}
|
||||
@ -197,7 +196,7 @@ void Test4059917()
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UChar *pattern;
|
||||
log_verbose("Testing apply pattern and to pattern regressively\n");
|
||||
pattern=(UChar*)malloc(sizeof(UChar) * 11);
|
||||
pattern=(UChar*)uprv_malloc(sizeof(UChar) * 11);
|
||||
u_uastrcpy(pattern, "yyyy/MM/dd");
|
||||
log_verbose("%s\n", austrdup(pattern) );
|
||||
def = udat_openPattern(pattern, u_strlen(pattern), NULL, &status);
|
||||
@ -205,7 +204,7 @@ void Test4059917()
|
||||
{
|
||||
log_err("FAIL: error in creating the dateformat using openPattern: %s\n", myErrorName(status));
|
||||
}
|
||||
myDate=(UChar*)malloc(sizeof(UChar) * 11);
|
||||
myDate=(UChar*)uprv_malloc(sizeof(UChar) * 11);
|
||||
u_uastrcpy(myDate, "1970/01/12");
|
||||
|
||||
aux917( def, myDate );
|
||||
@ -220,8 +219,8 @@ void Test4059917()
|
||||
u_uastrcpy(myDate, "19700112");
|
||||
aux917( def, myDate );
|
||||
udat_close(def);
|
||||
free(pattern);
|
||||
free(myDate);
|
||||
uprv_free(pattern);
|
||||
uprv_free(myDate);
|
||||
|
||||
}
|
||||
|
||||
@ -239,7 +238,7 @@ void aux917( UDateFormat *fmt, UChar* str)
|
||||
{
|
||||
status=U_ZERO_ERROR;
|
||||
resultlength=resultlengthneeded + 1;
|
||||
pat=(UChar*)malloc(sizeof(UChar) * (resultlength));
|
||||
pat=(UChar*)uprv_malloc(sizeof(UChar) * (resultlength));
|
||||
udat_toPattern(fmt, TRUE, pat, resultlength, &status);
|
||||
}
|
||||
if(U_FAILURE(status)){
|
||||
@ -252,7 +251,7 @@ void aux917( UDateFormat *fmt, UChar* str)
|
||||
if( u_strcmp(formatted,str)!=0) {
|
||||
log_err("Fail: Want %s Got: %s\n", austrdup(str), austrdup(formatted) );
|
||||
}
|
||||
free(pat);
|
||||
uprv_free(pat);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -381,7 +380,7 @@ void Test4073003()
|
||||
|
||||
for(i= 0; i < 4; i+=2) {
|
||||
status=U_ZERO_ERROR;
|
||||
datestr=(UChar*)malloc(sizeof(UChar) * (strlen(tests[i])+1));
|
||||
datestr=(UChar*)uprv_malloc(sizeof(UChar) * (strlen(tests[i])+1));
|
||||
u_uastrcpy(datestr, tests[i]);
|
||||
|
||||
pos=0;
|
||||
@ -390,8 +389,8 @@ void Test4073003()
|
||||
log_err("ERROR : in test 4073003: %s\n", myErrorName(status));
|
||||
}
|
||||
|
||||
free(datestr);
|
||||
datestr=(UChar*)malloc(sizeof(UChar) * (strlen(tests[i+1])+1));
|
||||
uprv_free(datestr);
|
||||
datestr=(UChar*)uprv_malloc(sizeof(UChar) * (strlen(tests[i+1])+1));
|
||||
u_uastrcpy(datestr, tests[i+1]);
|
||||
|
||||
pos=0;
|
||||
@ -400,7 +399,7 @@ void Test4073003()
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR : in test 4073003: %s\n", myErrorName(status));
|
||||
}
|
||||
free(datestr);
|
||||
uprv_free(datestr);
|
||||
|
||||
result =myFormatit(fmt, d);
|
||||
result2 =myFormatit(fmt, dd);
|
||||
|
@ -26,6 +26,7 @@ void addDateForRgrTest(TestNode**);
|
||||
void addNumFrDepTest(TestNode**);
|
||||
void addDtFrDepTest(TestNode**);
|
||||
|
||||
void addFormatTest(TestNode** root);
|
||||
|
||||
void addFormatTest(TestNode** root)
|
||||
{
|
||||
|
@ -39,6 +39,8 @@ static void _remove(UHashtable* hash,
|
||||
const char* key,
|
||||
int32_t expectedValue);
|
||||
|
||||
void addHashtableTest(TestNode** root);
|
||||
|
||||
/**********************************************************************
|
||||
* FW Registration
|
||||
*********************************************************************/
|
||||
|
@ -120,6 +120,7 @@ enum {
|
||||
DNAME_EL = 22
|
||||
};
|
||||
|
||||
void addLocaleTest(TestNode** root);
|
||||
|
||||
void addLocaleTest(TestNode** root)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user