mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
avoid possible problem with replacement when there's nothing to do ... we could be unnecessarily checking that a buffer exists when we don't actually need to
move anything in it. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37537 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
96b757f0d2
commit
955bf169c2
1 changed files with 8 additions and 4 deletions
|
@ -2066,7 +2066,7 @@ failure:
|
|||
if (aRange.location > size)
|
||||
{
|
||||
[NSException raise: NSRangeException
|
||||
format: @"location bad in replaceByteInRange:withBytes:"];
|
||||
format: @"location bad in %@", NSStringFromSelector(_cmd)];
|
||||
}
|
||||
if (aRange.length > 0)
|
||||
{
|
||||
|
@ -2080,7 +2080,7 @@ failure:
|
|||
if (0 == buf)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"missing bytes in replaceBytesInRange:withBytes:"];
|
||||
format: @"missing bytes in %@", NSStringFromSelector(_cmd)];
|
||||
}
|
||||
memmove(buf + aRange.location, bytes, aRange.length);
|
||||
}
|
||||
|
@ -2104,7 +2104,11 @@ failure:
|
|||
if (aRange.location > size)
|
||||
{
|
||||
[NSException raise: NSRangeException
|
||||
format: @"location bad in replaceByteInRange:withBytes:length:"];
|
||||
format: @"location bad in %@", NSStringFromSelector(_cmd)];
|
||||
}
|
||||
if (0 == length && 0 == shift)
|
||||
{
|
||||
return; // Nothing to do
|
||||
}
|
||||
if (need > size)
|
||||
{
|
||||
|
@ -2114,7 +2118,7 @@ failure:
|
|||
if (0 == buf)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"missing bytes in replaceByteInRange:withBytes:length:"];
|
||||
format: @"missing bytes in %@", NSStringFromSelector(_cmd)];
|
||||
}
|
||||
if (shift < 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue