ICU-3221 Fix AIX linker warnings, and reduce amount of private static class data being exported (some mainframes have minor issues with that)

X-SVN-Rev: 13337
This commit is contained in:
George Rhoten 2003-10-07 15:49:47 +00:00
parent b626ac0b2d
commit 8e7a34ec49
22 changed files with 50 additions and 136 deletions

View File

@ -111,25 +111,25 @@ static const UChar gLastResortZoneStrings[5][4] =
U_NAMESPACE_BEGIN
const char DateFormatSymbols::fgClassID=0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DateFormatSymbols)
/**
* These are the tags we expect to see in normal resource bundle files associated
* with a locale.
*/
const char DateFormatSymbols::fgErasTag[]="Eras";
const char DateFormatSymbols::fgMonthNamesTag[]="MonthNames";
const char DateFormatSymbols::fgMonthAbbreviationsTag[]="MonthAbbreviations";
const char DateFormatSymbols::fgDayNamesTag[]="DayNames";
const char DateFormatSymbols::fgDayAbbreviationsTag[]="DayAbbreviations";
const char DateFormatSymbols::fgAmPmMarkersTag[]="AmPmMarkers";
const char gErasTag[]="Eras";
const char gMonthNamesTag[]="MonthNames";
const char gMonthAbbreviationsTag[]="MonthAbbreviations";
const char gDayNamesTag[]="DayNames";
const char gDayAbbreviationsTag[]="DayAbbreviations";
const char gAmPmMarkersTag[]="AmPmMarkers";
/**
* These are the tags we expect to see in time zone data resource bundle files
* associated with a locale.
*/
const char DateFormatSymbols::fgZoneStringsTag[]="zoneStrings";
const char DateFormatSymbols::fgLocalPatternCharsTag[]="localPatternChars";
const char gZoneStringsTag[]="zoneStrings";
const char gLocalPatternCharsTag[]="localPatternChars";
/**
* Jitterbug 2974: MSVC has a bug whereby new X[0] behaves badly.
@ -644,14 +644,14 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
// if we make it to here, the resource data is cool, and we can get everything out
// of it that we need except for the time-zone and localized-pattern data, which
// are stoerd in a separate file
initField(&fEras, fErasCount, getData(resource, fgErasTag, type, status), status);
initField(&fMonths, fMonthsCount, getData(resource, fgMonthNamesTag, type, status), status);
initField(&fShortMonths, fShortMonthsCount, getData(resource, fgMonthAbbreviationsTag, type, status), status);
initField(&fAmPms, fAmPmsCount, getData(resource, fgAmPmMarkersTag, type, status), status);
initField(&fEras, fErasCount, getData(resource, gErasTag, type, status), status);
initField(&fMonths, fMonthsCount, getData(resource, gMonthNamesTag, type, status), status);
initField(&fShortMonths, fShortMonthsCount, getData(resource, gMonthAbbreviationsTag, type, status), status);
initField(&fAmPms, fAmPmsCount, getData(resource, gAmPmMarkersTag, type, status), status);
// fastCopyFrom() - see assignArray comments
fLocalPatternChars.fastCopyFrom(resource.getStringEx(fgLocalPatternCharsTag, status));
fLocalPatternChars.fastCopyFrom(resource.getStringEx(gLocalPatternCharsTag, status));
ResourceBundle zoneArray(resource.get(fgZoneStringsTag, status));
ResourceBundle zoneArray(resource.get(gZoneStringsTag, status));
fZoneStringsRowCount = zoneArray.getSize();
ResourceBundle zoneRow(zoneArray.get((int32_t)0, status));
/* TODO: Fix the case where the zoneStrings is not a perfect square array of information. */
@ -677,7 +677,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
}
// {sfb} fixed to handle 1-based weekdays
ResourceBundle weekdaysData(getData(resource, fgDayNamesTag, type, status));
ResourceBundle weekdaysData(getData(resource, gDayNamesTag, type, status));
fWeekdaysCount = weekdaysData.getSize();
fWeekdays = new UnicodeString[fWeekdaysCount+1];
/* test for NULL */
@ -691,7 +691,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
fWeekdays[i+1].fastCopyFrom(weekdaysData.getStringEx(i, status));
}
ResourceBundle lsweekdaysData(getData(resource, fgDayAbbreviationsTag, type, status));
ResourceBundle lsweekdaysData(getData(resource, gDayAbbreviationsTag, type, status));
fShortWeekdaysCount = lsweekdaysData.getSize();
fShortWeekdays = new UnicodeString[fShortWeekdaysCount+1];
/* test for NULL */

