mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-18 08:52:12 +08:00
Use nullptr/NULL instead of 0 for pointers, two fixes for undefined behavior
This commit fixes most -Wzero-as-null-pointer-constant warnings, except in some places which appear to be vendored 3rd party libraries, e.g. in sdl_ttf.c, libchdr, physfs and gmock and in 3rd party components therein. Since it might make more sense to update this 3rd party code to some later versions instead of fixing the warnings manually, I decided not to enable the C++ compiler flag in configure.ac at this point. In two functions with the return type of std::string executed `return 0;` statements, causing std::string to be constructed from a null pointer. To avoid undefined behavior these were changed to `return {};`. Signed-off-by: Jaak Ristioja <jaak@ristioja.ee>
This commit is contained in:
@@ -290,7 +290,7 @@ void LoadMessageFile(const char * fname) {
|
||||
bool res=true;
|
||||
int cp=dos.loaded_codepage;
|
||||
if (!dos.loaded_codepage) res=InitCodePage();
|
||||
while(fgets(linein, LINE_IN_MAXLEN+1024, mfile)!=0) {
|
||||
while(fgets(linein, LINE_IN_MAXLEN+1024, mfile)) {
|
||||
/* Parse the read line */
|
||||
/* First remove characters 10 and 13 from the line */
|
||||
char * parser=linein;
|
||||
|
Reference in New Issue
Block a user