/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2010, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
{ 12, 13, 9, 0, 14, 1, 11, 2, 3, 4, 5, 6, 8, 10, 7, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, /* en_US */
{ 12, 13, 9, 0, 14, 1, 11, 2, 3, 4, 5, 6, 8, 10, 7, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, /* en_GB */
{ 12, 13, 9, 0, 14, 1, 11, 2, 3, 4, 5, 6, 8, 10, 7, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, /* en_CA */
- { 12, 13, 9, 0, 14, 1, 11, 3, 2, 4, 5, 6, 8, 10, 7, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, /* fr_FR */
+ { 12, 13, 9, 0, 14, 1, 11, 2, 3, 4, 5, 6, 8, 10, 7, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, /* fr_FR */
{ 12, 13, 9, 0, 14, 1, 11, 3, 2, 4, 5, 6, 8, 10, 7, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, /* fr_CA */
{ 12, 13, 9, 0, 14, 1, 11, 2, 3, 4, 5, 6, 8, 10, 7, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, /* de_DE */
{ 12, 13, 9, 0, 14, 1, 11, 2, 3, 4, 5, 6, 8, 10, 7, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, /* it_IT */
if (U_FAILURE(status))
{
- log_err("Error in creating collator in %s: %s\n", locales[i], myErrorName(status));
+ log_err_status(status, "Error in creating collator in %s: %s\n", locales[i], myErrorName(status));
continue;
}
UCOL_DEFAULT_STRENGTH,NULL, &status);
if (U_FAILURE(status))
{
-
- log_err("Error in creating collator in %s: %s\n", locales[i], myErrorName(status));
+ ucol_close(myCollation);
+ log_err_status(status, "Error in creating collator in %s: %s\n", locales[i], myErrorName(status));
continue;
}
{
UCollator *myCollation;
int32_t j, n;
- const char *rules = "& Z < p, P";
- int32_t len=strlen(rules);
- UChar *temp = (UChar*)malloc(sizeof(UChar) * (len+1));
+ static const char rules[] = "& Z < p, P";
+ int32_t len=(int32_t)strlen(rules);
+ UChar temp[sizeof(rules)];
UErrorCode status = U_ZERO_ERROR;
u_uastrcpy(temp, rules);
if (U_FAILURE(status))
{
- log_err( "Demo Test 1 Rule collation object creation failed. : %s\n", myErrorName(status));
+ log_err_status(status, "Demo Test 1 Rule collation object creation failed. : %s\n", myErrorName(status));
return;
}
}
ucol_close(myCollation);
- free(temp);
}
static void TestDemo2()
{
UCollator *myCollation;
int32_t j, n;
- const char *rules = "& C < ch , cH, Ch, CH";
- int32_t len=strlen(rules);
- UChar *temp = (UChar*)malloc(sizeof(UChar) * (len+1));
+ static const char rules[] = "& C < ch , cH, Ch, CH";
+ int32_t len=(int32_t)strlen(rules);
+ UChar temp[sizeof(rules)];
UErrorCode status = U_ZERO_ERROR;
u_uastrcpy(temp, rules);
if (U_FAILURE(status))
{
- log_err( "Demo Test 2 Rule collation object creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "Demo Test 2 Rule collation object creation failed.: %s\n", myErrorName(status));
return;
}
for (j = 0; j < TOTALTESTSET; j++)
}
}
ucol_close(myCollation);
- free(temp);
}
static void TestDemo3()
{
UCollator *myCollation;
int32_t j, n;
- const char *rules = "& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'";
- int32_t len=strlen(rules);
- UChar *temp = (UChar*)malloc(sizeof(UChar) * (len+1));
+ static const char rules[] = "& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'";
+ int32_t len=(int32_t)strlen(rules);
+ UChar temp[sizeof(rules)];
UErrorCode status = U_ZERO_ERROR;
u_uastrcpy(temp, rules);
if (U_FAILURE(status))
{
- log_err( "Demo Test 3 Rule collation object creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "Demo Test 3 Rule collation object creation failed.: %s\n", myErrorName(status));
return;
}
}
}
ucol_close(myCollation);
- free(temp);
}
static void TestDemo4()
{
UCollator *myCollation;
int32_t j, n;
- const char *rules = " & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' ";
- int32_t len=strlen(rules);
- UChar *temp = (UChar*)malloc(sizeof(UChar) * (len+1));
+ static const char rules[] = " & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' ";
+ int32_t len=(int32_t)strlen(rules);
+ UChar temp[sizeof(rules)];
UErrorCode status = U_ZERO_ERROR;
u_uastrcpy(temp, rules);
if (U_FAILURE(status))
{
- log_err( "Demo Test 4 Rule collation object creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "Demo Test 4 Rule collation object creation failed.: %s\n", myErrorName(status));
return;
}
for (j = 0; j < TOTALTESTSET; j++)
}
}
ucol_close(myCollation);
- free(temp);
}
#endif /* #if !UCONFIG_NO_COLLATION */