.
@@ -977,18 +977,18 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
//-------------------------------------------------------------------------
// The Moon
//-------------------------------------------------------------------------
-
+
#define moonL0 (318.351648 * CalendarAstronomer::PI/180 ) // Mean long. at epoch
#define moonP0 ( 36.340410 * CalendarAstronomer::PI/180 ) // Mean long. of perigee
#define moonN0 ( 318.510107 * CalendarAstronomer::PI/180 ) // Mean long. of node
#define moonI ( 5.145366 * CalendarAstronomer::PI/180 ) // Inclination of orbit
#define moonE ( 0.054900 ) // Eccentricity of orbit
-
+
// These aren't used right now
#define moonA ( 3.84401e5 ) // semi-major axis (km)
#define moonT0 ( 0.5181 * CalendarAstronomer::PI/180 ) // Angular size at distance A
#define moonPi ( 0.9507 * CalendarAstronomer::PI/180 ) // Parallax at distance A
-
+
/**
* The position of the moon at the time set on this
* object, in equatorial coordinates.
@@ -1005,18 +1005,18 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
// Calculate the solar longitude. Has the side effect of
// filling in "meanAnomalySun" as well.
getSunLongitude();
-
+
//
// Find the # of days since the epoch of our orbital parameters.
// TODO: Convert the time of day portion into ephemeris time
//
double day = getJulianDay() - JD_EPOCH; // Days since epoch
-
+
// Calculate the mean longitude and anomaly of the moon, based on
// a circular orbit. Similar to the corresponding solar calculation.
double meanLongitude = norm2PI(13.1763966*PI/180*day + moonL0);
meanAnomalyMoon = norm2PI(meanLongitude - 0.1114041*PI/180 * day - moonP0);
-
+
//
// Calculate the following corrections:
// Evection: the sun's gravity affects the moon's eccentricity
@@ -1029,7 +1029,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
double a3 = 0.3700*PI/180 * ::sin(meanAnomalySun);
meanAnomalyMoon += evection - annual - a3;
-
+
//
// More correction factors:
// center equation of the center correction
@@ -1039,7 +1039,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
//
double center = 6.2886*PI/180 * ::sin(meanAnomalyMoon);
double a4 = 0.2140*PI/180 * ::sin(2 * meanAnomalyMoon);
-
+
// Now find the moon's corrected longitude
moonLongitude = meanLongitude + evection + center - annual + a4;
@@ -1049,9 +1049,9 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
// the earth the moon is on
//
double variation = 0.6583*CalendarAstronomer::PI/180 * ::sin(2*(moonLongitude - sunLongitude));
-
+
moonLongitude += variation;
-
+
//
// What we've calculated so far is the moon's longitude in the plane
// of its own orbit. Now map to the ecliptic to get the latitude
@@ -1065,7 +1065,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
double y = ::sin(moonLongitude - nodeLongitude);
double x = cos(moonLongitude - nodeLongitude);
-
+
moonEclipLong = ::atan2(y*cos(moonI), x) + nodeLongitude;
double moonEclipLat = ::asin(y * ::sin(moonI));
@@ -1074,7 +1074,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
}
return moonPosition;
}
-
+
/**
* The "age" of the moon at the time specified in this object.
* This is really the angle between the
@@ -1093,10 +1093,10 @@ double CalendarAstronomer::getMoonAge() {
// some the intermediate results cached during that calculation.
//
getMoonPosition();
-
+
return norm2PI(moonEclipLong - sunLongitude);
}
-
+
/**
* Calculate the phase of the moon at the time set in this object.
* The returned phase is a double
in the range
@@ -1117,7 +1117,7 @@ double CalendarAstronomer::getMoonPhase() {
// by Peter Duffet-Smith, for details on the algorithm.
return 0.5 * (1 - cos(getMoonAge()));
}
-
+
/**
* Constant representing a new moon.
* For use with {@link #getMoonTime getMoonTime}
@@ -1137,7 +1137,7 @@ const CalendarAstronomer::MoonAge CalendarAstronomer::NEW_MOON() {
const CalendarAstronomer::MoonAge CalendarAstronomer::FIRST_QUARTER() {
return CalendarAstronomer::MoonAge(CalendarAstronomer::PI/2);
}
-
+
/**
* Constant representing a full moon.
* For use with {@link #getMoonTime getMoonTime}
@@ -1165,11 +1165,11 @@ const CalendarAstronomer::MoonAge CalendarAstronomer::LAST_QUARTER() {
/**
* Find the next or previous time at which the Moon's ecliptic
- * longitude will have the desired value.
+ * longitude will have the desired value.
*
* @param desired The desired longitude.
* @param next true if the next occurrance of the phase
- * is desired, false for the previous occurrance.
+ * is desired, false for the previous occurrance.
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
@@ -1182,26 +1182,26 @@ UDate CalendarAstronomer::getMoonTime(double desired, UBool next)
MINUTE_MS,
next);
}
-
+
/**
* Find the next or previous time at which the moon will be in the
* desired phase.
*
* @param desired The desired phase of the moon.
* @param next true if the next occurrance of the phase
- * is desired, false for the previous occurrance.
+ * is desired, false for the previous occurrance.
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
UDate CalendarAstronomer::getMoonTime(const CalendarAstronomer::MoonAge& desired, UBool next) {
return getMoonTime(desired.value, next);
}
-
+
class MoonRiseSetCoordFunc : public CalendarAstronomer::CoordFunc {
public:
virtual void eval(CalendarAstronomer::Equatorial& result, CalendarAstronomer&a) { result = a.getMoonPosition(); }
};
-
+
/**
* Returns the time (GMT) of sunrise or sunset on the local date to which
* this calendar is currently set.
@@ -1221,23 +1221,23 @@ UDate CalendarAstronomer::getMoonRiseSet(UBool rise)
//-------------------------------------------------------------------------
// Interpolation methods for finding the time at which a given event occurs
//-------------------------------------------------------------------------
-
+
UDate CalendarAstronomer::timeOfAngle(AngleFunc& func, double desired,
double periodDays, double epsilon, UBool next)
{
// Find the value of the function at the current time
double lastAngle = func.eval(*this);
-
+
// Find out how far we are from the desired angle
double deltaAngle = norm2PI(desired - lastAngle) ;
-
+
// Using the average period, estimate the next (or previous) time at
// which the desired angle occurs.
double deltaT = (deltaAngle + (next ? 0.0 : - CalendarAstronomer_PI2 )) * (periodDays*DAY_MS) / CalendarAstronomer_PI2;
-
+
double lastDeltaT = deltaT; // Liu
UDate startTime = fTime; // Liu
-
+
setTime(fTime + uprv_ceil(deltaT));
// Now iterate until we get the error below epsilon. Throughout
@@ -1252,17 +1252,17 @@ UDate CalendarAstronomer::timeOfAngle(AngleFunc& func, double desired,
// Correct the time estimate based on how far off the angle is
deltaT = normPI(desired - angle) * factor;
-
+
// HACK:
- //
+ //
// If abs(deltaT) begins to diverge we need to quit this loop.
// This only appears to happen when attempting to locate, for
// example, a new moon on the day of the new moon. E.g.:
- //
+ //
// This result is correct:
// newMoon(7508(Mon Jul 23 00:00:00 CST 1990,false))=
// Sun Jul 22 10:57:41 CST 1990
- //
+ //
// But attempting to make the same call a day earlier causes deltaT
// to diverge:
// CalendarAstronomer.timeOfAngle() diverging: 1.348508727575625E9 ->
@@ -1286,19 +1286,19 @@ UDate CalendarAstronomer::timeOfAngle(AngleFunc& func, double desired,
setTime(fTime + uprv_ceil(deltaT));
}
while (uprv_fabs(deltaT) > epsilon);
-
+
return fTime;
}
-
+
UDate CalendarAstronomer::riseOrSet(CoordFunc& func, UBool rise,
- double diameter, double refraction,
+ double diameter, double refraction,
double epsilon)
-{
+{
Equatorial pos;
double tanL = ::tan(fLatitude);
double deltaT = 0;
int32_t count = 0;
-
+
//
// Calculate the object's position at the current time, then use that
// position to calculate the time of rising or setting. The position
@@ -1311,10 +1311,10 @@ UDate CalendarAstronomer::riseOrSet(CoordFunc& func, UBool rise,
func.eval(pos, *this);
double angle = ::acos(-tanL * ::tan(pos.declination));
double lst = ((rise ? CalendarAstronomer_PI2-angle : angle) + pos.ascension ) * 24 / CalendarAstronomer_PI2;
-
+
// Convert from LST to Universal Time.
UDate newTime = lstToUT( lst );
-
+
deltaT = newTime - fTime;
setTime(newTime);
U_DEBUG_ASTRO_MSG(("%d] dT=%.3lf, angle=%.3lf, lst=%.3lf, A=%.3lf/D=%.3lf\n",
@@ -1328,10 +1328,10 @@ UDate CalendarAstronomer::riseOrSet(CoordFunc& func, UBool rise,
double x = diameter / 2 + refraction;
double y = ::asin(sin(x) / ::sin(psi));
long delta = (long)((240 * y * RAD_DEG / cosD)*SECOND_MS);
-
+
return fTime + (rise ? -delta : delta);
}
-
+
/**
* Find the "true anomaly" (longitude) of an object from
* its mean anomaly and the eccentricity of its orbit. This uses
@@ -1339,7 +1339,7 @@ UDate CalendarAstronomer::riseOrSet(CoordFunc& func, UBool rise,
*
* @param meanAnomaly The object's longitude calculated as if it were in
* a regular, circular orbit, measured in radians
- * from the point of perigee.
+ * from the point of perigee.
*
* @param eccentricity The eccentricity of the orbit
*
@@ -1354,13 +1354,13 @@ double CalendarAstronomer::trueAnomaly(double meanAnomaly, double eccentricity)
do {
delta = E - eccentricity * ::sin(E) - meanAnomaly;
E = E - delta / (1 - eccentricity * ::cos(E));
- }
+ }
while (uprv_fabs(delta) > 1e-5); // epsilon = 1e-5 rad
return 2.0 * ::atan( ::tan(E/2) * ::sqrt( (1+eccentricity)
/(1-eccentricity) ) );
}
-
+
/**
* Return the obliquity of the ecliptic (the angle between the ecliptic
* and the earth's equator) at the current time. This varies due to
@@ -1374,18 +1374,18 @@ double CalendarAstronomer::eclipticObliquity() {
const double epoch = 2451545.0; // 2000 AD, January 1.5
double T = (getJulianDay() - epoch) / 36525;
-
+
eclipObliquity = 23.439292
- 46.815/3600 * T
- 0.0006/3600 * T*T
+ 0.00181/3600 * T*T*T;
-
+
eclipObliquity *= DEG_RAD;
}
return eclipObliquity;
}
-
-
+
+
//-------------------------------------------------------------------------
// Private data
//-------------------------------------------------------------------------
@@ -1404,15 +1404,15 @@ void CalendarAstronomer::clearCache() {
siderealT0 = INVALID;
moonPositionSet = FALSE;
}
-
+
//private static void out(String s) {
// System.out.println(s);
//}
-
+
//private static String deg(double rad) {
// return Double.toString(rad * RAD_DEG);
//}
-
+
//private static String hours(long ms) {
// return Double.toString((double)ms / HOUR_MS) + " hours";
//}
@@ -1433,7 +1433,7 @@ UDate CalendarAstronomer::local(UDate localMillis) {
}
// Debugging functions
-UnicodeString CalendarAstronomer::Ecliptic::toString() const
+UnicodeString CalendarAstronomer::Ecliptic::toString() const
{
#ifdef U_DEBUG_ASTRO
char tmp[800];
@@ -1444,11 +1444,11 @@ UnicodeString CalendarAstronomer::Ecliptic::toString() const
#endif
}
-UnicodeString CalendarAstronomer::Equatorial::toString() const
+UnicodeString CalendarAstronomer::Equatorial::toString() const
{
#ifdef U_DEBUG_ASTRO
char tmp[400];
- sprintf(tmp, "%f,%f",
+ sprintf(tmp, "%f,%f",
(ascension*RAD_DEG), (declination*RAD_DEG));
return UnicodeString(tmp, "");
#else
@@ -1456,7 +1456,7 @@ UnicodeString CalendarAstronomer::Equatorial::toString() const
#endif
}
-UnicodeString CalendarAstronomer::Horizon::toString() const
+UnicodeString CalendarAstronomer::Horizon::toString() const
{
#ifdef U_DEBUG_ASTRO
char tmp[800];
@@ -1472,15 +1472,15 @@ UnicodeString CalendarAstronomer::Horizon::toString() const
// int hrs = (int) (angle*RAD_HOUR);
// int min = (int)((angle*RAD_HOUR - hrs) * 60);
// int sec = (int)((angle*RAD_HOUR - hrs - min/60.0) * 3600);
-
+
// return Integer.toString(hrs) + "h" + min + "m" + sec + "s";
// }
-
+
// static private String radToDms(double angle) {
// int deg = (int) (angle*RAD_DEG);
// int min = (int)((angle*RAD_DEG - deg) * 60);
// int sec = (int)((angle*RAD_DEG - deg - min/60.0) * 3600);
-
+
// return Integer.toString(deg) + "\u00b0" + min + "'" + sec + "\"";
// }
diff --git a/icu4c/source/i18n/calendar.cpp b/icu4c/source/i18n/calendar.cpp
index 377c54c801..f323ef6e99 100644
--- a/icu4c/source/i18n/calendar.cpp
+++ b/icu4c/source/i18n/calendar.cpp
@@ -315,18 +315,18 @@ public:
}
virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* /*actualID*/, UErrorCode& status) const {
- LocaleKey& lkey = (LocaleKey&)key;
- //int32_t kind = lkey.kind();
+ LocaleKey& lkey = (LocaleKey&)key;
+ //int32_t kind = lkey.kind();
- Locale loc;
- lkey.canonicalLocale(loc);
+ Locale loc;
+ lkey.canonicalLocale(loc);
#ifdef U_DEBUG_CALSVC
Locale loc2;
lkey.currentLocale(loc2);
fprintf(stderr, "CalSvc:handleDefault for currentLoc %s, canloc %s\n", (const char*)loc.getName(), (const char*)loc2.getName());
#endif
- Calendar *nc = new GregorianCalendar(loc, status);
+ Calendar *nc = new GregorianCalendar(loc, status);
#ifdef U_DEBUG_CALSVC
UErrorCode status2 = U_ZERO_ERROR;
@@ -2895,7 +2895,7 @@ void Calendar::prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErr
}
break;
default:
- ;
+ ;
}
// Do this last to give it the newest time stamp
diff --git a/icu4c/source/i18n/decimfmt.cpp b/icu4c/source/i18n/decimfmt.cpp
index 07c95da937..fcbf2243da 100644
--- a/icu4c/source/i18n/decimfmt.cpp
+++ b/icu4c/source/i18n/decimfmt.cpp
@@ -626,7 +626,7 @@ DecimalFormat::format(int32_t number,
UnicodeString& appendTo,
FieldPosition& fieldPosition) const
{
- return format((int64_t)number, appendTo, fieldPosition);
+ return format((int64_t)number, appendTo, fieldPosition);
}
//------------------------------------------------------------------------------
@@ -983,14 +983,14 @@ DecimalFormat::subformat(UnicodeString& appendTo,
DigitList expDigits;
expDigits.set(exponent);
- {
+ {
int expDig = fMinExponentDigits;
if (fUseExponentialNotation && expDig < 1) {
expDig = 1;
}
for (i=expDigits.fDecimalAt; i %d/%d/%d not %d/%d/%d\n",
// __FILE__, __LINE__,julianDay,
-// eyear,month,dayOfMonth,
-// getGregorianYear(), getGregorianMonth(), getGregorianDayOfMonth() );
+// eyear,month,dayOfMonth,
+// getGregorianYear(), getGregorianMonth(), getGregorianDayOfMonth() );
fprintf(stderr, "%s:%d: doy %d (greg's %d)- [cut=%d]\n",
__FILE__, __LINE__, dayOfYear, getGregorianDayOfYear(), fCutoverJulianDay);
#endif
@@ -1194,8 +1194,8 @@ int32_t GregorianCalendar::handleGetExtendedYear() {
#endif
break;
- default:
- year = kEpochYear;
+ default:
+ year = kEpochYear;
}
return year;
}
diff --git a/icu4c/source/i18n/msgfmt.cpp b/icu4c/source/i18n/msgfmt.cpp
index d9800d1899..5e639b282c 100644
--- a/icu4c/source/i18n/msgfmt.cpp
+++ b/icu4c/source/i18n/msgfmt.cpp
@@ -1175,9 +1175,9 @@ static Format* makeRBNF(URBNFRuleSetTag tag, const Locale& locale, const Unicode
RuleBasedNumberFormat* fmt = new RuleBasedNumberFormat(tag, locale, ec);
if (U_SUCCESS(ec) && defaultRuleSet.length() > 0) {
fmt->setDefaultRuleSet(defaultRuleSet, ec);
- if (U_FAILURE(ec)) { // ignore unrecognized default rule set
- ec = U_ZERO_ERROR;
- }
+ if (U_FAILURE(ec)) { // ignore unrecognized default rule set
+ ec = U_ZERO_ERROR;
+ }
}
return fmt;
}
diff --git a/icu4c/source/i18n/nfrs.cpp b/icu4c/source/i18n/nfrs.cpp
index dc619762a1..a066614f04 100644
--- a/icu4c/source/i18n/nfrs.cpp
+++ b/icu4c/source/i18n/nfrs.cpp
@@ -135,7 +135,7 @@ NFRuleSet::NFRuleSet(UnicodeString* descriptions, int32_t index, UErrorCode& sta
if (description.length() == 0) {
// throw new IllegalArgumentException("Empty rule set description");
status = U_PARSE_ERROR;
- return;
+ return;
}
// if the description begins with a rule set name (the rule set
diff --git a/icu4c/source/i18n/numfmt.cpp b/icu4c/source/i18n/numfmt.cpp
index 21789ea1e0..59a548be8e 100644
--- a/icu4c/source/i18n/numfmt.cpp
+++ b/icu4c/source/i18n/numfmt.cpp
@@ -281,8 +281,8 @@ NumberFormat::format(int64_t number,
UnicodeString& appendTo,
FieldPosition& pos) const
{
- // default so we don't introduce a new abstract method
- return format((int32_t)number, appendTo, pos);
+ // default so we don't introduce a new abstract method
+ return format((int32_t)number, appendTo, pos);
}
// -------------------------------------
diff --git a/icu4c/source/i18n/quant.cpp b/icu4c/source/i18n/quant.cpp
index 8b164adb46..9a5606da04 100644
--- a/icu4c/source/i18n/quant.cpp
+++ b/icu4c/source/i18n/quant.cpp
@@ -126,7 +126,7 @@ UBool Quantifier::matchesIndexValue(uint8_t v) const {
*/
void Quantifier::addMatchSetTo(UnicodeSet& toUnionTo) const {
if (maxCount > 0) {
- matcher->toMatcher()->addMatchSetTo(toUnionTo);
+ matcher->toMatcher()->addMatchSetTo(toUnionTo);
}
}
diff --git a/icu4c/source/i18n/rbnf.cpp b/icu4c/source/i18n/rbnf.cpp
index 9c6ca87582..cee6d44ffa 100644
--- a/icu4c/source/i18n/rbnf.cpp
+++ b/icu4c/source/i18n/rbnf.cpp
@@ -677,8 +677,8 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
}
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
- UParseError& perror,
- UErrorCode& status)
+ UParseError& perror,
+ UErrorCode& status)
: ruleSets(NULL)
, defaultRuleSet(NULL)
, locale(Locale::getDefault())
@@ -692,9 +692,9 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
}
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
- const Locale& aLocale,
- UParseError& perror,
- UErrorCode& status)
+ const Locale& aLocale,
+ UParseError& perror,
+ UErrorCode& status)
: ruleSets(NULL)
, defaultRuleSet(NULL)
, locale(aLocale)
diff --git a/icu4c/source/i18n/rbt_rule.cpp b/icu4c/source/i18n/rbt_rule.cpp
index a8eb124ad5..bf16248c90 100644
--- a/icu4c/source/i18n/rbt_rule.cpp
+++ b/icu4c/source/i18n/rbt_rule.cpp
@@ -529,14 +529,14 @@ void TransliterationRule::setData(const TransliterationRuleData* d) {
void TransliterationRule::addSourceSetTo(UnicodeSet& toUnionTo) const {
int32_t limit = anteContextLength + keyLength;
for (int32_t i=anteContextLength; ilookupMatcher(ch);
- if (matcher == NULL) {
- toUnionTo.add(ch);
- } else {
- matcher->addMatchSetTo(toUnionTo);
- }
+ UChar32 ch = pattern.char32At(i);
+ i += UTF_CHAR_LENGTH(ch);
+ const UnicodeMatcher* matcher = data->lookupMatcher(ch);
+ if (matcher == NULL) {
+ toUnionTo.add(ch);
+ } else {
+ matcher->addMatchSetTo(toUnionTo);
+ }
}
}
diff --git a/icu4c/source/i18n/rbt_set.cpp b/icu4c/source/i18n/rbt_set.cpp
index f16f1903b6..0999cc2177 100644
--- a/icu4c/source/i18n/rbt_set.cpp
+++ b/icu4c/source/i18n/rbt_set.cpp
@@ -434,17 +434,17 @@ UnicodeString& TransliterationRuleSet::toRules(UnicodeString& ruleSource,
* (getTarget=false) or emitted (getTarget=true) by this set.
*/
UnicodeSet& TransliterationRuleSet::getSourceTargetSet(UnicodeSet& result,
- UBool getTarget) const {
+ UBool getTarget) const {
result.clear();
int32_t count = ruleVector->size();
for (int32_t i=0; ielementAt(i);
- if (getTarget) {
- r->addTargetSetTo(result);
- } else {
- r->addSourceSetTo(result);
- }
+ TransliterationRule* r =
+ (TransliterationRule*) ruleVector->elementAt(i);
+ if (getTarget) {
+ r->addTargetSetTo(result);
+ } else {
+ r->addSourceSetTo(result);
+ }
}
return result;
}
diff --git a/icu4c/source/i18n/rbt_set.h b/icu4c/source/i18n/rbt_set.h
index 3a7c5d219b..45ce7c1e3e 100644
--- a/icu4c/source/i18n/rbt_set.h
+++ b/icu4c/source/i18n/rbt_set.h
@@ -149,7 +149,7 @@ public:
* (getTarget=false) or emitted (getTarget=true) by this set.
*/
UnicodeSet& getSourceTargetSet(UnicodeSet& result,
- UBool getTarget) const;
+ UBool getTarget) const;
private:
diff --git a/icu4c/source/i18n/regexst.cpp b/icu4c/source/i18n/regexst.cpp
index 8b9081eb85..e874f2ad55 100644
--- a/icu4c/source/i18n/regexst.cpp
+++ b/icu4c/source/i18n/regexst.cpp
@@ -114,8 +114,8 @@ static const UChar gIsWordPattern[] = {
0x5b, 0x3a, 0x43, 0x63, 0x3a, 0x5d, 0x5b, 0x3a, 0x43, 0x66, 0x3a, 0x5d, 0x2d,
// [ : G r a p h e m e _
0x5b, 0x3a, 0x47, 0x72, 0x61, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x5f,
-// E x t e n d : ] ]
- 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x3a, 0x5d, 0x5d, 0};
+// E x t e n d : ] ]
+ 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x3a, 0x5d, 0x5d, 0};
static const UChar gGC_ExtendPattern[] = {
// [ \ p { G r a p h e m e _
diff --git a/icu4c/source/i18n/search.cpp b/icu4c/source/i18n/search.cpp
index fca18fe77d..c190e94b10 100644
--- a/icu4c/source/i18n/search.cpp
+++ b/icu4c/source/i18n/search.cpp
@@ -235,14 +235,14 @@ int32_t SearchIterator::next(UErrorCode &status)
}
if (matchlength > 0) {
- // if matchlength is 0 we are at the start of the iteration
- if (m_search_->isOverlap) {
- offset ++;
- }
- else {
- offset += matchlength;
- }
- }
+ // if matchlength is 0 we are at the start of the iteration
+ if (m_search_->isOverlap) {
+ offset ++;
+ }
+ else {
+ offset += matchlength;
+ }
+ }
return handleNext(offset, status);
}
return USEARCH_DONE;
diff --git a/icu4c/source/i18n/strrepl.cpp b/icu4c/source/i18n/strrepl.cpp
index 03237ce2d3..4ae12b05c2 100644
--- a/icu4c/source/i18n/strrepl.cpp
+++ b/icu4c/source/i18n/strrepl.cpp
@@ -295,13 +295,13 @@ UnicodeString& StringReplacer::toReplacerPattern(UnicodeString& rule,
void StringReplacer::addReplacementSetTo(UnicodeSet& toUnionTo) const {
UChar32 ch;
for (int32_t i=0; ilookupReplacer(ch);
- if (r == NULL) {
- toUnionTo.add(ch);
- } else {
- r->addReplacementSetTo(toUnionTo);
- }
+ ch = output.char32At(i);
+ UnicodeReplacer* r = data->lookupReplacer(ch);
+ if (r == NULL) {
+ toUnionTo.add(ch);
+ } else {
+ r->addReplacementSetTo(toUnionTo);
+ }
}
}
diff --git a/icu4c/source/i18n/stsearch.cpp b/icu4c/source/i18n/stsearch.cpp
index b73d9afac4..0b2b08c9d2 100644
--- a/icu4c/source/i18n/stsearch.cpp
+++ b/icu4c/source/i18n/stsearch.cpp
@@ -42,15 +42,15 @@ StringSearch::StringSearch(const UnicodeString &pattern,
uprv_free(m_search_);
m_search_ = NULL;
- // !!! dlf m_collator_ is an odd beast. basically it is an aliasing
- // wrapper around the internal collator and rules, which (here) are
- // owned by this stringsearch object. this means 1) it's destructor
- // _should not_ delete the ucollator or rules, and 2) changes made
- // to the exposed collator (setStrength etc) _should_ modify the
- // ucollator. thus the collator is not a copy-on-write alias, and it
- // needs to distinguish itself not merely from 'stand alone' colators
- // but also from copy-on-write ones. it needs additional state, which
- // setUCollator should set.
+ // !!! dlf m_collator_ is an odd beast. basically it is an aliasing
+ // wrapper around the internal collator and rules, which (here) are
+ // owned by this stringsearch object. this means 1) it's destructor
+ // _should not_ delete the ucollator or rules, and 2) changes made
+ // to the exposed collator (setStrength etc) _should_ modify the
+ // ucollator. thus the collator is not a copy-on-write alias, and it
+ // needs to distinguish itself not merely from 'stand alone' colators
+ // but also from copy-on-write ones. it needs additional state, which
+ // setUCollator should set.
if (U_SUCCESS(status)) {
int32_t length;
@@ -365,7 +365,7 @@ int32_t StringSearch::handleNext(int32_t position, UErrorCode &status)
// StringSearch instead of SearchIterator because m_strsrch_ is
// not accessible in SearchIterator
if (position + m_strsrch_->pattern.defaultShiftSize
- > m_search_->textLength) {
+ > m_search_->textLength) {
setMatchNotFound();
return USEARCH_DONE;
}
@@ -379,7 +379,7 @@ int32_t StringSearch::handleNext(int32_t position, UErrorCode &status)
m_search_->matchedIndex = position - 1;
}
- ucol_setOffset(m_strsrch_->textIter, position, &status);
+ ucol_setOffset(m_strsrch_->textIter, position, &status);
while (TRUE) {
if (m_search_->isCanonicalMatch) {
// can't use exact here since extra accents are allowed.
diff --git a/icu4c/source/i18n/ucol.cpp b/icu4c/source/i18n/ucol.cpp
index c428c3fa1a..acc2591d46 100644
--- a/icu4c/source/i18n/ucol.cpp
+++ b/icu4c/source/i18n/ucol.cpp
@@ -350,7 +350,7 @@ tryOpeningFromRules(UResourceBundle *collElem, UErrorCode *status) {
U_CAPI UCollator*
ucol_open(const char *loc,
- UErrorCode *status)
+ UErrorCode *status)
{
UTRACE_ENTRY_OC(UTRACE_UCOL_OPEN);
UTRACE_DATA1(UTRACE_INFO, "locale = \"%s\"", loc);
@@ -372,7 +372,7 @@ ucol_open(const char *loc,
U_CFUNC UCollator*
ucol_open_internal(const char *loc,
- UErrorCode *status)
+ UErrorCode *status)
{
const UCollator* UCA = ucol_initUCA(status);
@@ -477,12 +477,12 @@ clean:
result->requestedLocale = (char *)uprv_malloc((uprv_strlen(loc)+1)*sizeof(char));
/* test for NULL */
if (result->requestedLocale == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- ures_close(b); // ??? appears needed
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ ures_close(b); // ??? appears needed
ures_close(collElem);
ures_close(collations);
ures_close(binary); // ??? appears needed
- return NULL;
+ return NULL;
}
uprv_strcpy(result->requestedLocale, loc);
@@ -498,11 +498,11 @@ ucol_setReqValidLocales(UCollator *coll, char *requestedLocaleToAdopt, char *val
if (coll) {
if (coll->validLocale) {
uprv_free(coll->validLocale);
- }
+ }
coll->validLocale = validLocaleToAdopt;
if (coll->requestedLocale) { // should always have
uprv_free(coll->requestedLocale);
- }
+ }
coll->requestedLocale = requestedLocaleToAdopt;
}
}
@@ -997,7 +997,7 @@ UCollator* ucol_initCollator(const UCATableHeader *image, UCollator *fillIn, con
*/
/**
- * Function used to:
+ * Function used to:
* a) collapse the 2 different Han ranges from UCA into one (in the right order), and
* b) bump any non-CJK characters by 10FFFF.
* The relevant blocks are:
@@ -1056,24 +1056,24 @@ static const UChar32
CJK_B_LIMIT = 0x2A6DF+1;
static UChar32 swapCJK(UChar32 i) {
-
+
if (i >= CJK_BASE) {
if (i < CJK_LIMIT) return i - CJK_BASE;
-
+
if (i < CJK_COMPAT_USED_BASE) return i + NON_CJK_OFFSET;
-
+
if (i < CJK_COMPAT_USED_LIMIT) return i - CJK_COMPAT_USED_BASE
+ (CJK_LIMIT - CJK_BASE);
if (i < CJK_B_BASE) return i + NON_CJK_OFFSET;
-
+
if (i < CJK_B_LIMIT) return i; // non-BMP-CJK
-
+
return i + NON_CJK_OFFSET; // non-CJK
}
if (i < CJK_A_BASE) return i + NON_CJK_OFFSET;
-
+
if (i < CJK_A_LIMIT) return i - CJK_A_BASE
- + (CJK_LIMIT - CJK_BASE)
+ + (CJK_LIMIT - CJK_BASE)
+ (CJK_COMPAT_USED_LIMIT - CJK_COMPAT_USED_BASE);
return i + NON_CJK_OFFSET; // non-CJK
}
@@ -1118,37 +1118,37 @@ uprv_uca_getImplicitFromRaw(UChar32 cp) {
if (last0 < 0) {
int32_t last1 = cp / final3Count;
last0 = cp % final3Count;
-
+
int32_t last2 = last1 / medialCount;
last1 %= medialCount;
-
+
last0 = minTrail + last0*final3Multiplier; // spread out, leaving gap at start
last1 = minTrail + last1; // offset
last2 = min3Primary + last2; // offset
/*
if (last2 >= min4Primary) {
throw new IllegalArgumentException("4-byte out of range: " + Utility.hex(cp) + ", " + Utility.hex(last2));
- }
+ }
*/
return (last2 << 24) + (last1 << 16) + (last0 << 8);
} else {
int32_t last1 = last0 / final4Count;
last0 %= final4Count;
-
+
int32_t last2 = last1 / medialCount;
last1 %= medialCount;
-
+
int32_t last3 = last2 / medialCount;
last2 %= medialCount;
-
- last0 = minTrail + last0*final4Multiplier; // spread out, leaving gap at start
+
+ last0 = minTrail + last0*final4Multiplier; // spread out, leaving gap at start
last1 = minTrail + last1; // offset
last2 = minTrail + last2; // offset
last3 = min4Primary + last3; // offset
/*
if (last3 > max4Primary) {
throw new IllegalArgumentException("4-byte out of range: " + Utility.hex(cp) + ", " + Utility.hex(last3));
- }
+ }
*/
return (last3 << 24) + (last2 << 16) + (last1 << 8) + last0;
}
@@ -1157,13 +1157,13 @@ uprv_uca_getImplicitFromRaw(UChar32 cp) {
U_CAPI uint32_t U_EXPORT2
uprv_uca_getImplicitPrimary(UChar32 cp) {
//if (DEBUG) System.out.println("Incoming: " + Utility.hex(cp));
-
+
cp = swapCJK(cp);
cp++;
// we now have a range of numbers from 0 to 21FFFF.
-
+
//if (DEBUG) System.out.println("CJK swapped: " + Utility.hex(cp));
-
+
return uprv_uca_getImplicitFromRaw(cp);
}
@@ -1232,27 +1232,27 @@ static inline int32_t divideAndRoundUp(int a, int b) {
* @param gap3 the gap we leave for tailoring for 3-byte forms
* @param gap4 the gap we leave for tailoring for 4-byte forms
*/
-static void initImplicitConstants(int minPrimary, int maxPrimary,
- int minTrailIn, int maxTrailIn,
+static void initImplicitConstants(int minPrimary, int maxPrimary,
+ int minTrailIn, int maxTrailIn,
int gap3, int primaries3count,
UErrorCode *status) {
// some simple parameter checks
- if (minPrimary < 0 || minPrimary >= maxPrimary || maxPrimary > 0xFF) {
+ if (minPrimary < 0 || minPrimary >= maxPrimary || maxPrimary > 0xFF) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return;
};
- if (minTrailIn < 0 || minTrailIn >= maxTrailIn || maxTrailIn > 0xFF) {
+ if (minTrailIn < 0 || minTrailIn >= maxTrailIn || maxTrailIn > 0xFF) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return;
};
- if (primaries3count < 1) {
+ if (primaries3count < 1) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return;
};
minTrail = minTrailIn;
maxTrail = maxTrailIn;
-
+
min3Primary = minPrimary;
max4Primary = maxPrimary;
// compute constants for use later.
@@ -1264,7 +1264,7 @@ static void initImplicitConstants(int minPrimary, int maxPrimary,
final3Multiplier = gap3 + 1;
final3Count = (maxTrail - minTrail + 1) / final3Multiplier;
max3Trail = minTrail + (final3Count - 1) * final3Multiplier;
-
+
// medials can use full range
medialCount = (maxTrail - minTrail + 1);
// find out how many values fit in each form
@@ -1273,8 +1273,8 @@ static void initImplicitConstants(int minPrimary, int maxPrimary,
// we use 3 bytes below the boundary, and 4 above
int32_t primariesAvailable = maxPrimary - minPrimary + 1;
int32_t primaries4count = primariesAvailable - primaries3count;
-
-
+
+
int32_t min3ByteCoverage = primaries3count * threeByteCount;
min4Primary = minPrimary + primaries3count;
min4Boundary = min3ByteCoverage;
@@ -1304,7 +1304,7 @@ static void initImplicitConstants(int minPrimary, int maxPrimary,
}
*/
}
-
+
/**
* Supply parameters for generating implicit CEs
*/
@@ -1362,10 +1362,10 @@ ucol_initUCA(UErrorCode *status) {
newUCA = ucol_initCollator((const UCATableHeader *)udata_getMemory(result), newUCA, newUCA, status);
if(U_SUCCESS(*status)){
newUCA->rb = NULL;
- newUCA->elements = NULL;
- newUCA->validLocale = NULL;
- newUCA->requestedLocale = NULL;
- newUCA->hasRealData = FALSE; // real data lives in .dat file...
+ newUCA->elements = NULL;
+ newUCA->validLocale = NULL;
+ newUCA->requestedLocale = NULL;
+ newUCA->hasRealData = FALSE; // real data lives in .dat file...
newUCA->freeImageOnClose = FALSE;
umtx_lock(NULL);
if(_staticUCA == NULL) {
@@ -3279,7 +3279,7 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
case DIGIT_TAG:
{
/*
- We do a check to see if we want to collate digits as numbers; if so we generate
+ We do a check to see if we want to collate digits as numbers; if so we generate
a custom collation key. Otherwise we pull out the value stored in the expansion table.
*/
uint32_t size;
@@ -3287,217 +3287,217 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
collIterateState digitState;
if (source->coll->numericCollation == UCOL_ON){
- UChar32 char32 = 0;
+ UChar32 char32 = 0;
- uint32_t digIndx = 0;
- uint32_t endIndex = 0;
- uint32_t trailingZeroIndex = 0;
+ uint32_t digIndx = 0;
+ uint32_t endIndex = 0;
+ uint32_t trailingZeroIndex = 0;
- uint32_t primWeight = 0;
+ uint32_t primWeight = 0;
- int32_t digVal = 0;
- uint8_t collateVal = 0;
+ int32_t digVal = 0;
+ uint8_t collateVal = 0;
- UBool nonZeroValReached = FALSE;
+ UBool nonZeroValReached = FALSE;
- uint8_t *numTempBuf;
- uint8_t stackNumTempBuf[UCOL_MAX_BUFFER]; // I just need a temporary place to store my generated CEs.
- uint32_t numTempBufSize = UCOL_MAX_BUFFER;
+ uint8_t *numTempBuf;
+ uint8_t stackNumTempBuf[UCOL_MAX_BUFFER]; // I just need a temporary place to store my generated CEs.
+ uint32_t numTempBufSize = UCOL_MAX_BUFFER;
- numTempBuf = stackNumTempBuf;
- /*
- We parse the source string until we hit a char that's NOT a digit.
- Use this u_charDigitValue. This might be slow because we have to
- handle surrogates...
- */
+ numTempBuf = stackNumTempBuf;
+ /*
+ We parse the source string until we hit a char that's NOT a digit.
+ Use this u_charDigitValue. This might be slow because we have to
+ handle surrogates...
+ */
/*
- if (U16_IS_LEAD(ch)){
+ if (U16_IS_LEAD(ch)){
if (!collIter_eos(source)) {
backupState(source, &digitState);
UChar trail = getNextNormalizedChar(source);
if(U16_IS_TRAIL(trail)) {
- char32 = U16_GET_SUPPLEMENTARY(ch, trail);
+ char32 = U16_GET_SUPPLEMENTARY(ch, trail);
} else {
loadState(source, &digitState, TRUE);
char32 = ch;
}
} else {
- char32 = ch;
+ char32 = ch;
}
} else {
- char32 = ch;
+ char32 = ch;
}
- digVal = u_charDigitValue(char32);
+ digVal = u_charDigitValue(char32);
*/
digVal = u_charDigitValue(cp); // if we have arrived here, we have
// already processed possible supplementaries that trigered the digit tag -
// all supplementaries are marked in the UCA.
- /*
- We pad a zero in front of the first element anyways. This takes
- care of the (probably) most common case where people are sorting things followed
- by a single digit
- */
- digIndx++;
- for(;;){
- // Make sure we have enough space.
- if (digIndx >= ((numTempBufSize - 2) * 2) + 1)
- {
- numTempBufSize *= 2;
- if (numTempBuf == stackNumTempBuf){
- numTempBuf = (uint8_t *)uprv_malloc(sizeof(uint8_t) * numTempBufSize);
- uprv_memcpy(numTempBuf, stackNumTempBuf, UCOL_MAX_BUFFER);
- }else
- uprv_realloc(numTempBuf, numTempBufSize);
- }
+ /*
+ We pad a zero in front of the first element anyways. This takes
+ care of the (probably) most common case where people are sorting things followed
+ by a single digit
+ */
+ digIndx++;
+ for(;;){
+ // Make sure we have enough space.
+ if (digIndx >= ((numTempBufSize - 2) * 2) + 1)
+ {
+ numTempBufSize *= 2;
+ if (numTempBuf == stackNumTempBuf){
+ numTempBuf = (uint8_t *)uprv_malloc(sizeof(uint8_t) * numTempBufSize);
+ uprv_memcpy(numTempBuf, stackNumTempBuf, UCOL_MAX_BUFFER);
+ }else
+ uprv_realloc(numTempBuf, numTempBufSize);
+ }
- // Skipping over leading zeroes.
- if (digVal != 0 || nonZeroValReached){
- if (digVal != 0 && !nonZeroValReached)
- nonZeroValReached = TRUE;
+ // Skipping over leading zeroes.
+ if (digVal != 0 || nonZeroValReached){
+ if (digVal != 0 && !nonZeroValReached)
+ nonZeroValReached = TRUE;
- /*
- We parse the digit string into base 100 numbers (this fits into a byte).
- We only add to the buffer in twos, thus if we are parsing an odd character,
- that serves as the 'tens' digit while the if we are parsing an even one, that
- is the 'ones' digit. We dumped the parsed base 100 value (collateVal) into
- a buffer. We multiply each collateVal by 2 (to give us room) and add 5 (to avoid
- overlapping magic CE byte values). The last byte we subtract 1 to ensure it is less
- than all the other bytes.
- */
+ /*
+ We parse the digit string into base 100 numbers (this fits into a byte).
+ We only add to the buffer in twos, thus if we are parsing an odd character,
+ that serves as the 'tens' digit while the if we are parsing an even one, that
+ is the 'ones' digit. We dumped the parsed base 100 value (collateVal) into
+ a buffer. We multiply each collateVal by 2 (to give us room) and add 5 (to avoid
+ overlapping magic CE byte values). The last byte we subtract 1 to ensure it is less
+ than all the other bytes.
+ */
- if (digIndx % 2 == 1){
- collateVal += (uint8_t)digVal;
+ if (digIndx % 2 == 1){
+ collateVal += (uint8_t)digVal;
- // We don't enter the low-order-digit case unless we've already seen
- // the high order, or for the first digit, which is always non-zero.
- if (collateVal != 0)
- trailingZeroIndex = 0;
+ // We don't enter the low-order-digit case unless we've already seen
+ // the high order, or for the first digit, which is always non-zero.
+ if (collateVal != 0)
+ trailingZeroIndex = 0;
- numTempBuf[(digIndx/2) + 2] = collateVal*2 + 6;
- collateVal = 0;
- }
- else{
- // We drop the collation value into the buffer so if we need to do
- // a "front patch" we don't have to check to see if we're hitting the
- // last element.
- collateVal = (uint8_t)(digVal * 10);
+ numTempBuf[(digIndx/2) + 2] = collateVal*2 + 6;
+ collateVal = 0;
+ }
+ else{
+ // We drop the collation value into the buffer so if we need to do
+ // a "front patch" we don't have to check to see if we're hitting the
+ // last element.
+ collateVal = (uint8_t)(digVal * 10);
- // Check for trailing zeroes.
- if (collateVal == 0)
- {
- if (!trailingZeroIndex)
- trailingZeroIndex = (digIndx/2) + 2;
- }
- else
- trailingZeroIndex = 0;
+ // Check for trailing zeroes.
+ if (collateVal == 0)
+ {
+ if (!trailingZeroIndex)
+ trailingZeroIndex = (digIndx/2) + 2;
+ }
+ else
+ trailingZeroIndex = 0;
- numTempBuf[(digIndx/2) + 2] = collateVal*2 + 6;
- }
- digIndx++;
- }
+ numTempBuf[(digIndx/2) + 2] = collateVal*2 + 6;
+ }
+ digIndx++;
+ }
- // Get next character.
- if (!collIter_eos(source)){
- ch = getNextNormalizedChar(source);
- if (U16_IS_LEAD(ch)){
+ // Get next character.
+ if (!collIter_eos(source)){
+ ch = getNextNormalizedChar(source);
+ if (U16_IS_LEAD(ch)){
if (!collIter_eos(source)) {
backupState(source, &digitState);
UChar trail = getNextNormalizedChar(source);
if(U16_IS_TRAIL(trail)) {
- char32 = U16_GET_SUPPLEMENTARY(ch, trail);
+ char32 = U16_GET_SUPPLEMENTARY(ch, trail);
} else {
loadState(source, &digitState, TRUE);
char32 = ch;
}
}
} else {
- char32 = ch;
+ char32 = ch;
}
- if ((digVal = u_charDigitValue(char32)) == -1){
- // Resetting position to point to the next unprocessed char. We
- // overshot it when doing our test/set for numbers.
+ if ((digVal = u_charDigitValue(char32)) == -1){
+ // Resetting position to point to the next unprocessed char. We
+ // overshot it when doing our test/set for numbers.
if (char32 > 0xFFFF) { // For surrogates.
loadState(source, &digitState, TRUE);
- //goBackOne(source);
+ //goBackOne(source);
}
- goBackOne(source);
- break;
- }
+ goBackOne(source);
+ break;
+ }
} else {
- break;
+ break;
}
- }
+ }
- if (nonZeroValReached == FALSE){
- digIndx = 2;
- numTempBuf[2] = 6;
- }
+ if (nonZeroValReached == FALSE){
+ digIndx = 2;
+ numTempBuf[2] = 6;
+ }
- endIndex = trailingZeroIndex ? trailingZeroIndex : ((digIndx/2) + 2) ;
- if (digIndx % 2 != 0){
- /*
- We missed a value. Since digIndx isn't even, stuck too many values into the buffer (this is what
- we get for padding the first byte with a zero). "Front-patch" now by pushing all nybbles forward.
- Doing it this way ensures that at least 50% of the time (statistically speaking) we'll only be doing a
- single pass and optimizes for strings with single digits. I'm just assuming that's the more common case.
- */
+ endIndex = trailingZeroIndex ? trailingZeroIndex : ((digIndx/2) + 2) ;
+ if (digIndx % 2 != 0){
+ /*
+ We missed a value. Since digIndx isn't even, stuck too many values into the buffer (this is what
+ we get for padding the first byte with a zero). "Front-patch" now by pushing all nybbles forward.
+ Doing it this way ensures that at least 50% of the time (statistically speaking) we'll only be doing a
+ single pass and optimizes for strings with single digits. I'm just assuming that's the more common case.
+ */
- for(i = 2; i < endIndex; i++){
- numTempBuf[i] = (((((numTempBuf[i] - 6)/2) % 10) * 10) +
- (((numTempBuf[i+1])-6)/2) / 10) * 2 + 6;
- }
- --digIndx;
- }
+ for(i = 2; i < endIndex; i++){
+ numTempBuf[i] = (((((numTempBuf[i] - 6)/2) % 10) * 10) +
+ (((numTempBuf[i+1])-6)/2) / 10) * 2 + 6;
+ }
+ --digIndx;
+ }
- // Subtract one off of the last byte.
- numTempBuf[endIndex-1] -= 1;
+ // Subtract one off of the last byte.
+ numTempBuf[endIndex-1] -= 1;
- /*
- We want to skip over the first two slots in the buffer. The first slot
- is reserved for the header byte UCOL_CODAN_PLACEHOLDER. The second slot is for the
- sign/exponent byte: 0x80 + (decimalPos/2) & 7f.
- */
+ /*
+ We want to skip over the first two slots in the buffer. The first slot
+ is reserved for the header byte UCOL_CODAN_PLACEHOLDER. The second slot is for the
+ sign/exponent byte: 0x80 + (decimalPos/2) & 7f.
+ */
numTempBuf[0] = UCOL_CODAN_PLACEHOLDER;
- numTempBuf[1] = (uint8_t)(0x80 + ((digIndx/2) & 0x7F));
+ numTempBuf[1] = (uint8_t)(0x80 + ((digIndx/2) & 0x7F));
- // Now transfer the collation key to our collIterate struct.
- // The total size for our collation key is endIndx bumped up to the next largest even value divided by two.
- size = ((endIndex+1) & ~1)/2;
- CE = (((numTempBuf[0] << 8) | numTempBuf[1]) << UCOL_PRIMARYORDERSHIFT) | //Primary weight
- (UCOL_BYTE_COMMON << UCOL_SECONDARYORDERSHIFT) | // Secondary weight
- UCOL_BYTE_COMMON; // Tertiary weight.
- i = 2; // Reset the index into the buffer.
- while(i < endIndex)
- {
- primWeight = numTempBuf[i++] << 8;
- if ( i < endIndex)
- primWeight |= numTempBuf[i++];
- *(source->CEpos++) = (primWeight << UCOL_PRIMARYORDERSHIFT) | UCOL_CONTINUATION_MARKER;
- }
+ // Now transfer the collation key to our collIterate struct.
+ // The total size for our collation key is endIndx bumped up to the next largest even value divided by two.
+ size = ((endIndex+1) & ~1)/2;
+ CE = (((numTempBuf[0] << 8) | numTempBuf[1]) << UCOL_PRIMARYORDERSHIFT) | //Primary weight
+ (UCOL_BYTE_COMMON << UCOL_SECONDARYORDERSHIFT) | // Secondary weight
+ UCOL_BYTE_COMMON; // Tertiary weight.
+ i = 2; // Reset the index into the buffer.
+ while(i < endIndex)
+ {
+ primWeight = numTempBuf[i++] << 8;
+ if ( i < endIndex)
+ primWeight |= numTempBuf[i++];
+ *(source->CEpos++) = (primWeight << UCOL_PRIMARYORDERSHIFT) | UCOL_CONTINUATION_MARKER;
+ }
- if (numTempBuf != stackNumTempBuf)
- uprv_free(numTempBuf);
+ if (numTempBuf != stackNumTempBuf)
+ uprv_free(numTempBuf);
} else {
// no numeric mode, we'll just switch to whatever we stashed and continue
- CEOffset = (uint32_t *)coll->image+getExpansionOffset(CE); /* find the offset to expansion table */
- CE = *CEOffset++;
+ CEOffset = (uint32_t *)coll->image+getExpansionOffset(CE); /* find the offset to expansion table */
+ CE = *CEOffset++;
break;
#if 0
- CEOffset = (uint32_t *)coll->image+getExpansionOffset(CE); /* find the offset to expansion table */
- size = getExpansionCount(CE);
- CE = *CEOffset++;
- if(size != 0) { /* if there are less than 16 elements in expansion, we don't terminate */
- for(i = 1; iCEpos++) = *CEOffset++;
- }
- } else { /* else, we do */
- while(*CEOffset != 0) {
- *(source->CEpos++) = *CEOffset++;
- }
- }
+ CEOffset = (uint32_t *)coll->image+getExpansionOffset(CE); /* find the offset to expansion table */
+ size = getExpansionCount(CE);
+ CE = *CEOffset++;
+ if(size != 0) { /* if there are less than 16 elements in expansion, we don't terminate */
+ for(i = 1; iCEpos++) = *CEOffset++;
+ }
+ } else { /* else, we do */
+ while(*CEOffset != 0) {
+ *(source->CEpos++) = *CEOffset++;
+ }
+ }
#endif
- }
+ }
return CE;
}
/* various implicits optimization */
@@ -3871,11 +3871,11 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
}
strbuffer = (UChar *)uprv_malloc(sizeof(UChar) *
(newsize + UCOL_MAX_BUFFER));
- /* test for NULL */
- if (strbuffer == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return UCOL_NO_MORE_CES;
- }
+ /* test for NULL */
+ if (strbuffer == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return UCOL_NO_MORE_CES;
+ }
UCharOffset = strbuffer + newsize;
uprv_memcpy(UCharOffset, buffer,
UCOL_MAX_BUFFER * sizeof(UChar));
@@ -3968,7 +3968,7 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
case DIGIT_TAG:
{
/*
- We do a check to see if we want to collate digits as numbers; if so we generate
+ We do a check to see if we want to collate digits as numbers; if so we generate
a custom collation key. Otherwise we pull out the value stored in the expansion table.
*/
//uint32_t size;
@@ -3976,235 +3976,235 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
collIterateState state;
if (source->coll->numericCollation == UCOL_ON){
- UChar32 char32 = 0;
+ UChar32 char32 = 0;
- uint32_t digIndx = 0;
- uint32_t endIndex = 0;
- uint32_t leadingZeroIndex = 0;
- uint32_t trailingZeroCount = 0;
+ uint32_t digIndx = 0;
+ uint32_t endIndex = 0;
+ uint32_t leadingZeroIndex = 0;
+ uint32_t trailingZeroCount = 0;
- uint32_t primWeight = 0;
+ uint32_t primWeight = 0;
- int32_t digVal = 0;
- uint8_t collateVal = 0;
+ int32_t digVal = 0;
+ uint8_t collateVal = 0;
- UBool nonZeroValReached = FALSE;
+ UBool nonZeroValReached = FALSE;
- uint8_t *numTempBuf;
- uint8_t stackNumTempBuf[UCOL_MAX_BUFFER]; // I just need a temporary place to store my generated CEs.
- uint32_t numTempBufSize = UCOL_MAX_BUFFER;
+ uint8_t *numTempBuf;
+ uint8_t stackNumTempBuf[UCOL_MAX_BUFFER]; // I just need a temporary place to store my generated CEs.
+ uint32_t numTempBufSize = UCOL_MAX_BUFFER;
- numTempBuf = stackNumTempBuf;
- /*
- We parse the source string until we hit a char that's NOT a digit.
- Use this u_charDigitValue. This might be slow because we have to
- handle surrogates...
- */
+ numTempBuf = stackNumTempBuf;
+ /*
+ We parse the source string until we hit a char that's NOT a digit.
+ Use this u_charDigitValue. This might be slow because we have to
+ handle surrogates...
+ */
- if (U16_IS_TRAIL (ch)){
- if (!collIter_bos(source)){
+ if (U16_IS_TRAIL (ch)){
+ if (!collIter_bos(source)){
UChar lead = getPrevNormalizedChar(source);
if(U16_IS_LEAD(lead)) {
- char32 = U16_GET_SUPPLEMENTARY(lead,ch);
- goBackOne(source);
+ char32 = U16_GET_SUPPLEMENTARY(lead,ch);
+ goBackOne(source);
} else {
char32 = ch;
}
} else {
- char32 = ch;
+ char32 = ch;
}
} else {
- char32 = ch;
+ char32 = ch;
}
- digVal = u_charDigitValue(char32);
+ digVal = u_charDigitValue(char32);
- for(;;){
- // Make sure we have enough space.
- if (digIndx >= ((numTempBufSize - 2) * 2) + 1)
- {
- numTempBufSize *= 2;
- if (numTempBuf == stackNumTempBuf){
- numTempBuf = (uint8_t *)uprv_malloc(sizeof(uint8_t) * numTempBufSize);
- uprv_memcpy(numTempBuf, stackNumTempBuf, UCOL_MAX_BUFFER);
- }else
- uprv_realloc(numTempBuf, numTempBufSize);
- }
+ for(;;){
+ // Make sure we have enough space.
+ if (digIndx >= ((numTempBufSize - 2) * 2) + 1)
+ {
+ numTempBufSize *= 2;
+ if (numTempBuf == stackNumTempBuf){
+ numTempBuf = (uint8_t *)uprv_malloc(sizeof(uint8_t) * numTempBufSize);
+ uprv_memcpy(numTempBuf, stackNumTempBuf, UCOL_MAX_BUFFER);
+ }else
+ uprv_realloc(numTempBuf, numTempBufSize);
+ }
- // Skip over trailing zeroes, and keep a count of them.
- if (digVal != 0)
- nonZeroValReached = TRUE;
- if (nonZeroValReached){
- /*
- We parse the digit string into base 100 numbers (this fits into a byte).
- We only add to the buffer in twos, thus if we are parsing an odd character,
- that serves as the 'tens' digit while the if we are parsing an even one, that
- is the 'ones' digit. We dumped the parsed base 100 value (collateVal) into
- a buffer. We multiply each collateVal by 2 (to give us room) and add 5 (to avoid
- overlapping magic CE byte values). The last byte we subtract 1 to ensure it is less
- than all the other bytes.
+ // Skip over trailing zeroes, and keep a count of them.
+ if (digVal != 0)
+ nonZeroValReached = TRUE;
+ if (nonZeroValReached){
+ /*
+ We parse the digit string into base 100 numbers (this fits into a byte).
+ We only add to the buffer in twos, thus if we are parsing an odd character,
+ that serves as the 'tens' digit while the if we are parsing an even one, that
+ is the 'ones' digit. We dumped the parsed base 100 value (collateVal) into
+ a buffer. We multiply each collateVal by 2 (to give us room) and add 5 (to avoid
+ overlapping magic CE byte values). The last byte we subtract 1 to ensure it is less
+ than all the other bytes.
- Since we're doing in this reverse we want to put the first digit encountered into the
- ones place and the second digit encountered into the tens place.
- */
+ Since we're doing in this reverse we want to put the first digit encountered into the
+ ones place and the second digit encountered into the tens place.
+ */
- if ((digIndx + trailingZeroCount) % 2 == 1){
- // High-order digit case (tens place)
- collateVal += (uint8_t)(digVal * 10);
+ if ((digIndx + trailingZeroCount) % 2 == 1){
+ // High-order digit case (tens place)
+ collateVal += (uint8_t)(digVal * 10);
- // We cannot set leadingZeroIndex unless it has been set for the
- // low-order digit. Therefore, all we can do for the high-order
- // digit is turn it off, never on.
- // The only time we will have a high digit without a low is for
- // the very first non-zero digit, so no zero check is necessary.
- if (collateVal != 0)
- leadingZeroIndex = 0;
+ // We cannot set leadingZeroIndex unless it has been set for the
+ // low-order digit. Therefore, all we can do for the high-order
+ // digit is turn it off, never on.
+ // The only time we will have a high digit without a low is for
+ // the very first non-zero digit, so no zero check is necessary.
+ if (collateVal != 0)
+ leadingZeroIndex = 0;
- numTempBuf[(digIndx/2) + 2] = collateVal*2 + 6;
- collateVal = 0;
- }
- else{
- // Low-order digit case (ones place)
- collateVal = (uint8_t)digVal;
+ numTempBuf[(digIndx/2) + 2] = collateVal*2 + 6;
+ collateVal = 0;
+ }
+ else{
+ // Low-order digit case (ones place)
+ collateVal = (uint8_t)digVal;
- // Check for leading zeroes.
- if (collateVal == 0)
- {
- if (!leadingZeroIndex)
- leadingZeroIndex = (digIndx/2) + 2;
- }
- else
- leadingZeroIndex = 0;
-
- // No need to write to buffer; the case of a last odd digit
- // is handled below.
- }
- ++digIndx;
- }
- else
- ++trailingZeroCount;
+ // Check for leading zeroes.
+ if (collateVal == 0)
+ {
+ if (!leadingZeroIndex)
+ leadingZeroIndex = (digIndx/2) + 2;
+ }
+ else
+ leadingZeroIndex = 0;
- if (!collIter_bos(source)){
- ch = getPrevNormalizedChar(source);
- //goBackOne(source);
- if (U16_IS_TRAIL(ch)){
+ // No need to write to buffer; the case of a last odd digit
+ // is handled below.
+ }
+ ++digIndx;
+ }
+ else
+ ++trailingZeroCount;
+
+ if (!collIter_bos(source)){
+ ch = getPrevNormalizedChar(source);
+ //goBackOne(source);
+ if (U16_IS_TRAIL(ch)){
backupState(source, &state);
- if (!collIter_bos(source))
- {
- goBackOne(source);
+ if (!collIter_bos(source))
+ {
+ goBackOne(source);
UChar lead = getPrevNormalizedChar(source);
if(U16_IS_LEAD(lead)) {
- char32 = U16_GET_SUPPLEMENTARY(lead,ch);
+ char32 = U16_GET_SUPPLEMENTARY(lead,ch);
} else {
loadState(source, &state, FALSE);
char32 = ch;
}
- }
- }
- else
- char32 = ch;
+ }
+ }
+ else
+ char32 = ch;
- if ((digVal = u_charDigitValue(char32)) == -1){
+ if ((digVal = u_charDigitValue(char32)) == -1){
if (char32 > 0xFFFF) {// For surrogates.
loadState(source, &state, FALSE);
}
- // Don't need to "reverse" the goBackOne call,
- // as this points to the next position to process..
- //if (char32 > 0xFFFF) // For surrogates.
- //getNextNormalizedChar(source);
- break;
- }
+ // Don't need to "reverse" the goBackOne call,
+ // as this points to the next position to process..
+ //if (char32 > 0xFFFF) // For surrogates.
+ //getNextNormalizedChar(source);
+ break;
+ }
goBackOne(source);
- }else
- break;
- }
-
- if (nonZeroValReached == FALSE){
- digIndx = 2;
- trailingZeroCount = 0;
- numTempBuf[2] = 6;
- }
-
- if ((digIndx + trailingZeroCount) % 2 != 0){
- numTempBuf[((digIndx)/2) + 2] = collateVal*2 + 6;
- digIndx += 1; // The implicit leading zero
- }
- if (trailingZeroCount % 2 != 0){
- // We had to consume one trailing zero for the low digit
- // of the least significant byte
- digIndx += 1; // The trailing zero not in the exponent
- trailingZeroCount -= 1;
+ }else
+ break;
}
- endIndex = leadingZeroIndex ? leadingZeroIndex : ((digIndx/2) + 2) ;
+ if (nonZeroValReached == FALSE){
+ digIndx = 2;
+ trailingZeroCount = 0;
+ numTempBuf[2] = 6;
+ }
- // Subtract one off of the last byte. Really the first byte here, but it's reversed...
- numTempBuf[2] -= 1;
+ if ((digIndx + trailingZeroCount) % 2 != 0){
+ numTempBuf[((digIndx)/2) + 2] = collateVal*2 + 6;
+ digIndx += 1; // The implicit leading zero
+ }
+ if (trailingZeroCount % 2 != 0){
+ // We had to consume one trailing zero for the low digit
+ // of the least significant byte
+ digIndx += 1; // The trailing zero not in the exponent
+ trailingZeroCount -= 1;
+ }
- /*
- We want to skip over the first two slots in the buffer. The first slot
- is reserved for the header byte UCOL_CODAN_PLACEHOLDER. The second slot is for the
- sign/exponent byte: 0x80 + (decimalPos/2) & 7f.
- The exponent must be adjusted by the number of leading zeroes, and the number of
- trailing zeroes.
- */
- numTempBuf[0] = UCOL_CODAN_PLACEHOLDER;
- uint32_t exponent = (digIndx+trailingZeroCount)/2;
- if (leadingZeroIndex)
- exponent -= ((digIndx/2) + 2 - leadingZeroIndex);
- numTempBuf[1] = (uint8_t)(0x80 + (exponent & 0x7F));
+ endIndex = leadingZeroIndex ? leadingZeroIndex : ((digIndx/2) + 2) ;
- // Now transfer the collation key to our collIterate struct.
- // The total size for our collation key is endIndx bumped up to the next largest even value divided by two.
- //size = ((endIndex+1) & ~1)/2;
- *(source->CEpos++) = (((numTempBuf[0] << 8) | numTempBuf[1]) << UCOL_PRIMARYORDERSHIFT) | //Primary weight
- (UCOL_BYTE_COMMON << UCOL_SECONDARYORDERSHIFT) | // Secondary weight
- UCOL_BYTE_COMMON; // Tertiary weight.
- i = endIndex - 1; // Reset the index into the buffer.
- while(i >= 2)
- {
- primWeight = numTempBuf[i--] << 8;
- if ( i >= 2)
- primWeight |= numTempBuf[i--];
- *(source->CEpos++) = (primWeight << UCOL_PRIMARYORDERSHIFT) | UCOL_CONTINUATION_MARKER;
- }
- if (numTempBuf != stackNumTempBuf)
- uprv_free(numTempBuf);
+ // Subtract one off of the last byte. Really the first byte here, but it's reversed...
+ numTempBuf[2] -= 1;
- source->toReturn = source->CEpos -1;
- return *(source->toReturn);
+ /*
+ We want to skip over the first two slots in the buffer. The first slot
+ is reserved for the header byte UCOL_CODAN_PLACEHOLDER. The second slot is for the
+ sign/exponent byte: 0x80 + (decimalPos/2) & 7f.
+ The exponent must be adjusted by the number of leading zeroes, and the number of
+ trailing zeroes.
+ */
+ numTempBuf[0] = UCOL_CODAN_PLACEHOLDER;
+ uint32_t exponent = (digIndx+trailingZeroCount)/2;
+ if (leadingZeroIndex)
+ exponent -= ((digIndx/2) + 2 - leadingZeroIndex);
+ numTempBuf[1] = (uint8_t)(0x80 + (exponent & 0x7F));
+
+ // Now transfer the collation key to our collIterate struct.
+ // The total size for our collation key is endIndx bumped up to the next largest even value divided by two.
+ //size = ((endIndex+1) & ~1)/2;
+ *(source->CEpos++) = (((numTempBuf[0] << 8) | numTempBuf[1]) << UCOL_PRIMARYORDERSHIFT) | //Primary weight
+ (UCOL_BYTE_COMMON << UCOL_SECONDARYORDERSHIFT) | // Secondary weight
+ UCOL_BYTE_COMMON; // Tertiary weight.
+ i = endIndex - 1; // Reset the index into the buffer.
+ while(i >= 2)
+ {
+ primWeight = numTempBuf[i--] << 8;
+ if ( i >= 2)
+ primWeight |= numTempBuf[i--];
+ *(source->CEpos++) = (primWeight << UCOL_PRIMARYORDERSHIFT) | UCOL_CONTINUATION_MARKER;
+ }
+ if (numTempBuf != stackNumTempBuf)
+ uprv_free(numTempBuf);
+
+ source->toReturn = source->CEpos -1;
+ return *(source->toReturn);
}
else {
- CEOffset = (uint32_t *)coll->image + getExpansionOffset(CE);
+ CEOffset = (uint32_t *)coll->image + getExpansionOffset(CE);
CE = *(CEOffset++);
break;
#if 0
- /* find the offset to expansion table */
- CEOffset = (uint32_t *)coll->image + getExpansionOffset(CE);
- size = getExpansionCount(CE);
- if (size != 0) {
- /*
- if there are less than 16 elements in expansion, we don't terminate
- */
- uint32_t count;
- for (count = 0; count < size; count++) {
- *(source->CEpos ++) = *CEOffset++;
- }
- }
- else {
- /* else, we do */
- while (*CEOffset != 0) {
- *(source->CEpos ++) = *CEOffset ++;
- }
- }
- source->toReturn = source->CEpos - 1;
+ /* find the offset to expansion table */
+ CEOffset = (uint32_t *)coll->image + getExpansionOffset(CE);
+ size = getExpansionCount(CE);
+ if (size != 0) {
+ /*
+ if there are less than 16 elements in expansion, we don't terminate
+ */
+ uint32_t count;
+ for (count = 0; count < size; count++) {
+ *(source->CEpos ++) = *CEOffset++;
+ }
+ }
+ else {
+ /* else, we do */
+ while (*CEOffset != 0) {
+ *(source->CEpos ++) = *CEOffset ++;
+ }
+ }
+ source->toReturn = source->CEpos - 1;
// in case of one element expansion, we
// want to immediately return CEpos
if(source->toReturn == source->CEs) {
source->CEpos = source->CEs;
}
- return *(source->toReturn);
+ return *(source->toReturn);
#endif
- }
+ }
}
case HANGUL_SYLLABLE_TAG: /* AC00-D7AF*/
{
@@ -5475,11 +5475,11 @@ ucol_calcSortKey(const UCollator *coll,
if(allocateSKBuffer == TRUE) {
*result = (uint8_t*)uprv_malloc(sortKeySize);
- /* test for NULL */
- if (*result == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return sortKeySize;
- }
+ /* test for NULL */
+ if (*result == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return sortKeySize;
+ }
uprv_memcpy(*result, primStart, sortKeySize);
if(primStart != prim) {
uprv_free(primStart);
@@ -5841,11 +5841,11 @@ ucol_calcSortKeySimpleTertiary(const UCollator *coll,
if(allocateSKBuffer == TRUE) {
*result = (uint8_t*)uprv_malloc(sortKeySize);
- /* test for NULL */
- if (*result == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return sortKeySize;
- }
+ /* test for NULL */
+ if (*result == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return sortKeySize;
+ }
uprv_memcpy(*result, primStart, sortKeySize);
if(primStart != prim) {
uprv_free(primStart);
@@ -7464,8 +7464,8 @@ ucol_safeClone(const UCollator *coll, void *stackBuffer, int32_t * pBufferSize,
localCollator = (UCollator *)stackBuffer;
uprv_memcpy(localCollator, coll, sizeof(UCollator));
localCollator->freeOnClose = FALSE;
- localCollator->requestedLocale = NULL; // zero copies of pointers
- localCollator->validLocale = NULL;
+ localCollator->requestedLocale = NULL; // zero copies of pointers
+ localCollator->validLocale = NULL;
}
return localCollator;
}
@@ -9281,9 +9281,9 @@ ucol_getUCAVersion(const UCollator* coll, UVersionInfo info) {
}
U_CAPI int32_t U_EXPORT2
-ucol_cloneBinary(const UCollator *coll,
+ucol_cloneBinary(const UCollator *coll,
uint8_t *buffer, int32_t capacity,
- UErrorCode *status)
+ UErrorCode *status)
{
int32_t length = 0;
if(U_FAILURE(*status)) {
@@ -9334,9 +9334,9 @@ ucol_cloneBinary(const UCollator *coll,
}
U_CAPI UCollator* U_EXPORT2
-ucol_openBinary(const uint8_t *bin, int32_t length,
- const UCollator *base,
- UErrorCode *status)
+ucol_openBinary(const uint8_t *bin, int32_t length,
+ const UCollator *base,
+ UErrorCode *status)
{
UCollator *result = NULL;
if(U_FAILURE(*status)){
diff --git a/icu4c/source/i18n/ucol_elm.cpp b/icu4c/source/i18n/ucol_elm.cpp
index 1f42958ac2..dd07039157 100644
--- a/icu4c/source/i18n/ucol_elm.cpp
+++ b/icu4c/source/i18n/ucol_elm.cpp
@@ -1017,7 +1017,7 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
if(element->noOfCEs == 1) {
if(element->isThai == FALSE) {
- element->mapCE = element->CEs[0];
+ element->mapCE = element->CEs[0];
} else { /* add thai - totally bad here */
expansion = (uint32_t)(UCOL_SPECIAL_FLAG | (THAI_TAG<CEs[0], status)+(headersize>>2))<<4)
@@ -1051,10 +1051,10 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
| ((element->CEs[0]>>8) & 0xFFFF00) // first and second byte of primary
| ((element->CEs[1]>>24) & 0xFF); // third byte of primary
} else {
- expansion = (uint32_t)(UCOL_SPECIAL_FLAG | (EXPANSION_TAG<CEs[0], status)+(headersize>>2))<<4)
- & 0xFFFFF0);
-
+ expansion = (uint32_t)(UCOL_SPECIAL_FLAG | (EXPANSION_TAG<CEs[0], status)+(headersize>>2))<<4)
+ & 0xFFFFF0);
+
for(i = 1; inoOfCEs; i++) {
uprv_uca_addExpansion(expansions, element->CEs[i], status);
}
@@ -1084,9 +1084,9 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
UChar32 uniChar = 0;
//printElement(element);
if ((element->cSize == 2) && U16_IS_LEAD(element->uchars[0])){
- uniChar = U16_GET_SUPPLEMENTARY(element->uchars[0], element->uchars[1]);
+ uniChar = U16_GET_SUPPLEMENTARY(element->uchars[0], element->uchars[1]);
} else if (element->cSize == 1){
- uniChar = element->uchars[0];
+ uniChar = element->uchars[0];
}
// Here, we either have one normal CE OR mapCE is set. Therefore, we stuff only
@@ -1096,17 +1096,17 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
// a special, further processing will occur. If it's a simple CE, we'll return due
// to how the loop is constructed.
if (uniChar != 0 && u_isdigit(uniChar)){
- expansion = (uint32_t)(UCOL_SPECIAL_FLAG | (DIGIT_TAG<mapCE) { // if there is an expansion, we'll pick it here
expansion |= ((uprv_uca_addExpansion(expansions, element->mapCE, status)+(headersize>>2))<<4);
} else {
- expansion |= ((uprv_uca_addExpansion(expansions, element->CEs[0], status)+(headersize>>2))<<4);
+ expansion |= ((uprv_uca_addExpansion(expansions, element->CEs[0], status)+(headersize>>2))<<4);
}
- element->mapCE = expansion;
-
- // Need to go back to the beginning of the digit string if in the middle!
+ element->mapCE = expansion;
+
+ // Need to go back to the beginning of the digit string if in the middle!
if(uniChar <= 0xFFFF) { // supplementaries are always unsafe. API takes UChars
- unsafeCPSet(t->unsafeCP, (UChar)uniChar);
+ unsafeCPSet(t->unsafeCP, (UChar)uniChar);
}
}
diff --git a/icu4c/source/i18n/ucol_imp.h b/icu4c/source/i18n/ucol_imp.h
index 41a1c36fa7..f8b11c6681 100644
--- a/icu4c/source/i18n/ucol_imp.h
+++ b/icu4c/source/i18n/ucol_imp.h
@@ -658,8 +658,8 @@ typedef enum {
/* It fits in a single 32 bit CE and is used instead of expansion to save */
/* space without affecting the performance (hopefully) */
- DIGIT_TAG = 13, /* COllate Digits As Numbers (CODAN) implementation */
-
+ DIGIT_TAG = 13, /* COllate Digits As Numbers (CODAN) implementation */
+
CE_TAGS_COUNT
} UColCETags;
diff --git a/icu4c/source/i18n/ucol_tok.cpp b/icu4c/source/i18n/ucol_tok.cpp
index f94ad66bfe..c0f460a8e2 100644
--- a/icu4c/source/i18n/ucol_tok.cpp
+++ b/icu4c/source/i18n/ucol_tok.cpp
@@ -13,9 +13,9 @@
* created 02/22/2001
* created by: Vladimir Weinstein
*
-* This module reads a tailoring rule string and produces a list of
+* This module reads a tailoring rule string and produces a list of
* tokens that will be turned into collation elements
-*
+*
*/
#include "unicode/utypes.h"
@@ -25,7 +25,7 @@
#include "unicode/ustring.h"
#include "unicode/uchar.h"
#include "unicode/uniset.h"
-
+
#include "ucol_tok.h"
#include "cmemory.h"
#include "util.h"
@@ -41,10 +41,10 @@ uhash_hashTokens(const UHashTok k)
//int32_t len = (key & 0xFF000000)>>24;
int32_t len = (key->source & 0xFF000000)>>24;
int32_t inc = ((len - 32) / 32) + 1;
-
+
//const UChar *p = (key & 0x00FFFFFF) + rulesToParse;
const UChar *p = (key->source & 0x00FFFFFF) + key->rulesToParse;
- const UChar *limit = p + len;
+ const UChar *limit = p + len;
while (poffset = pos;
parseError->line = 0 ; /* we are not using line numbers */
-
+
// for pre-context
int32_t start = (pos <=U_PARSE_CONTEXT_LEN)? 0 : (pos - (U_PARSE_CONTEXT_LEN-1));
int32_t stop = pos;
-
+
u_memcpy(parseError->preContext,rules+start,stop-start);
//null terminate the buffer
parseError->preContext[stop-start] = 0;
-
+
//for post-context
start = pos+1;
- stop = ((pos+U_PARSE_CONTEXT_LEN)<= rulesLen )? (pos+(U_PARSE_CONTEXT_LEN-1)) :
+ stop = ((pos+U_PARSE_CONTEXT_LEN)<= rulesLen )? (pos+(U_PARSE_CONTEXT_LEN-1)) :
rulesLen;
if(start < stop) {
@@ -217,8 +217,8 @@ void ucol_uprv_tok_setOptionInImage(UColOptionSet *opts, UColAttribute attrib, U
opts->strength = value;
break;
case UCOL_NUMERIC_COLLATION:
- opts->numericCollation = value;
- break;
+ opts->numericCollation = value;
+ break;
case UCOL_ATTRIBUTE_COUNT:
default:
break;
@@ -254,33 +254,33 @@ U_STRING_DECL(suboption_17, "trailing", 8);
U_STRING_DECL(option_00, "undefined", 9);
-U_STRING_DECL(option_01, "rearrange", 9);
+U_STRING_DECL(option_01, "rearrange", 9);
U_STRING_DECL(option_02, "alternate", 9);
-U_STRING_DECL(option_03, "backwards", 9);
-U_STRING_DECL(option_04, "variable top", 12);
-U_STRING_DECL(option_05, "top", 3);
-U_STRING_DECL(option_06, "normalization", 13);
-U_STRING_DECL(option_07, "caseLevel", 9);
-U_STRING_DECL(option_08, "caseFirst", 9);
-U_STRING_DECL(option_09, "scriptOrder", 11);
-U_STRING_DECL(option_10, "charsetname", 11);
-U_STRING_DECL(option_11, "charset", 7);
-U_STRING_DECL(option_12, "before", 6);
+U_STRING_DECL(option_03, "backwards", 9);
+U_STRING_DECL(option_04, "variable top", 12);
+U_STRING_DECL(option_05, "top", 3);
+U_STRING_DECL(option_06, "normalization", 13);
+U_STRING_DECL(option_07, "caseLevel", 9);
+U_STRING_DECL(option_08, "caseFirst", 9);
+U_STRING_DECL(option_09, "scriptOrder", 11);
+U_STRING_DECL(option_10, "charsetname", 11);
+U_STRING_DECL(option_11, "charset", 7);
+U_STRING_DECL(option_12, "before", 6);
U_STRING_DECL(option_13, "hiraganaQ", 9);
U_STRING_DECL(option_14, "strength", 8);
U_STRING_DECL(option_15, "first", 5);
U_STRING_DECL(option_16, "last", 4);
U_STRING_DECL(option_17, "optimize", 8);
U_STRING_DECL(option_18, "suppressContractions", 20);
-U_STRING_DECL(option_19, "numericOrdering", 15);
+U_STRING_DECL(option_19, "numericOrdering", 15);
/*
-[last variable] last variable value
-[last primary ignorable] largest CE for primary ignorable
-[last secondary ignorable] largest CE for secondary ignorable
-[last tertiary ignorable] largest CE for tertiary ignorable
-[top] guaranteed to be above all implicit CEs, for now and in the future (in 1.8)
+[last variable] last variable value
+[last primary ignorable] largest CE for primary ignorable
+[last secondary ignorable] largest CE for secondary ignorable
+[last tertiary ignorable] largest CE for tertiary ignorable
+[top] guaranteed to be above all implicit CEs, for now and in the future (in 1.8)
*/
@@ -360,7 +360,7 @@ static const ucolTokOption rulesOptions[UTOK_OPTION_COUNT] = {
/*04*/ {option_06, 13, onOffSub, 2, UCOL_NORMALIZATION_MODE}, /*"normalization" */
/*05*/ {option_13, 9, onOffSub, 2, UCOL_HIRAGANA_QUATERNARY_MODE}, /*"hiraganaQ" */
/*06*/ {option_14, 8, strengthSub, 5, UCOL_STRENGTH}, /*"strength" */
- /*07*/ {option_19, 15, onOffSub, 2, UCOL_NUMERIC_COLLATION}, /*"numericOrdering"*/
+ /*07*/ {option_19, 15, onOffSub, 2, UCOL_NUMERIC_COLLATION}, /*"numericOrdering"*/
/*08*/ {option_04, 12, NULL, 0, UCOL_ATTRIBUTE_COUNT}, /*"variable top" */
/*09*/ {option_01, 9, NULL, 0, UCOL_ATTRIBUTE_COUNT}, /*"rearrange" */
/*10*/ {option_12, 6, beforeSub, 3, UCOL_ATTRIBUTE_COUNT}, /*"before" */
@@ -376,9 +376,9 @@ static const ucolTokOption rulesOptions[UTOK_OPTION_COUNT] = {
};
static
-int32_t u_strncmpNoCase(const UChar *s1,
- const UChar *s2,
- int32_t n)
+int32_t u_strncmpNoCase(const UChar *s1,
+ const UChar *s2,
+ int32_t n)
{
if(n > 0) {
int32_t rc;
@@ -421,25 +421,25 @@ void ucol_uprv_tok_initData() {
U_STRING_INIT(option_00, "undefined", 9);
- U_STRING_INIT(option_01, "rearrange", 9);
+ U_STRING_INIT(option_01, "rearrange", 9);
U_STRING_INIT(option_02, "alternate", 9);
- U_STRING_INIT(option_03, "backwards", 9);
- U_STRING_INIT(option_04, "variable top", 12);
- U_STRING_INIT(option_05, "top", 3);
- U_STRING_INIT(option_06, "normalization", 13);
- U_STRING_INIT(option_07, "caseLevel", 9);
- U_STRING_INIT(option_08, "caseFirst", 9);
- U_STRING_INIT(option_09, "scriptOrder", 11);
- U_STRING_INIT(option_10, "charsetname", 11);
- U_STRING_INIT(option_11, "charset", 7);
- U_STRING_INIT(option_12, "before", 6);
+ U_STRING_INIT(option_03, "backwards", 9);
+ U_STRING_INIT(option_04, "variable top", 12);
+ U_STRING_INIT(option_05, "top", 3);
+ U_STRING_INIT(option_06, "normalization", 13);
+ U_STRING_INIT(option_07, "caseLevel", 9);
+ U_STRING_INIT(option_08, "caseFirst", 9);
+ U_STRING_INIT(option_09, "scriptOrder", 11);
+ U_STRING_INIT(option_10, "charsetname", 11);
+ U_STRING_INIT(option_11, "charset", 7);
+ U_STRING_INIT(option_12, "before", 6);
U_STRING_INIT(option_13, "hiraganaQ", 9);
U_STRING_INIT(option_14, "strength", 8);
U_STRING_INIT(option_15, "first", 5);
U_STRING_INIT(option_16, "last", 4);
U_STRING_INIT(option_17, "optimize", 8);
U_STRING_INIT(option_18, "suppressContractions", 20);
- U_STRING_INIT(option_19, "numericOrdering", 15);
+ U_STRING_INIT(option_19, "numericOrdering", 15);
didInit = TRUE;
}
}
@@ -448,8 +448,8 @@ void ucol_uprv_tok_initData() {
// This function reads basic options to set in the runtime collator
// used by data driven tests. Should not support build time options
U_CAPI const UChar * U_EXPORT2
-ucol_tok_getNextArgument(const UChar *start, const UChar *end,
- UColAttribute *attrib, UColAttributeValue *value,
+ucol_tok_getNextArgument(const UChar *start, const UChar *end,
+ UColAttribute *attrib, UColAttributeValue *value,
UErrorCode *status) {
uint32_t i = 0;
int32_t j=0;
@@ -480,7 +480,7 @@ ucol_tok_getNextArgument(const UChar *start, const UChar *end,
while(u_isWhitespace(*optionArg)) { /* eat whitespace */
optionArg++;
}
- }
+ }
break;
}
i++;
@@ -515,12 +515,12 @@ ucol_tok_getNextArgument(const UChar *start, const UChar *end,
return NULL;
}
-static
+static
USet *ucol_uprv_tok_readAndSetUnicodeSet(const UChar *start, const UChar *end, UErrorCode *status) {
while(*start != 0x005b) { /* advance while we find the first '[' */
start++;
}
- // now we need to get a balanced set of '[]'. The problem is that a set can have
+ // now we need to get a balanced set of '[]'. The problem is that a set can have
// many, and *end point to the first closing '['
int32_t noOpenBraces = 1;
int32_t current = 1; // skip the opening brace
@@ -556,14 +556,14 @@ int32_t ucol_uprv_tok_readOption(const UChar *start, const UChar *end, const UCh
while(u_isWhitespace(**optionArg)) { /* eat whitespace */
(*optionArg)++;
}
- }
+ }
break;
}
i++;
}
if(i == UTOK_OPTION_COUNT) {
i = -1; // didn't find an option
- }
+ }
return i;
}
@@ -573,7 +573,7 @@ int32_t ucol_uprv_tok_readOption(const UChar *start, const UChar *end, const UCh
// However, some of the options take an UnicodeSet definition
// which needs to duplicate the closing ']'
// for example: '[copy [\uAC00-\uD7FF]]'
-// These options will move end to the second ']' and the
+// These options will move end to the second ']' and the
// caller will set the current to it.
static
uint8_t ucol_uprv_tok_readAndSetOption(UColTokenParser *src, UErrorCode *status) {
@@ -610,7 +610,7 @@ uint8_t ucol_uprv_tok_readAndSetOption(UColTokenParser *src, UErrorCode *status)
result = UCOL_TOK_SUCCESS;
}
}
- }
+ }
if(result == 0) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
}
@@ -698,7 +698,7 @@ inline void ucol_tok_addToExtraCurrent(UColTokenParser *src, const UChar *stuff,
src->extraCurrent += len;
}
-
+
}
inline UBool ucol_tok_doSetTop(UColTokenParser *src, UErrorCode *status) {
@@ -718,7 +718,7 @@ inline UBool ucol_tok_doSetTop(UColTokenParser *src, UErrorCode *status) {
buff[4] = (UChar)(ucolIndirectBoundaries[src->parsedToken.indirectIndex].startContCE & 0xFFFF);
src->parsedToken.charsLen = 5;
ucol_tok_addToExtraCurrent(src, buff, 5, status);
- }
+ }
return TRUE;
}
@@ -737,10 +737,10 @@ static UBool isCharNewLine(UChar c){
}
U_CAPI const UChar* U_EXPORT2
-ucol_tok_parseNextToken(UColTokenParser *src,
+ucol_tok_parseNextToken(UColTokenParser *src,
UBool startOfRules,
UParseError *parseError,
- UErrorCode *status) {
+ UErrorCode *status) {
/* parsing part */
UBool variableTop = FALSE;
UBool top = FALSE;
@@ -756,7 +756,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
// more time (around 2020 probably).
uint32_t newExtensionLen = 0;
uint32_t extensionOffset = 0;
- uint32_t newStrength = UCOL_TOK_UNSET;
+ uint32_t newStrength = UCOL_TOK_UNSET;
UChar buff[10];
src->parsedToken.charsOffset = 0; src->parsedToken.charsLen = 0;
@@ -785,11 +785,11 @@ ucol_tok_parseNextToken(UColTokenParser *src,
}else if(isEscaped){
isEscaped =FALSE;
if (newStrength == UCOL_TOK_UNSET) {
- *status = U_INVALID_FORMAT_ERROR;
+ *status = U_INVALID_FORMAT_ERROR;
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
return NULL;
// enabling rules to start with non-tokens a < b
- // newStrength = UCOL_TOK_RESET;
+ // newStrength = UCOL_TOK_RESET;
}
if(ch != 0x0000 && src->current != src->end) {
if (inChars) {
@@ -808,7 +808,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
if(!uprv_isRuleWhiteSpace(ch)) {
/* Sets the strength for this entry */
switch (ch) {
- case 0x003D/*'='*/ :
+ case 0x003D/*'='*/ :
if (newStrength != UCOL_TOK_UNSET) {
goto EndOfLoop;
}
@@ -823,7 +823,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
newStrength = UCOL_IDENTICAL;
break;
- case 0x002C/*','*/:
+ case 0x002C/*','*/:
if (newStrength != UCOL_TOK_UNSET) {
goto EndOfLoop;
}
@@ -853,7 +853,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
newStrength = UCOL_SECONDARY;
break;
- case 0x003C/*'<'*/:
+ case 0x003C/*'<'*/:
if (newStrength != UCOL_TOK_UNSET) {
goto EndOfLoop;
}
@@ -880,7 +880,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
}
break;
- case 0x0026/*'&'*/:
+ case 0x0026/*'&'*/:
if (newStrength != UCOL_TOK_UNSET) {
/**/
goto EndOfLoop;
@@ -896,7 +896,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
//src->current = optionEnd;
if(U_SUCCESS(*status)) {
if(result & UCOL_TOK_TOP) {
- if(newStrength == UCOL_TOK_RESET) {
+ if(newStrength == UCOL_TOK_RESET) {
top = ucol_tok_doSetTop(src, status);
if(before) { // This is a combination of before and indirection like '&[before 2][first regular]parsedToken.charsLen+=2;
@@ -932,7 +932,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
}
- }
+ }
} else {
*status = U_INVALID_FORMAT_ERROR;
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
@@ -940,8 +940,8 @@ ucol_tok_parseNextToken(UColTokenParser *src,
}
}
break;
- case 0x0021/*! skip java thai modifier reordering*/:
- break;
+ case 0x0021/*! skip java thai modifier reordering*/:
+ break;
case 0x002F/*'/'*/:
wasInQuote = FALSE; /* if we were copying source characters, we want to stop now */
inChars = FALSE; /* we're now processing expansion */
@@ -952,10 +952,10 @@ ucol_tok_parseNextToken(UColTokenParser *src,
/* found a quote, we're gonna start copying */
case 0x0027/*'\''*/:
if (newStrength == UCOL_TOK_UNSET) { /* quote is illegal until we have a strength */
- *status = U_INVALID_FORMAT_ERROR;
+ *status = U_INVALID_FORMAT_ERROR;
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
return NULL;
- // enabling rules to start with a non-token character a < b
+ // enabling rules to start with a non-token character a < b
// newStrength = UCOL_TOK_RESET;
}
@@ -981,7 +981,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
wasInQuote = TRUE;
- ch = *(++(src->current));
+ ch = *(++(src->current));
if(ch == 0x0027) { /* copy the double quote */
ucol_tok_addToExtraCurrent(src, &ch, 1, status);
inQuote = FALSE;
@@ -999,7 +999,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
case 0x007C /*|*/: /* this means we have actually been reading prefix part */
// we want to store read characters to the prefix part and continue reading
// the characters (proper way would be to restart reading the chars, but in
- // that case we would have to complicate the token hasher, which I do not
+ // that case we would have to complicate the token hasher, which I do not
// intend to play with. Instead, we will do prefixes when prefixes are due
// (before adding the elements).
src->parsedToken.prefixOffset = src->parsedToken.charsOffset;
@@ -1018,11 +1018,11 @@ ucol_tok_parseNextToken(UColTokenParser *src,
wasInQuote = TRUE;
do {
- ch = *(++(src->current));
+ ch = *(++(src->current));
// skip whitespace between '|' and the character
} while (uprv_isRuleWhiteSpace(ch));
break;
-
+
//charsOffset = 0;
//newCharsLen = 0;
//break; // We want to store the whole prefix/character sequence. If we break
@@ -1035,7 +1035,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
break;
default:
if (newStrength == UCOL_TOK_UNSET) {
- *status = U_INVALID_FORMAT_ERROR;
+ *status = U_INVALID_FORMAT_ERROR;
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
return NULL;
}
@@ -1063,7 +1063,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
}
break;
- }
+ }
}
}
@@ -1085,12 +1085,12 @@ ucol_tok_parseNextToken(UColTokenParser *src,
}
if (src->parsedToken.charsLen == 0 && top == FALSE) {
- syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
+ syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
*status = U_INVALID_FORMAT_ERROR;
return NULL;
}
- src->parsedToken.strength = newStrength;
+ src->parsedToken.strength = newStrength;
src->parsedToken.extensionOffset = extensionOffset;
src->parsedToken.extensionLen = newExtensionLen;
src->parsedToken.flags = (UCOL_TOK_VARIABLE_TOP * (variableTop?1:0)) | (UCOL_TOK_TOP * (top?1:0)) | before;
@@ -1100,11 +1100,11 @@ ucol_tok_parseNextToken(UColTokenParser *src,
/*
Processing Description
- 1 Build a ListList. Each list has a header, which contains two lists (positive
- and negative), a reset token, a baseCE, nextCE, and previousCE. The lists and
- reset may be null.
- 2 As you process, you keep a LAST pointer that points to the last token you
- handled.
+ 1 Build a ListList. Each list has a header, which contains two lists (positive
+ and negative), a reset token, a baseCE, nextCE, and previousCE. The lists and
+ reset may be null.
+ 2 As you process, you keep a LAST pointer that points to the last token you
+ handled.
*/
static UColToken *ucol_tok_initAReset(UColTokenParser *src, UChar *expand, uint32_t *expandNext,
@@ -1136,7 +1136,7 @@ static UColToken *ucol_tok_initAReset(UColTokenParser *src, UChar *expand, uint3
sourceToken->flags = src->parsedToken.flags;
if(src->parsedToken.prefixOffset != 0) {
- // this is a syntax error
+ // this is a syntax error
*status = U_INVALID_FORMAT_ERROR;
syntaxError(src->source,src->parsedToken.charsOffset-1,src->parsedToken.charsOffset+src->parsedToken.charsLen,parseError);
return 0;
@@ -1160,13 +1160,13 @@ static UColToken *ucol_tok_initAReset(UColTokenParser *src, UChar *expand, uint3
src->lh[src->resultLen].reset = sourceToken;
/*
- 3 Consider each item: relation, source, and expansion: e.g. ...< x / y ...
- First convert all expansions into normal form. Examples:
- If "xy" doesn't occur earlier in the list or in the UCA, convert &xy * c *
- d * ... into &x * c/y * d * ...
- Note: reset values can never have expansions, although they can cause the
- very next item to have one. They may be contractions, if they are found
- earlier in the list.
+ 3 Consider each item: relation, source, and expansion: e.g. ...< x / y ...
+ First convert all expansions into normal form. Examples:
+ If "xy" doesn't occur earlier in the list or in the UCA, convert &xy * c *
+ d * ... into &x * c/y * d * ...
+ Note: reset values can never have expansions, although they can cause the
+ very next item to have one. They may be contractions, if they are found
+ earlier in the list.
*/
if(expand != NULL) {
/* check to see if there is an expansion */
@@ -1198,9 +1198,9 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
uint32_t CE, SecondCE;
uint32_t invPos;
if(sourceToken != NULL) {
- uprv_init_collIterate(src->UCA, src->source+((sourceToken->source)&0xFFFFFF), 1, &s);
+ uprv_init_collIterate(src->UCA, src->source+((sourceToken->source)&0xFFFFFF), 1, &s);
} else {
- uprv_init_collIterate(src->UCA, src->source+src->parsedToken.charsOffset /**charsOffset*/, 1, &s);
+ uprv_init_collIterate(src->UCA, src->source+src->parsedToken.charsOffset /**charsOffset*/, 1, &s);
}
baseCE = ucol_getNextCE(src->UCA, &s, status) & 0xFFFFFF3F;
@@ -1215,7 +1215,7 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
uint32_t expandNext = 0;
UColToken key;
- if((baseCE & 0xFF000000) >= (consts->UCA_PRIMARY_IMPLICIT_MIN<<24) && (baseCE & 0xFF000000) <= (consts->UCA_PRIMARY_IMPLICIT_MAX<<24) ) { /* implicits - */
+ if((baseCE & 0xFF000000) >= (consts->UCA_PRIMARY_IMPLICIT_MIN<<24) && (baseCE & 0xFF000000) <= (consts->UCA_PRIMARY_IMPLICIT_MAX<<24) ) { /* implicits - */
uint32_t primary = baseCE & UCOL_PRIMARYMASK | (baseContCE & UCOL_PRIMARYMASK) >> 16;
uint32_t raw = uprv_uca_getRawFromImplicit(primary);
ch = uprv_uca_getCodePointFromRaw(raw-1);
@@ -1248,7 +1248,7 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
src->lh[src->resultLen].indirect = FALSE;
- sourceToken = ucol_tok_initAReset(src, 0, &expandNext, parseError, status);
+ sourceToken = ucol_tok_initAReset(src, 0, &expandNext, parseError, status);
}
} else {
@@ -1256,11 +1256,11 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
// we got the previous CE. Now we need to see if the difference between
// the two CEs is really of the requested strength.
- // if it's a bigger difference (we asked for secondary and got primary), we
+ // if it's a bigger difference (we asked for secondary and got primary), we
// need to modify the CE.
if(ucol_getCEStrengthDifference(baseCE, baseContCE, CE, SecondCE) < strength) {
// adjust the strength
- // now we are in the situation where our baseCE should actually be modified in
+ // now we are in the situation where our baseCE should actually be modified in
// order to get the CE in the right position.
if(strength == UCOL_SECONDARY) {
CE = baseCE - 0x0200;
@@ -1282,8 +1282,8 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
// 1. There are many code points that have the same CE
// 2. The CE to codepoint table (things pointed to by CETable[3*invPos+2] are broken.
// Also, in case when there is no equivalent strength before an element, we have to actually
- // construct one. For example, &[before 2]a << x won't result in x << a, because the element
- // before a is a primary difference.
+ // construct one. For example, &[before 2]a << x won't result in x << a, because the element
+ // before a is a primary difference.
//uint32_t *CETable = (uint32_t *)((uint8_t *)src->invUCA+src->invUCA->table);
@@ -1294,7 +1294,7 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
uint16_t *conts = (uint16_t *)((uint8_t *)src->invUCA+src->invUCA->conts);
uint32_t offset = (ch & UCOL_INV_OFFSETMASK);
ch = conts[offset];
- }
+ }
*src->extraCurrent++ = (UChar)ch;
src->parsedToken.charsOffset = (uint32_t)(src->extraCurrent - src->source - 1);
@@ -1304,8 +1304,8 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
// example:
// &\u30ca = \u306a
// &[before 3]\u306a<<<\u306a|\u309d
-
-
+
+
// uint32_t key = (*newCharsLen << 24) | *charsOffset;
key.source = (src->parsedToken.charsLen/**newCharsLen*/ << 24) | src->parsedToken.charsOffset/**charsOffset*/;
key.rulesToParse = src->source;
@@ -1314,19 +1314,19 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
sourceToken = (UColToken *)uhash_get(src->tailored, &key);
#endif
- // here is how it should be. The situation such as &[before 1]a < x, should be
- // resolved exactly as if we wrote &a > x.
+ // here is how it should be. The situation such as &[before 1]a < x, should be
+ // resolved exactly as if we wrote &a > x.
// therefore, I don't really care if the UCA value before a has been changed.
// However, I do care if the strength between my element and the previous element
- // is bigger then I wanted. So, if CE < baseCE and I wanted &[before 2], then i'll
+ // is bigger then I wanted. So, if CE < baseCE and I wanted &[before 2], then i'll
// have to construct the base CE.
- // if we found a tailored thing, we have to use the UCA value and construct
+ // if we found a tailored thing, we have to use the UCA value and construct
// a new reset token with constructed name
//if(sourceToken != NULL && sourceToken->strength != UCOL_TOK_RESET) {
- // character to which we want to anchor is already tailored.
+ // character to which we want to anchor is already tailored.
// We need to construct a new token which will be the anchor
// point
//*(src->extraCurrent-1) = 0xFFFE;
@@ -1347,7 +1347,7 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
src->lh[src->resultLen].indirect = FALSE;
- sourceToken = ucol_tok_initAReset(src, 0, &expandNext, parseError, status);
+ sourceToken = ucol_tok_initAReset(src, 0, &expandNext, parseError, status);
//}
}
@@ -1364,7 +1364,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
uint16_t specs = 0;
UColTokListHeader *ListList = NULL;
- src->parsedToken.strength = UCOL_TOK_UNSET;
+ src->parsedToken.strength = UCOL_TOK_UNSET;
ListList = src->lh;
@@ -1374,8 +1374,8 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
while(src->current < src->end) {
src->parsedToken.prefixOffset = 0;
-
- parseEnd = ucol_tok_parseNextToken(src,
+
+ parseEnd = ucol_tok_parseNextToken(src,
(UBool)(lastToken == NULL),
parseError,
status);
@@ -1390,7 +1390,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
UColToken *sourceToken = NULL;
//uint32_t key = 0;
uint32_t lastStrength = UCOL_TOK_UNSET;
-
+
if(lastToken != NULL ) {
lastStrength = lastToken->strength;
}
@@ -1461,12 +1461,12 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
sourceToken->listHeader = lastToken->listHeader;
/*
- 1. Find the strongest strength in each list, and set strongestP and strongestN
- accordingly in the headers.
+ 1. Find the strongest strength in each list, and set strongestP and strongestN
+ accordingly in the headers.
*/
- if(lastStrength == UCOL_TOK_RESET
+ if(lastStrength == UCOL_TOK_RESET
|| sourceToken->listHeader->first == 0) {
- /* If LAST is a reset
+ /* If LAST is a reset
insert sourceToken in the list. */
if(sourceToken->listHeader->first == 0) {
sourceToken->listHeader->first = sourceToken;
@@ -1494,12 +1494,12 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
}
}
} else {
- /* Otherwise (when LAST is not a reset)
- if polarity (LAST) == polarity(relation), insert sourceToken after LAST,
- otherwise insert before.
- when inserting after or before, search to the next position with the same
+ /* Otherwise (when LAST is not a reset)
+ if polarity (LAST) == polarity(relation), insert sourceToken after LAST,
+ otherwise insert before.
+ when inserting after or before, search to the next position with the same
strength in that direction. (This is called postpone insertion). */
- if(sourceToken != lastToken) {
+ if(sourceToken != lastToken) {
if(lastToken->polarity == sourceToken->polarity) {
while(lastToken->next != NULL && lastToken->next->strength > sourceToken->strength) {
lastToken = lastToken->next;
@@ -1540,8 +1540,8 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
}
// Treat the expansions.
- // There are two types of expansions: explicit (x / y) and reset based propagating expansions
- // (&abc * d * e <=> &ab * d / c * e / c)
+ // There are two types of expansions: explicit (x / y) and reset based propagating expansions
+ // (&abc * d * e <=> &ab * d / c * e / c)
// if both of them are in effect for a token, they are combined.
sourceToken->expansion = src->parsedToken.extensionLen << 24 | src->parsedToken.extensionOffset;
@@ -1568,7 +1568,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
// if the previous token was a reset before, the strength of this
// token must match the strength of before. Otherwise we have an
// undefined situation.
- // In other words, we currently have a cludge which we use to
+ // In other words, we currently have a cludge which we use to
// represent &a >> x. This is written as &[before 2]a << x.
if((lastToken->flags & UCOL_TOK_BEFORE) != 0) {
uint8_t beforeStrength = (lastToken->flags & UCOL_TOK_BEFORE) - 1;
@@ -1606,7 +1606,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
if((specs & UCOL_TOK_BEFORE) != 0) { /* we're doing before */
if(top == FALSE) { /* there is no indirection */
uint8_t strength = (specs & UCOL_TOK_BEFORE) - 1;
- if(sourceToken != NULL && sourceToken->strength != UCOL_TOK_RESET) {
+ if(sourceToken != NULL && sourceToken->strength != UCOL_TOK_RESET) {
/* this is a before that is already ordered in the UCA - so we need to get the previous with good strength */
while(sourceToken->strength > strength && sourceToken->previous != NULL) {
sourceToken = sourceToken->previous;
@@ -1617,7 +1617,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
sourceToken = sourceToken->previous;
} else { /* start of list */
sourceToken = sourceToken->listHeader->reset;
- }
+ }
} else { /* we hit NULL */
/* we should be doing the else part */
sourceToken = sourceToken->listHeader->reset;
@@ -1640,7 +1640,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
uint32_t CE = UCOL_NOT_FOUND, SecondCE = UCOL_NOT_FOUND;
UCAConstants *consts = (UCAConstants *)((uint8_t *)src->UCA->image + src->UCA->image->UCAConsts);
- if((baseCE & 0xFF000000) >= (consts->UCA_PRIMARY_IMPLICIT_MIN<<24) && (baseCE & 0xFF000000) <= (consts->UCA_PRIMARY_IMPLICIT_MAX<<24) ) { /* implicits - */
+ if((baseCE & 0xFF000000) >= (consts->UCA_PRIMARY_IMPLICIT_MIN<<24) && (baseCE & 0xFF000000) <= (consts->UCA_PRIMARY_IMPLICIT_MAX<<24) ) { /* implicits - */
uint32_t primary = baseCE & UCOL_PRIMARYMASK | (baseContCE & UCOL_PRIMARYMASK) >> 16;
uint32_t raw = uprv_uca_getRawFromImplicit(primary);
uint32_t primaryCE = uprv_uca_getImplicitFromRaw(raw-1);
@@ -1661,19 +1661,19 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
}
- /* 5 If the relation is a reset:
- If sourceToken is null
- Create new list, create new sourceToken, make the baseCE from source, put
+ /* 5 If the relation is a reset:
+ If sourceToken is null
+ Create new list, create new sourceToken, make the baseCE from source, put
the sourceToken in ListHeader of the new list */
if(sourceToken == NULL) {
/*
- 3 Consider each item: relation, source, and expansion: e.g. ...< x / y ...
- First convert all expansions into normal form. Examples:
- If "xy" doesn't occur earlier in the list or in the UCA, convert &xy * c *
- d * ... into &x * c/y * d * ...
- Note: reset values can never have expansions, although they can cause the
- very next item to have one. They may be contractions, if they are found
- earlier in the list.
+ 3 Consider each item: relation, source, and expansion: e.g. ...< x / y ...
+ First convert all expansions into normal form. Examples:
+ If "xy" doesn't occur earlier in the list or in the UCA, convert &xy * c *
+ d * ... into &x * c/y * d * ...
+ Note: reset values can never have expansions, although they can cause the
+ very next item to have one. They may be contractions, if they are found
+ earlier in the list.
*/
if(top == FALSE) {
collIterate s;
@@ -1715,7 +1715,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
top = FALSE;
}
}
- /* 7 After all this, set LAST to point to sourceToken, and goto step 3. */
+ /* 7 After all this, set LAST to point to sourceToken, and goto step 3. */
lastToken = sourceToken;
} else {
if(U_FAILURE(*status)) {
@@ -1736,10 +1736,10 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
if(U_FAILURE(*status)) {
return;
}
-
+
// set everything to zero, so that we can clean up gracefully
uprv_memset(src, 0, sizeof(UColTokenParser));
-
+
// first we need to find options that don't like to be normalized,
// like copy and remove...
//const UChar *openBrace = rules;
@@ -1850,7 +1850,7 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
UCAConstants *consts = (UCAConstants *)((uint8_t *)src->UCA->image + src->UCA->image->UCAConsts);
// UCOL_RESET_TOP_VALUE
- setIndirectBoundaries(0, consts->UCA_LAST_NON_VARIABLE, consts->UCA_FIRST_IMPLICIT);
+ setIndirectBoundaries(0, consts->UCA_LAST_NON_VARIABLE, consts->UCA_FIRST_IMPLICIT);
// UCOL_FIRST_PRIMARY_IGNORABLE
setIndirectBoundaries(1, consts->UCA_FIRST_PRIMARY_IGNORABLE, 0);
// UCOL_LAST_PRIMARY_IGNORABLE
diff --git a/icu4c/source/i18n/unicode/decimfmt.h b/icu4c/source/i18n/unicode/decimfmt.h
index 5ef37c7bfd..4fe6d32c3b 100644
--- a/icu4c/source/i18n/unicode/decimfmt.h
+++ b/icu4c/source/i18n/unicode/decimfmt.h
@@ -809,7 +809,7 @@ public:
UnicodeString& appendTo,
FieldPosition& pos) const;
- /**
+ /**
* Format a Formattable using base-10 representation.
*
* @param obj The value to be formatted.
@@ -1649,7 +1649,7 @@ public:
private:
DecimalFormat(); // default constructor not implemented
- int32_t precision(UBool isIntegral) const;
+ int32_t precision(UBool isIntegral) const;
/**
* Do real work of constructing a new DecimalFormat.
@@ -1861,7 +1861,7 @@ protected:
* end up with lots of zeroes.
* @draft ICU 2.8
*/
- static const int32_t kMaxScientificIntegerDigits;
+ static const int32_t kMaxScientificIntegerDigits;
};
inline UnicodeString&
diff --git a/icu4c/source/i18n/unicode/numfmt.h b/icu4c/source/i18n/unicode/numfmt.h
index 6c00fe07e4..248c7b0188 100644
--- a/icu4c/source/i18n/unicode/numfmt.h
+++ b/icu4c/source/i18n/unicode/numfmt.h
@@ -303,8 +303,8 @@ public:
/**
* Format an int64 number. (Not abstract to retain compatibility
- * with earlier releases, however subclasses should override this
- * method as it just delegates to format(int32_t number...);
+ * with earlier releases, however subclasses should override this
+ * method as it just delegates to format(int32_t number...);
*
* @param number The value to be formatted.
* @param appendTo Output parameter to receive result.
diff --git a/icu4c/source/i18n/unicode/rbnf.h b/icu4c/source/i18n/unicode/rbnf.h
index d950361c0e..27f08ec446 100644
--- a/icu4c/source/i18n/unicode/rbnf.h
+++ b/icu4c/source/i18n/unicode/rbnf.h
@@ -704,7 +704,7 @@ public:
* @draft ICU 3.2
*/
virtual UnicodeString getRuleSetDisplayName(int32_t index,
- const Locale& locale = Locale::getDefault());
+ const Locale& locale = Locale::getDefault());
/**
* Return the rule set display name for the provided rule set and locale.
@@ -715,7 +715,7 @@ public:
* @see #getRuleSetDisplayNames
*/
virtual UnicodeString getRuleSetDisplayName(const UnicodeString& ruleSetName,
- const Locale& locale = Locale::getDefault());
+ const Locale& locale = Locale::getDefault());
/**
* Formats the specified 32-bit number using the default ruleset.
@@ -963,7 +963,7 @@ private:
// this will ref the localizations if they are not NULL
// caller must deref to get adoption
RuleBasedNumberFormat(const UnicodeString& description, LocalizationInfo* localizations,
- const Locale& locale, UParseError& perror, UErrorCode& status);
+ const Locale& locale, UParseError& perror, UErrorCode& status);
void init(const UnicodeString& rules, LocalizationInfo* localizations, UParseError& perror, UErrorCode& status);
void dispose();
diff --git a/icu4c/source/i18n/unicode/usearch.h b/icu4c/source/i18n/unicode/usearch.h
index b0d95f9084..61637871e1 100644
--- a/icu4c/source/i18n/unicode/usearch.h
+++ b/icu4c/source/i18n/unicode/usearch.h
@@ -258,7 +258,7 @@ U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter);
* header comments
* @param strsrch search iterator data struct
* @param position position to start next search from. If position is less
-* than or greater than the text range for searching,
+* than or greater than the text range for searching,
* an U_INDEX_OUTOFBOUNDS_ERROR will be returned
* @param status error status if any.
* @stable ICU 2.4
diff --git a/icu4c/source/i18n/unum.cpp b/icu4c/source/i18n/unum.cpp
index a023068244..652535ebb7 100644
--- a/icu4c/source/i18n/unum.cpp
+++ b/icu4c/source/i18n/unum.cpp
@@ -565,7 +565,7 @@ unum_getDoubleAttribute(const UNumberFormat* fmt,
UNumberFormatAttribute attr)
{
if (((const NumberFormat*)fmt)->getDynamicClassID() == DecimalFormat::getStaticClassID() &&
- attr == UNUM_ROUNDING_INCREMENT) {
+ attr == UNUM_ROUNDING_INCREMENT) {
return ((const DecimalFormat*)fmt)->getRoundingIncrement();
} else {
return -1.0;
@@ -578,7 +578,7 @@ unum_setDoubleAttribute( UNumberFormat* fmt,
double newValue)
{
if (((NumberFormat*)fmt)->getDynamicClassID() == DecimalFormat::getStaticClassID() &&
- attr == UNUM_ROUNDING_INCREMENT) {
+ attr == UNUM_ROUNDING_INCREMENT) {
((DecimalFormat*)fmt)->setRoundingIncrement(newValue);
}
}
@@ -635,16 +635,16 @@ unum_getTextAttribute(const UNumberFormat* fmt,
U_ASSERT(((const NumberFormat*)fmt)->getDynamicClassID() == RuleBasedNumberFormat::getStaticClassID());
const RuleBasedNumberFormat* rbnf = (const RuleBasedNumberFormat*)fmt;
if (tag == UNUM_DEFAULT_RULESET) {
- res = rbnf->getDefaultRuleSetName();
+ res = rbnf->getDefaultRuleSetName();
} else if (tag == UNUM_PUBLIC_RULESETS) {
- int32_t count = rbnf->getNumberOfRuleSetNames();
- for (int i = 0; i < count; ++i) {
- res += rbnf->getRuleSetName(i);
- res += (UChar)0x003b; // semicolon
- }
+ int32_t count = rbnf->getNumberOfRuleSetNames();
+ for (int i = 0; i < count; ++i) {
+ res += rbnf->getRuleSetName(i);
+ res += (UChar)0x003b; // semicolon
+ }
} else {
- *status = U_UNSUPPORTED_ERROR;
- return -1;
+ *status = U_UNSUPPORTED_ERROR;
+ return -1;
}
}
@@ -698,9 +698,9 @@ unum_setTextAttribute( UNumberFormat* fmt,
} else {
U_ASSERT(((NumberFormat*)fmt)->getDynamicClassID() == RuleBasedNumberFormat::getStaticClassID());
if (tag == UNUM_DEFAULT_RULESET) {
- ((RuleBasedNumberFormat*)fmt)->setDefaultRuleSet(newValue, *status);
+ ((RuleBasedNumberFormat*)fmt)->setDefaultRuleSet(newValue, *status);
} else {
- *status = U_UNSUPPORTED_ERROR;
+ *status = U_UNSUPPORTED_ERROR;
}
}
}
diff --git a/icu4c/source/test/cintltst/callcoll.c b/icu4c/source/test/cintltst/callcoll.c
index aa69806c55..f326312f7f 100644
--- a/icu4c/source/test/cintltst/callcoll.c
+++ b/icu4c/source/test/cintltst/callcoll.c
@@ -1133,13 +1133,13 @@ TestJitterbug1098(){
u_uastrcpy(rule, rules[i]);
c1 = ucol_openRules(rule, u_strlen(rule), UCOL_OFF, UCOL_DEFAULT_STRENGTH, &parseError, &status);
if(U_FAILURE(status)){
- log_err("Could not parse the rules syntax. Error: %s ", u_errorName(status));
+ log_err("Could not parse the rules syntax. Error: %s ", u_errorName(status));
- if (status == U_PARSE_ERROR) {
- u_UCharsToChars(parseError.preContext,preContext,20);
- u_UCharsToChars(parseError.postContext,postContext,20);
- log_verbose("\n\tPre-Context: %s \n\tPost-Context:%s \n",preContext,postContext);
- }
+ if (status == U_PARSE_ERROR) {
+ u_UCharsToChars(parseError.preContext,preContext,20);
+ u_UCharsToChars(parseError.postContext,postContext,20);
+ log_verbose("\n\tPre-Context: %s \n\tPost-Context:%s \n",preContext,postContext);
+ }
return;
}
diff --git a/icu4c/source/test/cintltst/capitst.c b/icu4c/source/test/cintltst/capitst.c
index 0cc9a8eb5c..ead9a247b4 100644
--- a/icu4c/source/test/cintltst/capitst.c
+++ b/icu4c/source/test/cintltst/capitst.c
@@ -30,7 +30,7 @@
#include "putilimp.h"
static void TestAttribute(void);
- int TestBufferSize(); /* defined in "colutil.c" */
+ int TestBufferSize(); /* defined in "colutil.c" */
@@ -517,10 +517,10 @@ void TestRuleBasedColl()
/* testing with en since thai has its own tailoring */
uint32_t ce = ucol_next(iter1, &status);
uint32_t ce2 = ucol_next(iter2, &status);
- if(U_FAILURE(status)) {
+ if(U_FAILURE(status)) {
log_err("ERROR: CollationElement iterator creation failed.: %s\n", myErrorName(status));
return;
- }
+ }
if (ce2 != ce) {
log_err("! modifier test failed");
}
diff --git a/icu4c/source/test/cintltst/cbiapts.c b/icu4c/source/test/cintltst/cbiapts.c
index 1e0af34470..86f3f793f2 100644
--- a/icu4c/source/test/cintltst/cbiapts.c
+++ b/icu4c/source/test/cintltst/cbiapts.c
@@ -81,7 +81,7 @@ static UChar* toUChar(const char *src, void **freeHook) {
return NULL;
};
- cnv = ucnv_open(NULL, &status);
+ cnv = ucnv_open(NULL, &status);
if(U_FAILURE(status) || cnv == NULL) {
return NULL;
}
diff --git a/icu4c/source/test/cintltst/cbididat.c b/icu4c/source/test/cintltst/cbididat.c
index ffdb58e206..4b804ff968 100644
--- a/icu4c/source/test/cintltst/cbididat.c
+++ b/icu4c/source/test/cintltst/cbididat.c
@@ -315,47 +315,47 @@ testLevels20[]={
static const uint8_t
testText16[]={
- L, L, L, WS, L, L, L, WS, L, L, L
+ L, L, L, WS, L, L, L, WS, L, L, L
};
static const UBiDiLevel
testLevels21[]={
- 2, 2, 2, 2, 2, 2, 2, 1
+ 2, 2, 2, 2, 2, 2, 2, 1
};
static const uint8_t
testVisualMap20[]={
- 1, 2, 3, 4, 5, 6, 7, 0
+ 1, 2, 3, 4, 5, 6, 7, 0
};
static const uint8_t
testText17[]={
- R, R, R, WS, R, R, R, WS, R, R, R
+ R, R, R, WS, R, R, R, WS, R, R, R
};
static const UBiDiLevel
testLevels22[]={
- 1, 1, 1, 1, 1, 1, 1, 0
+ 1, 1, 1, 1, 1, 1, 1, 0
};
static const uint8_t
testVisualMap21[]={
- 6, 5, 4, 3, 2, 1, 0, 7
+ 6, 5, 4, 3, 2, 1, 0, 7
};
static const uint8_t
testTextXX[]={
- L
+ L
};
static const UBiDiLevel
testLevelsXX[]={
- 2
+ 2
};
static const uint8_t
testVisualMapXX[]={
- 0
+ 0
};
BiDiTestData
@@ -420,12 +420,12 @@ tests[]={
{testText15, ARRAY_LENGTH(testText15), UBIDI_DEFAULT_LTR, 2, 3,
UBIDI_LTR, 2,
testLevels20, testVisualMap19},
- {testText16, ARRAY_LENGTH(testText16), UBIDI_RTL, 0, 8,
- UBIDI_MIXED, 1,
- testLevels21, testVisualMap20},
- {testText17, ARRAY_LENGTH(testText17), UBIDI_LTR, 0, 8,
- UBIDI_MIXED, 0,
- testLevels22, testVisualMap21},
+ {testText16, ARRAY_LENGTH(testText16), UBIDI_RTL, 0, 8,
+ UBIDI_MIXED, 1,
+ testLevels21, testVisualMap20},
+ {testText17, ARRAY_LENGTH(testText17), UBIDI_LTR, 0, 8,
+ UBIDI_MIXED, 0,
+ testLevels22, testVisualMap21},
{testTextXX, ARRAY_LENGTH(testTextXX), UBIDI_RTL, -1, -1,
UBIDI_MIXED, 1, testLevelsXX, testVisualMapXX}
};
diff --git a/icu4c/source/test/cintltst/cbiditst.c b/icu4c/source/test/cintltst/cbiditst.c
index cf67e629e2..21f0d35cb8 100644
--- a/icu4c/source/test/cintltst/cbiditst.c
+++ b/icu4c/source/test/cintltst/cbiditst.c
@@ -123,7 +123,7 @@ doBiDiTest() {
pLine=ubidi_open();
if(pLine!=NULL) {
doTests(pBiDi, pLine, FALSE);
- doTests(pBiDi, pLine, TRUE);
+ doTests(pBiDi, pLine, TRUE);
} else {
log_err("ubidi_open() returned NULL, out of memory\n");
}
@@ -463,18 +463,18 @@ doTest(UBiDi *pBiDi, int testNumber, BiDiTestData *test, int32_t lineStart, UBoo
UErrorCode errorCode=U_ZERO_ERROR;
UBiDiLevel level, level2;
- if (countRunsFirst) {
- log_verbose("Calling ubidi_countRuns() first.\n");
+ if (countRunsFirst) {
+ log_verbose("Calling ubidi_countRuns() first.\n");
- runCount = ubidi_countRuns(pBiDi, &errorCode);
+ runCount = ubidi_countRuns(pBiDi, &errorCode);
- if(U_FAILURE(errorCode)) {
- log_err("ubidi_countRuns(tests[%d]): error %s\n", testNumber, myErrorName(errorCode));
- return;
- }
- } else {
- log_verbose("Calling ubidi_getLogicalMap() first.\n");
- }
+ if(U_FAILURE(errorCode)) {
+ log_err("ubidi_countRuns(tests[%d]): error %s\n", testNumber, myErrorName(errorCode));
+ return;
+ }
+ } else {
+ log_verbose("Calling ubidi_getLogicalMap() first.\n");
+ }
testReordering(pBiDi, testNumber);
@@ -529,13 +529,13 @@ doTest(UBiDi *pBiDi, int testNumber, BiDiTestData *test, int32_t lineStart, UBoo
}
}
- if (! countRunsFirst) {
- runCount=ubidi_countRuns(pBiDi, &errorCode);
- if(U_FAILURE(errorCode)) {
- log_err("ubidi_countRuns(tests[%d]): error %s\n", testNumber, myErrorName(errorCode));
- return;
- }
- }
+ if (! countRunsFirst) {
+ runCount=ubidi_countRuns(pBiDi, &errorCode);
+ if(U_FAILURE(errorCode)) {
+ log_err("ubidi_countRuns(tests[%d]): error %s\n", testNumber, myErrorName(errorCode));
+ return;
+ }
+ }
for(logicalIndex=0; logicalIndex>16);
- t = (t1 & 0xFFFF0000)|((t2 & 0xFFFF0000)>>16);
+ s = (s1 & 0xFFFF0000)|((s2 & 0xFFFF0000)>>16);
+ t = (t1 & 0xFFFF0000)|((t2 & 0xFFFF0000)>>16);
if(s < t) {
return -1;
} else if(s > t) {
@@ -1049,8 +1049,8 @@ typedef struct {
/* primary ignorable). */
static indirectBoundaries ucolIndirectBoundaries[15];
static UBool indirectBoundariesSet = FALSE;
-static void setIndirectBoundaries(uint32_t indexR, uint32_t *start, uint32_t *end) {
-
+static void setIndirectBoundaries(uint32_t indexR, uint32_t *start, uint32_t *end) {
+
/* Set values for the top - TODO: once we have values for all the indirects, we are going */
/* to initalize here. */
ucolIndirectBoundaries[indexR].startCE = start[0];
@@ -1096,7 +1096,7 @@ static void testCEs(UCollator *coll, UErrorCode *status) {
UCAConstants *consts = (UCAConstants *)((uint8_t *)UCA->image + UCA->image->UCAConsts);
uint32_t UCOL_RESET_TOP_VALUE = consts->UCA_LAST_NON_VARIABLE[0], /*UCOL_RESET_TOP_CONT = consts->UCA_LAST_NON_VARIABLE[1], */
UCOL_NEXT_TOP_VALUE = consts->UCA_FIRST_IMPLICIT[0], UCOL_NEXT_TOP_CONT = consts->UCA_FIRST_IMPLICIT[1];
-
+
baseCE=baseContCE=nextCE=nextContCE=currCE=currContCE=lastCE=lastContCE = UCOL_NOT_FOUND;
src.opts = &opts;
@@ -1107,7 +1107,7 @@ static void testCEs(UCollator *coll, UErrorCode *status) {
if(indirectBoundariesSet == FALSE) {
/* UCOL_RESET_TOP_VALUE */
- setIndirectBoundaries(0, consts->UCA_LAST_NON_VARIABLE, consts->UCA_FIRST_IMPLICIT);
+ setIndirectBoundaries(0, consts->UCA_LAST_NON_VARIABLE, consts->UCA_FIRST_IMPLICIT);
/* UCOL_FIRST_PRIMARY_IGNORABLE */
setIndirectBoundaries(1, consts->UCA_FIRST_PRIMARY_IGNORABLE, 0);
/* UCOL_LAST_PRIMARY_IGNORABLE */
@@ -1182,7 +1182,7 @@ static void testCEs(UCollator *coll, UErrorCode *status) {
before = (UBool)((specs & UCOL_TOK_BEFORE) != 0);
if(top_ == TRUE) {
int32_t index = src.parsedToken.indirectIndex;
-
+
nextCE = baseCE = currCE = ucolIndirectBoundaries[index].startCE;
nextContCE = baseContCE = currContCE = ucolIndirectBoundaries[index].startContCE;
} else {
@@ -1479,7 +1479,7 @@ static void TestImplicitTailoring(void) {
const char *rules;
const char *data[50];
const uint32_t len;
- } tests[] = {
+ } tests[] = {
{ "&[before 1]\\u4e00 < b < c &[before 1]\\u4e00 < d < e", { "d", "e", "b", "c", "\\u4e00"}, 5 },
{ "&\\u4e00 < a <<< A < b <<< B", { "\\u4e00", "a", "A", "b", "B", "\\u4e01"}, 6 },
{ "&[before 1]\\u4e00 < \\u4e01 < \\u4e02", { "\\u4e01", "\\u4e02", "\\u4e00"}, 3},
@@ -1591,7 +1591,7 @@ static void TestComposeDecompose(void) {
nfcSize = unorm_normalize(comp, len, UNORM_NFC, 0, t[noCases]->NFC, NORM_BUFFER_TEST_LEN, &status);
nfdSize = unorm_normalize(comp, len, UNORM_NFD, 0, t[noCases]->NFD, NORM_BUFFER_TEST_LEN, &status);
- if(nfcSize != nfdSize || (uprv_memcmp(t[noCases]->NFC, t[noCases]->NFD, nfcSize * sizeof(UChar)) != 0)
+ if(nfcSize != nfdSize || (uprv_memcmp(t[noCases]->NFC, t[noCases]->NFD, nfcSize * sizeof(UChar)) != 0)
|| (len != nfdSize || (uprv_memcmp(comp, t[noCases]->NFD, nfdSize * sizeof(UChar)) != 0))) {
t[noCases]->u = u;
if(len != nfdSize || (uprv_memcmp(comp, t[noCases]->NFD, nfdSize * sizeof(UChar)) != 0)) {
@@ -1601,7 +1601,7 @@ static void TestComposeDecompose(void) {
noCases++;
t[noCases] = (tester *)malloc(sizeof(tester));
uprv_memset(t[noCases], 0, sizeof(tester));
- }
+ }
}
for(u=0; u<(UChar32)noCases; u++) {
@@ -1831,8 +1831,8 @@ static void TestRedundantRules(void) {
uint32_t testdatalen;
} tests[] = {
/* this test conflicts with positioning of CODAN placeholder */
- /*{
- "& a <<< b <<< c << d <<< e& [before 1] e <<< x",
+ /*{
+ "& a <<< b <<< c << d <<< e& [before 1] e <<< x",
"&\\u2089<< 0*/
+ if(1) { /* QUICK > 0*/
log_verbose("Slide variable top over UCARules\n");
rulesLen = ucol_getRulesEx(coll, UCOL_FULL_RULES, rulesCopy, 0);
rulesCopy = (UChar *)malloc((rulesLen+UCOL_TOK_EXTRA_RULE_SPACE_SIZE)*sizeof(UChar));
@@ -2915,7 +2915,7 @@ static void TestVariableTopSetting(void) {
src.current = src.source = rulesCopy;
src.end = rulesCopy+rulesLen;
src.extraCurrent = src.end;
- src.extraEnd = src.end+UCOL_TOK_EXTRA_RULE_SPACE_SIZE;
+ src.extraEnd = src.end+UCOL_TOK_EXTRA_RULE_SPACE_SIZE;
while ((current = ucol_tok_parseNextToken(&src, startOfRules, &parseError,&status)) != NULL) {
strength = src.parsedToken.strength;
@@ -2955,10 +2955,10 @@ static void TestVariableTopSetting(void) {
log_verbose("= Expected failure for %s =", buffer);
} else {
if(s.pos == s.endp) {
- log_err("Unexpected failure setting variable top at offset %d. Error %s. Codepoints: %s\n",
+ log_err("Unexpected failure setting variable top at offset %d. Error %s. Codepoints: %s\n",
oldChOffset, u_errorName(status), buffer);
} else {
- log_verbose("There is a goofy contraction in UCA rules that does not appear in the fractional UCA. Codepoints: %s\n",
+ log_verbose("There is a goofy contraction in UCA rules that does not appear in the fractional UCA. Codepoints: %s\n",
buffer);
}
}
@@ -3193,15 +3193,15 @@ static void TestPrefix(void) {
const char *rules;
const char *data[50];
const uint32_t len;
- } tests[] = {
- { "&z <<< z|a",
+ } tests[] = {
+ { "&z <<< z|a",
{"zz", "za"}, 2 },
- { "&z <<< z| a",
+ { "&z <<< z| a",
{"zz", "za"}, 2 },
{ "[strength I]"
"&a=\\ud900\\udc25"
- "&z<<<\\ud900\\udc25|a",
+ "&z<<<\\ud900\\udc25|a",
{"aa", "az", "\\ud900\\udc25z", "\\ud900\\udc25a", "zz"}, 4 },
};
@@ -3227,7 +3227,7 @@ static void TestNewJapanese(void) {
"\\u30c6\\u30fc\\u30bf",
"\\u30c6\\u30a7\\u30bf",
"\\u3066\\u3048\\u305f",
- "\\u3067\\u30fc\\u305f",
+ "\\u3067\\u30fc\\u305f",
"\\u30c7\\u30fc\\u30bf",
"\\u30c7\\u30a7\\u30bf",
"\\u3067\\u3048\\u305f",
@@ -3251,7 +3251,7 @@ static void TestNewJapanese(void) {
"\\u30d2\\u30e5\\u30a6",
"\\u30d2\\u30e6\\u30a6",
"\\u30d4\\u30e5\\u30a6\\u30a2",
- "\\u3073\\u3085\\u30fc\\u3042\\u30fc",
+ "\\u3073\\u3085\\u30fc\\u3042\\u30fc",
"\\u30d3\\u30e5\\u30fc\\u30a2\\u30fc",
"\\u30d3\\u30e5\\u30a6\\u30a2\\u30fc",
"\\u3072\\u3085\\u3093",
@@ -3388,7 +3388,7 @@ static void TestContractionClosure(void) {
const char *rules;
const char *data[50];
const uint32_t len;
- } tests[] = {
+ } tests[] = {
{ "&b=\\u00e4\\u00e4",
{ "b", "\\u00e4\\u00e4", "a\\u0308a\\u0308", "\\u00e4a\\u0308", "a\\u0308\\u00e4" }, 5},
{ "&b=\\u00C5",
@@ -3408,13 +3408,13 @@ static void TestBeforePrefixFailure(void) {
const char *rules;
const char *data[50];
const uint32_t len;
- } tests[] = {
+ } tests[] = {
{ "&g <<< a"
"&[before 3]\\uff41 <<< x",
{"x", "\\uff41"}, 2 },
{ "&\\u30A7=\\u30A7=\\u3047=\\uff6a"
"&\\u30A8=\\u30A8=\\u3048=\\uff74"
- "&[before 3]\\u30a7<<<\\u30a9",
+ "&[before 3]\\u30a7<<<\\u30a9",
{"\\u30a9", "\\u30a7"}, 2 },
{ "&[before 3]\\u30a7<<<\\u30a9"
"&\\u30A7=\\u30A7=\\u3047=\\uff6a"
@@ -3429,16 +3429,16 @@ static void TestBeforePrefixFailure(void) {
}
#if 0
- const char* rule1 =
+ const char* rule1 =
"&\\u30A7=\\u30A7=\\u3047=\\uff6a"
"&\\u30A8=\\u30A8=\\u3048=\\uff74"
"&[before 3]\\u30a7<<<\\u30c6|\\u30fc";
- const char* rule2 =
+ const char* rule2 =
"&[before 3]\\u30a7<<<\\u30c6|\\u30fc"
"&\\u30A7=\\u30A7=\\u3047=\\uff6a"
"&\\u30A8=\\u30A8=\\u3048=\\uff74";
const char* test[] = {
- "\\u30c6\\u30fc\\u30bf",
+ "\\u30c6\\u30fc\\u30bf",
"\\u30c6\\u30a7\\u30bf",
};
genericRulesStarter(rule1, test, sizeof(test)/sizeof(test[0]));
@@ -3446,7 +3446,7 @@ static void TestBeforePrefixFailure(void) {
/* this piece of code should be in some sort of verbose mode */
/* it gets the collation elements for elements and prints them */
/* This is useful when trying to see whether the problem is */
- {
+ {
UErrorCode status = U_ZERO_ERROR;
uint32_t i = 0;
UCollationElements *it = NULL;
@@ -3481,15 +3481,15 @@ static void TestBeforePrefixFailure(void) {
}
static void TestPrefixCompose(void) {
- const char* rule1 =
+ const char* rule1 =
"&\\u30a7<<<\\u30ab|\\u30fc=\\u30ac|\\u30fc";
/*
const char* test[] = {
- "\\u30c6\\u30fc\\u30bf",
+ "\\u30c6\\u30fc\\u30bf",
"\\u30c6\\u30a7\\u30bf",
};
*/
- {
+ {
UErrorCode status = U_ZERO_ERROR;
/*uint32_t i = 0;*/
/*UCollationElements *it = NULL;*/
@@ -3508,60 +3508,60 @@ static void TestPrefixCompose(void) {
}
/*
-[last variable] last variable value
-[last primary ignorable] largest CE for primary ignorable
-[last secondary ignorable] largest CE for secondary ignorable
-[last tertiary ignorable] largest CE for tertiary ignorable
-[top] guaranteed to be above all implicit CEs, for now and in the future (in 1.8)
+[last variable] last variable value
+[last primary ignorable] largest CE for primary ignorable
+[last secondary ignorable] largest CE for secondary ignorable
+[last tertiary ignorable] largest CE for tertiary ignorable
+[top] guaranteed to be above all implicit CEs, for now and in the future (in 1.8)
*/
static void TestRuleOptions(void) {
- /* values here are hardcoded and are correct for the current UCA
- * when the UCA changes, one might be forced to change these
+ /* values here are hardcoded and are correct for the current UCA
+ * when the UCA changes, one might be forced to change these
* values. (\\u02d0, \\U00010FFFC etc...)
*/
static struct {
const char *rules;
const char *data[50];
const uint32_t len;
- } tests[] = {
+ } tests[] = {
/* - all befores here amount to zero */
- { "&[before 3][first tertiary ignorable]<< s2
-weiv will check - could be a problem with utf-8 iterator
-cycheng@ca.ibm.c... but if we use the utf-8 iterator, i.e. s1 = efbfbc62 and s2 = eda08021, we have s1 < s2
-weiv hmmm
-cycheng@ca.ibm.c... note that we have a standalone high surrogate
-weiv that doesn't sound right
-cycheng@ca.ibm.c... we got the same inconsistent results on AIX and Win2000
-weiv so you have two strings, you convert them to utf-8 and to utf-16BE
-cycheng@ca.ibm.c... yes
-weiv and then do the comparison
-cycheng@ca.ibm.c... in one case, the input strings are in utf8, and in the other case the input strings are in utf-16be
-weiv utf-16 strings look like a little endian ones in the example you sent me
-weiv It could be a bug - let me try to test it out
-cycheng@ca.ibm.c... ok
-cycheng@ca.ibm.c... we can wait till the conf. call
-cycheng@ca.ibm.c... next weke
-weiv that would be great
-weiv hmmm
-weiv I might be wrong
-weiv let me play with it some more
-cycheng@ca.ibm.c... ok
-cycheng@ca.ibm.c... also please check s3 = 0x0e3a0062 and s4 = 0x0e400021. both are in utf-16be
-cycheng@ca.ibm.c... seems with icu 2.2 we have s3 > s4, but not in icu 2.4 that's built for db2
-cycheng@ca.ibm.c... also s1 & s2 that I sent you earlier are also in utf-16be
-weiv ok
-cycheng@ca.ibm.c... i ask sherman to send you more inconsistent data
-weiv thanks
-cycheng@ca.ibm.c... the 4 strings we sent are just samples
+cycheng@ca.ibm.c... we got inconsistent results when using the UTF-16BE iterator and the UTF-8 iterator.
+weiv ucol_strcollIter?
+cycheng@ca.ibm.c... e.g. s1 = 0xfffc0062, and s2 = d8000021
+weiv these are the input strings?
+cycheng@ca.ibm.c... yes, using the utf-16 iterator and UCA with normalization on, we have s1 > s2
+weiv will check - could be a problem with utf-8 iterator
+cycheng@ca.ibm.c... but if we use the utf-8 iterator, i.e. s1 = efbfbc62 and s2 = eda08021, we have s1 < s2
+weiv hmmm
+cycheng@ca.ibm.c... note that we have a standalone high surrogate
+weiv that doesn't sound right
+cycheng@ca.ibm.c... we got the same inconsistent results on AIX and Win2000
+weiv so you have two strings, you convert them to utf-8 and to utf-16BE
+cycheng@ca.ibm.c... yes
+weiv and then do the comparison
+cycheng@ca.ibm.c... in one case, the input strings are in utf8, and in the other case the input strings are in utf-16be
+weiv utf-16 strings look like a little endian ones in the example you sent me
+weiv It could be a bug - let me try to test it out
+cycheng@ca.ibm.c... ok
+cycheng@ca.ibm.c... we can wait till the conf. call
+cycheng@ca.ibm.c... next weke
+weiv that would be great
+weiv hmmm
+weiv I might be wrong
+weiv let me play with it some more
+cycheng@ca.ibm.c... ok
+cycheng@ca.ibm.c... also please check s3 = 0x0e3a0062 and s4 = 0x0e400021. both are in utf-16be
+cycheng@ca.ibm.c... seems with icu 2.2 we have s3 > s4, but not in icu 2.4 that's built for db2
+cycheng@ca.ibm.c... also s1 & s2 that I sent you earlier are also in utf-16be
+weiv ok
+cycheng@ca.ibm.c... i ask sherman to send you more inconsistent data
+weiv thanks
+cycheng@ca.ibm.c... the 4 strings we sent are just samples
*/
#if 0
static void Alexis(void) {
@@ -3703,7 +3703,7 @@ static void Alexis2(void) {
UErrorCode status = U_ZERO_ERROR;
UChar U16Source[CMSCOLL_ALEXIS2_BUFFER_SIZE], U16Target[CMSCOLL_ALEXIS2_BUFFER_SIZE];
char U16BESource[CMSCOLL_ALEXIS2_BUFFER_SIZE], U16BETarget[CMSCOLL_ALEXIS2_BUFFER_SIZE];
- char U8Source[CMSCOLL_ALEXIS2_BUFFER_SIZE], U8Target[CMSCOLL_ALEXIS2_BUFFER_SIZE];
+ char U8Source[CMSCOLL_ALEXIS2_BUFFER_SIZE], U8Target[CMSCOLL_ALEXIS2_BUFFER_SIZE];
int32_t U16LenS = 0, U16LenT = 0, U16BELenS = 0, U16BELenT = 0, U8LenS = 0, U8LenT = 0;
UConverter *conv = NULL;
@@ -3822,7 +3822,7 @@ static void TestHebrewUCA(void) {
static void TestPartialSortKeyTermination(void) {
const char* cases[] = {
"\\u1234\\u1234\\udc00",
- "\\udc00\\ud800\\ud800"
+ "\\udc00\\ud800\\ud800"
};
int32_t i = sizeof(UCollator);
@@ -4069,36 +4069,36 @@ static void TestNumericCollation(void)
{
UErrorCode status = U_ZERO_ERROR;
- const static char *basicTestStrings[]={
- "hello1",
- "hello2",
- "hello2002",
- "hello2003",
- "hello123456",
- "hello1234567",
- "hello10000000",
- "hello100000000",
- "hello1000000000",
- "hello10000000000",
- };
-
- const static char *preZeroTestStrings[]={
- "avery10000",
- "avery010000",
- "avery0010000",
- "avery00010000",
- "avery000010000",
- "avery0000010000",
- "avery00000010000",
- "avery000000010000",
- };
-
- const static char *thirtyTwoBitNumericStrings[]={
- "avery42949672960",
- "avery42949672961",
- "avery42949672962",
- "avery429496729610"
- };
+ const static char *basicTestStrings[]={
+ "hello1",
+ "hello2",
+ "hello2002",
+ "hello2003",
+ "hello123456",
+ "hello1234567",
+ "hello10000000",
+ "hello100000000",
+ "hello1000000000",
+ "hello10000000000",
+ };
+
+ const static char *preZeroTestStrings[]={
+ "avery10000",
+ "avery010000",
+ "avery0010000",
+ "avery00010000",
+ "avery000010000",
+ "avery0000010000",
+ "avery00000010000",
+ "avery000000010000",
+ };
+
+ const static char *thirtyTwoBitNumericStrings[]={
+ "avery42949672960",
+ "avery42949672961",
+ "avery42949672962",
+ "avery429496729610"
+ };
const static char *supplementaryDigits[] = {
"\\uD835\\uDFCE", /* 0 */
@@ -4138,7 +4138,7 @@ static void TestNumericCollation(void)
UColAttribute att = UCOL_NUMERIC_COLLATION;
UColAttributeValue val = UCOL_ON;
- /* Open our collator. */
+ /* Open our collator. */
UCollator* coll = ucol_open("root", &status);
if (U_FAILURE(status)){
log_err("ERROR: in using ucol_open()\n %s\n",
@@ -4148,33 +4148,33 @@ static void TestNumericCollation(void)
genericLocaleStarterWithOptions("root", basicTestStrings, sizeof(basicTestStrings)/sizeof(basicTestStrings[0]), &att, &val, 1);
genericLocaleStarterWithOptions("root", thirtyTwoBitNumericStrings, sizeof(thirtyTwoBitNumericStrings)/sizeof(thirtyTwoBitNumericStrings[0]), &att, &val, 1);
genericLocaleStarterWithOptions("en_US", foreignDigits, sizeof(foreignDigits)/sizeof(foreignDigits[0]), &att, &val, 1);
- genericLocaleStarterWithOptions("root", supplementaryDigits, sizeof(supplementaryDigits)/sizeof(supplementaryDigits[0]), &att, &val, 1);
- genericLocaleStarterWithOptions("root", evenZeroes, sizeof(evenZeroes)/sizeof(evenZeroes[0]), &att, &val, 1);
+ genericLocaleStarterWithOptions("root", supplementaryDigits, sizeof(supplementaryDigits)/sizeof(supplementaryDigits[0]), &att, &val, 1);
+ genericLocaleStarterWithOptions("root", evenZeroes, sizeof(evenZeroes)/sizeof(evenZeroes[0]), &att, &val, 1);
- /* Setting up our collator to do digits. */
- ucol_setAttribute(coll, UCOL_NUMERIC_COLLATION, UCOL_ON, &status);
+ /* Setting up our collator to do digits. */
+ ucol_setAttribute(coll, UCOL_NUMERIC_COLLATION, UCOL_ON, &status);
if (U_FAILURE(status)){
log_err("ERROR: in setting UCOL_NUMERIC_COLLATION as an attribute\n %s\n",
myErrorName(status));
return;
}
- /*
- Testing that prepended zeroes still yield the correct collation behavior.
+ /*
+ Testing that prepended zeroes still yield the correct collation behavior.
We expect that every element in our strings array will be equal.
*/
genericOrderingTestWithResult(coll, preZeroTestStrings, sizeof(preZeroTestStrings)/sizeof(preZeroTestStrings[0]), UCOL_EQUAL);
-
+
ucol_close(coll);
}
-static void TestTibetanConformance(void)
-{
- const char* test[] = {
- "\\u0FB2\\u0591\\u0F71\\u0061",
+static void TestTibetanConformance(void)
+{
+ const char* test[] = {
+ "\\u0FB2\\u0591\\u0F71\\u0061",
"\\u0FB2\\u0F71\\u0061"
};
-
+
UErrorCode status = U_ZERO_ERROR;
UCollator *coll = ucol_open("", &status);
UChar source[100];
@@ -4188,7 +4188,7 @@ static void TestTibetanConformance(void)
result = ucol_strcoll(coll, source, -1, target, -1);
log_verbose("result %d\n", result);
if (UCOL_EQUAL != result) {
- log_err("Tibetan comparison error\n");
+ log_err("Tibetan comparison error\n");
}
}
ucol_close(coll);
@@ -4210,7 +4210,7 @@ static void TestPinyinProblem(void) {
static void showImplicit(UChar32 i) {
if (i >= 0 && i <= TST_UCOL_MAX_INPUT) {
log_verbose("%08X\t%08X\n", i, uprv_uca_getImplicitFromRaw(i));
- }
+ }
}
static void TestImplicitGeneration(void) {
@@ -4229,16 +4229,16 @@ static void TestImplicitGeneration(void) {
log_err("Couldn't open UCA\n");
return;
}
-
+
uprv_uca_getRawFromImplicit(0xE20303E7);
for (i = 0; i <= TST_UCOL_MAX_INPUT; ++i) {
current = uprv_uca_getImplicitFromRaw(i) & fourBytes;
-
+
/* check that it round-trips AND that all intervening ones are illegal*/
roundtrip = uprv_uca_getRawFromImplicit(current);
if (roundtrip != i) {
- log_err("No roundtrip %08X\n", i);
+ log_err("No roundtrip %08X\n", i);
}
if (last != 0) {
for (j = last + 1; j < current; ++j) {
@@ -4272,7 +4272,7 @@ static void TestImplicitGeneration(void) {
}
showImplicit(TST_UCOL_MAX_INPUT-2);
showImplicit(TST_UCOL_MAX_INPUT-1);
- showImplicit(TST_UCOL_MAX_INPUT);
+ showImplicit(TST_UCOL_MAX_INPUT);
ucol_close(coll);
}
@@ -4382,7 +4382,7 @@ ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
assertEquals("getFunctionalEquivalent(fr)", "fr", loc);
assertTrue("getFunctionalEquivalent(fr).isAvailable==TRUE",
isAvailable == TRUE);
-
+
n = ucol_getFunctionalEquivalent(loc, sizeof(loc), "collation", "fr_FR",
&isAvailable, &ec);
assertSuccess("getFunctionalEquivalent", &ec);
@@ -4393,7 +4393,7 @@ ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
/* supercedes TestJ784 */
static void TestBeforePinyin(void) {
- const static char rules[] = {
+ const static char rules[] = {
"&[before 2]A<<\\u0101<<<\\u0100<<\\u00E1<<<\\u00C1<<\\u01CE<<<\\u01CD<<\\u00E0<<<\\u00C0"
"&[before 2]e<<\\u0113<<<\\u0112<<\\u00E9<<<\\u00C9<<\\u011B<<<\\u011A<<\\u00E8<<<\\u00C8"
"&[before 2]i<<\\u012B<<<\\u012A<<\\u00ED<<<\\u00CD<<\\u01D0<<<\\u01CF<<\\u00EC<<<\\u00CC"
@@ -4575,9 +4575,9 @@ static void TestMoreBefore(void) {
{ "m","M","x","X","q","Q","a","z","n" }, 9},
{ "&m << a &[before 3] a <<< x <<< X << q <<< Q < z",
{ "m","M","x","X","a","q","Q","z","n" }, 9},
- { "&m <<< a &[before 1] a < x <<< X << q <<< Q < z",
+ { "&m <<< a &[before 1] a < x <<< X << q <<< Q < z",
{ "x","X","q","Q","z","n","m","a","M" }, 9},
- { "&m <<< a &[before 2] a << x <<< X << q <<< Q < z",
+ { "&m <<< a &[before 2] a << x <<< X << q <<< Q < z",
{ "x","X","q","Q","m","a","M","z","n" }, 9},
{ "&m <<< a &[before 3] a <<< x <<< X << q <<< Q < z",
{ "m","x","X","a","M","q","Q","z","n" }, 9},
@@ -4585,7 +4585,7 @@ static void TestMoreBefore(void) {
{ "r","R","x","X","q","Q","z","s","n" }, 9},
{ "&[before 2] s << x <<< X << q <<< Q < z",
{ "r","R","x","X","q","Q","s","z","n" }, 9},
- { "&[before 3] s <<< x <<< X << q <<< Q < z",
+ { "&[before 3] s <<< x <<< X << q <<< Q < z",
{ "r","R","x","X","s","q","Q","z","n" }, 9},
{ "&[before 1] \\u24DC < x <<< X << q <<< Q < z",
{ "x","X","q","Q","z","n","m","\\u24DC","M" }, 9},
@@ -4633,7 +4633,7 @@ void addMiscCollTest(TestNode** root)
TEST(TestPrefixCompose);
TEST(TestStrCollIdenticalPrefix);
TEST(TestPrefix);
- TEST(TestNewJapanese);
+ TEST(TestNewJapanese);
/*TEST(TestLimitations);*/
TEST(TestNonChars);
TEST(TestExtremeCompression);
diff --git a/icu4c/source/test/cintltst/udatatst.c b/icu4c/source/test/cintltst/udatatst.c
index 980a453a2f..0f3c7b2271 100644
--- a/icu4c/source/test/cintltst/udatatst.c
+++ b/icu4c/source/test/cintltst/udatatst.c
@@ -517,7 +517,7 @@ isAcceptable3(void *context,
static void TestUDataOpenChoiceDemo1() {
UDataMemory *result;
UErrorCode status=U_ZERO_ERROR;
-
+
const char* name[]={
"cnvalias",
"unames",
diff --git a/icu4c/source/test/intltest/apicoll.h b/icu4c/source/test/intltest/apicoll.h
index 5df7ecda6e..d08400c144 100644
--- a/icu4c/source/test/intltest/apicoll.h
+++ b/icu4c/source/test/intltest/apicoll.h
@@ -149,12 +149,12 @@ public:
*/
void TestGetTailoredSet();
- /**
+ /**
* Tests the subclassability
*/
void TestSubclass();
- /**
+ /**
* Tests the dynamic and static ids of collation classes
*/
void TestUClassID();
diff --git a/icu4c/source/test/intltest/astrotst.cpp b/icu4c/source/test/intltest/astrotst.cpp
index 6d05dce7c3..0a40f54045 100644
--- a/icu4c/source/test/intltest/astrotst.cpp
+++ b/icu4c/source/test/intltest/astrotst.cpp
@@ -1,5 +1,5 @@
/********************************************************************
- * COPYRIGHT:
+ * COPYRIGHT:
* Copyright (c) 1996-2004, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -84,14 +84,14 @@ void AstroTest::TestSolarLongitude(void) {
{ { 1980, 7, 27, 0, 00 }, 124.114347 },
{ { 1988, 7, 27, 00, 00 }, 124.187732 }
};
-
+
logln("");
for (uint32_t i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) {
gc->clear();
gc->set(tests[i].d[0], tests[i].d[1]-1, tests[i].d[2], tests[i].d[3], tests[i].d[4]);
-
+
astro->setDate(gc->getTime(status));
-
+
double longitude = astro->getSunLongitude();
//longitude = 0;
CalendarAstronomer::Equatorial result;
@@ -113,16 +113,16 @@ void AstroTest::TestLunarPosition(void) {
{ 1979, 2, 26, 16, 00, 0, 0 }
};
logln("");
-
+
for (int32_t i = 0; i < (int32_t)(sizeof(tests)/sizeof(tests[0])); i++) {
gc->clear();
gc->set((int32_t)tests[i][0], (int32_t)tests[i][1]-1, (int32_t)tests[i][2], (int32_t)tests[i][3], (int32_t)tests[i][4]);
astro->setDate(gc->getTime(status));
-
+
const CalendarAstronomer::Equatorial& result = astro->getMoonPosition();
logln((UnicodeString)"Moon position is " + result.toString() + (UnicodeString)"; " /* + result->toHmsString()*/);
}
-
+
closeAstro(status);
ASSERT_OK(status);
}
@@ -133,7 +133,7 @@ void AstroTest::TestCoordinates(void) {
UErrorCode status = U_ZERO_ERROR;
initAstro(status);
ASSERT_OK(status);
-
+
CalendarAstronomer::Equatorial result;
astro->eclipticToEquatorial(result, 139.686111 * CalendarAstronomer::PI / 180.0, 4.875278* CalendarAstronomer::PI / 180.0);
logln((UnicodeString)"result is " + result.toString() + (UnicodeString)"; " /* + result.toHmsString()*/ );
@@ -152,8 +152,8 @@ void AstroTest::TestCoverage(void) {
CalendarAstronomer *myastro = new CalendarAstronomer(then);
ASSERT_OK(status);
- //Latitude: 34 degrees 05' North
- //Longitude: 118 degrees 22' West
+ //Latitude: 34 degrees 05' North
+ //Longitude: 118 degrees 22' West
double laLat = 34 + 5./60, laLong = 360 - (118 + 22./60);
CalendarAstronomer *myastro2 = new CalendarAstronomer(laLong, laLat);
@@ -171,7 +171,7 @@ void AstroTest::TestCoverage(void) {
CalendarAstronomer *astronomers[] = {
myastro, myastro2, myastro3, myastro2 // check cache
};
-
+
for (uint32_t i = 0; i < sizeof(astronomers)/sizeof(astronomers[0]); ++i) {
CalendarAstronomer *anAstro = astronomers[i];
@@ -213,7 +213,7 @@ void AstroTest::TestSunriseTimes(void) {
// logln("Sunrise/Sunset times for San Jose, California, USA");
// CalendarAstronomer *astro2 = new CalendarAstronomer(-121.55, 37.20);
// TimeZone *tz = TimeZone::createTimeZone("America/Los_Angeles");
-
+
// We'll use a table generated by the UNSO website as our reference
// From: http://aa.usno.navy.mil/
//-Location: W079 25, N43 40
@@ -251,21 +251,21 @@ void AstroTest::TestSunriseTimes(void) {
6,13, 20,18,
6,11, 20,19,
};
-
+
logln("Sunrise/Sunset times for Toronto, Canada");
// long = 79 25", lat = 43 40"
CalendarAstronomer *astro3 = new CalendarAstronomer(-(79+25/60), 43+40/60);
-
+
// As of ICU4J 2.8 the ICU4J time zones implement pass-through
// to the underlying JDK. Because of variation in the
// underlying JDKs, we have to use a fixed-offset
// SimpleTimeZone to get consistent behavior between JDKs.
// The offset we want is [-18000000, 3600000] (raw, dst).
// [aliu 10/15/03]
-
+
// TimeZone tz = TimeZone.getTimeZone("America/Montreal");
TimeZone *tz = new SimpleTimeZone(-18000000 + 3600000, "Montreal(FIXED)");
-
+
GregorianCalendar *cal = new GregorianCalendar(tz->clone(), Locale::getUS(), status);
GregorianCalendar *cal2 = new GregorianCalendar(tz->clone(), Locale::getUS(), status);
cal->clear();
@@ -273,14 +273,14 @@ void AstroTest::TestSunriseTimes(void) {
cal->set(UCAL_MONTH, UCAL_APRIL);
cal->set(UCAL_DAY_OF_MONTH, 1);
cal->set(UCAL_HOUR_OF_DAY, 12); // must be near local noon for getSunRiseSet to work
-
+
DateFormat *df_t = DateFormat::createTimeInstance(DateFormat::MEDIUM,Locale::getUS());
DateFormat *df_d = DateFormat::createDateInstance(DateFormat::MEDIUM,Locale::getUS());
DateFormat *df_dt = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::MEDIUM, Locale::getUS());
df_t->adoptTimeZone(tz->clone());
df_d->adoptTimeZone(tz->clone());
df_dt->adoptTimeZone(tz->clone());
-
+
for (int32_t i=0; i < 30; i++) {
logln("setDate\n");
astro3->setDate(cal->getTime(status));
@@ -293,7 +293,7 @@ void AstroTest::TestSunriseTimes(void) {
cal2->setTime(cal->getTime(status), status);
cal2->set(UCAL_SECOND, 0);
cal2->set(UCAL_MILLISECOND, 0);
-
+
cal2->set(UCAL_HOUR_OF_DAY, USNO[4*i+0]);
cal2->set(UCAL_MINUTE, USNO[4*i+1]);
UDate exprise = cal2->getTime(status);
@@ -303,7 +303,7 @@ void AstroTest::TestSunriseTimes(void) {
// Compute delta of what we got to the USNO data, in seconds
int32_t deltarise = (int32_t)uprv_fabs((sunrise - exprise) / 1000);
int32_t deltaset = (int32_t)uprv_fabs((sunset - expset) / 1000);
-
+
// Allow a deviation of 0..MAX_DEV seconds
// It would be nice to get down to 60 seconds, but at this
// point that appears to be impossible without a redo of the
@@ -340,18 +340,18 @@ void AstroTest::TestSunriseTimes(void) {
" (USNO " + df_t->format(expset,s5) + ")");
}
cal->add(UCAL_DATE, 1, status);
- }
-
- // CalendarAstronomer a = new CalendarAstronomer(-(71+5/60), 42+37/60);
- // cal.clear();
- // cal.set(cal.YEAR, 1986);
- // cal.set(cal.MONTH, cal.MARCH);
- // cal.set(cal.DATE, 10);
- // cal.set(cal.YEAR, 1988);
- // cal.set(cal.MONTH, cal.JULY);
- // cal.set(cal.DATE, 27);
- // a.setDate(cal.getTime());
- // long r = a.getSunRiseSet2(true);
+ }
+
+ // CalendarAstronomer a = new CalendarAstronomer(-(71+5/60), 42+37/60);
+ // cal.clear();
+ // cal.set(cal.YEAR, 1986);
+ // cal.set(cal.MONTH, cal.MARCH);
+ // cal.set(cal.DATE, 10);
+ // cal.set(cal.YEAR, 1988);
+ // cal.set(cal.MONTH, cal.JULY);
+ // cal.set(cal.DATE, 27);
+ // a.setDate(cal.getTime());
+ // long r = a.getSunRiseSet2(true);
delete astro3;
delete tz;
delete cal;
@@ -413,7 +413,7 @@ void AstroTest::TestBasics(void) {
// cal3.add(cal3.DATE, -1);
// astro.setDate(cal3.getTime());
// astro.foo();
-
+
delete cal3;
delete d3;
ASSERT_OK(status);
@@ -424,7 +424,7 @@ void AstroTest::TestBasics(void) {
// TODO: try finding next new moon after 07/28/1984 16:00 GMT
-
+
#endif
diff --git a/icu4c/source/test/intltest/canittst.cpp b/icu4c/source/test/intltest/canittst.cpp
index 9a6695c988..419f3f61fb 100644
--- a/icu4c/source/test/intltest/canittst.cpp
+++ b/icu4c/source/test/intltest/canittst.cpp
@@ -73,10 +73,10 @@ void CanonicalIteratorTest::TestExhaustive() {
CanonicalIterator it("", status);
UChar32 i = 0;
UnicodeString s, decomp, comp;
- // Test static and dynamic class IDs
+ // Test static and dynamic class IDs
if(it.getDynamicClassID() != CanonicalIterator::getStaticClassID()){
- errln("CanonicalIterator::getStaticClassId ! = CanonicalIterator.getDynamicClassID");
- }
+ errln("CanonicalIterator::getStaticClassId ! = CanonicalIterator.getDynamicClassID");
+ }
for (i = 0; i < 0x10FFFF; quick?i+=0x10:++i) {
//for (i = 0xae00; i < 0xaf00; ++i) {
diff --git a/icu4c/source/test/intltest/citrtest.cpp b/icu4c/source/test/intltest/citrtest.cpp
index 344f8acd8c..dd390cd471 100644
--- a/icu4c/source/test/intltest/citrtest.cpp
+++ b/icu4c/source/test/intltest/citrtest.cpp
@@ -223,9 +223,9 @@ void CharIterTest::TestConstructionAndEquality() {
if (test1->hashCode() != test5->hashCode())
errln("hashCode() failed: identical objects have different hash codes");
- if(test1->getLength() != testText.length()){
- errln("getLength of CharacterIterator failed");
- }
+ if(test1->getLength() != testText.length()){
+ errln("getLength of CharacterIterator failed");
+ }
test1->getText(result1);
test1b->getText(result2);
test1c->getText(result3);
diff --git a/icu4c/source/test/intltest/cpdtrtst.cpp b/icu4c/source/test/intltest/cpdtrtst.cpp
index 66c96c2d39..e23ec1fd91 100644
--- a/icu4c/source/test/intltest/cpdtrtst.cpp
+++ b/icu4c/source/test/intltest/cpdtrtst.cpp
@@ -345,8 +345,8 @@ void CompoundTransliteratorTest::TestTransliterate(){
errln("CompoundTransliterator construction failed");
}else {
#if 0
- // handleTransliterate is a protected method that was erroneously made
- // public. It is not public API that needs to be tested.
+ // handleTransliterate is a protected method that was erroneously made
+ // public. It is not public API that needs to be tested.
UnicodeString s("abcabc");
expect(*ct1, s, s);
UTransPosition index = { 0, 0, 0, 0 };
diff --git a/icu4c/source/test/intltest/icusvtst.cpp b/icu4c/source/test/intltest/icusvtst.cpp
index d616be266a..1a25027a79 100644
--- a/icu4c/source/test/intltest/icusvtst.cpp
+++ b/icu4c/source/test/intltest/icusvtst.cpp
@@ -34,20 +34,20 @@ class ICUNSubclass : public ICUNotifier {
};
class LKFSubclass : public LocaleKeyFactory {
- Hashtable table;
+ Hashtable table;
public:
LKFSubclass(UBool visible)
: LocaleKeyFactory(visible ? VISIBLE : INVISIBLE, "LKFSubclass")
{
- UErrorCode status = U_ZERO_ERROR;
- table.put("en_US", this, status);
+ UErrorCode status = U_ZERO_ERROR;
+ table.put("en_US", this, status);
}
protected:
- virtual const Hashtable* getSupportedIDs(UErrorCode &/*status*/) const {
- return &table;
- }
+ virtual const Hashtable* getSupportedIDs(UErrorCode &/*status*/) const {
+ return &table;
+ }
};
class Integer : public UObject {
@@ -300,7 +300,7 @@ void
ICUServiceTest::msgstr(const UnicodeString& message, UObject* obj, UBool err)
{
if (obj) {
- UnicodeString* str = (UnicodeString*)obj;
+ UnicodeString* str = (UnicodeString*)obj;
logln(message + *str);
delete str;
} else if (err) {
@@ -317,7 +317,7 @@ ICUServiceTest::testAPI_One()
// register an object with one locale,
// search for an object with a more specific locale
// should return the original object
- UErrorCode status = U_ZERO_ERROR;
+ UErrorCode status = U_ZERO_ERROR;
Integer* singleton0 = new Integer(0);
service.registerInstance(singleton0, "en_US", status);
{
@@ -442,7 +442,7 @@ ICUServiceTest::testAPI_One()
confirmEqual("17) get invisible", result, singleton5);
delete result;
}
-
+
// should not be able to locate invisible services
{
UErrorCode status = U_ZERO_ERROR;
@@ -532,17 +532,17 @@ class TestMultipleKeyStringFactory : public ICUServiceFactory {
UObject* create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& status) const {
if (U_FAILURE(status)) {
- return NULL;
+ return NULL;
}
UnicodeString temp;
key.currentID(temp);
if (U_SUCCESS(_status)) {
- if (_ids.contains(&temp)) {
+ if (_ids.contains(&temp)) {
return new UnicodeString(_factoryID + temp);
- }
+ }
} else {
- status = _status;
- }
+ status = _status;
+ }
return NULL;
}
@@ -590,7 +590,7 @@ const char TestMultipleKeyStringFactory::fgClassID = '\0';
void
ICUServiceTest::testAPI_Two()
{
- UErrorCode status = U_ZERO_ERROR;
+ UErrorCode status = U_ZERO_ERROR;
TestStringService service;
service.registerFactory(new AnonymousStringFactory(), status);
@@ -858,7 +858,7 @@ void
ICUServiceTest::testRBF()
{
// resource bundle factory.
- UErrorCode status = U_ZERO_ERROR;
+ UErrorCode status = U_ZERO_ERROR;
TestStringService service;
service.registerFactory(new ICUResourceBundleFactory(), status);
@@ -1002,7 +1002,7 @@ class TestStringLocaleService : public ICULocaleService {
};
void ICUServiceTest::testLocale() {
- UErrorCode status = U_ZERO_ERROR;
+ UErrorCode status = U_ZERO_ERROR;
TestStringLocaleService service;
UnicodeString* root = new UnicodeString("root");
@@ -1092,7 +1092,7 @@ void ICUServiceTest::testLocale() {
}
{
- UErrorCode status = U_ZERO_ERROR;
+ UErrorCode status = U_ZERO_ERROR;
UnicodeString english = "en";
Locale localeResult;
UnicodeString result;
@@ -1184,7 +1184,7 @@ class WrapFactory : public ICUServiceFactory {
public:
static const UnicodeString& getGreetingID() {
if (greetingID == NULL) {
- greetingID = new UnicodeString("greeting");
+ greetingID = new UnicodeString("greeting");
}
return *greetingID;
}
@@ -1246,7 +1246,7 @@ ICUServiceTest::testWrapFactory()
{
UnicodeString* greeting = new UnicodeString("Hello There");
UnicodeString greetingID = "greeting";
- UErrorCode status = U_ZERO_ERROR;
+ UErrorCode status = U_ZERO_ERROR;
TestStringService service;
service.registerInstance(greeting, greetingID, status);
@@ -1309,10 +1309,10 @@ void ICUServiceTest::testCoverage()
{
UnicodeString* result = (UnicodeString*)service.get("object", status);
if (result) {
- logln("object is: " + *result);
- delete result;
+ logln("object is: " + *result);
+ delete result;
} else {
- errln("could not get object");
+ errln("could not get object");
}
}
}
diff --git a/icu4c/source/test/intltest/icusvtst.h b/icu4c/source/test/intltest/icusvtst.h
index 855f2c0ea4..21d1f6a483 100644
--- a/icu4c/source/test/intltest/icusvtst.h
+++ b/icu4c/source/test/intltest/icusvtst.h
@@ -50,7 +50,7 @@ class ICUServiceTest : public IntlTest
void msgstr(const UnicodeString& message, UObject* obj, UBool err = TRUE);
void logstr(const UnicodeString& message, UObject* obj) {
- msgstr(message, obj, FALSE);
+ msgstr(message, obj, FALSE);
}
};
diff --git a/icu4c/source/test/intltest/idnaref.cpp b/icu4c/source/test/intltest/idnaref.cpp
index 91ca6721fa..f629bea6d0 100644
--- a/icu4c/source/test/intltest/idnaref.cpp
+++ b/icu4c/source/test/intltest/idnaref.cpp
@@ -127,7 +127,7 @@ static inline int32_t convertUCharsToASCII(const UChar* src,char* dest, int32_t
}
// wrapper around the reference Punycode implementation
static int32_t convertToPuny(const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+ UChar* dest, int32_t destCapacity,
UErrorCode& status){
uint32_t b1Stack[MAX_LABEL_BUFFER_SIZE];
int32_t b1Len = 0, b1Capacity = MAX_LABEL_BUFFER_SIZE;
@@ -197,7 +197,7 @@ CLEANUP:
}
static int32_t convertFromPuny( const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+ UChar* dest, int32_t destCapacity,
UErrorCode& status){
char b1Stack[MAX_LABEL_BUFFER_SIZE];
char* b1 = b1Stack;
@@ -243,9 +243,9 @@ CLEANUP:
U_CFUNC int32_t U_EXPORT2
idnaref_toASCII(const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+ UChar* dest, int32_t destCapacity,
int32_t options,
- UParseError* parseError,
+ UParseError* parseError,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
@@ -263,7 +263,7 @@ idnaref_toASCII(const UChar* src, int32_t srcLength,
b2Capacity = MAX_LABEL_BUFFER_SIZE ,
reqLength=0;
- //get the options
+ //get the options
UBool allowUnassigned = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0);
UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0);
@@ -324,7 +324,7 @@ idnaref_toASCII(const UChar* src, int32_t srcLength,
uprv_memmove(dest, b1, b1Len * U_SIZEOF_UCHAR);
reqLength = b1Len;
}else{
- reqLength = b1Len;
+ reqLength = b1Len;
goto CLEANUP;
}
}else{
@@ -393,9 +393,9 @@ CLEANUP:
U_CFUNC int32_t U_EXPORT2
idnaref_toUnicode(const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+ UChar* dest, int32_t destCapacity,
int32_t options,
- UParseError* parseError,
+ UParseError* parseError,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
@@ -423,7 +423,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength,
b1Len = 0;
UBool* caseFlags = NULL;
- //get the options
+ //get the options
UBool allowUnassigned = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0);
UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0);
@@ -642,9 +642,9 @@ getNextSeparator(UChar *src,int32_t srcLength,NamePrepTransform* prep,
U_CFUNC int32_t U_EXPORT2
idnaref_IDNToASCII( const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
- int32_t options,
- UParseError* parseError,
+ UChar* dest, int32_t destCapacity,
+ int32_t options,
+ UParseError* parseError,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
@@ -669,7 +669,7 @@ idnaref_IDNToASCII( const UChar* src, int32_t srcLength,
int32_t remainingLen = srcLength;
int32_t b1Capacity = MAX_LABEL_BUFFER_SIZE;
- //get the options
+ //get the options
// UBool allowUnassigned = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0);
// UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0);
UBool done = FALSE;
@@ -794,9 +794,9 @@ CLEANUP:
U_CFUNC int32_t U_EXPORT2
idnaref_IDNToUnicode( const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
- int32_t options,
- UParseError* parseError,
+ UChar* dest, int32_t destCapacity,
+ int32_t options,
+ UParseError* parseError,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
@@ -822,11 +822,11 @@ idnaref_IDNToUnicode( const UChar* src, int32_t srcLength,
int32_t remainingLen = srcLength;
int32_t b1Capacity = MAX_LABEL_BUFFER_SIZE;
- //get the options
+ //get the options
// UBool allowUnassigned = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0);
// UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0);
- if(U_FAILURE(*status)){
+ if(U_FAILURE(*status)){
goto CLEANUP;
}
@@ -944,7 +944,7 @@ CLEANUP:
U_CFUNC int32_t U_EXPORT2
idnaref_compare( const UChar *s1, int32_t length1,
const UChar *s2, int32_t length2,
- int32_t options,
+ int32_t options,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
@@ -956,7 +956,7 @@ idnaref_compare( const UChar *s1, int32_t length1,
int32_t b1Len, b2Len, b1Capacity = MAX_IDN_BUFFER_SIZE, b2Capacity = MAX_IDN_BUFFER_SIZE;
int32_t result = -1;
- UParseError parseError;
+ UParseError parseError;
b1Len = idnaref_IDNToASCII(s1, length1, b1, b1Capacity, options, &parseError, status);
if(*status == U_BUFFER_OVERFLOW_ERROR){
diff --git a/icu4c/source/test/intltest/intltest.cpp b/icu4c/source/test/intltest/intltest.cpp
index 9c92da7676..26d2b6a225 100644
--- a/icu4c/source/test/intltest/intltest.cpp
+++ b/icu4c/source/test/intltest/intltest.cpp
@@ -977,16 +977,16 @@ main(int argc, char* argv[])
#endif
/* Initialize ICU */
- IntlTest::setICU_DATA(); // Must set data directory before u_init() is called.
+ IntlTest::setICU_DATA(); // Must set data directory before u_init() is called.
u_init(&errorCode);
if (U_FAILURE(errorCode)) {
fprintf(stderr,
"#### %s: u_init() failed, error is \"%s\".\n"
- "#### Most commonly indicates that the ICU data is not accesible.\n"
+ "#### Most commonly indicates that the ICU data is not accesible.\n"
"#### Check setting of ICU_DATA, or check that ICU data library is available\n"
- "#### ICU_DATA is currently set to \"%s\"\n", argv[0], u_errorName(errorCode), u_getDataDirectory());
- u_cleanup();
- return 1;
+ "#### ICU_DATA is currently set to \"%s\"\n", argv[0], u_errorName(errorCode), u_getDataDirectory());
+ u_cleanup();
+ return 1;
}
@@ -1209,7 +1209,7 @@ const char* IntlTest::loadTestData(UErrorCode& err){
/* u_getDataDirectory shoul return \source\data ... set the
* directory to ..\source\data\..\test\testdata\out\testdata
*/
- strcpy(tdpath, directory);
+ strcpy(tdpath, directory);
strcat(tdpath, tdrelativepath);
strcat(tdpath,"testdata");
@@ -1303,14 +1303,14 @@ const char * IntlTest::pathToDataDirectory()
}
else {
/* __FILE__ on MSVC7 does not contain the directory */
- FILE *file = fopen(".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING "Makefile.in", "r");
- if (file) {
- fclose(file);
- fgDataDir = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING;
- }
- else {
- fgDataDir = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING;
- }
+ FILE *file = fopen(".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING "Makefile.in", "r");
+ if (file) {
+ fclose(file);
+ fgDataDir = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING;
+ }
+ else {
+ fgDataDir = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING;
+ }
}
}
#endif
diff --git a/icu4c/source/test/intltest/itrbnf.cpp b/icu4c/source/test/intltest/itrbnf.cpp
index 9a4d8d0471..b9dd923bdf 100644
--- a/icu4c/source/test/intltest/itrbnf.cpp
+++ b/icu4c/source/test/intltest/itrbnf.cpp
@@ -1437,43 +1437,43 @@ IntlTestRBNF::TestSmallValues()
errln("FAIL: could not construct formatter");
} else {
static const char* testDataDefault[][2] = {
- { "0.001", "zero point zero zero one" },
- { "0.0001", "zero point zero zero zero one" },
- { "0.00001", "zero point zero zero zero zero one" },
- { "0.000001", "zero point zero zero zero zero zero one" },
- { "0.0000001", "zero point zero zero zero zero zero zero one" },
- { "0.00000001", "zero point zero zero zero zero zero zero zero one" },
- { "0.000000001", "zero point zero zero zero zero zero zero zero zero one" },
- { "0.0000000001", "zero point zero zero zero zero zero zero zero zero zero one" },
- { "0.00000000001", "zero point zero zero zero zero zero zero zero zero zero zero one" },
- { "0.000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero one" },
- { "0.0000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero one" },
- { "0.00000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero zero one" },
- { "0.000000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero zero zero one" },
- { "10,000,000.001", "ten million point zero zero one" },
- { "10,000,000.0001", "ten million point zero zero zero one" },
- { "10,000,000.00001", "ten million point zero zero zero zero one" },
- { "10,000,000.000001", "ten million point zero zero zero zero zero one" },
- { "10,000,000.0000001", "ten million point zero zero zero zero zero zero one" },
+ { "0.001", "zero point zero zero one" },
+ { "0.0001", "zero point zero zero zero one" },
+ { "0.00001", "zero point zero zero zero zero one" },
+ { "0.000001", "zero point zero zero zero zero zero one" },
+ { "0.0000001", "zero point zero zero zero zero zero zero one" },
+ { "0.00000001", "zero point zero zero zero zero zero zero zero one" },
+ { "0.000000001", "zero point zero zero zero zero zero zero zero zero one" },
+ { "0.0000000001", "zero point zero zero zero zero zero zero zero zero zero one" },
+ { "0.00000000001", "zero point zero zero zero zero zero zero zero zero zero zero one" },
+ { "0.000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero one" },
+ { "0.0000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero one" },
+ { "0.00000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero zero one" },
+ { "0.000000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero zero zero one" },
+ { "10,000,000.001", "ten million point zero zero one" },
+ { "10,000,000.0001", "ten million point zero zero zero one" },
+ { "10,000,000.00001", "ten million point zero zero zero zero one" },
+ { "10,000,000.000001", "ten million point zero zero zero zero zero one" },
+ { "10,000,000.0000001", "ten million point zero zero zero zero zero zero one" },
// { "10,000,000.00000001", "ten million point zero zero zero zero zero zero zero one" },
// { "10,000,000.000000002", "ten million point zero zero zero zero zero zero zero zero two" },
- { "10,000,000", "ten million" },
+ { "10,000,000", "ten million" },
// { "1,234,567,890.0987654", "one billion, two hundred and thirty-four million, five hundred and sixty-seven thousand, eight hundred and ninety point zero nine eight seven six five four" },
// { "123,456,789.9876543", "one hundred and twenty-three million, four hundred and fifty-six thousand, seven hundred and eighty-nine point nine eight seven six five four three" },
// { "12,345,678.87654321", "twelve million, three hundred and forty-five thousand, six hundred and seventy-eight point eight seven six five four three two one" },
- { "1,234,567.7654321", "one million, two hundred and thirty-four thousand, five hundred and sixty-seven point seven six five four three two one" },
- { "123,456.654321", "one hundred and twenty-three thousand, four hundred and fifty-six point six five four three two one" },
- { "12,345.54321", "twelve thousand three hundred and forty-five point five four three two one" },
- { "1,234.4321", "one thousand two hundred and thirty-four point four three two one" },
- { "123.321", "one hundred and twenty-three point three two one" },
- { "0.0000000011754944", "zero point zero zero zero zero zero zero zero zero one one seven five four nine four four" },
- { "0.000001175494351", "zero point zero zero zero zero zero one one seven five four nine four three five one" },
+ { "1,234,567.7654321", "one million, two hundred and thirty-four thousand, five hundred and sixty-seven point seven six five four three two one" },
+ { "123,456.654321", "one hundred and twenty-three thousand, four hundred and fifty-six point six five four three two one" },
+ { "12,345.54321", "twelve thousand three hundred and forty-five point five four three two one" },
+ { "1,234.4321", "one thousand two hundred and thirty-four point four three two one" },
+ { "123.321", "one hundred and twenty-three point three two one" },
+ { "0.0000000011754944", "zero point zero zero zero zero zero zero zero zero one one seven five four nine four four" },
+ { "0.000001175494351", "zero point zero zero zero zero zero one one seven five four nine four three five one" },
{ NULL, NULL }
- };
+ };
doTest(formatter, testDataDefault, TRUE);
- delete formatter;
+ delete formatter;
}
}
diff --git a/icu4c/source/test/intltest/nmfmapts.cpp b/icu4c/source/test/intltest/nmfmapts.cpp
index 3246526098..3c821e85f0 100644
--- a/icu4c/source/test/intltest/nmfmapts.cpp
+++ b/icu4c/source/test/intltest/nmfmapts.cpp
@@ -242,37 +242,37 @@ void IntlTestNumberFormatAPI::testAPI(/* char* par */)
#define SWAP_LOC Locale::getUS()
class NFTestFactory : public SimpleNumberFormatFactory {
- NumberFormat* currencyStyle;
+ NumberFormat* currencyStyle;
public:
- NFTestFactory()
- : SimpleNumberFormatFactory(SRC_LOC, TRUE)
- {
- UErrorCode status = U_ZERO_ERROR;
- currencyStyle = NumberFormat::createInstance(SWAP_LOC, status);
- }
+ NFTestFactory()
+ : SimpleNumberFormatFactory(SRC_LOC, TRUE)
+ {
+ UErrorCode status = U_ZERO_ERROR;
+ currencyStyle = NumberFormat::createInstance(SWAP_LOC, status);
+ }
- virtual ~NFTestFactory()
- {
- delete currencyStyle;
- }
-
+ virtual ~NFTestFactory()
+ {
+ delete currencyStyle;
+ }
+
virtual NumberFormat* createFormat(const Locale& /* loc */, UNumberFormatStyle formatType)
- {
- if (formatType == UNUM_CURRENCY) {
- return (NumberFormat*)currencyStyle->clone();
- }
- return NULL;
- }
+ {
+ if (formatType == UNUM_CURRENCY) {
+ return (NumberFormat*)currencyStyle->clone();
+ }
+ return NULL;
+ }
virtual inline UClassID getDynamicClassID() const
{
- return (UClassID)&gID;
+ return (UClassID)&gID;
}
static inline UClassID getStaticClassID()
{
- return (UClassID)&gID;
+ return (UClassID)&gID;
}
private:
@@ -285,35 +285,35 @@ void
IntlTestNumberFormatAPI::testRegistration()
{
#if !UCONFIG_NO_SERVICE
- UErrorCode status = U_ZERO_ERROR;
-
- NumberFormat* f0 = NumberFormat::createInstance(SWAP_LOC, status);
- NumberFormat* f1 = NumberFormat::createInstance(SRC_LOC, status);
- NumberFormat* f2 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
- URegistryKey key = NumberFormat::registerFactory(new NFTestFactory(), status);
- NumberFormat* f3 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
- NumberFormat* f3a = NumberFormat::createCurrencyInstance(SRC_LOC, status);
- NumberFormat* f4 = NumberFormat::createInstance(SRC_LOC, status);
+ UErrorCode status = U_ZERO_ERROR;
+
+ NumberFormat* f0 = NumberFormat::createInstance(SWAP_LOC, status);
+ NumberFormat* f1 = NumberFormat::createInstance(SRC_LOC, status);
+ NumberFormat* f2 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
+ URegistryKey key = NumberFormat::registerFactory(new NFTestFactory(), status);
+ NumberFormat* f3 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
+ NumberFormat* f3a = NumberFormat::createCurrencyInstance(SRC_LOC, status);
+ NumberFormat* f4 = NumberFormat::createInstance(SRC_LOC, status);
- StringEnumeration* locs = NumberFormat::getAvailableLocales();
+ StringEnumeration* locs = NumberFormat::getAvailableLocales();
- UNumberFormat* uf3 = unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(),NULL, &status);
- UNumberFormat* uf4 = unum_open(UNUM_DEFAULT, NULL, 0, SRC_LOC.getName(), NULL, &status);
+ UNumberFormat* uf3 = unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(),NULL, &status);
+ UNumberFormat* uf4 = unum_open(UNUM_DEFAULT, NULL, 0, SRC_LOC.getName(), NULL, &status);
const UnicodeString* res;
- for (res = locs->snext(status); res; res = locs->snext(status)) {
- logln(*res); // service is still in synch
- }
+ for (res = locs->snext(status); res; res = locs->snext(status)) {
+ logln(*res); // service is still in synch
+ }
- NumberFormat::unregister(key, status); // restore for other tests
- NumberFormat* f5 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
- UNumberFormat* uf5 = unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(),NULL, &status);
-
- float n = 1234.567f;
- UnicodeString res0, res1, res2, res3, res4, res5;
- UChar ures3[50];
- UChar ures4[50];
- UChar ures5[50];
+ NumberFormat::unregister(key, status); // restore for other tests
+ NumberFormat* f5 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
+ UNumberFormat* uf5 = unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(),NULL, &status);
+
+ float n = 1234.567f;
+ UnicodeString res0, res1, res2, res3, res4, res5;
+ UChar ures3[50];
+ UChar ures4[50];
+ UChar ures5[50];
f0->format(n, res0);
f1->format(n, res1);
@@ -322,68 +322,68 @@ IntlTestNumberFormatAPI::testRegistration()
f4->format(n, res4);
f5->format(n, res5);
- unum_formatDouble(uf3, n, ures3, 50, NULL, &status);
- unum_formatDouble(uf4, n, ures4, 50, NULL, &status);
- unum_formatDouble(uf5, n, ures5, 50, NULL, &status);
+ unum_formatDouble(uf3, n, ures3, 50, NULL, &status);
+ unum_formatDouble(uf4, n, ures4, 50, NULL, &status);
+ unum_formatDouble(uf5, n, ures5, 50, NULL, &status);
- logln((UnicodeString)"f0 swap int: " + res0);
- logln((UnicodeString)"f1 src int: " + res1);
- logln((UnicodeString)"f2 src cur: " + res2);
- logln((UnicodeString)"f3 reg cur: " + res3);
- logln((UnicodeString)"f4 reg int: " + res4);
- logln((UnicodeString)"f5 unreg cur: " + res5);
- log("uf3 reg cur: ");
- logln(ures3);
- log("uf4 reg int: ");
- logln(ures4);
- log("uf5 ureg cur: ");
- logln(ures5);
-
- if (f3 == f3a) {
- errln("did not get new instance from service");
- } else {
- delete f3a;
- }
- if (res3 != res0) {
- errln("registered service did not match");
- }
- if (res4 != res1) {
- errln("registered service did not inherit");
- }
- if (res5 != res2) {
- errln("unregistered service did not match original");
- }
+ logln((UnicodeString)"f0 swap int: " + res0);
+ logln((UnicodeString)"f1 src int: " + res1);
+ logln((UnicodeString)"f2 src cur: " + res2);
+ logln((UnicodeString)"f3 reg cur: " + res3);
+ logln((UnicodeString)"f4 reg int: " + res4);
+ logln((UnicodeString)"f5 unreg cur: " + res5);
+ log("uf3 reg cur: ");
+ logln(ures3);
+ log("uf4 reg int: ");
+ logln(ures4);
+ log("uf5 ureg cur: ");
+ logln(ures5);
+
+ if (f3 == f3a) {
+ errln("did not get new instance from service");
+ } else {
+ delete f3a;
+ }
+ if (res3 != res0) {
+ errln("registered service did not match");
+ }
+ if (res4 != res1) {
+ errln("registered service did not inherit");
+ }
+ if (res5 != res2) {
+ errln("unregistered service did not match original");
+ }
- if (res0 != ures3) {
- errln("registered service did not match / unum");
- }
- if (res1 != ures4) {
- errln("registered service did not inherit / unum");
- }
- if (res2 != ures5) {
- errln("unregistered service did not match original / unum");
- }
+ if (res0 != ures3) {
+ errln("registered service did not match / unum");
+ }
+ if (res1 != ures4) {
+ errln("registered service did not inherit / unum");
+ }
+ if (res2 != ures5) {
+ errln("unregistered service did not match original / unum");
+ }
- unum_close(uf5);
- delete f5;
- unum_close(uf4);
- unum_close(uf3);
- delete f4;
- delete f3;
- delete f2;
- delete f1;
- delete f0;
+ unum_close(uf5);
+ delete f5;
+ unum_close(uf4);
+ unum_close(uf3);
+ delete f4;
+ delete f3;
+ delete f2;
+ delete f1;
+ delete f0;
- for (res = locs->snext(status); res; res = locs->snext(status)) {
- errln(*res); // service should be out of synch
- }
+ for (res = locs->snext(status); res; res = locs->snext(status)) {
+ errln(*res); // service should be out of synch
+ }
- locs->reset(status); // now in synch again, we hope
- for (res = locs->snext(status); res; res = locs->snext(status)) {
- logln(*res);
- }
+ locs->reset(status); // now in synch again, we hope
+ for (res = locs->snext(status); res; res = locs->snext(status)) {
+ logln(*res);
+ }
- delete locs;
+ delete locs;
#endif
}
diff --git a/icu4c/source/test/intltest/nmfmapts.h b/icu4c/source/test/intltest/nmfmapts.h
index c34ea1ad16..a2bcae2381 100644
--- a/icu4c/source/test/intltest/nmfmapts.h
+++ b/icu4c/source/test/intltest/nmfmapts.h
@@ -25,7 +25,7 @@ private:
* executes tests of API functions, see detailed comments in source code
**/
void testAPI(/* char* par */);
- void testRegistration();
+ void testRegistration();
};
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/icu4c/source/test/intltest/numfmtst.cpp b/icu4c/source/test/intltest/numfmtst.cpp
index 62fc0592ca..e6bf04c2eb 100644
--- a/icu4c/source/test/intltest/numfmtst.cpp
+++ b/icu4c/source/test/intltest/numfmtst.cpp
@@ -67,9 +67,9 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n
CASE(20,TestSymbolsWithBadLocale);
CASE(21,TestAdoptDecimalFormatSymbols);
- CASE(22,TestScientific2);
- CASE(23,TestScientificGrouping);
- CASE(24,TestInt64);
+ CASE(22,TestScientific2);
+ CASE(23,TestScientificGrouping);
+ CASE(24,TestInt64);
CASE(25,TestPerMill);
CASE(26,TestIllegalPatterns);
@@ -351,134 +351,134 @@ NumberFormatTest::TestExponential(void)
void
NumberFormatTest::TestScientific2() {
- // jb 2552
+ // jb 2552
UErrorCode status = U_ZERO_ERROR;
DecimalFormat* fmt = (DecimalFormat*)NumberFormat::createCurrencyInstance("en_US", status);
- if (U_SUCCESS(status)) {
- double num = 12.34;
- expect(*fmt, num, "$12.34");
- fmt->setScientificNotation(TRUE);
- expect(*fmt, num, "$1.23E1");
- fmt->setScientificNotation(FALSE);
- expect(*fmt, num, "$12.34");
- }
- delete fmt;
+ if (U_SUCCESS(status)) {
+ double num = 12.34;
+ expect(*fmt, num, "$12.34");
+ fmt->setScientificNotation(TRUE);
+ expect(*fmt, num, "$1.23E1");
+ fmt->setScientificNotation(FALSE);
+ expect(*fmt, num, "$12.34");
+ }
+ delete fmt;
}
void
NumberFormatTest::TestScientificGrouping() {
- // jb 2552
+ // jb 2552
UErrorCode status = U_ZERO_ERROR;
- DecimalFormat fmt("##0.00E0",status);
- if (U_SUCCESS(status)) {
- expect(fmt, .01234, "12.3E-3");
- expect(fmt, .1234, "123E-3");
- expect(fmt, 1.234, "1.23E0");
- expect(fmt, 12.34, "12.3E0");
- expect(fmt, 123.4, "123E0");
- expect(fmt, 1234., "1.23E3");
- }
+ DecimalFormat fmt("##0.00E0",status);
+ if (U_SUCCESS(status)) {
+ expect(fmt, .01234, "12.3E-3");
+ expect(fmt, .1234, "123E-3");
+ expect(fmt, 1.234, "1.23E0");
+ expect(fmt, 12.34, "12.3E0");
+ expect(fmt, 123.4, "123E0");
+ expect(fmt, 1234., "1.23E3");
+ }
}
static void setFromString(DigitList& dl, const char* str) {
- char c;
- UBool decimalSet = FALSE;
- dl.clear();
- while ((c = *str++)) {
- if (c == '-') {
- dl.fIsPositive = FALSE;
- } else if (c == '+') {
- dl.fIsPositive = TRUE;
- } else if (c == '.') {
- dl.fDecimalAt = dl.fCount;
- decimalSet = TRUE;
- } else {
- dl.append(c);
- }
- }
- if (!decimalSet) {
- dl.fDecimalAt = dl.fCount;
- }
+ char c;
+ UBool decimalSet = FALSE;
+ dl.clear();
+ while ((c = *str++)) {
+ if (c == '-') {
+ dl.fIsPositive = FALSE;
+ } else if (c == '+') {
+ dl.fIsPositive = TRUE;
+ } else if (c == '.') {
+ dl.fDecimalAt = dl.fCount;
+ decimalSet = TRUE;
+ } else {
+ dl.append(c);
+ }
+ }
+ if (!decimalSet) {
+ dl.fDecimalAt = dl.fCount;
+ }
}
void
NumberFormatTest::TestInt64() {
UErrorCode status = U_ZERO_ERROR;
- DecimalFormat fmt("#.#E0",status);
- fmt.setMaximumFractionDigits(20);
- if (U_SUCCESS(status)) {
- expect(fmt, (Formattable)(int64_t)0, "0E0");
- expect(fmt, (Formattable)(int64_t)-1, "-1E0");
- expect(fmt, (Formattable)(int64_t)1, "1E0");
- expect(fmt, (Formattable)(int64_t)2147483647, "2.147483647E9");
- expect(fmt, (Formattable)((int64_t)-2147483647-1), "-2.147483648E9");
- expect(fmt, (Formattable)(int64_t)U_INT64_MAX, "9.223372036854775807E18");
- expect(fmt, (Formattable)(int64_t)U_INT64_MIN, "-9.223372036854775808E18");
- }
+ DecimalFormat fmt("#.#E0",status);
+ fmt.setMaximumFractionDigits(20);
+ if (U_SUCCESS(status)) {
+ expect(fmt, (Formattable)(int64_t)0, "0E0");
+ expect(fmt, (Formattable)(int64_t)-1, "-1E0");
+ expect(fmt, (Formattable)(int64_t)1, "1E0");
+ expect(fmt, (Formattable)(int64_t)2147483647, "2.147483647E9");
+ expect(fmt, (Formattable)((int64_t)-2147483647-1), "-2.147483648E9");
+ expect(fmt, (Formattable)(int64_t)U_INT64_MAX, "9.223372036854775807E18");
+ expect(fmt, (Formattable)(int64_t)U_INT64_MIN, "-9.223372036854775808E18");
+ }
- // also test digitlist
- int64_t int64max = U_INT64_MAX;
- int64_t int64min = U_INT64_MIN;
- const char* int64maxstr = "9223372036854775807";
- const char* int64minstr = "-9223372036854775808";
- UnicodeString fail("fail: ");
+ // also test digitlist
+ int64_t int64max = U_INT64_MAX;
+ int64_t int64min = U_INT64_MIN;
+ const char* int64maxstr = "9223372036854775807";
+ const char* int64minstr = "-9223372036854775808";
+ UnicodeString fail("fail: ");
- // test max int64 value
- DigitList dl;
- setFromString(dl, int64maxstr);
- {
- if (!dl.fitsIntoInt64(FALSE)) {
- errln(fail + int64maxstr + " didn't fit");
- }
- int64_t int64Value = dl.getInt64();
- if (int64Value != int64max) {
- errln(fail + int64maxstr);
- }
- dl.set(int64Value);
- int64Value = dl.getInt64();
- if (int64Value != int64max) {
- errln(fail + int64maxstr);
- }
- }
- // test negative of max int64 value (1 shy of min int64 value)
- dl.fIsPositive = FALSE;
- {
- if (!dl.fitsIntoInt64(FALSE)) {
- errln(fail + "-" + int64maxstr + " didn't fit");
- }
- int64_t int64Value = dl.getInt64();
- if (int64Value != -int64max) {
- errln(fail + "-" + int64maxstr);
- }
- dl.set(int64Value);
- int64Value = dl.getInt64();
- if (int64Value != -int64max) {
- errln(fail + "-" + int64maxstr);
- }
- }
- // test min int64 value
- setFromString(dl, int64minstr);
- {
- if (!dl.fitsIntoInt64(FALSE)) {
- errln(fail + "-" + int64minstr + " didn't fit");
- }
- int64_t int64Value = dl.getInt64();
- if (int64Value != int64min) {
- errln(fail + int64minstr);
- }
- dl.set(int64Value);
- int64Value = dl.getInt64();
- if (int64Value != int64min) {
- errln(fail + int64minstr);
- }
- }
- // test negative of min int 64 value (1 more than max int64 value)
- dl.fIsPositive = TRUE; // won't fit
- {
- if (dl.fitsIntoInt64(FALSE)) {
- errln(fail + "-(" + int64minstr + ") didn't fit");
- }
- }
+ // test max int64 value
+ DigitList dl;
+ setFromString(dl, int64maxstr);
+ {
+ if (!dl.fitsIntoInt64(FALSE)) {
+ errln(fail + int64maxstr + " didn't fit");
+ }
+ int64_t int64Value = dl.getInt64();
+ if (int64Value != int64max) {
+ errln(fail + int64maxstr);
+ }
+ dl.set(int64Value);
+ int64Value = dl.getInt64();
+ if (int64Value != int64max) {
+ errln(fail + int64maxstr);
+ }
+ }
+ // test negative of max int64 value (1 shy of min int64 value)
+ dl.fIsPositive = FALSE;
+ {
+ if (!dl.fitsIntoInt64(FALSE)) {
+ errln(fail + "-" + int64maxstr + " didn't fit");
+ }
+ int64_t int64Value = dl.getInt64();
+ if (int64Value != -int64max) {
+ errln(fail + "-" + int64maxstr);
+ }
+ dl.set(int64Value);
+ int64Value = dl.getInt64();
+ if (int64Value != -int64max) {
+ errln(fail + "-" + int64maxstr);
+ }
+ }
+ // test min int64 value
+ setFromString(dl, int64minstr);
+ {
+ if (!dl.fitsIntoInt64(FALSE)) {
+ errln(fail + "-" + int64minstr + " didn't fit");
+ }
+ int64_t int64Value = dl.getInt64();
+ if (int64Value != int64min) {
+ errln(fail + int64minstr);
+ }
+ dl.set(int64Value);
+ int64Value = dl.getInt64();
+ if (int64Value != int64min) {
+ errln(fail + int64minstr);
+ }
+ }
+ // test negative of min int 64 value (1 more than max int64 value)
+ dl.fIsPositive = TRUE; // won't fit
+ {
+ if (dl.fitsIntoInt64(FALSE)) {
+ errln(fail + "-(" + int64minstr + ") didn't fit");
+ }
+ }
}
// -------------------------------------
diff --git a/icu4c/source/test/intltest/numrgts.cpp b/icu4c/source/test/intltest/numrgts.cpp
index 2c0445f0ec..bfc26475f1 100644
--- a/icu4c/source/test/intltest/numrgts.cpp
+++ b/icu4c/source/test/intltest/numrgts.cpp
@@ -24,7 +24,7 @@
int32_t gMyNumberFormatTestClassID;
UClassID MyNumberFormatTest::getDynamicClassID() const
{
- return (UClassID)&gMyNumberFormatTestClassID;
+ return (UClassID)&gMyNumberFormatTestClassID;
}
@@ -1957,9 +1957,9 @@ NumberFormatRegressionTest::Test4162198(void)
//if(n.getDouble() != dbl) {
// errln("Round trip failure");
//}
- if (n.getInt64() != dbl) {
- errln("Round trip failure");
- }
+ if (n.getInt64() != dbl) {
+ errln("Round trip failure");
+ }
delete f;
}
diff --git a/icu4c/source/test/intltest/rbbiapts.cpp b/icu4c/source/test/intltest/rbbiapts.cpp
index fd722e5e00..86792f974d 100644
--- a/icu4c/source/test/intltest/rbbiapts.cpp
+++ b/icu4c/source/test/intltest/rbbiapts.cpp
@@ -934,8 +934,8 @@ void RBBIAPITest::TestRegistration() {
void RBBIAPITest::RoundtripRule(const char *dataFile) {
UErrorCode status = U_ZERO_ERROR;
UParseError parseError;
- parseError.line = 0;
- parseError.offset = 0;
+ parseError.line = 0;
+ parseError.offset = 0;
UDataMemory *data = udata_open(NULL, "brk", dataFile, &status);
uint32_t length;
const UChar *builtSource;
diff --git a/icu4c/source/test/intltest/regextst.cpp b/icu4c/source/test/intltest/regextst.cpp
index 5afbcd1d2b..343ec78567 100644
--- a/icu4c/source/test/intltest/regextst.cpp
+++ b/icu4c/source/test/intltest/regextst.cpp
@@ -29,7 +29,7 @@
// Test class boilerplate
//
//---------------------------------------------------------------------------
-RegexTest::RegexTest()
+RegexTest::RegexTest()
{
};
@@ -46,29 +46,29 @@ void RegexTest::runIndexedTest( int32_t index, UBool exec, const char* &name, ch
switch (index) {
case 0: name = "Basic";
- if (exec) Basic();
+ if (exec) Basic();
break;
case 1: name = "API_Match";
- if (exec) API_Match();
+ if (exec) API_Match();
break;
case 2: name = "API_Replace";
- if (exec) API_Replace();
+ if (exec) API_Replace();
break;
case 3: name = "API_Pattern";
- if (exec) API_Pattern();
+ if (exec) API_Pattern();
break;
case 4: name = "Extended";
- if (exec) Extended();
+ if (exec) Extended();
break;
case 5: name = "Errors";
- if (exec) Errors();
+ if (exec) Errors();
break;
case 6: name = "PerlTests";
if (exec) PerlTests();
break;
- default: name = "";
+ default: name = "";
break; //needed to end loop
}
}
@@ -106,7 +106,7 @@ if (status!=errcode) {errln("RegexTest failure at line %d. Expected status=%s,
//
// The expected results are UBool - TRUE or FALSE.
// The input text is unescaped. The pattern is not.
-//
+//
//
//---------------------------------------------------------------------------
@@ -138,7 +138,7 @@ UBool RegexTest::doRegexLMTest(const char *pat, const char *text, UBool looking,
line, u_errorName(status));
return FALSE;
}
-
+
UBool actualmatch;
actualmatch = REMatcher->lookingAt(status);
if (U_FAILURE(status)) {
@@ -171,7 +171,7 @@ UBool RegexTest::doRegexLMTest(const char *pat, const char *text, UBool looking,
delete REMatcher;
return retVal;
}
-
+
@@ -185,8 +185,8 @@ UBool RegexTest::doRegexLMTest(const char *pat, const char *text, UBool looking,
// The input text is marked with the expected match positions
// <0>text <1> more text 1> 0>
// The tags are removed before trying the match.
-// The tags mark the start and end of the match and of any capture groups.
-//
+// The tags mark the start and end of the match and of any capture groups.
+//
//
//---------------------------------------------------------------------------
@@ -205,8 +205,8 @@ static void set(UVector &vec, int val, UnicodeString index) {
while (vec.size()= 0) { // 'i' flag
+ if (flags.indexOf((UChar)0x69) >= 0) { // 'i' flag
bflags |= UREGEX_CASE_INSENSITIVE;
}
- if (flags.indexOf((UChar)0x78) >= 0) { // 'x' flag
+ if (flags.indexOf((UChar)0x78) >= 0) { // 'x' flag
bflags |= UREGEX_COMMENTS;
}
- if (flags.indexOf((UChar)0x73) >= 0) { // 's' flag
+ if (flags.indexOf((UChar)0x73) >= 0) { // 's' flag
bflags |= UREGEX_DOTALL;
}
- if (flags.indexOf((UChar)0x6d) >= 0) { // 'm' flag
+ if (flags.indexOf((UChar)0x6d) >= 0) { // 'm' flag
bflags |= UREGEX_MULTILINE;
}
@@ -281,7 +281,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
//
parsePat = RegexPattern::compile("<(/?)([0-9]+)>", 0, pe, status);
REGEX_CHECK_STATUS_L(line);
-
+
unEscapedInput = inputString.unescape();
parseMatcher = parsePat->matcher(unEscapedInput, status);
REGEX_CHECK_STATUS_L(line);
@@ -334,9 +334,9 @@ void RegexTest::regex_find(const UnicodeString &pattern,
errln("Error at line %d: No match expected, but one found.\n", line);
failed = TRUE;
}
- goto cleanupAndReturn;
+ goto cleanupAndReturn;
}
-
+
for (i=0; i<=matcher->groupCount(); i++) {
int32_t expectedStart = (i >= groupStarts.size()? -1 : groupStarts.elementAti(i));
if (matcher->start(i, status) != expectedStart) {
@@ -355,11 +355,11 @@ void RegexTest::regex_find(const UnicodeString &pattern,
}
}
if ( matcher->groupCount()+1 < groupStarts.size()) {
- errln("Error at line %d: Expected %d capture groups, found %d.",
+ errln("Error at line %d: Expected %d capture groups, found %d.",
line, groupStarts.size()-1, matcher->groupCount());
failed = TRUE;
}
-
+
cleanupAndReturn:
if (failed) {
errln("\"%s\" %s \"%s\"", (const char *)CharString(pattern, 0),
@@ -372,7 +372,7 @@ cleanupAndReturn:
delete matcher;
delete callerPattern;
}
-
+
@@ -550,23 +550,23 @@ void RegexTest::Basic() {
// Escape sequences that become single literal chars, handled internally
// by ICU's Unescape.
//
-
+
// REGEX_TESTLM("\101\142", "Ab", TRUE, TRUE); // Octal TODO: not implemented yet.
REGEX_TESTLM("\\a", "\\u0007", TRUE, TRUE); // BEL
- REGEX_TESTLM("\\cL", "\\u000c", TRUE, TRUE); // Control-L
- REGEX_TESTLM("\\e", "\\u001b", TRUE, TRUE); // Escape
+ REGEX_TESTLM("\\cL", "\\u000c", TRUE, TRUE); // Control-L
+ REGEX_TESTLM("\\e", "\\u001b", TRUE, TRUE); // Escape
REGEX_TESTLM("\\f", "\\u000c", TRUE, TRUE); // Form Feed
REGEX_TESTLM("\\n", "\\u000a", TRUE, TRUE); // new line
REGEX_TESTLM("\\r", "\\u000d", TRUE, TRUE); // CR
REGEX_TESTLM("\\t", "\\u0009", TRUE, TRUE); // Tab
- REGEX_TESTLM("\\u1234", "\\u1234", TRUE, TRUE);
- REGEX_TESTLM("\\U00001234", "\\u1234", TRUE, TRUE);
+ REGEX_TESTLM("\\u1234", "\\u1234", TRUE, TRUE);
+ REGEX_TESTLM("\\U00001234", "\\u1234", TRUE, TRUE);
REGEX_TESTLM(".*\\Ax", "xyz", TRUE, FALSE); // \A matches only at the beginning of input
REGEX_TESTLM(".*\\Ax", " xyz", FALSE, FALSE); // \A matches only at the beginning of input
// Escape of special chars in patterns
- REGEX_TESTLM("\\\\\\|\\(\\)\\[\\{\\~\\$\\*\\+\\?\\.", "\\\\|()[{~$*+?.", TRUE, TRUE);
+ REGEX_TESTLM("\\\\\\|\\(\\)\\[\\{\\~\\$\\*\\+\\?\\.", "\\\\|()[{~$*+?.", TRUE, TRUE);
};
@@ -574,7 +574,7 @@ void RegexTest::Basic() {
//---------------------------------------------------------------------------
//
-// API_Match Test that the API for class RegexMatcher
+// API_Match Test that the API for class RegexMatcher
// is present and nominally working, but excluding functions
// implementing replace operations.
//
@@ -601,18 +601,18 @@ void RegexTest::API_Match() {
RegexPattern *pat2;
pat2 = RegexPattern::compile(re, flags, pe, status);
REGEX_CHECK_STATUS;
-
+
UnicodeString inStr1 = "abcdef this is a test";
UnicodeString instr2 = "not abc";
UnicodeString empty = "";
-
-
+
+
//
// Matcher creation and reset.
//
RegexMatcher *m1 = pat2->matcher(inStr1, status);
REGEX_CHECK_STATUS;
- REGEX_ASSERT(m1->lookingAt(status) == TRUE);
+ REGEX_ASSERT(m1->lookingAt(status) == TRUE);
REGEX_ASSERT(m1->input() == inStr1);
m1->reset(instr2);
REGEX_ASSERT(m1->lookingAt(status) == FALSE);
@@ -626,7 +626,7 @@ void RegexTest::API_Match() {
REGEX_ASSERT(&m1->pattern() == pat2);
//
- // reset(pos, status)
+ // reset(pos, status)
//
m1->reset(inStr1);
m1->reset(4, status);
@@ -708,14 +708,14 @@ void RegexTest::API_Match() {
REGEX_CHECK_STATUS;
REGEX_ASSERT(m1->lookingAt(len+1, status) == FALSE);
REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR);
-
+
delete m1;
delete pat2;
}
//
- // Capture Group.
+ // Capture Group.
// RegexMatcher::start();
// RegexMatcher::end();
// RegexMatcher::groupCount();
@@ -729,10 +729,10 @@ void RegexTest::API_Match() {
RegexPattern *pat = RegexPattern::compile(re, flags, pe, status);
REGEX_CHECK_STATUS;
UnicodeString data = "0123456789";
-
+
RegexMatcher *matcher = pat->matcher(data, status);
REGEX_CHECK_STATUS;
- REGEX_ASSERT(matcher->lookingAt(status) == TRUE);
+ REGEX_ASSERT(matcher->lookingAt(status) == TRUE);
int matchStarts[] = {0, 2, 4, 8};
int matchEnds[] = {10, 8, 6, 10};
int i;
@@ -789,7 +789,7 @@ void RegexTest::API_Match() {
REGEX_CHECK_STATUS;
UnicodeString data = ".abc..abc...abc..";
// 012345678901234567
-
+
RegexMatcher *matcher = pat->matcher(data, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(matcher->find());
@@ -843,17 +843,17 @@ void RegexTest::API_Match() {
REGEX_CHECK_STATUS;
UnicodeString data = ".abcabc.abc..";
// 012345678901234567
-
+
RegexMatcher *matcher = pat->matcher(data, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(matcher->find());
REGEX_ASSERT(matcher->start(status) == 0);
- REGEX_ASSERT(matcher->start(1, status) == -1);
+ REGEX_ASSERT(matcher->start(1, status) == -1);
REGEX_ASSERT(matcher->start(2, status) == 1);
REGEX_ASSERT(matcher->find());
REGEX_ASSERT(matcher->start(status) == 4);
- REGEX_ASSERT(matcher->start(1, status) == 4);
+ REGEX_ASSERT(matcher->start(1, status) == 4);
REGEX_ASSERT(matcher->start(2, status) == -1);
REGEX_CHECK_STATUS;
@@ -901,7 +901,7 @@ void RegexTest::API_Match() {
// match of zero length at the end of the input string.
int i;
UErrorCode status=U_ZERO_ERROR;
- RegexMatcher m(".?", 0, status);
+ RegexMatcher m(".?", 0, status);
REGEX_CHECK_STATUS;
UnicodeString s(" ");
m.reset(s);
@@ -933,7 +933,7 @@ void RegexTest::API_Match() {
RegexPattern *p = RegexPattern::compile(".", 0, status);
RegexMatcher *m = p->matcher(status);
REGEX_CHECK_STATUS;
-
+
REGEX_ASSERT(m->find() == FALSE);
REGEX_ASSERT(m->input() == "");
delete m;
@@ -969,7 +969,7 @@ void RegexTest::API_Match() {
//---------------------------------------------------------------------------
//
-// API_Replace API test for class RegexMatcher, testing the
+// API_Replace API test for class RegexMatcher, testing the
// Replace family of functions.
//
//---------------------------------------------------------------------------
@@ -980,14 +980,14 @@ void RegexTest::API_Replace() {
int32_t flags=0;
UParseError pe;
UErrorCode status=U_ZERO_ERROR;
-
+
UnicodeString re("abc");
RegexPattern *pat = RegexPattern::compile(re, flags, pe, status);
REGEX_CHECK_STATUS;
UnicodeString data = ".abc..abc...abc..";
// 012345678901234567
RegexMatcher *matcher = pat->matcher(data, status);
-
+
//
// Plain vanilla matches.
//
@@ -995,11 +995,11 @@ void RegexTest::API_Replace() {
dest = matcher->replaceFirst("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == ".yz..abc...abc..");
-
+
dest = matcher->replaceAll("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == ".yz..yz...yz..");
-
+
//
// Plain vanilla non-matches.
//
@@ -1008,11 +1008,11 @@ void RegexTest::API_Replace() {
dest = matcher->replaceFirst("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == ".abx..abx...abx..");
-
+
dest = matcher->replaceAll("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == ".abx..abx...abx..");
-
+
//
// Empty source string
//
@@ -1021,11 +1021,11 @@ void RegexTest::API_Replace() {
dest = matcher->replaceFirst("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "");
-
+
dest = matcher->replaceAll("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "");
-
+
//
// Empty substitution string
//
@@ -1033,24 +1033,24 @@ void RegexTest::API_Replace() {
dest = matcher->replaceFirst("", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "...abc...abc..");
-
+
dest = matcher->replaceAll("", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "........");
-
+
//
// match whole string
//
UnicodeString d4 = "abc";
- matcher->reset(d4);
+ matcher->reset(d4);
dest = matcher->replaceFirst("xyz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "xyz");
-
+
dest = matcher->replaceAll("xyz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "xyz");
-
+
//
// Capture Group, simple case
//
@@ -1077,10 +1077,10 @@ void RegexTest::API_Replace() {
dest = matcher2->replaceFirst(replacement, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "Supplemental Digit 1 bc.defg");
-
+
REGEX_ASSERT_FAIL(matcher2->replaceFirst("bad capture group number $5...",status), U_INDEX_OUTOFBOUNDS_ERROR);
-
-
+
+
//
// Replacement String with \u hex escapes
//
@@ -1090,7 +1090,7 @@ void RegexTest::API_Replace() {
matcher->reset(src);
UnicodeString result = matcher->replaceAll(substitute, status);
REGEX_CHECK_STATUS;
- REGEX_ASSERT(result == "--C-- 1 --C-- 2 --C-- 3");
+ REGEX_ASSERT(result == "--C-- 1 --C-- 2 --C-- 3");
}
{
UnicodeString src = "abc !";
@@ -1101,10 +1101,10 @@ void RegexTest::API_Replace() {
UnicodeString expected = UnicodeString("--");
expected.append((UChar32)0x10000);
expected.append("-- !");
- REGEX_ASSERT(result == expected);
+ REGEX_ASSERT(result == expected);
}
// TODO: need more through testing of capture substitutions.
-
+
// Bug 4057
//
{
@@ -1448,7 +1448,7 @@ RegexTest::getPath(char buffer[2048], const char *filename) {
const char *testDataDirectory = IntlTest::getSourceTestData(status);
if (U_FAILURE(status)) {
errln("ERROR: loadTestData() failed - %s", u_errorName(status));
- return NULL;
+ return NULL;
}
strcpy(buffer, testDataDirectory);
@@ -1482,7 +1482,7 @@ void RegexTest::Extended() {
UnicodeString testString(FALSE, testData, len);
RegexMatcher quotedStuffMat("\\s*([\\'\\\"/])(.*?)\\1", 0, status);
- RegexMatcher commentMat ("\\s*(#.*)?$", 0, status);
+ RegexMatcher commentMat ("\\s*(#.*)?$", 0, status);
RegexMatcher flagsMat ("\\s*([ixsmdtGv2-9]*)([:letter:]*)", 0, status);
RegexMatcher lineMat("(.*?)\\r?\\n", testString, 0, status);
@@ -1601,7 +1601,7 @@ void RegexTest::Errors() {
// TODO: add tests for unbounded length look-behinds.
REGEX_ERR("abc(?<@xyz).*", 1, 7, U_REGEX_RULE_SYNTAX); // illegal construct
- // Attempt to use non-default flags
+ // Attempt to use non-default flags
{
UParseError pe;
UErrorCode status = U_ZERO_ERROR;
@@ -1628,7 +1628,7 @@ void RegexTest::Errors() {
REGEX_ERR("abc{222222222222222222222}",1,14, U_REGEX_NUMBER_TOO_BIG);
REGEX_ERR("abc{5,50000000000}", 1, 17, U_REGEX_NUMBER_TOO_BIG); // Overflows int during scan
REGEX_ERR("abc{5,687865858}", 1, 16, U_REGEX_NUMBER_TOO_BIG); // Overflows regex binary format
- REGEX_ERR("abc{687865858,687865859}", 1, 24, U_REGEX_NUMBER_TOO_BIG);
+ REGEX_ERR("abc{687865858,687865859}", 1, 24, U_REGEX_NUMBER_TOO_BIG);
// UnicodeSet containing a string
@@ -1648,12 +1648,12 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
char *fileBuf = NULL;
UConverter* conv = NULL;
FILE *f = NULL;
-
+
ulen = 0;
if (U_FAILURE(status)) {
return retPtr;
}
-
+
//
// Open the file.
//
@@ -1668,7 +1668,7 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
//
int fileSize;
int amt_read;
-
+
fseek( f, 0, SEEK_END);
fileSize = ftell(f);
fileBuf = new char[fileSize];
@@ -1678,14 +1678,14 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
errln("Error reading test data file.");
goto cleanUpAndReturn;
}
-
+
//
// Look for a Unicode Signature (BOM) on the data just read
//
int32_t signatureLength;
const char * fileBufC;
const char* encoding;
-
+
fileBufC = fileBuf;
encoding = ucnv_detectUnicodeSignature(
fileBuf, fileSize, &signatureLength, &status);
@@ -1693,7 +1693,7 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
fileBufC += signatureLength;
fileSize -= signatureLength;
}
-
+
//
// Open a converter to take the rule file to UTF-16
//
@@ -1701,7 +1701,7 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
if (U_FAILURE(status)) {
goto cleanUpAndReturn;
}
-
+
//
// Convert the rules to UChar.
// Preflight first to determine required buffer size.
@@ -1715,7 +1715,7 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
if (status == U_BUFFER_OVERFLOW_ERROR) {
// Buffer Overflow is expected from the preflight operation.
status = U_ZERO_ERROR;
-
+
retPtr = new UChar[ulen+1];
ucnv_toUChars(conv,
retPtr, // dest,
@@ -1757,11 +1757,11 @@ cleanUpAndReturn:
// # Column 2 contains the string to be matched.
// #
// # Column 3 contains the expected result:
-// # y expect a match
-// # n expect no match
-// # c expect an error
-// # B test exposes a known bug in Perl, should be skipped
-// # b test exposes a known bug in Perl, should be skipped if noamp
+// # y expect a match
+// # n expect no match
+// # c expect an error
+// # B test exposes a known bug in Perl, should be skipped
+// # b test exposes a known bug in Perl, should be skipped if noamp
// #
// # Columns 4 and 5 are used only if column 3 contains C or C.
// #
@@ -1846,7 +1846,7 @@ void RegexTest::PerlTests() {
// regexp for $-[0], $+[2], etc.
RegexPattern *groupsPat = RegexPattern::compile("\\$([+\\-])\\[(\\d+)\\]", 0, pe, status);
RegexMatcher *groupsMat = groupsPat->matcher(status);
-
+
// regexp for $0, $1, $2, etc.
RegexPattern *cgPat = RegexPattern::compile("\\$(\\d+)", 0, pe, status);
RegexMatcher *cgMat = cgPat->matcher(status);
@@ -1944,7 +1944,7 @@ void RegexTest::PerlTests() {
//
// replace the Perl variables that appear in some of the
- // match data strings.
+ // match data strings.
//
UnicodeString matchString = fields[1];
matchString.findAndReplace(nulnulSrc, nulnul);
@@ -1954,7 +1954,7 @@ void RegexTest::PerlTests() {
// Don't do full unescape, as this unescapes more than Perl does, which
// causes other spurious failures in the tests.
matchString.findAndReplace("\\n", "\n");
-
+
//
@@ -1967,7 +1967,7 @@ void RegexTest::PerlTests() {
expected = TRUE;
}
if (expected != found) {
- errln("line %d: Expected %smatch, got %smatch",
+ errln("line %d: Expected %smatch, got %smatch",
lineNum, expected?"":"no ", found?"":"no " );
continue;
}
@@ -1975,7 +1975,7 @@ void RegexTest::PerlTests() {
//
// Interpret the Perl expression from the fourth field of the data file,
// building up an ICU string from the results of the ICU match.
- // The Perl expression will contain references to the results of
+ // The Perl expression will contain references to the results of
// a regex match, including the matched string, capture group strings,
// group starting and ending indicies, etc.
//
@@ -2052,7 +2052,7 @@ void RegexTest::PerlTests() {
case 'n': c = '\n'; break;
// add any other escape sequences that show up in the test expected results.
}
- resultString.append(c);
+ resultString.append(c);
perlExpr.remove(0, 1);
}
@@ -2069,7 +2069,7 @@ void RegexTest::PerlTests() {
break;
}
}
-
+
//
// Expected Results Compare
//
@@ -2094,19 +2094,19 @@ void RegexTest::PerlTests() {
//
delete cgMat;
delete cgPat;
-
+
delete groupsMat;
delete groupsPat;
-
+
delete flagMat;
delete flagPat;
delete lineMat;
delete linePat;
-
+
delete fieldPat;
delete [] testData;
-
+
logln("%d tests skipped because of unimplemented regexp features.", skippedUnimplementedCount);
diff --git a/icu4c/source/test/intltest/restsnew.cpp b/icu4c/source/test/intltest/restsnew.cpp
index e2b4d79f48..abeca616a3 100644
--- a/icu4c/source/test/intltest/restsnew.cpp
+++ b/icu4c/source/test/intltest/restsnew.cpp
@@ -992,7 +992,7 @@ NewResourceBundleTest::TestNewTypes() {
}
ResourceBundle theBundle(testdatapath, "testtypes", status);
- ResourceBundle bundle(testdatapath, Locale("te_IN"),status);
+ ResourceBundle bundle(testdatapath, Locale("te_IN"),status);
UnicodeString emptyStr = theBundle.getStringEx("emptystring", status);
if(!emptyStr.length()==0) {
@@ -1010,7 +1010,7 @@ NewResourceBundleTest::TestNewTypes() {
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
CONFIRM_EQ(res.getType(), URES_STRING);
UnicodeString zeroString=res.getString(status);
- len = zeroString.length();
+ len = zeroString.length();
if(U_SUCCESS(status)){
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
CONFIRM_EQ(len, 7);
@@ -1099,10 +1099,10 @@ NewResourceBundleTest::TestNewTypes() {
UnicodeString str = theBundle.getStringEx("testescape",status);
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
if(U_SUCCESS(status)){
- u_charsToUChars(expect,uExpect,(int32_t)uprv_strlen(expect)+1);
+ u_charsToUChars(expect,uExpect,(int32_t)uprv_strlen(expect)+1);
if(str.compare(uExpect)!=0){
errln("Did not get the expected string for testescape expected. Expected : "
- +UnicodeString(uExpect )+ " Got: " + str);
+ +UnicodeString(uExpect )+ " Got: " + str);
}
}
}
@@ -1111,7 +1111,7 @@ NewResourceBundleTest::TestNewTypes() {
UnicodeString str = theBundle.getStringEx("test_underscores",status);
expect ="test message ....";
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
- u_charsToUChars(expect,uExpect,(int32_t)uprv_strlen(expect)+1);
+ u_charsToUChars(expect,uExpect,(int32_t)uprv_strlen(expect)+1);
if(str.compare(uExpect)!=0){
errln("Did not get the expected string for test_underscores.\n");
}
diff --git a/icu4c/source/test/intltest/restsnew.h b/icu4c/source/test/intltest/restsnew.h
index 75f1d87974..2cadcf5b1b 100644
--- a/icu4c/source/test/intltest/restsnew.h
+++ b/icu4c/source/test/intltest/restsnew.h
@@ -32,7 +32,7 @@ public:
void TestOtherAPI(void);
- void TestNewTypes(void);
+ void TestNewTypes(void);
private:
/**
diff --git a/icu4c/source/test/intltest/srchtest.cpp b/icu4c/source/test/intltest/srchtest.cpp
index a673f25301..6899f4bb25 100644
--- a/icu4c/source/test/intltest/srchtest.cpp
+++ b/icu4c/source/test/intltest/srchtest.cpp
@@ -2235,7 +2235,7 @@ void StringSearchTest::TestSubclass()
int i;
StringCharacterIterator chariter(text);
- search.setText(text, status);
+ search.setText(text, status);
if (search.getText() != search2.getText()) {
errln("Error setting text");
}
diff --git a/icu4c/source/test/intltest/srchtest.h b/icu4c/source/test/intltest/srchtest.h
index 24331ab8eb..36163a1d8f 100644
--- a/icu4c/source/test/intltest/srchtest.h
+++ b/icu4c/source/test/intltest/srchtest.h
@@ -86,7 +86,7 @@ private:
void TestSupplementaryCanonical();
void TestContractionCanonical();
void TestUClassID();
- void TestSubclass();
+ void TestSubclass();
};
#endif /* #if !UCONFIG_NO_COLLATION */
diff --git a/icu4c/source/test/intltest/svccoll.cpp b/icu4c/source/test/intltest/svccoll.cpp
index 8b95abc526..34b56bd86f 100644
--- a/icu4c/source/test/intltest/svccoll.cpp
+++ b/icu4c/source/test/intltest/svccoll.cpp
@@ -500,7 +500,7 @@ int32_t CollationServiceTest::checkStringEnumeration(const char* msg,
logln(UnicodeString() + msg + " = [" + buf + "] (" + toString(i) + ")");
#else
logln(UnicodeString() + msg + " = [" + buf + "] (??? NO_FORMATTING)");
-#endif
+#endif
assertTrue("count verified", i==n);
// did we see all expected strings?
if (((1<setText(iteratorText, coll_status);
backAndForth(*c);
diff --git a/icu4c/source/test/intltest/tmsgfmt.cpp b/icu4c/source/test/intltest/tmsgfmt.cpp
index 53bdc6d796..fa5d38b384 100644
--- a/icu4c/source/test/intltest/tmsgfmt.cpp
+++ b/icu4c/source/test/intltest/tmsgfmt.cpp
@@ -51,7 +51,7 @@ TestMessageFormat::runIndexedTest(int32_t index, UBool exec,
TESTCASE(15,testAdopt);
TESTCASE(16,testCopyConstructor2);
TESTCASE(17,TestUnlimitedArgsAndSubformats);
- TESTCASE(18,TestRBNF);
+ TESTCASE(18,TestRBNF);
default: name = ""; break;
}
}
diff --git a/icu4c/source/test/intltest/transrt.cpp b/icu4c/source/test/intltest/transrt.cpp
index 36e6877423..f8803212dd 100644
--- a/icu4c/source/test/intltest/transrt.cpp
+++ b/icu4c/source/test/intltest/transrt.cpp
@@ -984,7 +984,7 @@ void TransliteratorRoundTripTest::TestKana() {
strcat(temp, HALFWIDTH_KATAKANA);
strcat(temp, LENGTH);
strcat(temp, "]");
- test.test(KATAKANA, UnicodeString("[") + HIRAGANA + LENGTH + UnicodeString("]"),
+ test.test(KATAKANA, UnicodeString("[") + HIRAGANA + LENGTH + UnicodeString("]"),
temp,
this, quick, legal);
delete legal;
diff --git a/icu4c/source/test/intltest/tsnmfmt.cpp b/icu4c/source/test/intltest/tsnmfmt.cpp
index 117694f324..57d49ecce4 100644
--- a/icu4c/source/test/intltest/tsnmfmt.cpp
+++ b/icu4c/source/test/intltest/tsnmfmt.cpp
@@ -297,8 +297,8 @@ IntlTestNumberFormat::tryIt(double aNumber)
// Convert from long to double
if (number[i].getType() == Formattable::kLong)
number[i].setDouble(number[i].getLong());
- else if (number[i].getType() == Formattable::kInt64)
- number[i].setDouble((double)number[i].getInt64());
+ else if (number[i].getType() == Formattable::kInt64)
+ number[i].setDouble((double)number[i].getInt64());
else if (number[i].getType() != Formattable::kDouble)
{
errMsg = ("**** FAIL: Parse of " + prettify(string[i-1])
diff --git a/icu4c/source/test/intltest/tztest.cpp b/icu4c/source/test/intltest/tztest.cpp
index f51074be67..633da043c3 100644
--- a/icu4c/source/test/intltest/tztest.cpp
+++ b/icu4c/source/test/intltest/tztest.cpp
@@ -905,8 +905,8 @@ TimeZoneTest::TestDisplayName()
errln("Fail: Expected " + UnicodeString(kData[i].expect) + "; got " + name);
logln("PST [with options]->" + name);
}
- for (i=0; kData[i].expect[0] != '\0'; i++)
- {
+ for (i=0; kData[i].expect[0] != '\0'; i++)
+ {
name.remove();
name = zone->getDisplayName(kData[i].useDst,
kData[i].style, name);
@@ -995,7 +995,7 @@ TimeZoneTest::TestDisplayName()
name.compare("GMT+0130") &&
name.compare("GMT+130"))
errln("Fail: Expected GMT+01:30 or something similar");
- name.truncate(0);
+ name.truncate(0);
zone2->getDisplayName(name);
logln("GMT+90min->" + name);
if (name.compare("GMT+01:30") &&
@@ -1189,29 +1189,29 @@ void TimeZoneTest::TestCountries() {
errln("FAIL: " + laZone + " in JP = " + la);
errln("FAIL: " + tokyoZone + " in JP = " + tokyo);
}
- StringEnumeration* s1 = TimeZone::createEnumeration("US");
- StringEnumeration* s2 = TimeZone::createEnumeration("US");
- for(i=0;isnext(ec);
- if(id1==NULL || U_FAILURE(ec)){
- errln("Failed to fetch next from TimeZone enumeration. Length returned : %i Current Index: %i", n,i);
- }
- TimeZone* tz1 = TimeZone::createTimeZone(*id1);
- for(int j=0; jsnext(ec);
- if(id2==NULL || U_FAILURE(ec)){
- errln("Failed to fetch next from TimeZone enumeration. Length returned : %i Current Index: %i", n,i);
- }
- TimeZone* tz2 = TimeZone::createTimeZone(*id2);
- if(tz1->hasSameRules(*tz2)){
- logln("ID1 : " + *id1+" == ID2 : " +*id2);
- }
- delete tz2;
- }
- delete tz1;
- }
- delete s1;
- delete s2;
+ StringEnumeration* s1 = TimeZone::createEnumeration("US");
+ StringEnumeration* s2 = TimeZone::createEnumeration("US");
+ for(i=0;isnext(ec);
+ if(id1==NULL || U_FAILURE(ec)){
+ errln("Failed to fetch next from TimeZone enumeration. Length returned : %i Current Index: %i", n,i);
+ }
+ TimeZone* tz1 = TimeZone::createTimeZone(*id1);
+ for(int j=0; jsnext(ec);
+ if(id2==NULL || U_FAILURE(ec)){
+ errln("Failed to fetch next from TimeZone enumeration. Length returned : %i Current Index: %i", n,i);
+ }
+ TimeZone* tz2 = TimeZone::createTimeZone(*id2);
+ if(tz1->hasSameRules(*tz2)){
+ logln("ID1 : " + *id1+" == ID2 : " +*id2);
+ }
+ delete tz2;
+ }
+ delete tz1;
+ }
+ delete s1;
+ delete s2;
delete s;
}
diff --git a/icu4c/source/test/intltest/uobjtest.cpp b/icu4c/source/test/intltest/uobjtest.cpp
index 6d99b99300..8354871c3d 100644
--- a/icu4c/source/test/intltest/uobjtest.cpp
+++ b/icu4c/source/test/intltest/uobjtest.cpp
@@ -43,8 +43,8 @@ const char *ids_class[MAX_CLASS_ID];
uint32_t ids_count = 0;
UObject *UObjectTest::testClass(UObject *obj,
- const char *className, const char *factory,
- UClassID staticID)
+ const char *className, const char *factory,
+ UClassID staticID)
{
uint32_t i;
UnicodeString what = UnicodeString(className) + " * x= " + UnicodeString(factory?factory:" ABSTRACT ") + "; ";
@@ -94,11 +94,11 @@ UObject *UObjectTest::testClass(UObject *obj,
for(i=0;i 0 && total_size < 0x7FFF);
+ U_ASSERT(total_size > 0 && total_size < 0x7FFF);
header.total_size = (int16_t) total_size;
header.valueMap_offset = valueMap_offset;
header.valueMap_count = (int16_t) valueMap_count;
@@ -815,9 +815,9 @@ void Builder::fixupMiscellaneousOffsets() {
header.stringPool_offset = stringPool_offset;
header.stringPool_count = (int16_t) stringPool_count - 1; // don't include "" entry
- U_ASSERT(valueMap_count <= 0x7FFF);
- U_ASSERT(nameGroupPool_count <= 0x7FFF);
- U_ASSERT(stringPool_count <= 0x7FFF);
+ U_ASSERT(valueMap_count <= 0x7FFF);
+ U_ASSERT(nameGroupPool_count <= 0x7FFF);
+ U_ASSERT(stringPool_count <= 0x7FFF);
// 3:
Offset* p = enumToValue->getOffsetArray();
diff --git a/icu4c/source/tools/genrb/parse.c b/icu4c/source/tools/genrb/parse.c
index 0972fa548f..786bf67a47 100644
--- a/icu4c/source/tools/genrb/parse.c
+++ b/icu4c/source/tools/genrb/parse.c
@@ -499,7 +499,7 @@ parseUCARules(char *tag, uint32_t startline, UErrorCode *status)
}
}
- /* terminate the string */
+ /* terminate the string */
if(target < targetLimit){
*target = 0x0000;
}
diff --git a/icu4c/source/tools/genrb/rle.c b/icu4c/source/tools/genrb/rle.c
index d38ed7eeb9..053cb33e49 100644
--- a/icu4c/source/tools/genrb/rle.c
+++ b/icu4c/source/tools/genrb/rle.c
@@ -90,12 +90,12 @@ encodeRunByte(uint16_t* buffer,uint16_t* bufLimit, uint8_t value, int32_t length
}
#define APPEND( buffer, bufLimit, value, num, status){ \
- if(bufferstr)
@@ -57,7 +57,7 @@ const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim,
ln += (int32_t)uprv_strlen(l->str);
- ol = l;
+ ol = l;
if(l->next && delim)
{