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)

This commit is contained in:
Chris Taylor 2012-07-24 17:29:43 +08:00
parent a65bb22202
commit b9e16185a3
6 changed files with 14 additions and 3 deletions

View file

@ -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
--------

View file

@ -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

View file

@ -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)

View file

@ -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;

View file

@ -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;

View file

@ -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)