Fixed some non-critical compiler warnings; Now compiling with -std=c99 -pedantic and fixed warnings (except for editor build) caused by this

This commit is contained in:
zicodxx 2012-05-14 12:20:30 +02:00
parent 20b8e59305
commit 6d3782996c
13 changed files with 29 additions and 28 deletions

View file

@ -4,11 +4,11 @@
*
*/
#ifndef OGL
#include "u_mem.h"
#include "gr.h"
#include "grdef.h"
#ifndef OGL
int gr_disk(fix xc1,fix yc1,fix r1)
{
int p,x, y, xc, yc, r;

View file

@ -1,5 +1,9 @@
D2X-Rebirth Changelog
20120514
--------
2d/disc.c, SConstruct, editor/medmisc.c, include/gr.h, include/internal.h, main/gauges.c, main/menu.c, main/net_udp.c, main/playsave.c, main/state.c, misc/hmp.c, misc/physfsx.c: Fixed some non-critical compiler warnings; Now compiling with -std=c99 -pedantic and fixed warnings (except for editor build) caused by this
20120510
--------
main/multi.h, main/state.c: Reuse pre-defined player objects when loading coop savestate to revent messup when player amount or orders change in a certain way

View file

@ -280,7 +280,7 @@ if (verbosebuild == 0):
env["RANLIBCOMSTR"] = "Indexing $TARGET ..."
# flags and stuff for all platforms
env.Append(CPPFLAGS = ['-Wall', '-funsigned-char'])
env.Append(CPPFLAGS = ['-Wall', '-funsigned-char', '-std=c99', '-pedantic'])
env.Append(CPPDEFINES = [('PROGRAM_NAME', '\\"' + str(PROGRAM_NAME) + '\\"'), ('D2XMAJOR', '\\"' + str(D2XMAJOR) + '\\"'), ('D2XMINOR', '\\"' + str(D2XMINOR) + '\\"'), ('D2XMICRO', '\\"' + str(D2XMICRO) + '\\"')])
env.Append(CPPDEFINES = ['NETWORK', '_REENTRANT'])
env.Append(CPPPATH = ['include', 'main', 'arch/include'])

View file

@ -297,6 +297,7 @@ if (!render_3d_in_big_window)
Assert(render_canv->cv_bitmap.bm_w == show_canv->cv_bitmap.bm_w &&
render_canv->cv_bitmap.bm_h == show_canv->cv_bitmap.bm_h);
(void)show_canv;
}
Update_flags=UF_NONE; //clear flags

View file

@ -286,7 +286,6 @@ int gr_uaaline(fix x0,fix y0,fix x1,fix y1);
// Draw the bitmap into the current canvas at the specified location.
void gr_bitmap(int x,int y,grs_bitmap *bm);
void gr_ubitmap(int x,int y,grs_bitmap *bm);
inline void scale_line(unsigned char *in, unsigned char *out, int ilen, int olen);
void gr_bitmap_scale_to(grs_bitmap *src, grs_bitmap *dst);
void show_fullscr(grs_bitmap *bm);

View file

@ -37,11 +37,7 @@ extern int last_width,last_height;
#define OGL_VIEWPORT(x,y,w,h){if (w!=last_width || h!=last_height){glViewport(x,grd_curscreen->sc_canvas.cv_bitmap.bm_h-y-h,w,h);last_width=w;last_height=h;}}
//platform specific funcs
//MSVC seems to have problems with inline funcs not being found during linking
#ifndef _MSC_VER
inline
#endif
void ogl_swap_buffers_internal(void);
extern void ogl_swap_buffers_internal(void);
extern unsigned char *ogl_pal;

View file

@ -2135,7 +2135,7 @@ void draw_weapon_boxes()
}
void sb_draw_energy_bar(energy)
void sb_draw_energy_bar(int energy)
{
int erase_height, w, h, aw, i;
int ew, eh, eaw;

View file

@ -1567,7 +1567,7 @@ int select_file_recursive(char *title, const char *orig_path, char **ext_list, i
return 0;
}
return newmenu_listbox1(title, b->num_files, b->list, 1, 0, (int (*)(listbox *, d_event *, void *))select_file_handler, b) >= 0;
return newmenu_listbox1(title, b->num_files, b->list, 1, 0, (int (*)(listbox *, d_event *, void *))select_file_handler, b) != NULL;
}
#define PATH_HEADER_TYPE NM_TYPE_MENU

View file