View File

@ -25,7 +25,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(HexToUnicodeTransliterator)
/**
* ID for this transliterator.
*/
const char HexToUnicodeTransliterator::_ID[] = "Hex-Any";
const char CURR_ID[] = "Hex-Any";
/**
* This pattern encodes the following specs for the default constructor:
@ -53,7 +53,7 @@ HexToUnicodeTransliterator::~HexToUnicodeTransliterator() {}
* Constructs a transliterator.
*/
HexToUnicodeTransliterator::HexToUnicodeTransliterator(UnicodeFilter* adoptedFilter) :
Transliterator(_ID, adoptedFilter) {
Transliterator(UnicodeString(CURR_ID, ""), adoptedFilter) {
// We don't need to pass the status back to the caller because
// we know that the DEFAULT_PATTERN parses.
UErrorCode status = U_ZERO_ERROR;
@ -65,7 +65,7 @@ HexToUnicodeTransliterator::HexToUnicodeTransliterator(UnicodeFilter* adoptedFil
*/
HexToUnicodeTransliterator::HexToUnicodeTransliterator(const UnicodeString& thePattern,
UErrorCode& status) :
Transliterator(_ID, 0) {
Transliterator(UnicodeString(CURR_ID, ""), 0) {
applyPattern(thePattern, status);
}
@ -75,7 +75,7 @@ HexToUnicodeTransliterator::HexToUnicodeTransliterator(const UnicodeString& theP
HexToUnicodeTransliterator::HexToUnicodeTransliterator(const UnicodeString& thePattern,
UnicodeFilter* adoptedFilter,
UErrorCode& status) :
Transliterator(_ID, adoptedFilter) {
Transliterator(UnicodeString(CURR_ID, ""), adoptedFilter) {
applyPattern(thePattern, status);
}

View File

@ -32,10 +32,6 @@ U_NAMESPACE_BEGIN
*/
class U_I18N_API HexToUnicodeTransliterator : public Transliterator {
/**
* ID for this transliterator.
*/
static const char _ID[];
// Character constants defined here to avoid ASCII dependency
enum {

View File

@ -24,7 +24,7 @@ U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NameUnicodeTransliterator)
const char NameUnicodeTransliterator::_ID[] = "Name-Any";
const char CURR_ID[] = "Name-Any";
static const UChar OPEN[] = {92,78,126,123,126,0}; // "\N~{~"
static const UChar OPEN_DELIM = 92; // '\\' first char of OPEN
@ -36,7 +36,7 @@ static const UChar SPACE = 32; // ' '
* '}'.
*/
NameUnicodeTransliterator::NameUnicodeTransliterator(UnicodeFilter* adoptedFilter) :
Transliterator(_ID, adoptedFilter) {
Transliterator(UnicodeString(CURR_ID, ""), adoptedFilter) {
}
/**

View File

@ -81,9 +81,6 @@ public:
virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
UBool isIncremental) const;
private:
static const char _ID[];
};
U_NAMESPACE_END

View File

@ -31,13 +31,13 @@
U_NAMESPACE_BEGIN
const char SimpleTimeZone::fgClassID = 0; // Value is irrelevant
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleTimeZone)
// WARNING: assumes that no rule is measured from the end of February,
// since we don't handle leap years. Could handle assuming always
// Gregorian, since we know they didn't have daylight time when
// Gregorian calendar started.
const int8_t SimpleTimeZone::staticMonthLength[] = {31,29,31,30,31,30,31,31,30,31,30,31};
const int8_t SimpleTimeZone::STATICMONTHLENGTH[] = {31,29,31,30,31,30,31,31,30,31,30,31};
// *****************************************************************************
// class SimpleTimeZone
@ -403,7 +403,7 @@ int32_t
SimpleTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const
{
// Check the month before indexing into staticMonthLength. This
// Check the month before indexing into STATICMONTHLENGTH. This
// duplicates the test that occurs in the 7-argument getOffset(),
// however, this is unavoidable. We don't mind because this method, in
// fact, should not be called; internal code should always call the
@ -415,14 +415,14 @@ SimpleTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
return 0;
}
return getOffset(era, year, month, day, dayOfWeek, millis, staticMonthLength[month], status);
return getOffset(era, year, month, day, dayOfWeek, millis, STATICMONTHLENGTH[month], status);
}
int32_t
SimpleTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
uint8_t dayOfWeek, int32_t millis,
int32_t monthLength, UErrorCode& status) const {
// Check the month before indexing into staticMonthLength. This
// Check the month before indexing into STATICMONTHLENGTH. This
// duplicates a test that occurs in the 9-argument getOffset(),
// however, this is unavoidable. We don't mind because this method, in
// fact, should not be called; internal code should always call the
@ -436,7 +436,7 @@ SimpleTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
}
// TODO FIX We don't handle leap years yet!
int32_t prevMonthLength = (month >= 1) ? staticMonthLength[month - 1] : 31;
int32_t prevMonthLength = (month >= 1) ? STATICMONTHLENGTH[month - 1] : 31;
return getOffset(era, year, month, day, dayOfWeek, millis,
monthLength, prevMonthLength, status);
@ -581,7 +581,7 @@ SimpleTimeZone::compareToRule(int8_t month, int8_t monthLen, int8_t prevMonthLen
// if ruleDay is negative (we assume it's not zero here), we have to do
// the same calculation figuring backward from the last day of the month.
// (staticMonthLength gives us that last day. We don't take leap years
// (STATICMONTHLENGTH gives us that last day. We don't take leap years
// into account, so this may not work right for February.)
else
{
@ -857,7 +857,7 @@ SimpleTimeZone::decodeStartRule(UErrorCode& status)
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
} else if (startDay > staticMonthLength[startMonth]) {
} else if (startDay > STATICMONTHLENGTH[startMonth]) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@ -912,7 +912,7 @@ SimpleTimeZone::decodeEndRule(UErrorCode& status)
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
} else if (endDay > staticMonthLength[endMonth]) {
} else if (endDay > STATICMONTHLENGTH[endMonth]) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}

View File

@ -754,11 +754,6 @@ const int32_t RuleBasedCollator::RESETTERTIARY = 0x00000002;
const int32_t RuleBasedCollator::PRIMIGNORABLE = 0x0202;
/* unique file id for parity check */
const int16_t RuleBasedCollator::FILEID = 0x5443;
/* binary collation file extension */
const char RuleBasedCollator::kFilenameSuffix[] = ".col";
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedCollator)
U_NAMESPACE_END

View File

@ -70,7 +70,6 @@ static const UChar CUSTOM_ID[] =
static UMTX LOCK;
static TimeZone* DEFAULT_ZONE = NULL;
static TimeZone* _GMT = NULL; // cf. TimeZone::GMT
const char TimeZone::fgClassID = 0; // Value is irrelevant
// #ifdef ICU_TIMEZONE_USE_DEPRECATES
static UnicodeString* OLSON_IDS = 0;

View File

@ -28,7 +28,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TitlecaseTransliterator)
/**
* ID for this transliterator.
*/
const char TitlecaseTransliterator::_ID[] = "Any-Title";
const char CURR_ID[] = "Any-Title";
/**
* The set of characters we skip. These are neither cased nor
@ -45,7 +45,7 @@ static UnicodeSet* SKIP = NULL;
static UnicodeSet* CASED = NULL;
TitlecaseTransliterator::TitlecaseTransliterator(const Locale& theLoc) :
Transliterator(_ID, 0),
Transliterator(UnicodeString(CURR_ID, ""), 0),
loc(theLoc),
buffer(0)
{

View File

@ -27,12 +27,6 @@ U_NAMESPACE_BEGIN
* @author Alan Liu
*/
class U_I18N_API TitlecaseTransliterator : public Transliterator {
/**
* ID for this transliterator.
*/
static const char _ID[];
public:
/**

View File

@ -22,12 +22,13 @@ U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LowercaseTransliterator)
const char LowercaseTransliterator::_ID[] = "Any-Lower";
const char CURR_ID[] = "Any-Lower";
/**
* Constructs a transliterator.
*/
LowercaseTransliterator::LowercaseTransliterator(const Locale& theLoc) : Transliterator(_ID, 0),
LowercaseTransliterator::LowercaseTransliterator(const Locale& theLoc) :
Transliterator(UnicodeString(CURR_ID, ""), 0),
loc(theLoc) , buffer(0)
{
buffer = (UChar *)uprv_malloc(u_getMaxCaseExpansion()*sizeof(buffer[0]));

View File

@ -88,7 +88,6 @@ private:
Locale loc;
UChar* buffer;
static const char _ID[];
};

View File

@ -22,13 +22,13 @@ U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UppercaseTransliterator)
const char UppercaseTransliterator::_ID[] = "Any-Upper";
const char CURR_ID[] = "Any-Upper";
/**
* Constructs a transliterator.
*/
UppercaseTransliterator::UppercaseTransliterator(const Locale& theLoc) :
Transliterator(_ID, 0),
Transliterator(UnicodeString(CURR_ID, ""), 0),
loc(theLoc),
buffer(0)
{

View File

@ -89,7 +89,6 @@ private:
Locale loc;
UChar* buffer;
static const char _ID[];
};

View File

@ -23,7 +23,7 @@ U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnicodeNameTransliterator)
const char UnicodeNameTransliterator::_ID[] = "Any-Name";
const char CURR_ID[] = "Any-Name";
static const UChar OPEN_DELIM[] = {92,78,123,0}; // "\N{"
static const UChar CLOSE_DELIM = 125; // "}"
@ -33,7 +33,7 @@ static const UChar CLOSE_DELIM = 125; // "}"
* Constructs a transliterator.
*/
UnicodeNameTransliterator::UnicodeNameTransliterator(UnicodeFilter* adoptedFilter) :
Transliterator(_ID, adoptedFilter) {
Transliterator(UnicodeString(CURR_ID, ""), adoptedFilter) {
}
/**

View File

@ -81,10 +81,6 @@ class U_I18N_API UnicodeNameTransliterator : public Transliterator {
virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
UBool isIncremental) const;
private:
static const char _ID[];
};
U_NAMESPACE_END

View File

@ -315,28 +315,16 @@ public:
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const;
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID();
static UClassID getStaticClassID();
private:
/**
* Tag names used by this class.
*/
static const char fgErasTag[]; // resource bundle tag for era names
static const char fgMonthNamesTag[]; // resource bundle tag for month names
static const char fgMonthAbbreviationsTag[]; // resource bundle tag for month abbreviations
static const char fgDayNamesTag[]; // resource bundle tag for day names
static const char fgDayAbbreviationsTag[]; // resource bundle tag for day abbreviations
static const char fgAmPmMarkersTag[]; // resource bundle tag for AM/PM strings
static const char fgZoneStringsTag[]; // resource bundle tag for time zone names
static const char fgLocalPatternCharsTag[]; // resource bundle tag for localized pattern characters
friend class SimpleDateFormat;
friend class DateFormatSymbolsSingleSetter; // see udat.cpp
@ -389,12 +377,6 @@ private:
*/
UnicodeString fLocalPatternChars;
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
private:
/* Sizes for the last resort string arrays */
@ -510,14 +492,6 @@ private:
void disposeZoneStrings(void);
};
inline UClassID
DateFormatSymbols::getStaticClassID()
{ return (UClassID)&fgClassID; }
inline UClassID
DateFormatSymbols::getDynamicClassID() const
{ return DateFormatSymbols::getStaticClassID(); }
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */

View File

@ -793,8 +793,6 @@ private:
void decodeStartRule(UErrorCode& status);
void decodeEndRule(UErrorCode& status);
static const char fgClassID;
int8_t startMonth, startDay, startDayOfWeek; // the month, day, DOW, and time DST starts
int32_t startTime;
TimeMode startTimeMode, endTimeMode; // Mode for startTime, endTime; see TimeMode
@ -803,7 +801,7 @@ private:
int32_t startYear; // the year these DST rules took effect
int32_t rawOffset; // the TimeZone's raw GMT offset
UBool useDaylight; // flag indicating whether this TimeZone uses DST
static const int8_t staticMonthLength[12]; // lengths of the months
static const int8_t STATICMONTHLENGTH[12]; // lengths of the months
EMode startMode, endMode; // flags indicating what kind of rules the DST rules are
/**
@ -813,14 +811,6 @@ private:
int32_t dstSavings;
};
inline UClassID
SimpleTimeZone::getStaticClassID(void)
{ return (UClassID)&fgClassID; }
inline UClassID
SimpleTimeZone::getDynamicClassID(void) const
{ return SimpleTimeZone::getStaticClassID(); }
inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfWeekInMonth,
int32_t dayOfWeek,
int32_t time, UErrorCode& status) {

View File

@ -639,9 +639,6 @@ private:
static const int32_t PRIMIGNORABLE;
static const int16_t FILEID;
static const char kFilenameSuffix[];
// private data members ---------------------------------------------------
UBool dataIsOwned;

View File

@ -571,19 +571,6 @@ public:
*/
virtual TimeZone* clone(void) const = 0;
/**
* Return the class ID for this class. This is useful only for
* comparing to a return value from getDynamicClassID(). For example:
* <pre>
* . Base* polymorphic_pointer = createPolymorphicObject();
* . if (polymorphic_pointer->getDynamicClassID() ==
* . Derived::getStaticClassID()) ...
* </pre>
* @return The class ID for all objects of this class.
* @stable ICU 2.0
*/
static inline UClassID getStaticClassID(void);
/**
* Returns a unique class ID POLYMORPHICALLY. Pure virtual method. This method is to
* implement a simple version of RTTI, since not all C++ compilers support genuine
@ -631,8 +618,6 @@ protected:
TimeZone& operator=(const TimeZone& right);
private:
static const char fgClassID;
static TimeZone* createCustomTimeZone(const UnicodeString&); // Creates a time zone based on the string.
/**
@ -656,10 +641,6 @@ private:
};
inline UClassID
TimeZone::getStaticClassID(void)
{ return (UClassID)&fgClassID; }
// -------------------------------------
inline UnicodeString&

View File

@ -23,7 +23,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnicodeToHexTransliterator)
/**
* ID for this transliterator.
*/
const char UnicodeToHexTransliterator::_ID[] = "Any-Hex";
const char CURR_ID[] = "Any-Hex";
static const UChar HEX_DIGITS[32] = {
// Use Unicode hex values for EBCDIC compatibility
@ -43,8 +43,9 @@ UnicodeToHexTransliterator::UnicodeToHexTransliterator(
UBool isUppercase,
UnicodeFilter* adoptedFilter,
UErrorCode& status) :
Transliterator(_ID, adoptedFilter),
uppercase(isUppercase) {
Transliterator(UnicodeString(CURR_ID, ""), adoptedFilter),
uppercase(isUppercase)
{
if (U_FAILURE(status)) {
return;
@ -58,7 +59,7 @@ UnicodeToHexTransliterator::UnicodeToHexTransliterator(
UnicodeToHexTransliterator::UnicodeToHexTransliterator(
const UnicodeString& thePattern,
UErrorCode& status) :
Transliterator(_ID, 0),
Transliterator(UnicodeString(CURR_ID, ""), 0),
uppercase(TRUE) {
if (U_FAILURE(status)) {
@ -73,7 +74,7 @@ UnicodeToHexTransliterator::UnicodeToHexTransliterator(
*/
UnicodeToHexTransliterator::UnicodeToHexTransliterator(
UnicodeFilter* adoptedFilter) :
Transliterator(_ID, adoptedFilter),
Transliterator(UnicodeString(CURR_ID, ""), adoptedFilter),
pattern("\\\\u0000", ""),
prefix("\\u", 2, ""),
suffix(),

View File

@ -52,11 +52,6 @@ private:
BACKSLASH = 0x005C // '\\'
};
/**
* ID for this transliterator.
*/
static const char _ID[];
/**
* The pattern set by applyPattern() and returned by toPattern().
*/