You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that the below build warning is pointing to a real defect. The caseInsensitiveCompare call returns a value from the NSComparisonResult enumeration, of which NSOrderedSame is a member. Applying the "!" operator to the NSComparisonResult doesn't seem to make a lot of sense on the face of things.
Plugins/cordova-plugin-httpd/WebSocket.m:111:11: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
22:31:58 else if (![upgradeHeaderValue caseInsensitiveCompare:@"WebSocket"] == NSOrderedSame) {
22:31:58 ^ ~~
22:31:58 /Users/jenkins/workspace/workspace/VandorLauncherUS/WebClients/LandoLauncher/platforms/ios/Earthworks GO!/Plugins/cordova-plugin-httpd/WebSocket.m:111:11: note: add parentheses after the '!' to evaluate the comparison first
22:31:58 else if (![upgradeHeaderValue caseInsensitiveCompare:@"WebSocket"] == NSOrderedSame) {
22:31:58 ^
22:31:58 ( )
22:31:58 /Users/jenkins/workspace/workspace/VandorLauncherUS/WebClients/LandoLauncher/platforms/ios/Earthworks GO!/Plugins/cordova-plugin-httpd/WebSocket.m:111:11: note: add parentheses around left hand side expression to silence this warning
22:31:58 else if (![upgradeHeaderValue caseInsensitiveCompare:@"WebSocket"] == NSOrderedSame) {
22:31:58 ^
22:31:58 ( )
For correctness, the "!A == B" structure of line 111 should be changed to "!(A == B)" or to "A != B", I think.
However, it's interesting to see that NSComparisonResult enumeration is defined with NSOrderedAscending as -1L, then NSOrderedSame, then NSOrderedDescending. If I'm correct to think that applying "!" to any nonzero value will always evaluate to 0 in Objective-C, which is the value of NSOrderedSame, then !A == B coincidentally evaluates to the same result as !(A == B), for this particular situation. I.e. there may be no behavioral change seen by correcting the code.
The text was updated successfully, but these errors were encountered:
I think that the below build warning is pointing to a real defect. The caseInsensitiveCompare call returns a value from the NSComparisonResult enumeration, of which NSOrderedSame is a member. Applying the "!" operator to the NSComparisonResult doesn't seem to make a lot of sense on the face of things.
For correctness, the "!A == B" structure of line 111 should be changed to "!(A == B)" or to "A != B", I think.
However, it's interesting to see that NSComparisonResult enumeration is defined with NSOrderedAscending as -1L, then NSOrderedSame, then NSOrderedDescending. If I'm correct to think that applying "!" to any nonzero value will always evaluate to 0 in Objective-C, which is the value of NSOrderedSame, then !A == B coincidentally evaluates to the same result as !(A == B), for this particular situation. I.e. there may be no behavioral change seen by correcting the code.
The text was updated successfully, but these errors were encountered: