Implement (and document) a MacOS-X compatibility behavior

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19909 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2004-08-24 05:20:40 +00:00
parent 2ef86a582f
commit 0d8ec1ee0f
3 changed files with 13 additions and 2 deletions

View file

@ -280,14 +280,20 @@ static unsigned posForIndex(GSIArray array, unsigned index)
unsigned pos;
unsigned i = 0;
NSRange r;
NSRange fullRange;
if (aBuffer == 0 || aRange == 0)
if (aBuffer == 0)
{
[NSException raise: NSInvalidArgumentException
format: @"[%@-%@]: nul pointer argument",
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
}
if (NSNotFound - aRange->length < aRange->location)
if (aRange == 0)
{
fullRange = (NSRange){0, NSNotFound};
aRange = &fullRange;
}
else if (NSNotFound - aRange->length < aRange->location)
{
[NSException raise: NSInvalidArgumentException
format: @"[%@-%@]: Bad range",