mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
add last night's changes based on static analyser results.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32507 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
385f9b83fc
commit
74eac99280
20 changed files with 122 additions and 134 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2011-03-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSAttributedString.m: remove unused assignment
|
||||
* Source/GSFormat.m: remove unused increments
|
||||
* Source/GSHTTPAuthentication.m: remove unused assignment, fix possible
|
||||
use of nil as a dictionary key.
|
||||
* Source/GSHTTPURLHandle.m: remove unused assignment, check length.
|
||||
* Source/GSSocketStream.m: remove unused assignments
|
||||
* Source/GSString.m: remove unused assignments
|
||||
* Source/NSAttributedString.m: (-description) fix leak
|
||||
* Source/NSAutoreleasePool.m: tweak for clang static analyser
|
||||
* Source/NSBundle.m: fix memory leak
|
||||
* Source/NSCachedURLResponse.m: fix error in -copy
|
||||
* Source/NSCalendarDate.m: remove unused increments.
|
||||
* Source/NSDate.m: fix parsing string with ordering too long
|
||||
* Source/NSHTTPCookie.m: remove unused assignments
|
||||
* Source/GSMime.m: fix unused assignments
|
||||
* Source/NSInvocation.m: remove unused code
|
||||
* Source/unix/NSStream.m: remove unused ivar
|
||||
* Tools/gdomap.c: remove unused code
|
||||
|
||||
2011-03-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSInternal.h:
|
||||
|
|
|
@ -48,8 +48,8 @@ typedef struct {
|
|||
NSAffineTransformStruct _matrix;
|
||||
BOOL _isIdentity; // special case: A=D=1 and B=C=0
|
||||
BOOL _isFlipY; // special case: A=1 D=-1 and B=C=0
|
||||
BOOL _pad1;
|
||||
BOOL _pad2;
|
||||
BOOL _pad1 GS_UNUSED_IVAR;
|
||||
BOOL _pad2 GS_UNUSED_IVAR;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1404,7 +1404,6 @@ wordData(NSString *word)
|
|||
{
|
||||
*body = d;
|
||||
}
|
||||
l -= i;
|
||||
}
|
||||
|
||||
while (flags.inBody == 0)
|
||||
|
@ -1655,6 +1654,7 @@ wordData(NSString *word)
|
|||
if (subtype == nil)
|
||||
{
|
||||
subtype = @"plain";
|
||||
[info setObject: subtype forKey: @"Subtype"];
|
||||
}
|
||||
}
|
||||
else if ([type isEqualToString: @"multipart"] == YES)
|
||||
|
@ -1662,6 +1662,7 @@ wordData(NSString *word)
|
|||
if (subtype == nil)
|
||||
{
|
||||
subtype = @"mixed";
|
||||
[info setObject: subtype forKey: @"Subtype"];
|
||||
}
|
||||
if (boundary == nil)
|
||||
{
|
||||
|
@ -1674,6 +1675,7 @@ wordData(NSString *word)
|
|||
if (subtype == nil)
|
||||
{
|
||||
subtype = @"octet-stream";
|
||||
[info setObject: subtype forKey: @"Subtype"];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5856,9 +5858,9 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
|
|||
name = [[self headerNamed: @"content-type"] parameterForKey: @"name"];
|
||||
if (name == nil)
|
||||
{
|
||||
name = @"data";
|
||||
name = @"untitled";
|
||||
}
|
||||
[d uuencodeInto: md name: @"untitled" mode: 0644];
|
||||
[d uuencodeInto: md name: name mode: 0644];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6009,7 +6011,6 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
|
|||
else
|
||||
{
|
||||
type = [hdr objectForKey: @"Type"];
|
||||
subtype = [hdr objectForKey: @"Subtype"];
|
||||
}
|
||||
|
||||
if (name != nil)
|
||||
|
|
|
@ -672,7 +672,6 @@ SANITY();
|
|||
if (NSMaxRange(effectiveRange) > afterRangeLoc)
|
||||
{
|
||||
range.length = NSMaxRange(effectiveRange) - range.location;
|
||||
afterRangeLoc = NSMaxRange(range);
|
||||
}
|
||||
}
|
||||
else if (effectiveRange.location > beginRangeLoc)
|
||||
|
|
|
@ -1459,7 +1459,7 @@ NSDictionary *locale)
|
|||
if (specs[nspecs_done].info.spec != '\0')
|
||||
*bp++ = specs[nspecs_done].info.spec;
|
||||
|
||||
*bp++ = '\0';
|
||||
*bp = '\0';
|
||||
|
||||
if (specs[nspecs_done].info.is_long_double)
|
||||
{
|
||||
|
@ -1577,7 +1577,7 @@ NSDictionary *locale)
|
|||
if (specs[nspecs_done].info.spec != '\0')
|
||||
*bp++ = specs[nspecs_done].info.spec;
|
||||
|
||||
*bp++ = '\0';
|
||||
*bp = '\0';
|
||||
|
||||
if (specs[nspecs_done].info.is_long_double)
|
||||
{
|
||||
|
|
|
@ -369,7 +369,7 @@ static GSMimeParser *mimeParser = nil;
|
|||
[domainMap setObject: sDict forKey: server];
|
||||
RELEASE(sDict);
|
||||
}
|
||||
[sDict setObject: space forKey: [u path]];
|
||||
[sDict setObject: space forKey: path];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
|
@ -503,7 +503,6 @@ static GSMimeParser *mimeParser = nil;
|
|||
[self->_lock lock];
|
||||
nonce = _nonce;
|
||||
opaque = _opaque;
|
||||
qop = _qop;
|
||||
realm = [self->_space realm];
|
||||
}
|
||||
|
||||
|
|
|
@ -610,10 +610,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
NSString *enc;
|
||||
NSString *len;
|
||||
int status;
|
||||
float ver;
|
||||
|
||||
info = [document headerNamed: @"http"];
|
||||
ver = [[info value] floatValue];
|
||||
status = [[info objectForKey: NSHTTPPropertyStatusCodeKey] intValue];
|
||||
len = [[document headerNamed: @"content-length"] value];
|
||||
enc = [[document headerNamed: @"content-transfer-encoding"] value];
|
||||
|
@ -630,6 +628,10 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
{
|
||||
complete = NO; // Read chunked body data
|
||||
}
|
||||
else if (nil != len && [len count] == 0)
|
||||
{
|
||||
complete = YES; // content-length explicitly zero
|
||||
}
|
||||
if (complete == NO && [d length] == 0)
|
||||
{
|
||||
complete = YES; // Had EOF ... terminate
|
||||
|
|
|
@ -435,13 +435,13 @@ static gnutls_anon_client_credentials_t anoncred;
|
|||
}
|
||||
if ([proto isEqualToString: NSStreamSocketSecurityLevelNone] == YES)
|
||||
{
|
||||
proto = NSStreamSocketSecurityLevelNone;
|
||||
// proto = NSStreamSocketSecurityLevelNone;
|
||||
DESTROY(self);
|
||||
return nil;
|
||||
}
|
||||
else if ([proto isEqualToString: NSStreamSocketSecurityLevelSSLv2] == YES)
|
||||
{
|
||||
proto = NSStreamSocketSecurityLevelSSLv2;
|
||||
// proto = NSStreamSocketSecurityLevelSSLv2;
|
||||
GSOnceMLog(@"NSStreamSocketSecurityLevelTLSv2 is insecure ..."
|
||||
@" not implemented");
|
||||
DESTROY(self);
|
||||
|
@ -809,7 +809,7 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn";
|
|||
#endif /* AF_INET6 */
|
||||
else
|
||||
{
|
||||
struct sockaddr_in *addr = (struct sockaddr_in*)(void*)[istream _address];
|
||||
struct sockaddr_in *addr;
|
||||
NSDictionary *conf;
|
||||
NSString *host;
|
||||
int pnum;
|
||||
|
@ -817,6 +817,7 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn";
|
|||
/* Record the host and port that the streams are supposed to be
|
||||
* connecting to.
|
||||
*/
|
||||
addr = (struct sockaddr_in*)(void*)[istream _address];
|
||||
address = [[NSString alloc] initWithUTF8String:
|
||||
(char*)inet_ntoa(addr->sin_addr)];
|
||||
port = [[NSString alloc] initWithFormat: @"%d",
|
||||
|
@ -828,8 +829,8 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn";
|
|||
conf = [istream propertyForKey: NSStreamSOCKSProxyConfigurationKey];
|
||||
host = [conf objectForKey: NSStreamSOCKSProxyHostKey];
|
||||
pnum = [[conf objectForKey: NSStreamSOCKSProxyPortKey] intValue];
|
||||
[istream _setSocketAddress: address port: pnum family: AF_INET];
|
||||
[ostream _setSocketAddress: address port: pnum family: AF_INET];
|
||||
[istream _setSocketAddress: host port: pnum family: AF_INET];
|
||||
[ostream _setSocketAddress: host port: pnum family: AF_INET];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
|
@ -1148,7 +1149,6 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn";
|
|||
{
|
||||
NSString *a;
|
||||
|
||||
error = @""; // success
|
||||
if (rbuffer[3] == 1)
|
||||
{
|
||||
a = [NSString stringWithFormat: @"%d.%d.%d.%d",
|
||||
|
|
|
@ -2030,7 +2030,7 @@ getCStringE_u(GSStr self, char *buffer, unsigned int maxLength,
|
|||
}
|
||||
buffer[i] = (char)u;
|
||||
}
|
||||
buffer[i++] = '\0';
|
||||
buffer[i] = '\0';
|
||||
if (bytes == self->_count)
|
||||
{
|
||||
return YES;
|
||||
|
@ -2056,7 +2056,7 @@ getCStringE_u(GSStr self, char *buffer, unsigned int maxLength,
|
|||
}
|
||||
buffer[i] = (char)u;
|
||||
}
|
||||
buffer[i++] = '\0';
|
||||
buffer[i] = '\0';
|
||||
if (bytes == self->_count)
|
||||
{
|
||||
return YES;
|
||||
|
@ -2518,15 +2518,18 @@ rangeOfCharacter_c(GSStr self, NSCharacterSet *aSet, unsigned mask,
|
|||
|
||||
if (aSet == nil)
|
||||
[NSException raise: NSInvalidArgumentException format: @"range of nil"];
|
||||
i = self->_count;
|
||||
|
||||
if ((mask & NSBackwardsSearch) == NSBackwardsSearch)
|
||||
{
|
||||
start = NSMaxRange(aRange)-1; stop = aRange.location-1; step = -1;
|
||||
start = NSMaxRange(aRange) - 1;
|
||||
stop = aRange.location - 1;
|
||||
step = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = aRange.location; stop = NSMaxRange(aRange); step = 1;
|
||||
start = aRange.location;
|
||||
stop = NSMaxRange(aRange);
|
||||
step = 1;
|
||||
}
|
||||
range.location = NSNotFound;
|
||||
range.length = 0;
|
||||
|
@ -2572,15 +2575,18 @@ rangeOfCharacter_u(GSStr self, NSCharacterSet *aSet, unsigned mask,
|
|||
|
||||
if (aSet == nil)
|
||||
[NSException raise: NSInvalidArgumentException format: @"range of nil"];
|
||||
i = self->_count;
|
||||
|
||||
if ((mask & NSBackwardsSearch) == NSBackwardsSearch)
|
||||
{
|
||||
start = NSMaxRange(aRange)-1; stop = aRange.location-1; step = -1;
|
||||
start = NSMaxRange(aRange) - 1;
|
||||
stop = aRange.location - 1;
|
||||
step = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = aRange.location; stop = NSMaxRange(aRange); step = 1;
|
||||
start = aRange.location;
|
||||
stop = NSMaxRange(aRange);
|
||||
step = 1;
|
||||
}
|
||||
range.location = NSNotFound;
|
||||
range.length = 0;
|
||||
|
|
|
@ -405,7 +405,7 @@ appendUIntData(NSMutableData *d, NSUInteger i)
|
|||
NSDictionary *attrs;
|
||||
NSMutableString *desc;
|
||||
|
||||
desc = [[NSMutableString alloc] init];
|
||||
desc = [NSMutableString stringWithCapacity: length];
|
||||
while (index < length &&
|
||||
(attrs = [self attributesAtIndex: index effectiveRange: &r]) != nil)
|
||||
{
|
||||
|
|
|
@ -365,8 +365,8 @@ pop_pool_from_cache (struct autorelease_thread_vars *tv)
|
|||
pool = t->_autorelease_vars.current_pool;
|
||||
if (pool == nil && t->_active == NO)
|
||||
{
|
||||
[self new]; // Don't leak while exiting thread.
|
||||
pool = t->_autorelease_vars.current_pool;
|
||||
// Don't leak while exiting thread.
|
||||
pool = t->_autorelease_vars.current_pool = [self new];
|
||||
}
|
||||
if (pool != nil)
|
||||
{
|
||||
|
|
|
@ -2018,8 +2018,10 @@ IF_NO_GC(
|
|||
dict = [[NSDictionary alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
}
|
||||
if (dict == nil)
|
||||
dict = [self infoDictionary];
|
||||
if (nil == [dict autorelease])
|
||||
{
|
||||
dict = [self infoDictionary];
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,10 +63,10 @@ typedef struct {
|
|||
else
|
||||
{
|
||||
o = [[self class] allocWithZone: z];
|
||||
o = [self initWithResponse: [self response]
|
||||
data: [self data]
|
||||
userInfo: [self userInfo]
|
||||
storagePolicy: [self storagePolicy]];
|
||||
o = [o initWithResponse: [self response]
|
||||
data: [self data]
|
||||
userInfo: [self userInfo]
|
||||
storagePolicy: [self storagePolicy]];
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
|
|
@ -1981,8 +1981,9 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
v = info->yd;
|
||||
if (ycent)
|
||||
{
|
||||
if (fmtlen == 1) // no format width specified; supply default
|
||||
if (fmtlen == 1)
|
||||
{
|
||||
// no format width specified; supply default
|
||||
fldfmt[fmtlen++] = '0';
|
||||
fldfmt[fmtlen++] = '4';
|
||||
}
|
||||
|
@ -1991,14 +1992,15 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
{
|
||||
if (v < 0) v = -v;
|
||||
v = v % 100;
|
||||
if (fmtlen == 1) // no format width specified; supply default
|
||||
if (fmtlen == 1)
|
||||
{
|
||||
// no format width specified; supply default
|
||||
fldfmt[fmtlen++] = '0';
|
||||
fldfmt[fmtlen++] = '2';
|
||||
}
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen++] = 0;
|
||||
fldfmt[fmtlen] = 0;
|
||||
outputValueWithFormat(v, fldfmt, info);
|
||||
break;
|
||||
|
||||
|
@ -2035,13 +2037,14 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
{
|
||||
v = info->md;
|
||||
v = v % 100;
|
||||
if (fmtlen == 1) // no format width specified; supply default
|
||||
if (fmtlen == 1)
|
||||
{
|
||||
// no format width specified; supply default
|
||||
fldfmt[fmtlen++] = '0';
|
||||
fldfmt[fmtlen++] = '2';
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen++] = 0;
|
||||
fldfmt[fmtlen] = 0;
|
||||
outputValueWithFormat(v, fldfmt, info);
|
||||
}
|
||||
break;
|
||||
|
@ -2049,26 +2052,26 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
case 'd': // day of month with leading zero
|
||||
v = info->dom;
|
||||
v = v % 100;
|
||||
if (fmtlen == 1) // no format width specified; supply default
|
||||
{
|
||||
fldfmt[fmtlen++] = '0';
|
||||
fldfmt[fmtlen++] = '2';
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen++] = 0;
|
||||
outputValueWithFormat(v, fldfmt, info);
|
||||
if (fmtlen == 1) // no format width specified; supply default
|
||||
{
|
||||
fldfmt[fmtlen++] = '0';
|
||||
fldfmt[fmtlen++] = '2';
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen] = 0;
|
||||
outputValueWithFormat(v, fldfmt, info);
|
||||
break;
|
||||
|
||||
case 'e': // day of month with leading space
|
||||
v = info->dom;
|
||||
v = v % 100;
|
||||
if (fmtlen == 1) // no format width specified; supply default
|
||||
{
|
||||
fldfmt[fmtlen++] = '1'; // no leading space, just like Cocoa
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen++] = 0;
|
||||
outputValueWithFormat(v, fldfmt, info);
|
||||
if (fmtlen == 1) // no format width specified; supply default
|
||||
{
|
||||
fldfmt[fmtlen++] = '1'; // no leading space, just like Cocoa
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen] = 0;
|
||||
outputValueWithFormat(v, fldfmt, info);
|
||||
break;
|
||||
|
||||
case 'F': // milliseconds
|
||||
|
@ -2088,7 +2091,7 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
fldfmt[fmtlen++] = '3';
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen++] = 0;
|
||||
fldfmt[fmtlen] = 0;
|
||||
outputValueWithFormat(v, fldfmt, info);
|
||||
break;
|
||||
|
||||
|
@ -2100,7 +2103,7 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
fldfmt[fmtlen++] = '3';
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen++] = 0;
|
||||
fldfmt[fmtlen] = 0;
|
||||
outputValueWithFormat(v, fldfmt, info);
|
||||
break;
|
||||
|
||||
|
@ -2137,12 +2140,13 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
}
|
||||
if (dtag == NO)
|
||||
{
|
||||
if (fmtlen == 1) // no format width specified; supply default
|
||||
if (fmtlen == 1)
|
||||
{
|
||||
// no format width specified; supply default
|
||||
fldfmt[fmtlen++] = '1';
|
||||
}
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen++] = 0;
|
||||
fldfmt[fmtlen] = 0;
|
||||
outputValueWithFormat(v, fldfmt, info);
|
||||
}
|
||||
}
|
||||
|
@ -2179,7 +2183,7 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen++] = 0;
|
||||
fldfmt[fmtlen] = 0;
|
||||
if (GSPrivateDefaultsFlag(GSMacOSXCompatible)
|
||||
&& hspc == YES)
|
||||
{
|
||||
|
@ -2201,7 +2205,7 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
fldfmt[fmtlen++] = '2';
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen++] = 0;
|
||||
fldfmt[fmtlen] = 0;
|
||||
outputValueWithFormat(v, fldfmt, info);
|
||||
break;
|
||||
|
||||
|
@ -2214,7 +2218,7 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
fldfmt[fmtlen++] = '2';
|
||||
}
|
||||
fldfmt[fmtlen++] = 'd';
|
||||
fldfmt[fmtlen++] = 0;
|
||||
fldfmt[fmtlen] = 0;
|
||||
outputValueWithFormat(v, fldfmt, info);
|
||||
break;
|
||||
|
||||
|
|
|
@ -673,7 +673,7 @@ otherTime(NSDate* other)
|
|||
{
|
||||
BOOL mustSkip = YES;
|
||||
|
||||
while ((dtoIndex < [dto length]) && (mustSkip == YES))
|
||||
while ((dtoIndex < length) && (mustSkip == YES))
|
||||
{
|
||||
switch ([dto characterAtIndex: dtoIndex])
|
||||
{
|
||||
|
@ -715,7 +715,7 @@ otherTime(NSDate* other)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (dtoIndex >= [dto length])
|
||||
if (dtoIndex >= length)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
|
@ -982,7 +982,7 @@ otherTime(NSDate* other)
|
|||
+ (id) distantFuture
|
||||
{
|
||||
if (_distantFuture == nil)
|
||||
return [GSDateFuture allocWithZone: 0];
|
||||
_distantFuture = [GSDateFuture allocWithZone: 0];
|
||||
return _distantFuture;
|
||||
}
|
||||
|
||||
|
@ -993,7 +993,7 @@ otherTime(NSDate* other)
|
|||
+ (id) distantPast
|
||||
{
|
||||
if (_distantPast == nil)
|
||||
return [GSDatePast allocWithZone: 0];
|
||||
_distantPast = [GSDatePast allocWithZone: 0];
|
||||
return _distantPast;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ static const unsigned char whitespace[32] = {
|
|||
|
||||
#define GS_IS_WHITESPACE(X) IS_BIT_SET(whitespace[(X)/8], (X) % 8)
|
||||
|
||||
static id GSPropertyListFromCookieFormat(NSString *string);
|
||||
static id GSPropertyListFromCookieFormat(NSString *string, int version);
|
||||
static NSRange GSRangeOfCookie(NSString *string);
|
||||
|
||||
@implementation NSHTTPCookie
|
||||
|
@ -141,11 +141,10 @@ static NSRange GSRangeOfCookie(NSString *string);
|
|||
forHeader: (NSString *)header
|
||||
andURL: (NSURL *)url
|
||||
{
|
||||
int ckcount, pos;
|
||||
int version;
|
||||
NSString *defaultPath, *defaultDomain;
|
||||
NSMutableArray *a = [NSMutableArray array];
|
||||
ckcount = 0;
|
||||
NSMutableArray *a;
|
||||
|
||||
if ([header isEqual: @"Set-Cookie"])
|
||||
version = 0;
|
||||
else if ([header isEqual: @"Set-Cookie2"])
|
||||
|
@ -153,6 +152,7 @@ static NSRange GSRangeOfCookie(NSString *string);
|
|||
else
|
||||
return nil;
|
||||
|
||||
a = [NSMutableArray array];
|
||||
defaultDomain = [url host];
|
||||
defaultPath = [url path];
|
||||
if ([[url absoluteString] hasSuffix: @"/"] == NO)
|
||||
|
@ -161,31 +161,31 @@ static NSRange GSRangeOfCookie(NSString *string);
|
|||
/* We could use an NSScanner here, but this string could contain all
|
||||
sorts of odd stuff. It's not quite a property list either - it has
|
||||
dates and also could have tokens without values. */
|
||||
pos = 0;
|
||||
while (1)
|
||||
{
|
||||
NSHTTPCookie *cookie;
|
||||
NSMutableDictionary *dict;
|
||||
NSString *onecookie;
|
||||
NSRange range = GSRangeOfCookie(field);
|
||||
|
||||
if (range.location == NSNotFound)
|
||||
break;
|
||||
onecookie = [field substringFromRange: range];
|
||||
NS_DURING
|
||||
dict = GSPropertyListFromCookieFormat(onecookie);
|
||||
dict = GSPropertyListFromCookieFormat(onecookie, version);
|
||||
NS_HANDLER
|
||||
dict = nil;
|
||||
NS_ENDHANDLER
|
||||
if ([dict count])
|
||||
{
|
||||
if ([dict objectForKey: NSHTTPCookiePath] == nil)
|
||||
[dict setObject: defaultPath forKey: NSHTTPCookiePath];
|
||||
if ([dict objectForKey: NSHTTPCookieDomain] == nil)
|
||||
[dict setObject: defaultDomain forKey: NSHTTPCookieDomain];
|
||||
cookie = [NSHTTPCookie cookieWithProperties: dict];
|
||||
if (cookie)
|
||||
[a addObject: cookie];
|
||||
}
|
||||
if ([dict count])
|
||||
{
|
||||
if ([dict objectForKey: NSHTTPCookiePath] == nil)
|
||||
[dict setObject: defaultPath forKey: NSHTTPCookiePath];
|
||||
if ([dict objectForKey: NSHTTPCookieDomain] == nil)
|
||||
[dict setObject: defaultDomain forKey: NSHTTPCookieDomain];
|
||||
cookie = [NSHTTPCookie cookieWithProperties: dict];
|
||||
if (cookie)
|
||||
[a addObject: cookie];
|
||||
}
|
||||
if ([field length] <= NSMaxRange(range))
|
||||
break;
|
||||
field = [field substringFromIndex: NSMaxRange(range)+1];
|
||||
|
@ -674,7 +674,7 @@ _setCookieKey(NSMutableDictionary *dict, NSString *key, NSString *value)
|
|||
}
|
||||
|
||||
static id
|
||||
GSPropertyListFromCookieFormat(NSString *string)
|
||||
GSPropertyListFromCookieFormat(NSString *string, int version)
|
||||
{
|
||||
NSMutableDictionary *dict;
|
||||
pldata _pld;
|
||||
|
@ -755,7 +755,7 @@ GSPropertyListFromCookieFormat(NSString *string)
|
|||
DESTROY(dict);
|
||||
break;
|
||||
}
|
||||
moreCharacters = skipSpace(pld);
|
||||
skipSpace(pld);
|
||||
if (_setCookieKey(dict, key, val) == NO)
|
||||
{
|
||||
pld->err = @"invalid cookie pair";
|
||||
|
|
|
@ -399,16 +399,11 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
*/
|
||||
- (void) getReturnValue: (void*)buffer
|
||||
{
|
||||
const char *type;
|
||||
|
||||
if (_validReturn == NO)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"getReturnValue with no value set"];
|
||||
}
|
||||
|
||||
type = [_sig methodReturnType];
|
||||
|
||||
if (*_inf[0].type != _C_VOID)
|
||||
{
|
||||
memcpy(buffer, _retval, _inf[0].size);
|
||||
|
|
|
@ -81,10 +81,6 @@
|
|||
@end
|
||||
|
||||
@interface GSLocalServerStream : GSSocketServerStream
|
||||
{
|
||||
@private
|
||||
struct sockaddr_un _serverAddr;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSFileInputStream
|
||||
|
|
|
@ -3229,9 +3229,6 @@ handle_request(int desc)
|
|||
if (ri->addr.sin_port == my_port)
|
||||
{
|
||||
struct in_addr sin;
|
||||
unsigned long net;
|
||||
struct in_addr *ptr;
|
||||
int c;
|
||||
|
||||
memcpy(&sin, &ri->buf.r.name, IASIZE);
|
||||
if (debug > 2)
|
||||
|
@ -3240,38 +3237,7 @@ handle_request(int desc)
|
|||
"Probe reply from '%s'", inet_ntoa(sin));
|
||||
gdomap_log(LOG_DEBUG);
|
||||
}
|
||||
#if defined(__MINGW__)
|
||||
if (IN_CLASSA(sin.s_addr))
|
||||
{
|
||||
net = sin.s_addr & IN_CLASSA_NET;
|
||||
}
|
||||
else if (IN_CLASSB(sin.s_addr))
|
||||
{
|
||||
net = sin.s_addr & IN_CLASSB_NET;
|
||||
}
|
||||
else if (IN_CLASSC(sin.s_addr))
|
||||
{
|
||||
net = sin.s_addr & IN_CLASSC_NET;
|
||||
}
|
||||
#else
|
||||
net = inet_netof(sin);
|
||||
#endif
|
||||
ptr = (struct in_addr*)&ri->buf.r.name[2*IASIZE];
|
||||
c = (ri->buf.r.nsize - 2*IASIZE)/IASIZE;
|
||||
prb_add(&sin);
|
||||
#if 0
|
||||
while (c-- > 0)
|
||||
{
|
||||
if (debug > 2)
|
||||
{
|
||||
snprintf(ebuf, sizeof(ebuf),
|
||||
"Add server '%s'", inet_ntoa(*ptr));
|
||||
gdomap_log(LOG_DEBUG);
|
||||
}
|
||||
prb_add(ptr);
|
||||
ptr++;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Irrespective of what we are told to do - we also add the
|
||||
* interface from which this packet arrived so we have a
|
||||
|
@ -4035,7 +4001,7 @@ nameServer(const char* name, const char* host, int op, int ptype, struct sockadd
|
|||
* the specified server on it.
|
||||
*/
|
||||
rval = tryHost(GDO_SERVERS, 0, 0, ptype, &sin, &num, (uptr*)&b);
|
||||
if (rval != 0 && host == local_hostname)
|
||||
if (rval != 0)
|
||||
{
|
||||
snprintf(ebuf, sizeof(ebuf),
|
||||
"failed to contact gdomap on %s(%s) - %s",
|
||||
|
|
|
@ -344,8 +344,6 @@ ParseFile(const char *filename, NSMutableDictionary *tables)
|
|||
{
|
||||
loc_func_t *lf = &loc_funcs[name];
|
||||
|
||||
num_args++;
|
||||
|
||||
/*{
|
||||
printf("got call to '%s', %i args\n", loc_funcs[name].func_name, num_args);
|
||||
for (i = 0;i<num_args;i++)
|
||||
|
@ -505,8 +503,7 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
|
||||
NSMutableDictionary *source_entries;
|
||||
|
||||
NSMutableArray *languages = [[NSMutableArray alloc] init];
|
||||
NSMutableArray *languages = [NSMutableArray arrayWithcCapacity: 10];
|
||||
|
||||
int error;
|
||||
|
||||
|
|
Loading…
Reference in a new issue