/*
******************************************************************************
*
-* Copyright (C) 2007-2011, International Business Machines
+* Copyright (C) 2007-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
// limit<=0x800. If limit==0x800 then limitLead=32 and limitTrail=0.
// In that case, bits=1<<limitLead is undefined but the bits value
// is not used because trail<limitTrail is already false.
- bits=1<<limitLead;
+ bits=(uint32_t)1<<((limitLead == 0x20) ? (limitLead - 1) : limitLead);
for(trail=0; trail<limitTrail; ++trail) {
table[trail]|=bits;
}
/*
*******************************************************************************
-* Copyright (C) 2010-2011, International Business Machines
+* Copyright (C) 2010-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: bytestriebuilder.cpp
int32_t length=1;
if(i<0 || i>0xffffff) {
intBytes[0]=(char)BytesTrie::kFiveByteValueLead;
- intBytes[1]=(char)(i>>24);
- intBytes[2]=(char)(i>>16);
- intBytes[3]=(char)(i>>8);
+ intBytes[1]=(char)((uint32_t)i>>24);
+ intBytes[2]=(char)((uint32_t)i>>16);
+ intBytes[3]=(char)((uint32_t)i>>8);
intBytes[4]=(char)i;
length=5;
// } else if(i<=BytesTrie::kMaxOneByteValue) {
/*
*******************************************************************************
*
-* Copyright (C) 1997-2011, International Business Machines
+* Copyright (C) 1997-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
static const char _kVariants[] = "Variants";
static const char _kKeys[] = "Keys";
static const char _kTypes[] = "Types";
-static const char _kRootName[] = "root";
+//static const char _kRootName[] = "root";
static const char _kCurrency[] = "currency";
static const char _kCurrencies[] = "Currencies";
static const char _kLocaleDisplayPattern[] = "localeDisplayPattern";
/*
**********************************************************************
- * Copyright (C) 1996-2011, International Business Machines
+ * Copyright (C) 1996-2012, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
ILCID_POSIX_ELEMENT_ARRAY(0x046d, ba, ba_RU)
ILCID_POSIX_ELEMENT_ARRAY(0x0423, be, be_BY)
-ILCID_POSIX_SUBTABLE(ber) {
+/*ILCID_POSIX_SUBTABLE(ber) {
{0x5f, "ber"},
{0x045f, "ber_Arab_DZ"},
{0x045f, "ber_Arab"},
{0x085f, "ber_Latn_DZ"},
{0x085f, "ber_Latn"}
-};
+};*/
ILCID_POSIX_ELEMENT_ARRAY(0x0402, bg, bg_BG)
if(limit==NULL) { // appendZeroCC() needs limit!=NULL
limit=u_strchr(iter.codePointStart, 0);
}
- buffer.append(src, (int32_t)(iter.codePointStart-src), firstCC, prevCC, errorCode) &&
+
+ if (buffer.append(src, (int32_t)(iter.codePointStart-src), firstCC, prevCC, errorCode)) {
buffer.appendZeroCC(iter.codePointStart, limit, errorCode);
+ }
}
// Note: hasDecompBoundary() could be implemented as aliases to
/*
*************************************************************************
* COPYRIGHT:
- * Copyright (c) 1996-2011, International Business Machines Corporation and
+ * Copyright (c) 1996-2012, International Business Machines Corporation and
* others. All Rights Reserved.
*************************************************************************
*/
init();
}
-static const UChar _NUL=0;
-
void
Normalizer::init() {
UErrorCode errorCode=U_ZERO_ERROR;
if(scriptX>=UPROPS_SCRIPT_X_WITH_OTHER) {
scx=scriptExtensions+scx[1];
}
- if(sc>0x7fff) {
+ if(sc>=USCRIPT_CODE_LIMIT) {
/* Guard against bogus input that would make us go past the Script_Extensions terminator. */
return FALSE;
}
do {
sx=*scx++;
if(length<capacity) {
- scripts[length]=sx&0x7fff;
+ scripts[length]=(UScriptCode)(sx&0x7fff);
}
++length;
} while(sx<0x8000);
/*
*******************************************************************************
-* Copyright (C) 2010-2011, International Business Machines
+* Copyright (C) 2010-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucharstriebuilder.h
int32_t length;
if(i<0 || i>UCharsTrie::kMaxTwoUnitValue) {
intUnits[0]=(UChar)(UCharsTrie::kThreeUnitValueLead);
- intUnits[1]=(UChar)(i>>16);
+ intUnits[1]=(UChar)((uint32_t)i>>16);
intUnits[2]=(UChar)i;
length=3;
// } else if(i<=UCharsTrie::kMaxOneUnitValue) {
int32_t length;
if(value<0 || value>UCharsTrie::kMaxTwoUnitNodeValue) {
intUnits[0]=(UChar)(UCharsTrie::kThreeUnitNodeValueLead);
- intUnits[1]=(UChar)(value>>16);
+ intUnits[1]=(UChar)((uint32_t)value>>16);
intUnits[2]=(UChar)value;
length=3;
} else if(value<=UCharsTrie::kMaxOneUnitNodeValue) {
/*
**********************************************************************
-* Copyright (C) 2000-2011, International Business Machines
+* Copyright (C) 2000-2012, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: ucnv2022.cpp
#endif
static const char SHIFT_IN_STR[] = "\x0F";
-static const char SHIFT_OUT_STR[] = "\x0E";
+// static const char SHIFT_OUT_STR[] = "\x0E";
#define CR 0x0D
#define LF 0x0A
return;
}
- myConverterData->state = 0;
+ myConverterData->state = (COMPOUND_TEXT_CONVERTERS)0;
} else {
*errorCode = U_MEMORY_ALLOCATION_ERROR;
}
UErrorCode *pErrorCode) {
uint16_t *stage1;
uint32_t *stage2;
- uint8_t *bytes;
uint32_t dataLength=stage1Length*2+fullStage2Length*4+mbcsTable->fromUBytesLength;
mbcsTable->reconstitutedData=(uint8_t *)uprv_malloc(dataLength);
if(mbcsTable->reconstitutedData==NULL) {
stage2Length*4);
mbcsTable->fromUnicodeTable=stage1;
- mbcsTable->fromUnicodeBytes=bytes=(uint8_t *)(stage2+fullStage2Length);
+ mbcsTable->fromUnicodeBytes=(uint8_t *)(stage2+fullStage2Length);
/* indexes into stage 2 count from the bottom of the fromUnicodeTable */
stage2=(uint32_t *)stage1;
/*
******************************************************************************
*
-* Copyright (C) 2000-2011, International Business Machines
+* Copyright (C) 2000-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
#define MBCS_ENTRY_SET_STATE(entry, state) (int32_t)(((entry)&0x80ffffff)|((int32_t)(state)<<24L))
-#define MBCS_ENTRY_STATE(entry) (((entry)>>24)&0x7f)
+#define MBCS_ENTRY_STATE(entry) ((((uint32_t)entry)>>24)&0x7f)
#define MBCS_ENTRY_IS_TRANSITION(entry) ((entry)>=0)
#define MBCS_ENTRY_IS_FINAL(entry) ((entry)<0)
-#define MBCS_ENTRY_TRANSITION_STATE(entry) ((entry)>>24)
+#define MBCS_ENTRY_TRANSITION_STATE(entry) (((uint32_t)entry)>>24)
#define MBCS_ENTRY_TRANSITION_OFFSET(entry) ((entry)&0xffffff)
-#define MBCS_ENTRY_FINAL_STATE(entry) (((entry)>>24)&0x7f)
+#define MBCS_ENTRY_FINAL_STATE(entry) ((((uint32_t)entry)>>24)&0x7f)
#define MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry) ((entry)<(int32_t)0x80100000)
-#define MBCS_ENTRY_FINAL_ACTION(entry) (((entry)>>20)&0xf)
+#define MBCS_ENTRY_FINAL_ACTION(entry) ((((uint32_t)entry)>>20)&0xf)
#define MBCS_ENTRY_FINAL_VALUE(entry) ((entry)&0xfffff)
#define MBCS_ENTRY_FINAL_VALUE_16(entry) (uint16_t)(entry)
while(keywordStart[i-1] == ' ') {
i--;
}
- U_ASSERT(i>=0);
+ U_ASSERT(i>=0 && i<ULOC_KEYWORD_BUFFER_LEN);
localeKeywordNameBuffer[i] = 0;
nextSeparator = uprv_strchr(nextEqualsign, ';');
len += _getKeywords(tmpLocaleID+1, '@', (len<nameCapacity ? name+len : NULL), nameCapacity-len,
NULL, 0, NULL, TRUE, addKeyword, addValue, err);
} else if (addKeyword != NULL) {
- U_ASSERT(addValue != NULL);
+ U_ASSERT(addValue != NULL && len < nameCapacity);
/* inelegant but works -- later make _getKeywords do this? */
len += _copyCount(name+len, nameCapacity-len, "@");
len += _copyCount(name+len, nameCapacity-len, addKeyword);
U_NAMESPACE_BEGIN
-class U_COMMON_API IDNAInfo;
+class IDNAInfo;
/**
* Abstract base class for IDNA processing.
/*
*******************************************************************************
*
-* Copyright (C) 1999-2011, International Business Machines
+* Copyright (C) 1999-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
//static const UChar POSIX_OPEN[] = { SET_OPEN,COLON,0 }; // "[:"
static const UChar POSIX_CLOSE[] = { COLON,SET_CLOSE,0 }; // ":]"
//static const UChar PERL_OPEN[] = { BACKSLASH,LOWER_P,0 }; // "\\p"
-static const UChar PERL_CLOSE[] = { CLOSE_BRACE,0 }; // "}"
+//static const UChar PERL_CLOSE[] = { CLOSE_BRACE,0 }; // "}"
//static const UChar NAME_OPEN[] = { BACKSLASH,UPPER_N,0 }; // "\\N"
static const UChar HYPHEN_RIGHT_BRACE[] = {HYPHEN,SET_CLOSE,0}; /*-]*/
applyFilter(numericValueFilter, &value, UPROPS_SRC_CHAR, ec);
return *this;
}
- break;
case UCHAR_NAME:
{
// Must munge name, since u_charFromName() does not do
FAIL(ec);
}
}
- break;
case UCHAR_UNICODE_1_NAME:
// ICU 49 deprecates the Unicode_1_Name property APIs.
FAIL(ec);
applyFilter(versionFilter, &version, UPROPS_SRC_PROPSVEC, ec);
return *this;
}
- break;
case UCHAR_SCRIPT_EXTENSIONS:
v = u_getPropertyValueEnum(UCHAR_SCRIPT, vname.data());
if (v == UCHAR_INVALID_CODE) {
/*
*******************************************************************************
* *
-* Copyright (C) 1999-2011, International Business Machines Corporation *
+* Copyright (C) 1999-2012, International Business Machines Corporation *
* and others. All Rights Reserved. *
* *
*******************************************************************************
}
/* currently, we accept only resources that have a Table as their roots */
- rootType=RES_GET_TYPE(pResData->rootRes);
+ rootType=(UResType)RES_GET_TYPE(pResData->rootRes);
if(!URES_IS_TABLE(rootType)) {
*errorCode=U_INVALID_FORMAT_ERROR;
res_unload(pResData);
Resource t1 = r;
Resource t2;
int32_t indexR = 0;
- UResType type = RES_GET_TYPE(t1);
+ UResType type = (UResType)RES_GET_TYPE(t1);
/* if you come in with an empty path, you'll be getting back the same resource */
if(!uprv_strlen(pathP)) {
t2 = RES_BOGUS;
}
t1 = t2;
- type = RES_GET_TYPE(t1);
+ type = (UResType)RES_GET_TYPE(t1);
/* position pathP to next resource key/index */
pathP = *path;
}
/*
******************************************************************************
*
-* Copyright (C) 2001-2011, International Business Machines
+* Copyright (C) 2001-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
}
/* Faster loop without ongoing checking for pSrcLimit and pDestLimit. */
- pSrcLimit = pSrc + srcLength;
+ pSrcLimit = (pSrc == NULL) ? NULL : pSrc + srcLength;
for(;;) {
count = (int32_t)(pDestLimit - pDest);
srcLength = (int32_t)(pSrcLimit - pSrc);
/*
******************************************************************************
*
-* Copyright (C) 2001-2011, International Business Machines
+* Copyright (C) 2001-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
/* calculate the actual size of the dummy trie data */
/* max(Latin-1, block 0) */
- latin1Length= UTRIE_SHIFT<=8 ? 256 : UTRIE_DATA_BLOCK_LENGTH;
+ latin1Length= 256; /*UTRIE_SHIFT<=8 ? 256 : UTRIE_DATA_BLOCK_LENGTH;*/
trie->indexLength=UTRIE_BMP_INDEX_LENGTH+UTRIE_SURROGATE_BLOCK_COUNT;
trie->dataLength=latin1Length;
macos-518-10.2 { UTR22* } x-mac-arabic { MIME* } x-MacArabic { JAVA* } MacArabic { JAVA }
macos-1285-10.2 { UTR22* } x-mac-hebrew { MIME* } x-MacHebrew { JAVA* } MacHebrew { JAVA }
-ibm-1051_P100-1995 { UTR22* } ibm-1051 { IBM* } hp-roman8 { IANA* } roman8 { IANA } r8 { IANA } csHPRoman8 { IANA } x-roman8 { JAVA} # HP Latin1
+ibm-1051_P100-1995 { UTR22* } ibm-1051 { IBM* } hp-roman8 { IANA* } roman8 { IANA } r8 { IANA } csHPRoman8 { IANA } x-roman8 { JAVA* } # HP Latin1
ibm-1276_P100-1995 { UTR22* } ibm-1276 { IBM* } Adobe-Standard-Encoding { IANA* } csAdobeStandardEncoding { IANA } # Different from ISO-Unicode-IBM-1276 (GCSGID: 1276)
ibm-1006_P100-1995 { UTR22* } ibm-1006 { IBM* } IBM1006 { JAVA } cp1006 { JAVA* } 1006 { JAVA } x-IBM1006 { JAVA } # Urdu
/*****************************************************************************
*
-* Copyright (C) 1999-2011, International Business Machines
+* Copyright (C) 1999-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************/
UConverter *convto = 0;
UErrorCode err = U_ZERO_ERROR;
UBool flush;
+ UBool closeFile = FALSE;
const char *cbufp, *prevbufp;
char *bufp;
u_wmsg(stderr, "cantOpenInputF", str1.getBuffer(), str2.getBuffer());
return FALSE;
}
+ closeFile = TRUE;
} else {
infilestr = "-";
infile = stdin;
delete t;
#endif
- if (infile != stdin) {
+ if (closeFile) {
fclose(infile);
}
/*
**********************************************************************
-* Copyright (C) 1998-2004, International Business Machines Corporation
+* Copyright (C) 1998-2012, International Business Machines Corporation
* and others. All Rights Reserved.
**********************************************************************
*
ucnv_close(converter);
}
-static const char *gPath = 0;
static UResourceBundle *gBundle = NULL;
U_STRING_DECL(gNoFormatting, " (UCONFIG_NO_FORMATTING see uconfig.h)", 38);
return 0;
}
- gPath = uprv_strdup(path);
gBundle = b;
U_STRING_INIT(gNoFormatting, " (UCONFIG_NO_FORMATTING see uconfig.h)", 38);
if(U_FAILURE(err))
{
-#if 0
- fprintf(stderr, "u_wmsg: failed to load tag [%s] [%s] [%s]!!\n", tag, u_errorName(err), gPath);
-#endif
return -1;
}
/*
******************************************************************************
- * Copyright (C) 1996-2011, International Business Machines *
+ * Copyright (C) 1996-2012, International Business Machines *
* Corporation and others. All Rights Reserved. *
******************************************************************************
*/
bufferMin = 0;
bufferMax = 1;
- ceb[0].order = UCOL_NULLORDER;
+ ceb[0].order = (uint32_t)UCOL_NULLORDER;
ceb[0].lowOffset = last;
ceb[0].highOffset = last;
/*
*******************************************************************************
-* Copyright (C) 2003-2008, International Business Machines Corporation and *
+* Copyright (C) 2003-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(BuddhistCalendar)
-static const int32_t kMaxEra = 0; // only 1 era
+//static const int32_t kMaxEra = 0; // only 1 era
static const int32_t kBuddhistEraStart = -543; // 544 BC (Gregorian)
// we're not possibly in the last week -must be ywoy
return yearWoy;
}
- break;
case UCAL_DATE:
if((internalGet(UCAL_MONTH)==0) &&
//within 1st week and in this month..
//return yearWoy+1;
return yearWoy;
- break;
default: // assume the year is appropriate
return yearWoy;
- break;
}
-
-#if defined (U_DEBUG_CAL)
- fprintf(stderr, "%s:%d - forgot a return on field %s\n", __FILE__, __LINE__, fldName(bestField));
-#endif
-
- return yearWoy;
}
int32_t Calendar::handleGetMonthLength(int32_t extendedYear, int32_t month) const
/*
*******************************************************************************
-* Copyright (C) 1997-2011, International Business Machines Corporation and *
+* Copyright (C) 1997-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
#endif
#define INFINITY ((UChar)0x221E)
-static const UChar gPositiveInfinity[] = {INFINITY, 0};
-static const UChar gNegativeInfinity[] = {MINUS, INFINITY, 0};
+//static const UChar gPositiveInfinity[] = {INFINITY, 0};
+//static const UChar gNegativeInfinity[] = {MINUS, INFINITY, 0};
#define POSITIVE_INF_STRLEN 1
#define NEGATIVE_INF_STRLEN 2
/*
******************************************************************************
- * Copyright (C) 1996-2011, International Business Machines *
+ * Copyright (C) 1996-2012, International Business Machines *
* Corporation and others. All Rights Reserved. *
******************************************************************************
*/
return ces[index];
}
- return UCOL_NULLORDER;
+ return (uint32_t)UCOL_NULLORDER;
}
uint32_t &CEList::operator[](int32_t index) const
/* If total ordering then handle differing signs 'up front' */
if (op==COMPTOTAL) { /* total ordering */
- if (decNumberIsNegative(lhs) & !decNumberIsNegative(rhs)) {
+ if (decNumberIsNegative(lhs) && !decNumberIsNegative(rhs)) {
result=-1;
break;
}
- if (!decNumberIsNegative(lhs) & decNumberIsNegative(rhs)) {
+ if (!decNumberIsNegative(lhs) && decNumberIsNegative(rhs)) {
result=+1;
break;
}
/* Only for 32 bit numbers. Ignore the negative sign. */
-static const char LONG_MIN_REP[] = "2147483648";
-static const char I64_MIN_REP[] = "9223372036854775808";
+//static const char LONG_MIN_REP[] = "2147483648";
+//static const char I64_MIN_REP[] = "9223372036854775808";
U_NAMESPACE_BEGIN
static const char gAmPmMarkersTag[]="AmPmMarkers";
static const char gQuartersTag[]="quarters";
-static const char gZoneStringsTag[]="zoneStrings";
+// static const char gZoneStringsTag[]="zoneStrings";
-static const char gLocalPatternCharsTag[]="localPatternChars";
+// static const char gLocalPatternCharsTag[]="localPatternChars";
static const char gContextTransformsTag[]="contextTransforms";
static const UChar UDATPG_ItemFormat[]= {0x7B, 0x30, 0x7D, 0x20, 0x251C, 0x7B, 0x32, 0x7D, 0x3A,
0x20, 0x7B, 0x31, 0x7D, 0x2524, 0}; // {0} \u251C{2}: {1}\u2524
-static const UChar repeatedPatterns[6]={CAP_G, CAP_E, LOW_Z, LOW_V, CAP_Q, 0}; // "GEzvQ"
+//static const UChar repeatedPatterns[6]={CAP_G, CAP_E, LOW_Z, LOW_V, CAP_Q, 0}; // "GEzvQ"
static const char DT_DateTimePatternsTag[]="DateTimePatterns";
static const char DT_DateTimeCalendarTag[]="calendar";
return new DummyFormat();
}
+UnicodeString& MessageFormat::DummyFormat::format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const {
+ if (U_SUCCESS(status)) {
+ status = U_UNSUPPORTED_ERROR;
+ }
+ return appendTo;
+}
+
UnicodeString& MessageFormat::DummyFormat::format(const Formattable&,
UnicodeString& appendTo,
FieldPosition&,
return appendTo;
}
+UnicodeString& MessageFormat::DummyFormat::format(const Formattable&,
+ UnicodeString& appendTo,
+ FieldPositionIterator* posIter,
+ UErrorCode& status) const {
+ if (U_SUCCESS(status)) {
+ status = U_UNSUPPORTED_ERROR;
+ }
+ return appendTo;
+}
+
void MessageFormat::DummyFormat::parseObject(const UnicodeString&,
Formattable&,
ParsePosition& ) const {
UErrorCode status = U_ZERO_ERROR;
char parentLocaleName[ULOC_FULLNAME_CAPACITY];
const char *curLocaleName=locale.getName();
- int32_t localeNameLen=0;
uprv_strcpy(parentLocaleName, curLocaleName);
- while ((localeNameLen=uloc_getParent(parentLocaleName, parentLocaleName,
- ULOC_FULLNAME_CAPACITY, &status)) > 0) {
+ while (uloc_getParent(parentLocaleName, parentLocaleName,
+ ULOC_FULLNAME_CAPACITY, &status) > 0) {
resLen=0;
s = ures_getStringByKey(locRes.getAlias(), parentLocaleName, &resLen, &status);
if (s != NULL) {
return;
}
}
- break;
default:
status = U_UNEXPECTED_TOKEN;
return;
static const UChar chColon = 0x3A; // ':'
static const UChar chE = 0x45; // 'E'
static const UChar chQ = 0x51; // 'Q'
-static const UChar chN = 0x4E; // 'N'
+//static const UChar chN = 0x4E; // 'N'
static const UChar chP = 0x50; // 'P'
static const UChar chBackSlash = 0x5c; // '\' introduces a char escape
-static const UChar chLBracket = 0x5b; // '['
+//static const UChar chLBracket = 0x5b; // '['
static const UChar chRBracket = 0x5d; // ']'
static const UChar chUp = 0x5e; // '^'
static const UChar chLowerP = 0x70;
case URX_BACKSLASH_B: // Test for word boundaries
{
UBool success = isWordBoundary(fp->fInputIdx);
- success ^= (opValue != 0); // flip sense for \B
+ success ^= (UBool)(opValue != 0); // flip sense for \B
if (!success) {
fp = (REStackFrame *)fStack->popFrame(fFrameSize);
}
case URX_BACKSLASH_BU: // Test for word boundaries, Unicode-style
{
UBool success = isUWordBoundary(fp->fInputIdx);
- success ^= (opValue != 0); // flip sense for \B
+ success ^= (UBool)(opValue != 0); // flip sense for \B
if (!success) {
fp = (REStackFrame *)fStack->popFrame(fFrameSize);
}
UChar32 c = UTEXT_NEXT32(fInputText);
int8_t ctype = u_charType(c); // TODO: make a unicode set for this. Will be faster.
UBool success = (ctype == U_DECIMAL_DIGIT_NUMBER);
- success ^= (opValue != 0); // flip sense for \D
+ success ^= (UBool)(opValue != 0); // flip sense for \D
if (success) {
fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
} else {
case URX_BACKSLASH_B: // Test for word boundaries
{
UBool success = isChunkWordBoundary((int32_t)fp->fInputIdx);
- success ^= (opValue != 0); // flip sense for \B
+ success ^= (UBool)(opValue != 0); // flip sense for \B
if (!success) {
fp = (REStackFrame *)fStack->popFrame(fFrameSize);
}
case URX_BACKSLASH_BU: // Test for word boundaries, Unicode-style
{
UBool success = isUWordBoundary(fp->fInputIdx);
- success ^= (opValue != 0); // flip sense for \B
+ success ^= (UBool)(opValue != 0); // flip sense for \B
if (!success) {
fp = (REStackFrame *)fStack->popFrame(fFrameSize);
}
U16_NEXT(inputBuf, fp->fInputIdx, fActiveLimit, c);
int8_t ctype = u_charType(c); // TODO: make a unicode set for this. Will be faster.
UBool success = (ctype == U_DECIMAL_DIGIT_NUMBER);
- success ^= (opValue != 0); // flip sense for \D
+ success ^= (UBool)(opValue != 0); // flip sense for \D
if (!success) {
fp = (REStackFrame *)fStack->popFrame(fFrameSize);
}
// For time zones that have no names, use strings GMT+minutes and
// GMT-minutes. For instance, in France the time zone is GMT+60.
// Also accepted are GMT+H:MM or GMT-H:MM.
-static const UChar gGmt[] = {0x0047, 0x004D, 0x0054, 0x0000}; // "GMT"
-static const UChar gGmtPlus[] = {0x0047, 0x004D, 0x0054, 0x002B, 0x0000}; // "GMT+"
-static const UChar gGmtMinus[] = {0x0047, 0x004D, 0x0054, 0x002D, 0x0000}; // "GMT-"
-static const UChar gDefGmtPat[] = {0x0047, 0x004D, 0x0054, 0x007B, 0x0030, 0x007D, 0x0000}; /* GMT{0} */
-static const UChar gDefGmtNegHmsPat[] = {0x002D, 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0x003A, 0x0073, 0x0073, 0x0000}; /* -HH:mm:ss */
-static const UChar gDefGmtNegHmPat[] = {0x002D, 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0x0000}; /* -HH:mm */
-static const UChar gDefGmtPosHmsPat[] = {0x002B, 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0x003A, 0x0073, 0x0073, 0x0000}; /* +HH:mm:ss */
-static const UChar gDefGmtPosHmPat[] = {0x002B, 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0x0000}; /* +HH:mm */
-static const UChar gUt[] = {0x0055, 0x0054, 0x0000}; // "UT"
-static const UChar gUtc[] = {0x0055, 0x0054, 0x0043, 0x0000}; // "UT"
+// Currently not being used
+//static const UChar gGmt[] = {0x0047, 0x004D, 0x0054, 0x0000}; // "GMT"
+//static const UChar gGmtPlus[] = {0x0047, 0x004D, 0x0054, 0x002B, 0x0000}; // "GMT+"
+//static const UChar gGmtMinus[] = {0x0047, 0x004D, 0x0054, 0x002D, 0x0000}; // "GMT-"
+//static const UChar gDefGmtPat[] = {0x0047, 0x004D, 0x0054, 0x007B, 0x0030, 0x007D, 0x0000}; /* GMT{0} */
+//static const UChar gDefGmtNegHmsPat[] = {0x002D, 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0x003A, 0x0073, 0x0073, 0x0000}; /* -HH:mm:ss */
+//static const UChar gDefGmtNegHmPat[] = {0x002D, 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0x0000}; /* -HH:mm */
+//static const UChar gDefGmtPosHmsPat[] = {0x002B, 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0x003A, 0x0073, 0x0073, 0x0000}; /* +HH:mm:ss */
+//static const UChar gDefGmtPosHmPat[] = {0x002B, 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0x0000}; /* +HH:mm */
+//static const UChar gUt[] = {0x0055, 0x0054, 0x0000}; // "UT"
+//static const UChar gUtc[] = {0x0055, 0x0054, 0x0043, 0x0000}; // "UT"
typedef enum GmtPatSize {
kGmtLen = 3,
*/
static const char gDateTimePatternsTag[]="DateTimePatterns";
-static const UChar gEtcUTC[] = {0x45, 0x74, 0x63, 0x2F, 0x55, 0x54, 0x43, 0x00}; // "Etc/UTC"
+//static const UChar gEtcUTC[] = {0x45, 0x74, 0x63, 0x2F, 0x55, 0x54, 0x43, 0x00}; // "Etc/UTC"
static const UChar QUOTE = 0x27; // Single quote
/*
static const UChar GMT_ID[] = {0x47, 0x4D, 0x54, 0x00}; /* "GMT" */
static const UChar UNKNOWN_ZONE_ID[] = {0x45, 0x74, 0x63, 0x2F, 0x55, 0x6E, 0x6B, 0x6E, 0x6F, 0x77, 0x6E, 0x00}; /* "Etc/Unknown" */
-static const UChar Z_STR[] = {0x7A, 0x00}; /* "z" */
-static const UChar ZZZZ_STR[] = {0x7A, 0x7A, 0x7A, 0x7A, 0x00}; /* "zzzz" */
-static const UChar Z_UC_STR[] = {0x5A, 0x00}; /* "Z" */
-static const UChar ZZZZ_UC_STR[] = {0x5A, 0x5A, 0x5A, 0x5A, 0x00}; /* "ZZZZ" */
-static const UChar V_STR[] = {0x76, 0x00}; /* "v" */
-static const UChar VVVV_STR[] = {0x76, 0x76, 0x76, 0x76, 0x00}; /* "vvvv" */
-static const UChar V_UC_STR[] = {0x56, 0x00}; /* "V" */
-static const UChar VVVV_UC_STR[] = {0x56, 0x56, 0x56, 0x56, 0x00}; /* "VVVV" */
static const int32_t GMT_ID_LENGTH = 3;
static const int32_t UNKNOWN_ZONE_ID_LENGTH = 11;
static const UChar TZID_GMT[] = {0x0045, 0x0074, 0x0063, 0x002F, 0x0047, 0x004D, 0x0054, 0}; // Etc/GMT
static const UChar DEFAULT_GMT_PATTERN[] = {0x0047, 0x004D, 0x0054, 0x007B, 0x0030, 0x007D, 0}; // GMT{0}
-static const UChar DEFAULT_GMT_ZERO[] = {0x0047, 0x004D, 0x0054, 0}; // GMT
+//static const UChar DEFAULT_GMT_ZERO[] = {0x0047, 0x004D, 0x0054, 0}; // GMT
static const UChar DEFAULT_GMT_POSITIVE_HM[] = {0x002B, 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0}; // +HH:mm
static const UChar DEFAULT_GMT_POSITIVE_HMS[] = {0x002B, 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0x003A, 0x0073, 0x0073, 0}; // +HH:mm:ss
static const UChar DEFAULT_GMT_NEGATIVE_HM[] = {0x002D, 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0}; // -HH:mm
U_ASSERT(maxDigits <= MAX_OFFSET_DIGITS);
- int32_t digits[MAX_OFFSET_DIGITS];
+ int32_t digits[MAX_OFFSET_DIGITS] = {};
int32_t numDigits = 0;
int32_t idx = start;
while (numDigits < maxDigits && idx < text.length()) {
IInit_collIterate(coll, UCharOffset, noChars, &temp, status);
if(U_FAILURE(*status)) {
- return UCOL_NULLORDER;
+ return (uint32_t)UCOL_NULLORDER;
}
temp.flags &= ~UCOL_ITER_NORM;
temp.flags |= source->flags & UCOL_FORCE_HAN_IMPLICIT;
// The total size for our collation key is half of endIndex, rounded up.
int32_t size = (endIndex+1)/2;
if(!ensureCEsCapacity(source, size)) {
- return UCOL_NULLORDER;
+ return (uint32_t)UCOL_NULLORDER;
}
*(source->CEpos++) = (((numTempBuf[0] << 8) | numTempBuf[1]) << UCOL_PRIMARYORDERSHIFT) | //Primary weight
(UCOL_BYTE_COMMON << UCOL_SECONDARYORDERSHIFT) | // Secondary weight
// If we are doing French, we need to store whether we have just finished the French level
if(level == UCOL_PSK_SECONDARY && doingFrench) {
- state[1] |= (((state[0] == 0) & UCOL_PSK_BYTE_COUNT_OR_FRENCH_DONE_MASK) << UCOL_PSK_BYTE_COUNT_OR_FRENCH_DONE_SHIFT);
+ state[1] |= (((int32_t)(state[0] == 0) & UCOL_PSK_BYTE_COUNT_OR_FRENCH_DONE_MASK) << UCOL_PSK_BYTE_COUNT_OR_FRENCH_DONE_SHIFT);
} else {
state[1] |= ((byteCountOrFrenchDone & UCOL_PSK_BYTE_COUNT_OR_FRENCH_DONE_MASK) << UCOL_PSK_BYTE_COUNT_OR_FRENCH_DONE_SHIFT);
}
}
result->hasRealData = TRUE;
result->freeImageOnClose = TRUE;
+ } else {
+ goto cleanup;
}
} else { /* no rules, but no error either */
// must be only options
uloc_getCountry(locale, countryAndVariant, capacity, ec);
uloc_getVariant(locale, variant, sizeof(variant), ec);
if (variant[0] != 0) {
- variantType = (0 == uprv_strcmp(variant, VAR_EURO))
- | ((0 == uprv_strcmp(variant, VAR_PRE_EURO)) << 1);
+ variantType = (uint32_t)(0 == uprv_strcmp(variant, VAR_EURO))
+ | ((uint32_t)(0 == uprv_strcmp(variant, VAR_PRE_EURO)) << 1);
if (variantType)
{
uprv_strcat(countryAndVariant, VAR_DELIM_STR);
public:
virtual UBool operator==(const Format&) const;
virtual Format* clone() const;
+ virtual UnicodeString& format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const;
virtual UnicodeString& format(const Formattable&,
UnicodeString& appendTo,
FieldPosition&,
UErrorCode& status) const;
+ virtual UnicodeString& format(const Formattable& obj,
+ UnicodeString& appendTo,
+ FieldPositionIterator* posIter,
+ UErrorCode& status) const;
virtual void parseObject(const UnicodeString&,
Formattable&,
ParsePosition&) const;
/*
*******************************************************************************
*
-* Copyright (C) 1998-2011, International Business Machines
+* Copyright (C) 1998-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
#include "unicode/ustring.h"
#include "unicode/uloc.h"
-static UBool isFormatsInitialized = FALSE;
static UNumberFormat *gPosixNumberFormat[ULOCALEBUNDLE_NUMBERFORMAT_COUNT];
U_CDECL_BEGIN
unum_close(gPosixNumberFormat[style]);
gPosixNumberFormat[style] = NULL;
}
- isFormatsInitialized = FALSE;
return TRUE;
}
U_CDECL_END
/*
*
- * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1998-2012 - All Rights Reserved
*
*/
featureReferences += SWAPW(featureTable->lookupCount);
}
+ if (!featureTable) {
+ success = LE_INTERNAL_ERROR;
+ return;
+ }
+
if (requiredFeatureIndex != 0xFFFF) {
requiredFeatureTable = featureListTable->getFeatureTable(requiredFeatureIndex, &requiredFeatureTag);
featureReferences += SWAPW(featureTable->lookupCount);
REPEAT_TESTS = value;
break;
case ICU_TRACE_OPTION:
- ICU_TRACE = value;
+ ICU_TRACE = (UTraceLevel)value;
break;
default :
break;
/*
*******************************************************************************
*
-* Copyright (C) 1999-2011, International Business Machines
+* Copyright (C) 1999-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
static uint16_t
addAlias(const char *alias, uint16_t standard, uint16_t converter, UBool defaultName) {
uint32_t idx, idx2;
- UBool dupFound = FALSE;
UBool startEmptyWithoutDefault = FALSE;
AliasList *aliasList;
GET_ALIAS_STR(converters[converter].converter),
GET_ALIAS_STR(converters[idx].converter));
}
- dupFound = TRUE;
break;
}
}
};
/* Just to store "TRUE" */
-static const UChar trueValue[] = {0x0054, 0x0052, 0x0055, 0x0045, 0x0000};
+//static const UChar trueValue[] = {0x0054, 0x0052, 0x0055, 0x0045, 0x0000};
typedef struct {
struct Lookahead lookahead[MAX_LOOKAHEAD + 1];
char filename[256] = { '\0' };
char cs[128] = { '\0' };
uint32_t line;
- int len=0;
UBool quoted = FALSE;
UCHARBUF *ucbuf=NULL;
UChar32 c = 0;
* append at the end of the loop
*/
while(c != ENDCOMMAND) {
- U_APPEND_CHAR32(c, target,len);
+ U_APPEND_CHAR32_ONLY(c, target);
c = ucbuf_getc(ucbuf, status);
}
}
/* Append UChar * after dissembling if c > 0xffff*/
if (c != (UChar32)U_EOF)
{
- U_APPEND_CHAR32(c, target,len);
+ U_APPEND_CHAR32_ONLY(c, target);
}
else
{
/*
*******************************************************************************
*
-* Copyright (C) 1998-2011, International Business Machines
+* Copyright (C) 1998-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
} \
}
+#define U_APPEND_CHAR32_ONLY(c,target) { \
+ if (c <= 0xffff) \
+ { \
+ *(target)++ = (UChar) c; \
+ } \
+ else \
+ { \
+ target[0] = U16_LEAD(c); \
+ target[1] = U16_TRAIL(c); \
+ target +=2; \
+ } \
+}
+
/* A C representation of a string "object" (to avoid realloc all the time) */
struct UString {
UChar *fChars;
static FileStream* out=NULL;
static struct SRBRoot* srBundle ;
-static const char* outDir = NULL;
+/*static const char* outDir = NULL;*/
static const char* bName=NULL;
static const char* pName=NULL;
char className[256]={'\0'};
/*char constructor[1000] = { 0 };*/
/*UBool j1 =FALSE;*/
- outDir = outputDir;
+ /*outDir = outputDir;*/
start = TRUE; /* Reset the start indictor*/
/*
*******************************************************************************
*
-* Copyright (C) 2000-2011, International Business Machines
+* Copyright (C) 2000-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
offset+=MBCS_ENTRY_TRANSITION_OFFSET(entry);
} else {
if(i<length) {
- fprintf(stderr, "error: byte sequence too long by %d bytes, final state %hu: 0x%s (U+%x)\n",
+ fprintf(stderr, "error: byte sequence too long by %d bytes, final state %u: 0x%s (U+%x)\n",
(int)(length-i), state, printBytes(buffer, bytes, length), (int)c);
return FALSE;
}
static UBool
transformEUC(MBCSData *mbcsData) {
uint8_t *p8;
- uint32_t i, value, oldLength, old3Top, new3Top;
+ uint32_t i, value, oldLength, old3Top;
uint8_t b;
oldLength=mbcsData->ucm->states.maxCharLength;
/* modify outputType and adjust stage3Top */
mbcsData->ucm->states.outputType=(int8_t)(MBCS_OUTPUT_3_EUC+oldLength-3);
- mbcsData->stage3Top=new3Top=(old3Top*(oldLength-1))/oldLength;
+ mbcsData->stage3Top=(old3Top*(oldLength-1))/oldLength;
/*
* EUC-encode all byte sequences;
/*
********************************************************************************
*
- * Copyright (C) 1998-2011, International Business Machines
+ * Copyright (C) 1998-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
********************************************************************************
}
if(options[OPT_VERSION].doesOccur) {
- printf("makeconv version %hu.%hu, ICU tool to read .ucm codepage mapping files and write .cnv files\n",
+ printf("makeconv version %u.%u, ICU tool to read .ucm codepage mapping files and write .cnv files\n",
dataInfo.formatVersion[0], dataInfo.formatVersion[1]);
printf("%s\n", U_COPYRIGHT_STRING);
exit(0);
arg = getLongPathname(*argv);
/* Check for potential buffer overflow */
- if(strlen(arg) > UCNV_MAX_FULL_FILE_NAME_LENGTH)
+ if(strlen(arg) >= UCNV_MAX_FULL_FILE_NAME_LENGTH)
{
fprintf(stderr, "%s\n", u_errorName(U_BUFFER_OVERFLOW_ERROR));
return U_BUFFER_OVERFLOW_ERROR;
}
#ifndef U_WINDOWS_WITH_MSVC
char buffer[SMALL_BUFFER_MAX_SIZE] = "";
+ int32_t bufferLength = 0;
FileStream *f = T_FileStream_open(fileListName, "r");
if (f != NULL) {
for(;;) {
if (T_FileStream_readLine(f, buffer, SMALL_BUFFER_MAX_SIZE) != NULL) {
+ bufferLength = uprv_strlen(buffer);
/* Remove new line character. */
- buffer[uprv_strlen(buffer)-1] = 0;
+ if (bufferLength > 0) {
+ buffer[bufferLength-1] = 0;
+ }
sprintf(cmd, "%s %s%s%s %s%s%s",
pkgDataFlags[INSTALL_CMD],
option->doesOccur = TRUE;
return 0;
-#endif
+#else
return -1;
+#endif
}
/* deal with options, files and the entry point name */
getArchitecture(&cpu, &bits, &makeBigEndian, optMatchArch);
- printf("genccode: --match-arch cpu=%hu bits=%hu big-endian=%hu\n", cpu, bits, makeBigEndian);
+ printf("genccode: --match-arch cpu=%hu bits=%hu big-endian=%d\n", cpu, bits, makeBigEndian);
#if U_PLATFORM_HAS_WIN32_API
if(cpu==IMAGE_FILE_MACHINE_I386) {
entryOffset=1;
addFile(getLongPathname(line), name, source, sourceTOC, verbose);
}
- if (linePtr) {
- uprv_free(linePtr);
- }
+ uprv_free(linePtr);
if(in!=T_FileStream_stdin()) {
T_FileStream_close(in);
}
if(file==NULL) {
perror("error opening preparsed UCD");
- fprintf(stderr, "error opening preparsed UCD file %s\n", filename);
+ fprintf(stderr, "error opening preparsed UCD file %s\n", filename ? filename : "\"no file name given\"");
errorCode=U_FILE_ACCESS_ERROR;
return;
}
"for non-binary property on line %ld\n",
field, (long)lineNumber);
errorCode=U_PARSE_ERROR;
+ } else if (prop < UCHAR_INT_START) {
+ fprintf(stderr,
+ "error in preparsed UCD: prop value is invalid: '%d' for line %ld\n",
+ prop, (long)lineNumber);
+ errorCode=U_PARSE_ERROR;
} else if(prop<UCHAR_INT_LIMIT) {
int32_t value=pnames->getPropertyValueEnum(prop, v);
if(value==UCHAR_INVALID_CODE && prop==UCHAR_CANONICAL_COMBINING_CLASS) {
/* udata_swapDataHeader checks the arguments */
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- udata_printError(ds, "test_swap(): data header swap failed %s\n", u_errorName(*pErrorCode));
+ udata_printError(ds, "test_swap(): data header swap failed %s\n", pErrorCode != NULL ? u_errorName(*pErrorCode) : "pErrorCode is NULL");
return 0;
}
/*
*******************************************************************************
*
-* Copyright (C) 2003-2011, International Business Machines
+* Copyright (C) 2003-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
}
if(offset!=0) {
- fprintf(stderr, "ucm error: byte sequence too short, ends in non-final state %hu\n", state);
+ fprintf(stderr, "ucm error: byte sequence too short, ends in non-final state %u\n", state);
return -1;
}
/*
*******************************************************************************
*
-* Copyright (C) 2000-2011, International Business Machines
+* Copyright (C) 2000-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
}
if(s==NULL || destCapacity<0 || (destCapacity>0 && dest==NULL)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
}
if(pFirst!=NULL) {