From 4233f6a9d67509fb810f12e64ccf3b09c7e4f379 Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 21 Jun 2024 15:02:55 +0100 Subject: [PATCH] fix dead assignments --- ChangeLog | 12 ++++++++++++ Source/Additions/Unicode.m | 4 ++-- Source/GSTLS.m | 2 +- Source/NSDictionary.m | 6 ++---- Source/NSThread.m | 3 +-- Source/NSURLSession.m | 6 +----- Tools/AGSHtml.m | 13 +++---------- Tools/AGSOutput.m | 2 +- Tools/AGSParser.m | 5 ++++- 9 files changed, 27 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 522df81a1..914517a69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2024-06-21 Richard Frith-Macdonald + + * Source/Additions/Unicode.m: + * Source/GSTLS.m: + * Source/NSDictionary.m: + * Source/NSThread.m: + * Source/NSURLSession.m: + * Tools/AGSHtml.m: + * Tools/AGSOutput.m: + * Tools/AGSParser.m: + Fix dead assignments. + 2024-06-21 Richard Frith-Macdonald * Source/GSHTTPURLProtocol.m: diff --git a/Source/Additions/Unicode.m b/Source/Additions/Unicode.m index 14232ae7f..e6657028d 100644 --- a/Source/Additions/Unicode.m +++ b/Source/Additions/Unicode.m @@ -746,13 +746,13 @@ GSUnicode(const unichar *chars, unsigned length, if (isLatin1) *isLatin1 = YES; while (i < length) { - if ((c = chars[i++]) > 127) + if (chars[i++] > 127) { if (isASCII) *isASCII = NO; i--; while (i < length) { - if ((c = chars[i++]) > 255) + if (chars[i++] > 255) { if (isLatin1) *isLatin1 = NO; i--; diff --git a/Source/GSTLS.m b/Source/GSTLS.m index 9a9af7dc1..4cabfada2 100644 --- a/Source/GSTLS.m +++ b/Source/GSTLS.m @@ -483,7 +483,7 @@ static GSTLSDHParams *paramsCurrent = nil; * thread since it's likely to be rather slow. */ if (nil != paramsCurrent && NO == paramsGenerating - && (now = paramsWhen) > 24.0 * 60.0 * 60.0) + && paramsWhen > 24.0 * 60.0 * 60.0) { [NSThread detachNewThreadSelector: @selector(generate) toTarget: self diff --git a/Source/NSDictionary.m b/Source/NSDictionary.m index b80617aa0..7e63eca6f 100644 --- a/Source/NSDictionary.m +++ b/Source/NSDictionary.m @@ -879,9 +879,7 @@ static SEL appSel; */ - (NSArray*) allKeysForObject: (id)anObject { - unsigned c; - - if (anObject == nil || (c = [self count]) == 0) + if (anObject == nil || [self count] == 0) { return nil; } @@ -891,12 +889,12 @@ static SEL appSel; IMP nxtObj = [e methodForSelector: nxtSel]; IMP myObj = [self methodForSelector: objSel]; BOOL (*eqObj)(id, SEL, id); + unsigned c = 0; id k; id result; GS_BEGINIDBUF(a, [self count]); eqObj = (BOOL (*)(id, SEL, id))[anObject methodForSelector: eqSel]; - c = 0; while ((k = (*nxtObj)(e, nxtSel)) != nil) { id o = (*myObj)(self, objSel, k); diff --git a/Source/NSThread.m b/Source/NSThread.m index 3bee0bc6a..9f174afbf 100644 --- a/Source/NSThread.m +++ b/Source/NSThread.m @@ -1712,7 +1712,6 @@ lockInfoErr(NSString *str) if (YES == th->_active && nil != info->wait) { BOOL wasLocked; - GSStackTrace *stck; if (th == self || NULL != NSHashGet(_activeBlocked, (const void*)th)) @@ -1728,7 +1727,7 @@ lockInfoErr(NSString *str) wasLocked = NO; } if (nil != info->wait - && nil != (stck = NSHashGet(info->held, (const void*)want))) + && nil != (id)NSHashGet(info->held, (const void*)want)) { /* This thread holds the lock we are interested in and * is waiting for another lock. diff --git a/Source/NSURLSession.m b/Source/NSURLSession.m index 4937559c6..017a626d4 100644 --- a/Source/NSURLSession.m +++ b/Source/NSURLSession.m @@ -840,11 +840,7 @@ static unsigned nextSessionIdentifier() if ([urlResponse statusCode] == 401) { - NSURLProtectionSpace *space; - - if (nil != (space = [self _protectionSpaceFrom: urlResponse])) - { - } + [self _protectionSpaceFrom: urlResponse]; } delegate = [session delegate]; diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m index dbb6a7e8d..8d8a13f9f 100644 --- a/Tools/AGSHtml.m +++ b/Tools/AGSHtml.m @@ -185,7 +185,7 @@ static NSString *mainFont = nil; NSString *kind = (f == YES) ? @"rel=\"gsdoc\" href" : @"name"; NSString *hash = (f == YES) ? @"#" : @""; - if (f == NO || (s = [localRefs globalRef: r type: t]) != nil) + if (f == NO || [localRefs globalRef: r type: t] != nil) { s = [NSString stringWithFormat: @"", kind, hash, t, r]; @@ -1286,7 +1286,7 @@ static NSString *mainFont = nil; [buf appendString: @"

Date: "]; if (nil == tmp || ([tmp type] == XML_TEXT_NODE - && [(str = [[tmp escapedContent] stringByTrimmingSpaces]) + && [[[tmp escapedContent] stringByTrimmingSpaces] length] == 0)) { str = [NSString stringWithFormat: @"Generated at %@", @@ -1369,7 +1369,7 @@ static NSString *mainFont = nil; NSString *s; GSXMLNode *tmp; - tmp = children = firstElement(children); + tmp = firstElement(children); [buf appendString: indent]; [buf appendString: @"

"]; s = [self makeLink: n ofType: @"ivariable" inUnit: nil isRef: NO]; @@ -1390,13 +1390,6 @@ static NSString *mainFont = nil; } [buf appendFormat: @"%@@%@ %@ %@;
\n", indent, v, t, n]; -/* - if ([[children name] isEqual: @"desc"] == YES) - { - children = [children nextElement]; - } -*/ - /* * List standards with which ivar complies */ diff --git a/Tools/AGSOutput.m b/Tools/AGSOutput.m index 79a799cb6..1eb9aab30 100644 --- a/Tools/AGSOutput.m +++ b/Tools/AGSOutput.m @@ -1977,7 +1977,7 @@ static BOOL snuggleStart(NSString *t) pos++; if (pos < ePos && [identStart characterIsMember: - (c = [tmp characterAtIndex: pos])] == YES) + [tmp characterAtIndex: pos]] == YES) { while (pos < ePos) { diff --git a/Tools/AGSParser.m b/Tools/AGSParser.m index 3ae67c01c..39a6f4e00 100644 --- a/Tools/AGSParser.m +++ b/Tools/AGSParser.m @@ -3799,13 +3799,16 @@ countAttributes(NSSet *keys, NSDictionary *a) NSMutableDictionary *p = nil; NSMutableDictionary *s = nil; - if (nil == (p = [self parsePropertyGetter: &g andSetter: &s])) + if (nil == [self parsePropertyGetter: &g andSetter: &s]) { [self log: @"@property declaration invalid"]; [self skipStatementLine]; } else { + NSAssert(nil == p + || [[p objectForKey: @"Kind"] isEqual: @"Properties"], + NSInternalInconsistencyException); /* FIXME ... need to handle properties token = [p objectForKey: @"Name"]; [methods setObject: p forKey: token];