MantisBT - Zandronum
View Issue Details
0001337Zandronum[All Projects] Bugpublic2013-05-05 22:172015-09-05 02:22
Edward-san 
 
urgentmajoralways
closedno change required 
 
 
0001337: Using the wrong statement to compare two strings in PWO_ParseDef
clang 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...
No tags attached.
Issue History
2013-05-05 22:17Edward-sanNew Issue
2013-05-06 23:06Edward-sanView Statusprivate => public
2013-05-06 23:15DuskNote Added: 0006323
2013-05-07 09:28Edward-sanNote Added: 0006324
2013-06-01 18:35AlienOverlordNote Added: 0006357
2013-06-02 19:48Torr SamahoNote Added: 0006362
2013-07-26 20:07Edward-sanNote Added: 0006819
2014-06-14 17:31WatermelonStatusnew => closed
2014-06-14 17:31WatermelonResolutionopen => no change required
2014-06-14 23:09DuskStatusclosed => new
2014-06-14 23:09DuskResolutionno change required => reopened
2014-06-14 23:58WatermelonNote Added: 0009357
2014-06-14 23:58WatermelonStatusnew => feedback
2014-06-14 23:58WatermelonNote Edited: 0009357bug_revision_view_page.php?bugnote_id=9357#r4972
2015-09-05 02:22DuskNote Added: 0013409
2015-09-05 02:22DuskStatusfeedback => closed
2015-09-05 02:22DuskResolutionreopened => no change required

Notes
(0006323)
Dusk   
2013-05-06 23:15   
should use currentSection.Compare ("None") != 0
(0006324)
Edward-san   
2013-05-07 09:28   
How can the author get it right for 'sc' and not for 'currentSection'?
(0006357)
AlienOverlord   
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.
(0006362)
Torr Samaho   
2013-06-02 19:48   
Did anybody test of the code still works when the check is done properly?
(0006819)
Edward-san   
2013-07-26 20:07   
Should be okay. I did not find any problems with that change.
(0009357)
Watermelon   
2014-06-14 23:58   
Does MSVC complain when it's warning settings are cranked up to max? (out of curiosity)

(0013409)
Dusk   
2015-09-05 02:22   
This one ceased to exist when PWO was rewritten.