mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 17:51:01 +00:00
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:
parent
59d489fdc8
commit
fbee572507
3 changed files with 105 additions and 79 deletions
|
@ -1,7 +1,10 @@
|
||||||
2016-02-29 Richard Frith-Macdonald <rfm@gnu.org>
|
2016-02-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Based on testplant patch, fix bug with ownership when copying
|
* Source/NSFileManager.m: Based on testplant patch, fix bug with
|
||||||
subdirectories.
|
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>
|
2016-02-26 Niels Grewe <niels.grewe@halbordnung.de>
|
||||||
|
|
||||||
|
|
|
@ -595,7 +595,7 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
|
||||||
- (void) setShortWeekdaySymbols: (NSArray *)array
|
- (void) setShortWeekdaySymbols: (NSArray *)array
|
||||||
{
|
{
|
||||||
#if GS_USE_ICU == 1
|
#if GS_USE_ICU == 1
|
||||||
[self _getSymbols: UDAT_SHORT_WEEKDAYS];
|
[self _setSymbols: array : UDAT_SHORT_WEEKDAYS];
|
||||||
#else
|
#else
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
@ -613,7 +613,7 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
|
||||||
- (void) setMonthSymbols: (NSArray *)array
|
- (void) setMonthSymbols: (NSArray *)array
|
||||||
{
|
{
|
||||||
#if GS_USE_ICU == 1
|
#if GS_USE_ICU == 1
|
||||||
[self _getSymbols: UDAT_MONTHS];
|
[self _setSymbols: array : UDAT_MONTHS];
|
||||||
#else
|
#else
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
@ -631,7 +631,7 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
|
||||||
- (void) setShortMonthSymbols: (NSArray *)array
|
- (void) setShortMonthSymbols: (NSArray *)array
|
||||||
{
|
{
|
||||||
#if GS_USE_ICU == 1
|
#if GS_USE_ICU == 1
|
||||||
[self _getSymbols: UDAT_SHORT_MONTHS];
|
[self _setSymbols: array : UDAT_SHORT_MONTHS];
|
||||||
#else
|
#else
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1006,15 +1006,36 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
|
||||||
#endif
|
#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
|
- (void) _setSymbols: (NSArray*)array : (NSInteger)symbol
|
||||||
{
|
{
|
||||||
#if GS_USE_ICU == 1
|
#if GS_USE_ICU == 1
|
||||||
int idx = 0;
|
int idx;
|
||||||
int count = udat_countSymbols (internal->_formatter, symbol);
|
int count = udat_countSymbols (internal->_formatter, symbol);
|
||||||
|
|
||||||
if ([array count] != count)
|
symbolRange(symbol, &idx);
|
||||||
return;
|
if ([array count] == count - idx)
|
||||||
|
{
|
||||||
while (idx < count)
|
while (idx < count)
|
||||||
{
|
{
|
||||||
int length;
|
int length;
|
||||||
|
@ -1025,24 +1046,26 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
|
||||||
length = [string length];
|
length = [string length];
|
||||||
value = malloc(sizeof(unichar) * length);
|
value = malloc(sizeof(unichar) * length);
|
||||||
[string getCharacters: value range: NSMakeRange(0, 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);
|
free(value);
|
||||||
|
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
return;
|
|
||||||
#endif
|
#endif
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) _getSymbols: (NSInteger)symbol
|
- (NSArray *) _getSymbols: (NSInteger)symbol
|
||||||
{
|
{
|
||||||
#if GS_USE_ICU == 1
|
#if GS_USE_ICU == 1
|
||||||
NSMutableArray *mArray;
|
NSMutableArray *mArray;
|
||||||
int idx = 0;
|
int idx;
|
||||||
int count = udat_countSymbols (internal->_formatter, symbol);
|
int count;
|
||||||
|
|
||||||
mArray = [NSMutableArray arrayWithCapacity: count];
|
count = udat_countSymbols(internal->_formatter, symbol);
|
||||||
|
symbolRange(symbol, &idx);
|
||||||
|
mArray = [NSMutableArray arrayWithCapacity: count - idx];
|
||||||
while (idx < count)
|
while (idx < count)
|
||||||
{
|
{
|
||||||
int length;
|
int length;
|
||||||
|
|
|
@ -1263,10 +1263,10 @@ quotedFromString(NSString *aString)
|
||||||
SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, 0);
|
SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, 0);
|
||||||
[tasksLock unlock];
|
[tasksLock unlock];
|
||||||
|
|
||||||
if (result == 0)
|
if (0 == result)
|
||||||
{
|
{
|
||||||
NSLog(@"Error launching task: %@ ... %@", lpath, last);
|
[NSException raise: NSInvalidArgumentException
|
||||||
return;
|
format: @"NSTask - Error launching task: %@ ... %@", lpath, last];
|
||||||
}
|
}
|
||||||
|
|
||||||
_taskId = procInfo.dwProcessId;
|
_taskId = procInfo.dwProcessId;
|
||||||
|
|
Loading…
Reference in a new issue