mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 08:41:03 +00:00
More tweaks to avoid warnings (minor memory leak fixed in HTMLLinker.m)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36535 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f371df09b6
commit
e1271866b4
7 changed files with 69 additions and 22 deletions
|
@ -761,7 +761,17 @@ failure:
|
|||
NSUInteger size = [self length];
|
||||
|
||||
GS_RANGE_CHECK(aRange, size);
|
||||
memcpy(buffer, [self bytes] + aRange.location, aRange.length);
|
||||
if (aRange.length > 0)
|
||||
{
|
||||
const void *bytes = [self bytes];
|
||||
|
||||
if (0 == bytes)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"missing bytes in getBytes:range:"];
|
||||
}
|
||||
memcpy(buffer, bytes + aRange.location, aRange.length);
|
||||
}
|
||||
}
|
||||
|
||||
- (id) replacementObjectForPortCoder: (NSPortCoder*)aCoder
|
||||
|
@ -2017,10 +2027,15 @@ failure:
|
|||
length: (NSUInteger)bufferSize
|
||||
{
|
||||
NSUInteger oldLength = [self length];
|
||||
void* buffer;
|
||||
void *buffer;
|
||||
|
||||
[self setLength: oldLength + bufferSize];
|
||||
buffer = [self mutableBytes];
|
||||
if (0 == buffer)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"missing bytes in appendBytes:length:"];
|
||||
}
|
||||
memcpy(buffer + oldLength, aBuffer, bufferSize);
|
||||
}
|
||||
|
||||
|
@ -2056,11 +2071,18 @@ failure:
|
|||
}
|
||||
if (aRange.length > 0)
|
||||
{
|
||||
void *buf = [self mutableBytes];
|
||||
|
||||
if (0 == buf)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"missing bytes in replaceBytesInRange:withBytes:"];
|
||||
}
|
||||
if (need > size)
|
||||
{
|
||||
[self setLength: need];
|
||||
}
|
||||
memmove([self mutableBytes] + aRange.location, bytes, aRange.length);
|
||||
memmove(buf + aRange.location, bytes, aRange.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2089,6 +2111,11 @@ failure:
|
|||
[self setLength: need];
|
||||
}
|
||||
buf = [self mutableBytes];
|
||||
if (0 == buf)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"missing bytes in replaceByteInRange:withBytes:"];
|
||||
}
|
||||
if (shift < 0)
|
||||
{
|
||||
if (length > 0)
|
||||
|
@ -2124,9 +2151,15 @@ failure:
|
|||
- (void) resetBytesInRange: (NSRange)aRange
|
||||
{
|
||||
NSUInteger size = [self length];
|
||||
void *bytes = [self bytes];
|
||||
|
||||
GS_RANGE_CHECK(aRange, size);
|
||||
memset((char*)[self bytes] + aRange.location, 0, aRange.length);
|
||||
if (0 == bytes)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"missing bytes in resetBytesInRange:"];
|
||||
}
|
||||
memset((char*)bytes + aRange.location, 0, aRange.length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue