Various fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@5594 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-12-21 14:39:56 +00:00
parent d506bff8e8
commit e1792e565d
5 changed files with 39 additions and 16 deletions

View file

@ -1,3 +1,13 @@
Tue Dec 21 13:27:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Fixes suggested by karl@nfox.com
* Source/propList.h: Bugfix parsing larger lists.
* Source/NSProcessInfo.m: Avoid use of freopen()
* Source/GSeq.h: for ranges not found, return NSNotFound as the
location rather than 0 - for compatibility with Apple.
* NSDeserializer.m: Return nil if given nil data or an object that
is not a data object.
1999-12-19 David Lazaro <khelekir@encomix.es> 1999-12-19 David Lazaro <khelekir@encomix.es>
* configure.in (objc_thread_lib): Added support for FreeBSD native * configure.in (objc_thread_lib): Added support for FreeBSD native

View file

@ -552,7 +552,7 @@ GSEQ_STRRANGE(NSString *ss, NSString *os, unsigned mask, NSRange aRange)
/* Ensure the string can be found */ /* Ensure the string can be found */
strLength = GSEQ_OLEN; strLength = GSEQ_OLEN;
if (strLength > aRange.length || strLength == 0) if (strLength > aRange.length || strLength == 0)
return (NSRange){0, 0}; return (NSRange){NSNotFound, 0};
/* /*
* Cache method implementations for getting characters and ranges * Cache method implementations for getting characters and ranges
@ -606,7 +606,7 @@ GSEQ_STRRANGE(NSString *ss, NSString *os, unsigned mask, NSRange aRange)
break; break;
myIndex++; myIndex++;
} }
return (NSRange){0, 0}; return (NSRange){NSNotFound, 0};
} }
case BCLS : case BCLS :
@ -641,7 +641,7 @@ GSEQ_STRRANGE(NSString *ss, NSString *os, unsigned mask, NSRange aRange)
break; break;
myIndex--; myIndex--;
} }
return (NSRange){0, 0}; return (NSRange){NSNotFound, 0};
} }
case FLS : case FLS :
@ -675,7 +675,7 @@ GSEQ_STRRANGE(NSString *ss, NSString *os, unsigned mask, NSRange aRange)
break; break;
myIndex++; myIndex++;
} }
return (NSRange){0, 0}; return (NSRange){NSNotFound, 0};
} }
case BLS : case BLS :
@ -709,7 +709,7 @@ GSEQ_STRRANGE(NSString *ss, NSString *os, unsigned mask, NSRange aRange)
break; break;
myIndex--; myIndex--;
} }
return (NSRange){0, 0}; return (NSRange){NSNotFound, 0};
} }
case FCS : case FCS :
@ -783,7 +783,7 @@ GSEQ_STRRANGE(NSString *ss, NSString *os, unsigned mask, NSRange aRange)
break; break;
} }
} }
return (NSRange){0, 0}; return (NSRange){NSNotFound, 0};
} }
case BCS : case BCS :
@ -860,7 +860,7 @@ GSEQ_STRRANGE(NSString *ss, NSString *os, unsigned mask, NSRange aRange)
myIndex--; myIndex--;
} }
} }
return (NSRange){0, 0}; return (NSRange){NSNotFound, 0};
} }
case BS : case BS :
@ -930,7 +930,7 @@ GSEQ_STRRANGE(NSString *ss, NSString *os, unsigned mask, NSRange aRange)
myIndex--; myIndex--;
} }
} }
return (NSRange){0, 0}; return (NSRange){NSNotFound, 0};
} }
case FS : case FS :
@ -998,10 +998,10 @@ GSEQ_STRRANGE(NSString *ss, NSString *os, unsigned mask, NSRange aRange)
break; break;
} }
} }
return (NSRange){0, 0}; return (NSRange){NSNotFound, 0};
} }
} }
return (NSRange){0, 0}; return (NSRange){NSNotFound, 0};
} }
#undef GSEQ_STRRANGE #undef GSEQ_STRRANGE
#endif #endif

View file

@ -318,7 +318,9 @@ static char **_gnu_noobjc_env;
if (_gnu_noobjc_argv == NULL) if (_gnu_noobjc_argv == NULL)
goto malloc_error; goto malloc_error;
freopen(proc_file_name, "r", ifp); fclose(ifp);
ifp=fopen(proc_file_name,"r");
//freopen(proc_file_name, "r", ifp);
if (ifp == NULL) if (ifp == NULL)
{ {
free(_gnu_noobjc_argv); free(_gnu_noobjc_argv);
@ -341,7 +343,9 @@ static char **_gnu_noobjc_env;
length = 0; length = 0;
} }
} }
freopen(proc_file_name, "r", ifp); fclose(ifp);
ifp=fopen(proc_file_name,"r");
//freopen(proc_file_name, "r", ifp);
if (ifp == NULL) if (ifp == NULL)
{ {
for (c = 0; c < _gnu_noobjc_argc; c++) for (c = 0; c < _gnu_noobjc_argc; c++)

View file

@ -723,7 +723,10 @@ deserializeFromInfo(_NSDeserializerInfo* info)
_NSDeserializerInfo info; _NSDeserializerInfo info;
id o; id o;
NSAssert(data != nil, NSInvalidArgumentException); if (data == nil || [data isKindOfClass: [NSData class]] == NO)
{
return nil;
}
NSAssert(cursor != 0, NSInvalidArgumentException); NSAssert(cursor != 0, NSInvalidArgumentException);
initDeserializerInfo(&info, data, cursor, flag); initDeserializerInfo(&info, data, cursor, flag);
o = deserializeFromInfo(&info); o = deserializeFromInfo(&info);
@ -738,7 +741,10 @@ deserializeFromInfo(_NSDeserializerInfo* info)
unsigned int cursor = 0; unsigned int cursor = 0;
id o; id o;
NSAssert(data != nil, NSInvalidArgumentException); if (data == nil || [data isKindOfClass: [NSData class]] == NO)
{
return nil;
}
initDeserializerInfo(&info, data, &cursor, flag); initDeserializerInfo(&info, data, &cursor, flag);
o = deserializeFromInfo(&info); o = deserializeFromInfo(&info);
endDeserializerInfo(&info); endDeserializerInfo(&info);
@ -750,7 +756,10 @@ deserializeFromInfo(_NSDeserializerInfo* info)
length: (unsigned)length length: (unsigned)length
mutableContainers: (BOOL)flag mutableContainers: (BOOL)flag
{ {
NSAssert(data != nil, NSInvalidArgumentException); if (data == nil || [data isKindOfClass: [NSData class]] == NO)
{
return nil;
}
NSAssert(cursor != 0, NSInvalidArgumentException); NSAssert(cursor != 0, NSInvalidArgumentException);
if (length > [data length] - *cursor) if (length > [data length] - *cursor)
{ {

View file

@ -520,7 +520,7 @@ static id parsePlItem(pldata* pld)
byte |= char2num(pld->ptr[pld->pos]); byte |= char2num(pld->ptr[pld->pos]);
pld->pos++; pld->pos++;
buf[len++] = byte; buf[len++] = byte;
if (len > sizeof(buf)) if (len == sizeof(buf))
{ {
[data appendBytes: buf length: len]; [data appendBytes: buf length: len];
len = 0; len = 0;