mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 10:11:03 +00:00
Minor fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10674 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a0ef32c1ec
commit
7d4e3075ea
3 changed files with 131 additions and 108 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2001-08-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSDistantObject.m: Tidy method lookup code.
|
||||||
|
* Source/NSString.m: Handle nil content when parsing xml elements.
|
||||||
|
|
||||||
2001-08-06 Willem Rein Oudshoorn <wim@xs4all.nl>
|
2001-08-06 Willem Rein Oudshoorn <wim@xs4all.nl>
|
||||||
|
|
||||||
* Source/GSFFCallInvocation.m: Forwarding:
|
* Source/GSFFCallInvocation.m: Forwarding:
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
inv = [NSInvocation invocationWithMethodSignature: sig]; \
|
inv = [NSInvocation invocationWithMethodSignature: sig]; \
|
||||||
[inv setSelector: @selector(_SELX)]; \
|
[inv setSelector: @selector(_SELX)]; \
|
||||||
[inv setTarget: self]; \
|
[inv setTarget: self]; \
|
||||||
[inv setArgument: (void*)&_ARG1 atIndex: 2]; \
|
[inv setArgument: (void*)&_ARG1 atIndex: 2]; \
|
||||||
[self forwardInvocation: inv]; \
|
[self forwardInvocation: inv]; \
|
||||||
[inv getReturnValue: &m]
|
[inv getReturnValue: &m]
|
||||||
|
|
||||||
|
@ -773,6 +773,24 @@ enum
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Evil hack to prevent recursion - if we are asking a remote
|
||||||
|
* object for a method signature, we can't ask it for the
|
||||||
|
* signature of methodSignatureForSelector:, so we hack in
|
||||||
|
* the signature required manually :-(
|
||||||
|
*/
|
||||||
|
if (sel_eq(aSelector, _cmd))
|
||||||
|
{
|
||||||
|
static NSMethodSignature *sig = nil;
|
||||||
|
|
||||||
|
if (sig == nil)
|
||||||
|
{
|
||||||
|
sig = [NSMethodSignature signatureWithObjCTypes: "@@::"];
|
||||||
|
RETAIN(sig);
|
||||||
|
}
|
||||||
|
return sig;
|
||||||
|
}
|
||||||
|
|
||||||
if (_protocol != nil)
|
if (_protocol != nil)
|
||||||
{
|
{
|
||||||
const char *types = 0;
|
const char *types = 0;
|
||||||
|
@ -799,28 +817,10 @@ enum
|
||||||
id m;
|
id m;
|
||||||
const char *types;
|
const char *types;
|
||||||
#ifdef USE_FFCALL
|
#ifdef USE_FFCALL
|
||||||
/*
|
id inv;
|
||||||
* Evil hack to prevent recursion - if we are asking a remote
|
id sig;
|
||||||
* object for a method signature, we can't ask it for the
|
|
||||||
* signature of methodSignatureForSelector:, so we hack in
|
|
||||||
* the signature required manually :-(
|
|
||||||
*/
|
|
||||||
if (sel_eq(aSelector, _cmd))
|
|
||||||
{
|
|
||||||
static NSMethodSignature *sig = nil;
|
|
||||||
|
|
||||||
if (sig == nil)
|
DO_FORWARD_INVOCATION(methodSignatureForSelector:, aSelector);
|
||||||
{
|
|
||||||
sig = [NSMethodSignature signatureWithObjCTypes: "@@::"];
|
|
||||||
RETAIN(sig);
|
|
||||||
}
|
|
||||||
return sig;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
id inv, sig;
|
|
||||||
DO_FORWARD_INVOCATION(methodSignatureForSelector:, aSelector);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
arglist_t args;
|
arglist_t args;
|
||||||
void *retframe;
|
void *retframe;
|
||||||
|
@ -838,7 +838,6 @@ enum
|
||||||
m = retframe_id(retframe);
|
m = retframe_id(retframe);
|
||||||
#endif
|
#endif
|
||||||
types = [m methodType];
|
types = [m methodType];
|
||||||
|
|
||||||
return [NSMethodSignature signatureWithObjCTypes: types];
|
return [NSMethodSignature signatureWithObjCTypes: types];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4370,111 +4370,118 @@ nodeToObject(GSXMLNode* node)
|
||||||
if ([name isEqualToString: @"string"]
|
if ([name isEqualToString: @"string"]
|
||||||
|| [name isEqualToString: @"key"])
|
|| [name isEqualToString: @"key"])
|
||||||
{
|
{
|
||||||
NSRange r;
|
if (content == nil)
|
||||||
|
|
||||||
r = [content rangeOfString: @"\\"];
|
|
||||||
if (r.length == 1)
|
|
||||||
{
|
{
|
||||||
unsigned len = [content length];
|
content = @"";
|
||||||
unichar buf[len];
|
}
|
||||||
unsigned pos = r.location;
|
else
|
||||||
|
{
|
||||||
|
NSRange r;
|
||||||
|
|
||||||
[content getCharacters: buf];
|
r = [content rangeOfString: @"\\"];
|
||||||
while (pos < len)
|
if (r.length == 1)
|
||||||
{
|
{
|
||||||
if (++pos < len)
|
unsigned len = [content length];
|
||||||
|
unichar buf[len];
|
||||||
|
unsigned pos = r.location;
|
||||||
|
|
||||||
|
[content getCharacters: buf];
|
||||||
|
while (pos < len)
|
||||||
{
|
{
|
||||||
if (buf[pos] == '/')
|
if (++pos < len)
|
||||||
{
|
{
|
||||||
len--;
|
if (buf[pos] == '/')
|
||||||
memcpy(&buf[pos], &buf[pos+1],
|
{
|
||||||
(len - pos) * sizeof(unichar));
|
len--;
|
||||||
}
|
memcpy(&buf[pos], &buf[pos+1],
|
||||||
else if (buf[pos] == 'U')
|
(len - pos) * sizeof(unichar));
|
||||||
{
|
}
|
||||||
unichar val = 0;
|
else if (buf[pos] == 'U')
|
||||||
unsigned i;
|
{
|
||||||
|
unichar val = 0;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
if (len < pos + 4)
|
if (len < pos + 4)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"Short escape sequence"];
|
||||||
|
}
|
||||||
|
for (i = 1; i < 5; i++)
|
||||||
|
{
|
||||||
|
unichar c = buf[pos + i];
|
||||||
|
|
||||||
|
if (c >= '0' && c <= '9')
|
||||||
|
{
|
||||||
|
val = (val << 4) + c - '0';
|
||||||
|
}
|
||||||
|
else if (c >= 'A' && c <= 'F')
|
||||||
|
{
|
||||||
|
val = (val << 4) + c - 'A' + 10;
|
||||||
|
}
|
||||||
|
else if (c >= 'a' && c <= 'f')
|
||||||
|
{
|
||||||
|
val = (val << 4) + c - 'a' + 10;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[NSException raise:
|
||||||
|
NSInternalInconsistencyException
|
||||||
|
format: @"bad hex escape sequence"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
len -= 5;
|
||||||
|
memcpy(&buf[pos], &buf[pos+5],
|
||||||
|
(len - pos) * sizeof(unichar));
|
||||||
|
buf[pos - 1] = val;
|
||||||
|
}
|
||||||
|
else if (buf[pos] >= '0' && buf[pos] <= '7')
|
||||||
|
{
|
||||||
|
unichar val = 0;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
if (len < pos + 2)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"Short escape sequence"];
|
||||||
|
}
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
unichar c = buf[pos + i];
|
||||||
|
|
||||||
|
if (c >= '0' && c <= '7')
|
||||||
|
{
|
||||||
|
val = (val << 3) + c - '0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[NSException raise:
|
||||||
|
NSInternalInconsistencyException
|
||||||
|
format: @"bad octal escape sequence"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
len -= 3;
|
||||||
|
memcpy(&buf[pos], &buf[pos+3],
|
||||||
|
(len - pos) * sizeof(unichar));
|
||||||
|
buf[pos - 1] = val;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"Short escape sequence"];
|
format: @"Short escape sequence"];
|
||||||
}
|
}
|
||||||
for (i = 1; i < 5; i++)
|
while (pos < len && buf[pos] != '\\')
|
||||||
{
|
{
|
||||||
unichar c = buf[pos + i];
|
pos++;
|
||||||
|
|
||||||
if (c >= '0' && c <= '9')
|
|
||||||
{
|
|
||||||
val = (val << 4) + c - '0';
|
|
||||||
}
|
|
||||||
else if (c >= 'A' && c <= 'F')
|
|
||||||
{
|
|
||||||
val = (val << 4) + c - 'A' + 10;
|
|
||||||
}
|
|
||||||
else if (c >= 'a' && c <= 'f')
|
|
||||||
{
|
|
||||||
val = (val << 4) + c - 'a' + 10;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[NSException raise:
|
|
||||||
NSInternalInconsistencyException
|
|
||||||
format: @"bad hex escape sequence"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
len -= 5;
|
|
||||||
memcpy(&buf[pos], &buf[pos+5],
|
|
||||||
(len - pos) * sizeof(unichar));
|
|
||||||
buf[pos - 1] = val;
|
|
||||||
}
|
|
||||||
else if (buf[pos] >= '0' && buf[pos] <= '7')
|
|
||||||
{
|
|
||||||
unichar val = 0;
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
if (len < pos + 2)
|
|
||||||
{
|
|
||||||
[NSException raise: NSInternalInconsistencyException
|
|
||||||
format: @"Short escape sequence"];
|
|
||||||
}
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
unichar c = buf[pos + i];
|
|
||||||
|
|
||||||
if (c >= '0' && c <= '7')
|
|
||||||
{
|
|
||||||
val = (val << 3) + c - '0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[NSException raise:
|
|
||||||
NSInternalInconsistencyException
|
|
||||||
format: @"bad octal escape sequence"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
len -= 3;
|
|
||||||
memcpy(&buf[pos], &buf[pos+3],
|
|
||||||
(len - pos) * sizeof(unichar));
|
|
||||||
buf[pos - 1] = val;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"Short escape sequence"];
|
format: @"Short escape sequence"];
|
||||||
}
|
}
|
||||||
while (pos < len && buf[pos] != '\\')
|
|
||||||
{
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[NSException raise: NSInternalInconsistencyException
|
|
||||||
format: @"Short escape sequence"];
|
|
||||||
}
|
}
|
||||||
|
content = [NSString stringWithCharacters: buf length: len];
|
||||||
}
|
}
|
||||||
content = [NSString stringWithCharacters: buf length: len];
|
|
||||||
}
|
}
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
@ -4488,14 +4495,26 @@ nodeToObject(GSXMLNode* node)
|
||||||
}
|
}
|
||||||
else if ([name isEqualToString: @"integer"])
|
else if ([name isEqualToString: @"integer"])
|
||||||
{
|
{
|
||||||
|
if (content == nil)
|
||||||
|
{
|
||||||
|
content = @"0";
|
||||||
|
}
|
||||||
return [NSNumber numberWithInt: [content intValue]];
|
return [NSNumber numberWithInt: [content intValue]];
|
||||||
}
|
}
|
||||||
else if ([name isEqualToString: @"real"])
|
else if ([name isEqualToString: @"real"])
|
||||||
{
|
{
|
||||||
|
if (content == nil)
|
||||||
|
{
|
||||||
|
content = @"0.0";
|
||||||
|
}
|
||||||
return [NSNumber numberWithDouble: [content doubleValue]];
|
return [NSNumber numberWithDouble: [content doubleValue]];
|
||||||
}
|
}
|
||||||
else if ([name isEqualToString: @"date"])
|
else if ([name isEqualToString: @"date"])
|
||||||
{
|
{
|
||||||
|
if (content == nil)
|
||||||
|
{
|
||||||
|
content = @"";
|
||||||
|
}
|
||||||
return [NSCalendarDate dateWithString: content
|
return [NSCalendarDate dateWithString: content
|
||||||
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"];
|
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue