Zandronum Chat on our Discord Server Get the latest version: 3.2
Source Code

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001337Zandronum[All Projects] Bugpublic2013-05-05 22:172015-09-05 02:22
ReporterEdward-san 
Assigned To 
PriorityurgentSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001337: Using the wrong statement to compare two strings in PWO_ParseDef
Descriptionclang warns:


/home/edward-san/zdoom/zandronum/trunk/src/g_shared/pwo.cpp:252:48: warning: result of comparison against a string literal is unspecified (use strncmp instead) [-Wstring-compare]
                else if(sc.Compare("Game") && currentSection != "None")
                                                             ^ ~~~~~~
/home/edward-san/zdoom/zandronum/trunk/src/g_shared/pwo.cpp:272:51: warning: result of comparison against a string literal is unspecified (use strncmp instead) [-Wstring-compare]
                else if(sc.Compare("Section") && currentSection != "None")
                                                                ^ ~~~~~~
/home/edward-san/zdoom/zandronum/trunk/src/g_shared/pwo.cpp:309:50: warning: result of comparison against a string literal is unspecified (use strncmp instead) [-Wstring-compare]
                else if(sc.Compare("Weapon") && currentSection != "None")
                                                               ^ ~~~~~~


no comment on this...
Attached Files

- Relationships

-  Notes
User avatar (0006323)
Dusk (developer)
2013-05-06 23:15

should use currentSection.Compare ("None") != 0
User avatar (0006324)
Edward-san (developer)
2013-05-07 09:28

How can the author get it right for 'sc' and not for 'currentSection'?
User avatar (0006357)
AlienOverlord (reporter)
2013-06-01 18:35

Just lot of assumptions without checking actual variable types, also VS2005 didn't complain about string comparison.
First, 'sc' is of type FScanner, while 'currentSection' is FString. I used sc.Compare() because I assumed that it uses some different way to compare strings (probably stricmp or something like that). And I used != operator because I assumed FString implements it and again, VS2005 DID NOT COMPLAIN.
User avatar (0006362)
Torr Samaho (administrator)
2013-06-02 19:48

Did anybody test of the code still works when the check is done properly?
User avatar (0006819)
Edward-san (developer)
2013-07-26 20:07

Should be okay. I did not find any problems with that change.
User avatar (0009357)
Watermelon (developer)
2014-06-14 23:58
edited on: 2014-06-14 23:58

Does MSVC complain when it's warning settings are cranked up to max? (out of curiosity)

User avatar (0013409)
Dusk (developer)
2015-09-05 02:22

This one ceased to exist when PWO was rewritten.

Issue Community Support
This issue is already marked as resolved.
If you feel that is not the case, please reopen it and explain why.
Supporters: No one explicitly supports this issue yet.
Opponents: No one explicitly opposes this issue yet.

- Issue History
Date Modified Username Field Change
2013-05-05 22:17 Edward-san New Issue
2013-05-06 23:06 Edward-san View Status private => public
2013-05-06 23:15 Dusk Note Added: 0006323
2013-05-07 09:28 Edward-san Note Added: 0006324
2013-06-01 18:35 AlienOverlord Note Added: 0006357
2013-06-02 19:48 Torr Samaho Note Added: 0006362
2013-07-26 20:07 Edward-san Note Added: 0006819
2014-06-14 17:31 Watermelon Status new => closed
2014-06-14 17:31 Watermelon Resolution open => no change required
2014-06-14 23:09 Dusk Status closed => new
2014-06-14 23:09 Dusk Resolution no change required => reopened
2014-06-14 23:58 Watermelon Note Added: 0009357
2014-06-14 23:58 Watermelon Status new => feedback
2014-06-14 23:58 Watermelon Note Edited: 0009357 View Revisions
2015-09-05 02:22 Dusk Note Added: 0013409
2015-09-05 02:22 Dusk Status feedback => closed
2015-09-05 02:22 Dusk Resolution reopened => no change required






Questions or other issues? Contact Us.

Links


Copyright © 2000 - 2025 MantisBT Team
Powered by Mantis Bugtracker