summaryrefslogtreecommitdiff
path: root/src/hexen
diff options
context:
space:
mode:
authorFabian Greffrath2015-05-05 12:11:25 +0200
committerFabian Greffrath2015-05-05 12:15:44 +0200
commit90aec9de758dbb178dc19c146d3b0fb22b99342b (patch)
tree879fe93a29d1a3d460332e474fc1c4304fe33bea /src/hexen
parent25d920925361c1e70dbd73afd08a0b836080f2f1 (diff)
downloadchocolate-doom-90aec9de758dbb178dc19c146d3b0fb22b99342b.tar.gz
chocolate-doom-90aec9de758dbb178dc19c146d3b0fb22b99342b.tar.bz2
chocolate-doom-90aec9de758dbb178dc19c146d3b0fb22b99342b.zip
warnings: fix "value computed is not used" warnings
This fixes warnings that are caused by calling GET_LONG without using its return value, e.g.: sv_save.c: In function ‘StreamIn_player_t’: ../../src/i_swap.h:34:20: warning: value computed is not used [-Wunused-value] #define LONG(x) ((signed int) SDL_SwapLE32(x)) ^ sv_save.c:33:18: note: in expansion of macro ‘LONG’ #define GET_LONG LONG(*SavePtr.l++) ^ sv_save.c:349:5: note: in expansion of macro ‘GET_LONG’ GET_LONG; ^ Introducing a "long dummy" variable and calling "dummy = GET_LONG" does not help, because this provokes another warning, rightfully so: sv_save.c: In function ‘StreamIn_player_t’: sv_save.c:346:10: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable] long dummy; Assigning the return value directly to the struct field results in: sv_save.c: In function ‘StreamIn_player_t’: sv_save.c:349:13: warning: assignment makes pointer from integer without a cast [-Wint-conversion] str->mo = GET_LONG; Adding the cast to "(void *)" results in: sv_save.c: In function ‘StreamIn_player_t’: sv_save.c:349:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] str->mo = (void *) GET_LONG; Adding the intermediate cast to "(intptr_t)" finally silences the compiler. Phew!
Diffstat (limited to 'src/hexen')
-rw-r--r--src/hexen/sv_save.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/hexen/sv_save.c b/src/hexen/sv_save.c
index 7837b837..8fa211d8 100644
--- a/src/hexen/sv_save.c
+++ b/src/hexen/sv_save.c
@@ -346,7 +346,7 @@ static void StreamIn_player_t(player_t *str)
// mobj_t *mo;
// Pointer value is reset on load.
- GET_LONG;
+ str->mo = (void *) (intptr_t) GET_LONG;
str->mo = NULL;
// playerstate_t playerstate;
@@ -478,12 +478,12 @@ static void StreamIn_player_t(player_t *str)
// mobj_t *poisoner;
// Pointer value is reset.
- GET_LONG;
+ str->poisoner = (void *) (intptr_t) GET_LONG;
str->poisoner = NULL;
// mobj_t *attacker;
// Pointer value is reset.
- GET_LONG;
+ str->attacker = (void *) (intptr_t) GET_LONG;
str->attacker = NULL;
// int extralight;
@@ -685,14 +685,14 @@ static void StreamIn_thinker_t(thinker_t *str)
{
// struct thinker_s *prev, *next;
// Pointers are discarded:
- GET_LONG;
+ str->prev = (void *) (intptr_t) GET_LONG;
str->prev = NULL;
- GET_LONG;
+ str->next = (void *) (intptr_t) GET_LONG;
str->next = NULL;
// think_t function;
// Function pointer is discarded:
- GET_LONG;
+ str->function = (void *) (intptr_t) GET_LONG;
str->function = NULL;
}
@@ -766,9 +766,9 @@ static void StreamIn_mobj_t(mobj_t *str)
// struct mobj_s *snext, *sprev;
// Pointer values are discarded:
- GET_LONG;
+ str->snext = (void *) (intptr_t) GET_LONG;
str->snext = NULL;
- GET_LONG;
+ str->sprev = (void *) (intptr_t) GET_LONG;
str->sprev = NULL;
// angle_t angle;
@@ -783,14 +783,14 @@ static void StreamIn_mobj_t(mobj_t *str)
// struct mobj_s *bnext, *bprev;
// Values are read but discarded; this will be restored when the thing's
// position is set.
- GET_LONG;
+ str->bnext = (void *) (intptr_t) GET_LONG;
str->bnext = NULL;
- GET_LONG;
+ str->bprev = (void *) (intptr_t) GET_LONG;
str->bprev = NULL;
// struct subsector_s *subsector;
// Read but discard: pointer will be restored when thing position is set.
- GET_LONG;
+ str->subsector = (void *) (intptr_t) GET_LONG;
str->subsector = NULL;
// fixed_t floorz, ceilingz;
@@ -817,7 +817,7 @@ static void StreamIn_mobj_t(mobj_t *str)
// mobjinfo_t *info;
// Pointer value is read but discarded.
- GET_LONG;
+ str->info = (void *) (intptr_t) GET_LONG;
str->info = NULL;
// int tics;