X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/f3c0d7a59d99c2a94c6b8822291f0e42be3773c9..a01113dcd0f39d5da295ef82785beff9ed86fe38:/icuSources/i18n/dtitvinf.cpp?ds=sidebyside diff --git a/icuSources/i18n/dtitvinf.cpp b/icuSources/i18n/dtitvinf.cpp index c863a683..c0a6980e 100644 --- a/icuSources/i18n/dtitvinf.cpp +++ b/icuSources/i18n/dtitvinf.cpp @@ -326,7 +326,9 @@ struct DateIntervalInfo::DateIntervalSink : public ResourceSink { char c0; if ((c0 = patternLetter[0]) != 0 && patternLetter[1] == 0) { // Check that the pattern letter is accepted - if (c0 == 'y') { + if (c0 == 'G') { + return UCAL_ERA; + } else if (c0 == 'y') { return UCAL_YEAR; } else if (c0 == 'M') { return UCAL_MONTH; @@ -594,7 +596,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton, const UHashElement* elem = NULL; while ( (elem = fIntervalPatterns->nextElement(pos)) != NULL ) { const UHashTok keyTok = elem->key; - UnicodeString* skeleton = (UnicodeString*)keyTok.pointer; + UnicodeString* newSkeleton = (UnicodeString*)keyTok.pointer; #ifdef DTITVINF_DEBUG skeleton->extract(0, skeleton->length(), result, "UTF-8"); sprintf(mesg, "available skeletons: skeleton: %s; \n", result); @@ -606,7 +608,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton, for ( i = 0; i < fieldLength; ++i ) { skeletonFieldWidth[i] = 0; } - parseSkeleton(*skeleton, skeletonFieldWidth); + parseSkeleton(*newSkeleton, skeletonFieldWidth); // calculate distance int32_t distance = 0; int8_t fieldDifference = 1; @@ -632,7 +634,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton, } } if ( distance < bestDistance ) { - bestSkeleton = skeleton; + bestSkeleton = newSkeleton; bestDistance = distance; bestMatchDistanceInfo = fieldDifference; }