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:
Richard Frith-MacDonald 2013-04-15 06:04:40 +00:00
parent f371df09b6
commit e1271866b4
7 changed files with 69 additions and 22 deletions

View file

@ -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);
}
/**

View file

@ -844,10 +844,10 @@ static char **_gnu_noobjc_env = NULL;
#else /* !HAVE_FUNCTION_STRERROR */
fprintf(stderr, "Couldn't open file %s when starting gnustep-base.\n",
proc_file_name);
free(proc_file_name);
#endif /* HAVE_FUNCTION_STRERROR */
fprintf(stderr, "Your gnustep-base library is compiled for a kernel supporting the /proc filesystem, but it can't access it.\n");
fprintf(stderr, "You should recompile or change your kernel.\n");
free(proc_file_name);
#ifdef HAVE_PROGRAM_INVOCATION_NAME
fprintf(stderr, "We try to go on anyway; but the program will ignore any argument which were passed to it.\n");
_gnu_noobjc_argc = 1;

View file

@ -332,9 +332,12 @@ static char *buildURL(parsedURL *base, parsedURL *rel, BOOL standardize)
{
*tmp++ = '/';
}
l = strlen(base->path);
memcpy(tmp, base->path, l);
tmp += l;
if (base->path)
{
l = strlen(base->path);
memcpy(tmp, base->path, l);
tmp += l;
}
}
else
{

View file

@ -1217,7 +1217,6 @@ static NSString *mainFont = nil;
if ([[tmp name] isEqual: @"desc"] == YES)
{
desc = tmp;
tmp = [tmp nextElement];
}
[buf appendString: indent];
@ -1256,7 +1255,6 @@ static NSString *mainFont = nil;
{
[self incIndent];
[self outputNode: desc to: buf];
desc = nil;
[self decIndent];
}
[buf appendString: indent];
@ -1304,7 +1302,6 @@ static NSString *mainFont = nil;
[buf appendString: @"<p><b>Copyright:</b> (C) "];
[self outputText: [children firstChild] to: buf];
[buf appendString: @"</p>\n"];
children = [children nextElement];
}
}
else if ([name isEqual: @"heading"] == YES)
@ -1373,10 +1370,13 @@ static NSString *mainFont = nil;
}
[buf appendFormat: @"%@@%@ %@ <b>%@</b>;<br />\n", indent, v, t, n];
/*
if ([[children name] isEqual: @"desc"] == YES)
{
children = [children nextElement];
}
*/
/*
* List standards with which ivar complies
*/
@ -1867,7 +1867,6 @@ static NSString *mainFont = nil;
if (node != nil && [[node name] isEqual: @"desc"] == YES)
{
[self outputNode: node to: buf];
node = [node nextElement];
}
[buf appendString: indent];
@ -1962,7 +1961,6 @@ static NSString *mainFont = nil;
{
NSLog(@"Element '%@' not implemented", name); // FIXME
}
node = tmp;
}
}
[arp drain];
@ -2212,13 +2210,15 @@ static NSString *mainFont = nil;
NSDictionary *dProp = [dItem attributes];
NSString *value = [dProp objectForKey: @"value"];
GSXMLNode *dChild;
if (![@"dictionaryItem" isEqualToString: [dItem name]])
{
continue;
}
[buf appendString: indent];
[buf appendString: @"<dt>"];
[buf appendString: [[dProp objectForKey: @"key"] stringByEscapingXML]];
[buf appendString:
[[dProp objectForKey: @"key"] stringByEscapingXML]];
[buf appendString: @" = </dt>\n"];
[buf appendString: indent];
[buf appendString: @"<dd>\n"];
@ -2236,8 +2236,8 @@ static NSString *mainFont = nil;
dChild = [dItem firstChild];
[buf appendString: indent];
}
dItem = [self outputBlock: dChild to: buf inPara: NO];
//PENDING should check that dItem is what it should be...
[self outputBlock: dChild to: buf inPara: NO];
//PENDING use returne value for dItem?
}
[buf appendString: @"\n"];
[self decIndent];

View file

@ -1332,11 +1332,16 @@ recheck:
if ([self skipSpaces] < length && buffer[pos] == '(')
{
unsigned start = pos;
NSString *attr;
[self skipBlock]; // Skip the attributes
attr = [NSString stringWithCharacters: buffer + start
length: pos - start];
if (YES == verbose)
{
NSString *attr;
attr = [NSString stringWithCharacters: buffer + start
length: pos - start];
[self log: @"skip __attribute__ %@", attr];
}
}
else
{
@ -2984,7 +2989,6 @@ fail:
if (flag == YES)
{
exist = nil; // Declaration ... no existing methods.
methods = [NSMutableDictionary dictionaryWithCapacity: 8];
}
else

View file

@ -712,6 +712,7 @@ static int verbose = 0;
/* Generate the output. */
{
NSString *result;
/* Allocate space for the whole output in a single chunk now that
we know how big it should be. */
unichar *outputChars = malloc (sizeof(unichar) * totalNumberOfChars);
@ -738,8 +739,10 @@ static int verbose = 0;
head = s;
}
return [NSString stringWithCharacters: outputChars
length: totalNumberOfChars];
result = [NSString stringWithCharacters: outputChars
length: totalNumberOfChars];
free(outputChars);
return result;
}
}

View file

@ -872,6 +872,10 @@ main(int argc, char **argv, char **env)
verbose = [defs boolForKey: @"Verbose"];
warn = [defs boolForKey: @"Warn"];
if (YES == warn)
{
verbose = YES; // Do we want this?
}
ignoreDependencies = [defs boolForKey: @"IgnoreDependencies"];
showDependencies = [defs boolForKey: @"ShowDependencies"];
if (ignoreDependencies == YES)