portability tweak

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32290 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-02-22 11:55:37 +00:00
parent f2e81c9391
commit e689faf81a
5 changed files with 33 additions and 22 deletions

View file

@ -1,3 +1,12 @@
2011-02-22 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSDateFormatter.m:
* Source/NSLocale.m:
* Source/NSNumberFormatter.m:
* Source/NSTimeZone.m:
Remove a few bogus underscores (pointed out by David) which could
potentially cause problems with compiler/linker etc.
2011-02-21 Richard Frith-Macdonald <rfm@gnu.org> 2011-02-21 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSString.m: Modified stringByStandardizingPath and * Source/NSString.m: Modified stringByStandardizingPath and

View file

@ -56,7 +56,8 @@
- (NSArray *) _getSymbols: (NSInteger) symbol; - (NSArray *) _getSymbols: (NSInteger) symbol;
@end @end
static inline NSInteger _NSToUDateFormatStyle (NSDateFormatterStyle style) static inline NSInteger
NSToUDateFormatStyle (NSDateFormatterStyle style)
{ {
#if GS_USE_ICU == 1 #if GS_USE_ICU == 1
NSInteger relative = NSInteger relative =
@ -976,8 +977,8 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
tzID = NSZoneMalloc ([self zone], sizeof(UChar) * tzIDLength); tzID = NSZoneMalloc ([self zone], sizeof(UChar) * tzIDLength);
[[internal->_tz name] getCharacters: tzID range: NSMakeRange (0, tzIDLength)]; [[internal->_tz name] getCharacters: tzID range: NSMakeRange (0, tzIDLength)];
internal->_formatter = udat_open (_NSToUDateFormatStyle(internal->_timeStyle), internal->_formatter = udat_open (NSToUDateFormatStyle(internal->_timeStyle),
_NSToUDateFormatStyle(internal->_dateStyle), NSToUDateFormatStyle(internal->_dateStyle),
[[internal->_locale localeIdentifier] UTF8String], [[internal->_locale localeIdentifier] UTF8String],
tzID, tzID,
tzIDLength, tzIDLength,

View file

@ -114,7 +114,8 @@ NSString * const NSISO8601Calendar = @"";
static const char * ICUCalendarKeyword = "calendar"; static const char * ICUCalendarKeyword = "calendar";
static const char * ICUCollationKeyword = "collation"; static const char * ICUCollationKeyword = "collation";
static NSLocaleLanguageDirection _ICUToNSLocaleOrientation (ULayoutType layout) static NSLocaleLanguageDirection
ICUToNSLocaleOrientation (ULayoutType layout)
{ {
switch (layout) switch (layout)
{ {
@ -340,7 +341,7 @@ static NSRecursiveLock *classLock = nil;
if (U_FAILURE(status) || ULOC_LAYOUT_UNKNOWN == result) if (U_FAILURE(status) || ULOC_LAYOUT_UNKNOWN == result)
return NSLocaleLanguageDirectionUnknown; return NSLocaleLanguageDirectionUnknown;
return _ICUToNSLocaleOrientation (result); return ICUToNSLocaleOrientation (result);
#else #else
return NSLocaleLanguageDirectionLeftToRight; // FIXME return NSLocaleLanguageDirectionLeftToRight; // FIXME
#endif #endif
@ -530,7 +531,7 @@ static NSRecursiveLock *classLock = nil;
if (U_FAILURE(status) || ULOC_LAYOUT_UNKNOWN == result) if (U_FAILURE(status) || ULOC_LAYOUT_UNKNOWN == result)
return NSLocaleLanguageDirectionUnknown; return NSLocaleLanguageDirectionUnknown;
return _ICUToNSLocaleOrientation (result); return ICUToNSLocaleOrientation (result);
#else #else
return NSLocaleLanguageDirectionTopToBottom; // FIXME return NSLocaleLanguageDirectionTopToBottom; // FIXME
#endif #endif
@ -597,10 +598,10 @@ static NSRecursiveLock *classLock = nil;
// A locale cannot be constructed without a language. // A locale cannot be constructed without a language.
if (language == NULL) if (language == NULL)
return nil; return nil;
#define __TEST_CODE(x) (x ? "_" : ""), (x ? x : "") #define TEST_CODE(x) (x ? "_" : ""), (x ? x : "")
string = [[NSMutableString alloc] initWithFormat: @"%s%s%s%s%s%s%s", string = [[NSMutableString alloc] initWithFormat: @"%s%s%s%s%s%s%s",
language, __TEST_CODE(script), __TEST_CODE(country), __TEST_CODE(variant)]; language, TEST_CODE(script), TEST_CODE(country), TEST_CODE(variant)];
#undef __TEST_CODE #undef TEST_CODE
// I'm not using uloc_setKeywordValue() here because the format is easy // I'm not using uloc_setKeywordValue() here because the format is easy
// enough to reproduce and has the added advatange that we doesn't need ICU. // enough to reproduce and has the added advatange that we doesn't need ICU.

View file

@ -54,7 +54,7 @@
#if GS_USE_ICU == 1 #if GS_USE_ICU == 1
static inline UNumberFormatStyle static inline UNumberFormatStyle
_NSToICUFormatStyle (NSNumberFormatterStyle style) NSToICUFormatStyle (NSNumberFormatterStyle style)
{ {
UNumberFormatStyle result; UNumberFormatStyle result;
@ -84,7 +84,7 @@ _NSToICUFormatStyle (NSNumberFormatterStyle style)
} }
static inline UNumberFormatPadPosition static inline UNumberFormatPadPosition
_NSToICUPadPosition (NSNumberFormatterPadPosition position) NSToICUPadPosition (NSNumberFormatterPadPosition position)
{ {
UNumberFormatPadPosition result = 0; UNumberFormatPadPosition result = 0;
@ -108,7 +108,7 @@ _NSToICUPadPosition (NSNumberFormatterPadPosition position)
} }
static inline NSNumberFormatterPadPosition static inline NSNumberFormatterPadPosition
_ICUToNSPadPosition (UNumberFormatPadPosition position) ICUToNSPadPosition (UNumberFormatPadPosition position)
{ {
NSNumberFormatterPadPosition result = 0; NSNumberFormatterPadPosition result = 0;
@ -132,7 +132,7 @@ _ICUToNSPadPosition (UNumberFormatPadPosition position)
} }
static inline UNumberFormatRoundingMode static inline UNumberFormatRoundingMode
_NSToICURoundingMode (NSNumberFormatterRoundingMode mode) NSToICURoundingMode (NSNumberFormatterRoundingMode mode)
{ {
UNumberFormatRoundingMode result = 0; UNumberFormatRoundingMode result = 0;
@ -165,7 +165,7 @@ _NSToICURoundingMode (NSNumberFormatterRoundingMode mode)
} }
static inline NSNumberFormatterRoundingMode static inline NSNumberFormatterRoundingMode
_ICUToNSRoundingMode (UNumberFormatRoundingMode mode) ICUToNSRoundingMode (UNumberFormatRoundingMode mode)
{ {
NSNumberFormatterRoundingMode result = 0; NSNumberFormatterRoundingMode result = 0;
@ -1269,7 +1269,7 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
{ {
#if GS_USE_ICU == 1 #if GS_USE_ICU == 1
unum_setAttribute (internal->_formatter, UNUM_ROUNDING_MODE, unum_setAttribute (internal->_formatter, UNUM_ROUNDING_MODE,
_NSToICURoundingMode(mode)); NSToICURoundingMode(mode));
#else #else
return; return;
#endif #endif
@ -1278,7 +1278,7 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
- (NSNumberFormatterRoundingMode) roundingMode - (NSNumberFormatterRoundingMode) roundingMode
{ {
#if GS_USE_ICU == 1 #if GS_USE_ICU == 1
return _ICUToNSRoundingMode (unum_getAttribute (internal->_formatter, return ICUToNSRoundingMode (unum_getAttribute (internal->_formatter,
UNUM_ROUNDING_MODE)); UNUM_ROUNDING_MODE));
#else #else
return 0; return 0;
@ -1812,7 +1812,7 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
{ {
#if GS_USE_ICU == 1 #if GS_USE_ICU == 1
unum_setAttribute (internal->_formatter, UNUM_PADDING_POSITION, unum_setAttribute (internal->_formatter, UNUM_PADDING_POSITION,
_NSToICUPadPosition (position)); NSToICUPadPosition (position));
#else #else
return; return;
#endif #endif
@ -1821,7 +1821,7 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
- (NSNumberFormatterPadPosition) paddingPosition - (NSNumberFormatterPadPosition) paddingPosition
{ {
#if GS_USE_ICU == 1 #if GS_USE_ICU == 1
return _ICUToNSPadPosition(unum_getAttribute (internal->_formatter, return ICUToNSPadPosition(unum_getAttribute (internal->_formatter,
UNUM_PADDING_POSITION)); UNUM_PADDING_POSITION));
#else #else
return 0; return 0;
@ -2048,7 +2048,7 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
unum_close(internal->_formatter); unum_close(internal->_formatter);
cLocaleId = [[internal->_locale localeIdentifier] UTF8String]; cLocaleId = [[internal->_locale localeIdentifier] UTF8String];
style = _NSToICUFormatStyle (internal->_style); style = NSToICUFormatStyle (internal->_style);
internal->_formatter = unum_open (style, NULL, 0, cLocaleId, NULL, &err); internal->_formatter = unum_open (style, NULL, 0, cLocaleId, NULL, &err);
if (U_FAILURE(err)) if (U_FAILURE(err))

View file

@ -178,7 +178,7 @@ _NSToICUTZDisplayStyle(NSTimeZoneNameStyle style)
} }
static inline UCalendar * static inline UCalendar *
_UCalendarSetup (NSTimeZone *tz, NSLocale *locale) ICUCalendarSetup (NSTimeZone *tz, NSLocale *locale)
{ {
NSString *tzStr; NSString *tzStr;
int32_t tzLen; int32_t tzLen;
@ -2125,7 +2125,7 @@ localZoneString, [zone name], sign, s/3600, (s/60)%60);
UCalendar *cal; UCalendar *cal;
UErrorCode err = U_ZERO_ERROR; UErrorCode err = U_ZERO_ERROR;
cal = _UCalendarSetup (self, nil); cal = ICUCalendarSetup (self, nil);
if (cal == NULL) if (cal == NULL)
return 0.0; return 0.0;
@ -2166,7 +2166,7 @@ localZoneString, [zone name], sign, s/3600, (s/60)%60);
UCalendar *cal; UCalendar *cal;
UErrorCode err = U_ZERO_ERROR; UErrorCode err = U_ZERO_ERROR;
cal = _UCalendarSetup (self, locale); cal = ICUCalendarSetup (self, locale);
if (cal == NULL) if (cal == NULL)
return nil; return nil;