Misc minor bugfixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39422 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2016-02-29 09:20:43 +00:00
parent 59d489fdc8
commit fbee572507
3 changed files with 105 additions and 79 deletions

View file

@ -1,7 +1,10 @@
2016-02-29 Richard Frith-Macdonald <rfm@gnu.org>
* Based on testplant patch, fix bug with ownership when copying
subdirectories.
* Source/NSFileManager.m: Based on testplant patch, fix bug with
ownership when copying subdirectories.
* Source/NSTask.m OSX compatibility tweak .. raise an exception if
the task can't be launched.
* Source/NSNumberFormatter.m: Fixes for symbol indexes.
2016-02-26 Niels Grewe <niels.grewe@halbordnung.de>

View file

@ -595,7 +595,7 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
- (void) setShortWeekdaySymbols: (NSArray *)array
{
#if GS_USE_ICU == 1
[self _getSymbols: UDAT_SHORT_WEEKDAYS];
[self _setSymbols: array : UDAT_SHORT_WEEKDAYS];
#else
return;
#endif
@ -613,7 +613,7 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
- (void) setMonthSymbols: (NSArray *)array
{
#if GS_USE_ICU == 1
[self _getSymbols: UDAT_MONTHS];
[self _setSymbols: array : UDAT_MONTHS];
#else
return;
#endif
@ -631,7 +631,7 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
- (void) setShortMonthSymbols: (NSArray *)array
{
#if GS_USE_ICU == 1
[self _getSymbols: UDAT_SHORT_MONTHS];
[self _setSymbols: array : UDAT_SHORT_MONTHS];
#else
return;
#endif
@ -1006,15 +1006,36 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
#endif
}
static inline void
symbolRange(NSInteger symbol, int *from)
{
switch (symbol)
{
case UDAT_SHORT_WEEKDAYS:
case UDAT_STANDALONE_NARROW_WEEKDAYS:
case UDAT_STANDALONE_SHORT_WEEKDAYS:
case UDAT_STANDALONE_WEEKDAYS:
case UDAT_WEEKDAYS:
/* In ICU days of the week number from 1 rather than zero.
*/
*from = 1;
break;
default:
*from = 0;
break;
}
}
- (void) _setSymbols: (NSArray*)array : (NSInteger)symbol
{
#if GS_USE_ICU == 1
int idx = 0;
int idx;
int count = udat_countSymbols (internal->_formatter, symbol);
if ([array count] != count)
return;
symbolRange(symbol, &idx);
if ([array count] == count - idx)
{
while (idx < count)
{
int length;
@ -1025,24 +1046,26 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
length = [string length];
value = malloc(sizeof(unichar) * length);
[string getCharacters: value range: NSMakeRange(0, length)];
udat_setSymbols (internal->_formatter, symbol, idx, value, length, &err);
udat_setSymbols(internal->_formatter, symbol, idx,
value, length, &err);
free(value);
++idx;
}
#else
return;
}
#endif
return;
}
- (NSArray *) _getSymbols: (NSInteger)symbol
{
#if GS_USE_ICU == 1
NSMutableArray *mArray;
int idx = 0;
int count = udat_countSymbols (internal->_formatter, symbol);
int idx;
int count;
mArray = [NSMutableArray arrayWithCapacity: count];
count = udat_countSymbols(internal->_formatter, symbol);
symbolRange(symbol, &idx);
mArray = [NSMutableArray arrayWithCapacity: count - idx];
while (idx < count)
{
int length;

View file

@ -1263,10 +1263,10 @@ quotedFromString(NSString *aString)
SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, 0);
[tasksLock unlock];
if (result == 0)
if (0 == result)
{
NSLog(@"Error launching task: %@ ... %@", lpath, last);
return;
[NSException raise: NSInvalidArgumentException
format: @"NSTask - Error launching task: %@ ... %@", lpath, last];
}
_taskId = procInfo.dwProcessId;