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:
Richard Frith-MacDonald 2011-02-22 11:55:37 +00:00
parent 38670c0a08
commit e6fca186b1
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>
* Source/NSString.m: Modified stringByStandardizingPath and

View file

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

View file

@ -114,7 +114,8 @@ NSString * const NSISO8601Calendar = @"";
static const char * ICUCalendarKeyword = "calendar";
static const char * ICUCollationKeyword = "collation";
static NSLocaleLanguageDirection _ICUToNSLocaleOrientation (ULayoutType layout)
static NSLocaleLanguageDirection
ICUToNSLocaleOrientation (ULayoutType layout)
{
switch (layout)
{
@ -340,7 +341,7 @@ static NSRecursiveLock *classLock = nil;
if (U_FAILURE(status) || ULOC_LAYOUT_UNKNOWN == result)
return NSLocaleLanguageDirectionUnknown;
return _ICUToNSLocaleOrientation (result);
return ICUToNSLocaleOrientation (result);
#else
return NSLocaleLanguageDirectionLeftToRight; // FIXME
#endif
@ -530,7 +531,7 @@ static NSRecursiveLock *classLock = nil;
if (U_FAILURE(status) || ULOC_LAYOUT_UNKNOWN == result)
return NSLocaleLanguageDirectionUnknown;
return _ICUToNSLocaleOrientation (result);
return ICUToNSLocaleOrientation (result);
#else
return NSLocaleLanguageDirectionTopToBottom; // FIXME
#endif
@ -597,10 +598,10 @@ static NSRecursiveLock *classLock = nil;
// A locale cannot be constructed without a language.
if (language == NULL)
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",
language, __TEST_CODE(script), __TEST_CODE(country), __TEST_CODE(variant)];
#undef __TEST_CODE
language, TEST_CODE(script), TEST_CODE(country), TEST_CODE(variant)];
#undef TEST_CODE
// 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.

View file

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

View file

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