diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d3d064b53..c826a0276 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ D1X-Rebirth Changelog -------- main/bmread.c: No calling piggy_dump_all() when EDITOR is defined, it causes a failed Assert and causes it to exit when the PC Shareware descent.pig is used English.lproj/InfoPlist.strings, d1x-Info.plist, d1x-rebirth.xcodeproj/project.pbxproj, d1xgl-Info.plist: Increment version number for Mac files (should have committed this ages ago) +include/strutil.h, main/collide.c, main/dumpmine.c, ui/gadget.c, ui/radio.c: Fix warnings (add d_splitpath prototype, no checking ubyte 'id' is < 0, fix say_totals prototype, include d_strdup prototype for radio.c and make sure that 'text' gets freed) 20120723 -------- diff --git a/include/strutil.h b/include/strutil.h index 589468878..db2a35a84 100644 --- a/include/strutil.h +++ b/include/strutil.h @@ -17,7 +17,9 @@ void removeext(const char *filename, char *out); //give a filename a new extension, doesn't work with paths with no extension already there extern void change_filename_extension( char *dest, const char *src, char *new_ext ); -extern void _splitpath(char *name, char *drive, char *path, char *base, char *ext); +// split an MS-DOS path into drive, directory path, filename without the extension (base) and extension. +// if it's just a filename with no directory specified, this function will get 'base' and 'ext' +extern void d_splitpath(char *name, char *drive, char *path, char *base, char *ext); // create a growing 2D array with a single growing buffer for the text // this system is likely to cause less memory fragmentation than having one malloc'd buffer per string diff --git a/main/collide.c b/main/collide.c index fdf6bb8f5..9fe412c97 100644 --- a/main/collide.c +++ b/main/collide.c @@ -1055,7 +1055,7 @@ void collide_player_and_player( object * player1, object * player2, vms_vector * damage_flag = 0; if (!(player1->id == Player_num || player2->id == Player_num)) return; - if (player1->id < 0 || player1->id > MAX_PLAYERS || player2->id < 0 || player2->id > MAX_PLAYERS) + if (player1->id > MAX_PLAYERS || player2->id > MAX_PLAYERS) return; otherpl = (player1->id==Player_num)?player2->id:player1->id; if (last_player_bump[otherpl] + (F1_0/Netgame.PacketsPerSec) < GameTime64 || last_player_bump[otherpl] > GameTime64) diff --git a/main/dumpmine.c b/main/dumpmine.c index 5a875d55e..396a203cd 100644 --- a/main/dumpmine.c +++ b/main/dumpmine.c @@ -767,7 +767,7 @@ void say_unused_walls(PHYSFS_file *my_file, int *tb) } // ------------------------------------------------------------------------------------------------- -void say_totals(PHYSFS_file *my_file, char *level_name) +static void say_totals(PHYSFS_file *my_file, const char *level_name) { int i;// objnum; int total_robots = 0; diff --git a/ui/gadget.c b/ui/gadget.c index f60ebffb6..d33308632 100644 --- a/ui/gadget.c +++ b/ui/gadget.c @@ -107,6 +107,13 @@ void ui_gadget_delete_all( UI_DIALOG * dlg ) d_free( but1->text ); } + if (tmp->kind == 4 ) // Radio + { + UI_GADGET_RADIO * but1 = (UI_GADGET_RADIO *)tmp; + if (but1->text) + d_free( but1->text ); + } + if (tmp->kind == 6 ) // Inputbox { UI_GADGET_INPUTBOX * but1 = (UI_GADGET_INPUTBOX *)tmp; diff --git a/ui/radio.c b/ui/radio.c index 3db69c91f..92e20f5c2 100644 --- a/ui/radio.c +++ b/ui/radio.c @@ -27,6 +27,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "mouse.h" #include "key.h" #include "u_mem.h" +#include "strutil.h" #define Middle(x) ((2*(x)+1)/4)