@ -408,7 +408,7 @@ int udp_tracker_unregister()
pBuf[0] = TRACKER_PKT_UNREGISTER;
// Put the GameID
PUT_INTEL_INT( &pBuf[1], Netgame.protocol.udp.GameID );
PUT_INTEL_INT( pBuf+1, Netgame.protocol.udp.GameID );
// Send it off
return dxx_sendto( UDP_Socket[2], pBuf, iLen, 0, (struct sockaddr *)&TrackerSocket, sizeof( TrackerSocket ) );
@ -434,15 +434,15 @@ int udp_tracker_register()
pBuf[2] = 0x02;
// Write the port we're running on
PUT_INTEL_SHORT( &pBuf[3], atoi( UDP_MyPort ) );
PUT_INTEL_SHORT( pBuf+3, atoi( UDP_MyPort ) );
// Put the GameID
PUT_INTEL_INT( &pBuf[5], Netgame.protocol.udp.GameID );
PUT_INTEL_INT( pBuf+5, Netgame.protocol.udp.GameID );
// Now, put the game version
PUT_INTEL_SHORT( &pBuf[9], D2XMAJORi );
PUT_INTEL_SHORT( &pBuf[11], D2XMINORi );
PUT_INTEL_SHORT( &pBuf[13], D2XMICROi );
PUT_INTEL_SHORT( pBuf+9, D2XMAJORi );
PUT_INTEL_SHORT( pBuf+11, D2XMINORi );
PUT_INTEL_SHORT( pBuf+13, D2XMICROi );
// Send it off
return dxx_sendto( UDP_Socket[2], pBuf, iLen, 0, (struct sockaddr *)&TrackerSocket, sizeof( TrackerSocket ) );
@ -4671,13 +4671,13 @@ void net_udp_send_pdata()
memset(&pos, 0, sizeof(shortpos));
create_shortpos(&pos, Objects+Players[Player_num].objnum, 0);
memcpy(buf + len, &pos.bytemat, 9); len += 9;
PUT_INTEL_SHORT(&buf[len], pos.xo); len += 2;
PUT_INTEL_SHORT(&buf[len], pos.yo); len += 2;
PUT_INTEL_SHORT(&buf[len], pos.zo); len += 2;
PUT_INTEL_SHORT(&buf[len], pos.segment); len += 2;
PUT_INTEL_SHORT(&buf[len], pos.velx); len += 2;
PUT_INTEL_SHORT(&buf[len], pos.vely); len += 2;
PUT_INTEL_SHORT(&buf[len], pos.velz); len += 2;
PUT_INTEL_SHORT(buf+len, pos.xo); len += 2;
PUT_INTEL_SHORT(buf+len, pos.yo); len += 2;
PUT_INTEL_SHORT(buf+len, pos.zo); len += 2;
PUT_INTEL_SHORT(buf+len, pos.segment); len += 2;
PUT_INTEL_SHORT(buf+len, pos.velx); len += 2;
PUT_INTEL_SHORT(buf+len, pos.vely); len += 2;
PUT_INTEL_SHORT(buf+len, pos.velz); len += 2;
if (multi_i_am_master())
{

View file

@ -230,7 +230,7 @@ int read_player_d2x(char *filename)
strupr(word);
while(!strstr(word,"END") && !PHYSFS_eof(f))
{
int kc1=0,kc2=0,kc3=0;
unsigned int kc1=0,kc2=0,kc3=0;
int i=atoi(word);
if(i==0) i=10;

View file

@ -1217,7 +1217,7 @@ extern void copy_defaults_to_robot(object *objp);
int state_restore_all_sub(char *filename, int secret_restore)
{
int version,i, j, segnum, coop_player_got[MAX_PLAYERS], coop_org_objnum;
int version,i, j, segnum, coop_player_got[MAX_PLAYERS], coop_org_objnum = Players[Player_num].objnum;
object * obj;
PHYSFS_file *fp;
int swap = 0; // if file is not endian native, have to swap all shorts and ints
@ -1320,7 +1320,6 @@ int state_restore_all_sub(char *filename, int secret_restore)
else // in coop we want to stay the player we are already.
{
strcpy( org_callsign, Players[Player_num].callsign );
coop_org_objnum = Players[Player_num].objnum;
if (!secret_restore)
init_player_stats_game(Player_num);
}

View file

@ -712,7 +712,7 @@ ubyte tempo [19] = {'M','T','r','k',0,0,0,11,0,0xFF,0x51,0x03,0x18,0x80,0x00,0,0
void hmp2mid(char *hmp_name, unsigned char **midbuf, unsigned int *midlen)
{
int mi, i;
short ms;
short ms, time_div = 0xC0;
hmp_file *hmp=NULL;
hmp = hmp_open(hmp_name);
@ -737,7 +737,7 @@ void hmp2mid(char *hmp_name, unsigned char **midbuf, unsigned int *midlen)
*midbuf = d_realloc(*midbuf, *midlen + sizeof(ms));
memcpy(&(*midbuf)[*midlen], &ms, sizeof(ms));
*midlen += sizeof(ms);
ms = MIDISHORT((short) 0xC0);
ms = MIDISHORT(time_div);
*midbuf = d_realloc(*midbuf, *midlen + sizeof(ms));
memcpy(&(*midbuf)[*midlen], &ms, sizeof(ms));
*midlen += sizeof(ms);

View file

@ -23,7 +23,9 @@
// The user directory is searched first.
void PHYSFSX_init(int argc, char *argv[])
{
#if defined(__unix__) || defined(__APPLE__) || defined(__MACH__)
char fullPath[PATH_MAX + 5];
#endif
#if defined(__unix__)
char *path = NULL;
#endif