/********************************************************************
- * Copyright (c) 1997-2013, International Business Machines
+ * Copyright (c) 1997-2014, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************/
/*****************************************************************************
const UChar u16han[] = {0x5c71, 0x5ddd, 0};
const int32_t u16hanLen = 2;
- const char u8asc[] = {0x49, 0x42, 0x4D, 0};
+ const char *u8asc = "\x49\x42\x4D";
const int32_t u8ascLen = 3;
- const char u8han[] = {0xE5, 0xB1, 0xB1, 0xE5, 0xB7, 0x9D, 0};
+ const char *u8han = "\xE5\xB1\xB1\xE5\xB7\x9D";
const int32_t u8hanLen = 6;
coll = ucol_open(NULL, &status);
/*Reads the BOM*/
- fread(&BOM, sizeof(UChar), 1, ucs_file_in);
+ size_t numRead = fread(&BOM, sizeof(UChar), 1, ucs_file_in);
+ (void)numRead;
if (BOM!=0xFEFF && BOM!=0xFFFE)
{
log_err("File Missing BOM...Bailing!\n");
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2013, International Business Machines Corporation and
+ * Copyright (c) 1997-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
char bbuf1[kBbufMax];
char bbuf2[kBbufMax];
int32_t len = udat_format(udfmt, today, ubuf, kUbufMax, NULL, &status);
+ (void)len;
if ( U_FAILURE(status) ) {
log_err("FAIL: udat_format today for locale %s, capitalizationContext %d, status %s\n",
textRelContextItemPtr->locale, (int)textRelContextItemPtr->capitalizationContext, u_errorName(status) );
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2013, International Business Machines Corporation and
+ * Copyright (c) 1997-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*****************************************************************************
log_data_err("uldn_open fails for displayLocale %s, status=%s\n", itemPtr->displayLocale, u_errorName(status));
}
#endif
+ (void)ulen; /* Suppress variable not used warning */
}
}
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2013, International Business Machines Corporation and
+ * Copyright (c) 1997-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
itemPtr->locale, itemPtr->numsys, itemPtr->radix, itemPtr->isAlgorithmic, numsys, radix, isAlgorithmic);
}
ulen = unumsys_getDescription(unumsys, ubuf, kNumSysDescripBufMax, &status);
+ (void)ulen; // Suppress variable not used warning.
if ( U_FAILURE(status) || u_strcmp(ubuf, itemPtr->description) != 0 ) {
log_data_err("unumsys description for locale %s, description unexpected and/or status %\n", myErrorName(status));
}
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2001-2013, International Business Machines Corporation and
+ * Copyright (c) 2001-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
* Test with an illegal lead byte that would be followed by more than 3 trail bytes.
* See ticket #10371.
*/
- static const char src[1]={ 0xf8 };
+ static const char src[1]={ (char)0xf8 };
UChar out16[10];
err=U_ZERO_ERROR;
u_strFromUTF8(out16, LENGTHOF(out16), NULL, src, 1, &err);
/************************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2013, International Business Machines Corporation
+ * Copyright (c) 1997-2014, International Business Machines Corporation
* and others. All Rights Reserved.
************************************************************************/
#include "unicode/utypes.h"
// 5777 is NOT a lear year and does not have month Adar I
pCal->set(5777, HebrewCalendar::ADAR_1, 1);
d = pCal->getTime(status);
+ (void)d;
if (status == U_ILLEGAL_ARGUMENT_ERROR) {
logln("Info: U_ILLEGAL_ARGUMENT_ERROR, because 5777 Adar I 1 is not a valid date.");
} else {
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2013, International Business Machines
+ * Copyright (c) 1997-2014, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************/
{ NULL, true, UnicodeString(""), UnicodeString(""), UnicodeString("") }
};
UErrorCode status = U_ZERO_ERROR;
- Calendar* cal = Calendar::createInstance(status);
+ LocalPointer<Calendar> cal(Calendar::createInstance(status));
if (U_FAILURE(status)) {
dataerrln(UnicodeString("FAIL: Unable to create Calendar for default timezone and locale."));
- } else {
- cal->setTime(july022008, status);
- const TestDateFormatLeniencyItem * itemPtr;
- for (itemPtr = items; itemPtr->locale != NULL; itemPtr++ ) {
-
- Locale locale = Locale::createFromName(itemPtr->locale);
- status = U_ZERO_ERROR;
- ParsePosition pos(0);
- SimpleDateFormat * sdmft = new SimpleDateFormat(itemPtr->pattern, locale, status);
- if (U_FAILURE(status)) {
- dataerrln("Unable to create SimpleDateFormat - %s", u_errorName(status));
- continue;
- }
- sdmft->setLenient(itemPtr->leniency);
- sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, itemPtr->leniency, status).setBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, itemPtr->leniency, status);
- /*UDate d = */sdmft->parse(itemPtr->parseString, pos);
-
- delete sdmft;
- if(pos.getErrorIndex() > -1)
- if(itemPtr->expectedResult.length() != 0) {
- errln("error: unexpected error - " + itemPtr->parseString + " - error index " + pos.getErrorIndex() + " - leniency " + itemPtr->leniency);
- continue;
- } else {
- continue;
- }
- }
+ return;
+ }
+ cal->setTime(july022008, status);
+ const TestDateFormatLeniencyItem * itemPtr;
+ LocalPointer<SimpleDateFormat> sdmft;
+ for (itemPtr = items; itemPtr->locale != NULL; itemPtr++ ) {
+
+ Locale locale = Locale::createFromName(itemPtr->locale);
+ status = U_ZERO_ERROR;
+ ParsePosition pos(0);
+ sdmft.adoptInstead(new SimpleDateFormat(itemPtr->pattern, locale, status));
+ if (U_FAILURE(status)) {
+ dataerrln("Unable to create SimpleDateFormat - %s", u_errorName(status));
+ continue;
+ }
+ sdmft->setLenient(itemPtr->leniency);
+ sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, itemPtr->leniency, status).
+ setBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, itemPtr->leniency, status);
+ UDate d = sdmft->parse(itemPtr->parseString, pos);
+ (void)d;
+
+ // TODO: Ticket 10625. Nothing here is checking the expected result when the parse succeeds.
+
+ if ((pos.getErrorIndex() > -1) && (itemPtr->expectedResult.length() != 0)) {
+ errln("error: unexpected error - " + itemPtr->parseString +
+ " - error index " + pos.getErrorIndex() +
+ " - leniency " + itemPtr->leniency);
+ }
}
- delete cal;
-
}
#endif /* #if !UCONFIG_NO_FORMATTING */
/*
*******************************************************************************
-* Copyright (C) 2007-2013, International Business Machines Corporation and
+* Copyright (C) 2007-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************************
for (int32_t i=0; i<LENGTHOF(fData); i++) {
if ((newRules->select(fData[i])== KEYWORD_A) != isKeywordA[i]) {
errln("File %s, Line %d, ERROR: plural rules for decimal fractions test failed!\n"
- " number = %g, expected %s", __FILE__, __LINE__, fData[i], isKeywordA?"TRUE":"FALSE");
+ " number = %g, expected %s", __FILE__, __LINE__, fData[i], isKeywordA[i]?"TRUE":"FALSE");
}
}
/********************************************************************
- * Copyright (c) 2008-2013, International Business Machines Corporation and
+ * Copyright (c) 2008-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
#include <iostream>
#endif
+#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
+
void TimeUnitTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) {
if (exec) logln("TestSuite TimeUnitTest");
switch (index) {
dataerrln("generating NumberFormat Object failed: %s", u_errorName(status));
return;
}
- for (int32_t i = 0; i < sizeof(expected) / sizeof(expected[0]); ++i) {
+ for (int32_t i = 0; i < LENGTHOF(expected); ++i) {
nf->setMaximumFractionDigits(i);
nf->setRoundingMode(DecimalFormat::kRoundDown);
tuf.setNumberFormat(*nf, status);
/******************************************************************************
- * Copyright (C) 2000-2013, International Business Machines
+ * Copyright (C) 2000-2014, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: pkgdata.cpp
if (cmdBuf[0] != 0) {
uprv_strncat(cmdBuf, U_FILE_SEP_STRING, 1024);
}
- uprv_strncat(cmdBuf, cmd, 1024);
+ uprv_strncat(cmdBuf, cmd, 1023);
if(verbose) {
fprintf(stdout, "# Calling icu-config: %s\n", cmdBuf);