mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Fix warnings in net.c and xdelta3.
git-svn-id: https://svn.eduke32.com/eduke32@2683 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
299f7b5378
commit
9df8c00bdc
5 changed files with 80 additions and 45 deletions
|
@ -232,6 +232,7 @@ void Net_RestoreMapState(netmapstate_t *save)
|
|||
if (save != NULL)
|
||||
{
|
||||
int32_t i;
|
||||
// int32_t x; // used in commented code below
|
||||
intptr_t j;
|
||||
char phealth[MAXPLAYERS];
|
||||
|
||||
|
@ -732,7 +733,7 @@ void Net_SyncPlayer(ENetEvent *event)
|
|||
enet_packet_create(buf+csize-j, j, ENET_PACKET_FLAG_RELIABLE));
|
||||
enet_host_service(g_netServer, NULL, 0);
|
||||
|
||||
initprintf("Compressed %ld bytes to %ld\n", sizeof(netmapstate_t), qlz_size_compressed(buf));
|
||||
initprintf("Compressed %u bytes to %u\n", sizeof(netmapstate_t), qlz_size_compressed(buf));
|
||||
}
|
||||
else
|
||||
initprintf("Error compressing map state for transfer!\n");
|
||||
|
@ -1581,7 +1582,7 @@ void Net_GetPackets(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
initprintf("Invalid map state from server! Decompressed to %ld bytes, expected %ld.\n",
|
||||
initprintf("Invalid map state from server! Decompressed to %u bytes, expected %u.\n",
|
||||
qlz_size_decompressed((char *)buf), sizeof(netmapstate_t));
|
||||
|
||||
g_netDisconnect = 1;
|
||||
|
@ -1860,9 +1861,7 @@ void Net_UpdateClients(void)
|
|||
void Net_StreamLevel(void)
|
||||
{
|
||||
int32_t pi;
|
||||
int32_t i, nexti;
|
||||
int32_t siz = 0;
|
||||
int32_t zz, zj, k = 0, l;
|
||||
usize_t osize = sizeof(netmapstate_t);
|
||||
|
||||
if (!g_netServer || numplayers < 2)
|
||||
|
|
|
@ -543,7 +543,11 @@ xd3_decode_finish_window (xd3_stream *stream)
|
|||
}
|
||||
|
||||
static int
|
||||
xd3_decode_secondary_sections (xd3_stream *secondary_stream)
|
||||
xd3_decode_secondary_sections (xd3_stream *secondary_stream
|
||||
#if !defined(SECONDARY_ANY) || SECONDARY_ANY == 0
|
||||
ATTRIBUTE((unused))
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if SECONDARY_ANY
|
||||
int ret;
|
||||
|
|
|
@ -106,7 +106,7 @@ xd3_large_cksum_update (uint32_t cksum,
|
|||
static inline uint32_t
|
||||
xd3_scksum (uint32_t *state,
|
||||
const uint8_t *base,
|
||||
const usize_t look)
|
||||
const usize_t look ATTRIBUTE((unused)))
|
||||
{
|
||||
(*state) = *(uint32_t*)base;
|
||||
return (*state) * hash_multiplier;
|
||||
|
@ -114,7 +114,7 @@ xd3_scksum (uint32_t *state,
|
|||
static inline uint32_t
|
||||
xd3_small_cksum_update (uint32_t *state,
|
||||
const uint8_t *base,
|
||||
usize_t look)
|
||||
usize_t look ATTRIBUTE((unused)))
|
||||
{
|
||||
(*state) = *(uint32_t*)(base+1);
|
||||
return (*state) * hash_multiplier;
|
||||
|
@ -207,7 +207,7 @@ xd3_size_log2 (usize_t slots)
|
|||
}
|
||||
|
||||
static void
|
||||
xd3_size_hashtable (xd3_stream *stream,
|
||||
xd3_size_hashtable (xd3_stream *stream ATTRIBUTE((unused)),
|
||||
usize_t slots,
|
||||
xd3_hash_cfg *cfg)
|
||||
{
|
||||
|
|
|
@ -496,6 +496,28 @@ XD3_MAKELIST(xd3_rlist, xd3_rinst, link);
|
|||
#define IF_REGRESSION(x)
|
||||
#endif
|
||||
|
||||
/* custom EDuke32 "not" variants created to help avoid compiler warnings */
|
||||
#if XD3_DEBUG
|
||||
#define IFN_DEBUG(x)
|
||||
#else
|
||||
#define IFN_DEBUG(x) x
|
||||
#endif
|
||||
#if XD3_DEBUG > 1
|
||||
#define IFN_DEBUG1(x)
|
||||
#else
|
||||
#define IFN_DEBUG1(x) x
|
||||
#endif
|
||||
#if XD3_DEBUG > 2
|
||||
#define IFN_DEBUG2(x)
|
||||
#else
|
||||
#define IFN_DEBUG2(x) x
|
||||
#endif
|
||||
#if REGRESSION_TEST
|
||||
#define IFN_REGRESSION(x)
|
||||
#else
|
||||
#define IFN_REGRESSION(x) x
|
||||
#endif
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
#if XD3_ENCODER
|
||||
|
@ -2063,13 +2085,13 @@ xd3_decode_address (xd3_stream *stream, usize_t here,
|
|||
***********************************************************************/
|
||||
|
||||
static void*
|
||||
__xd3_alloc_func (void* opaque, usize_t items, usize_t size)
|
||||
__xd3_alloc_func (void* opaque ATTRIBUTE((unused)), usize_t items, usize_t size)
|
||||
{
|
||||
return malloc ((size_t) items * (size_t) size);
|
||||
}
|
||||
|
||||
static void
|
||||
__xd3_free_func (void* opaque, void* address)
|
||||
__xd3_free_func (void* opaque ATTRIBUTE((unused)), void* address)
|
||||
{
|
||||
free (address);
|
||||
}
|
||||
|
@ -2632,10 +2654,13 @@ xd3_set_source (xd3_stream *stream,
|
|||
* calculations are cheap. */
|
||||
if (!xd3_check_pow2 (src->blksize, &shiftby) == 0)
|
||||
{
|
||||
#if XD3_DEBUG
|
||||
int check;
|
||||
src->blksize = xd3_pow2_roundup(src->blksize);
|
||||
check = xd3_check_pow2 (src->blksize, &shiftby);
|
||||
XD3_ASSERT (check == 0);
|
||||
#else
|
||||
xd3_check_pow2 (src->blksize, &shiftby);
|
||||
#endif
|
||||
IF_DEBUG1 (DP(RINT "raising srcblksz to %u\n", src->blksize));
|
||||
}
|
||||
|
||||
|
@ -3226,7 +3251,7 @@ xd3_iopt_get_slot (xd3_stream *stream, xd3_rinst** iptr)
|
|||
* erase it. If the new instruction is covered by the previous one,
|
||||
* return 1 to skip it. */
|
||||
static void
|
||||
xd3_iopt_erase (xd3_stream *stream, usize_t pos, usize_t size)
|
||||
xd3_iopt_erase (xd3_stream *stream, usize_t pos, usize_t size ATTRIBUTE((unused)))
|
||||
{
|
||||
while (! xd3_rlist_empty (& stream->iopt_used))
|
||||
{
|
||||
|
@ -3303,8 +3328,8 @@ xd3_emit_single (xd3_stream *stream, xd3_rinst *single, usize_t code)
|
|||
}
|
||||
|
||||
static int
|
||||
xd3_emit_double (xd3_stream *stream, xd3_rinst *first,
|
||||
xd3_rinst *second, usize_t code)
|
||||
xd3_emit_double (xd3_stream *stream, xd3_rinst *first IFN_DEBUG2(ATTRIBUTE((unused))),
|
||||
xd3_rinst *second IFN_DEBUG2(ATTRIBUTE((unused))), usize_t code)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -4006,7 +4031,7 @@ xd3_encode_input (xd3_stream *stream)
|
|||
******************************************************************/
|
||||
|
||||
static int
|
||||
xd3_process_stream (int is_encode,
|
||||
xd3_process_stream (int is_encode ATTRIBUTE((unused)),
|
||||
xd3_stream *stream,
|
||||
int (*func) (xd3_stream *),
|
||||
int close_stream,
|
||||
|
@ -4080,7 +4105,7 @@ xd3_process_stream (int is_encode,
|
|||
static int
|
||||
xd3_process_memory (int is_encode,
|
||||
int (*func) (xd3_stream *),
|
||||
int close_stream,
|
||||
int close_stream ATTRIBUTE((unused)),
|
||||
const uint8_t *input,
|
||||
usize_t input_size,
|
||||
const uint8_t *source,
|
||||
|
@ -4807,7 +4832,7 @@ xd3_source_extend_match (xd3_stream *stream)
|
|||
static void
|
||||
xd3_scksum_insert (xd3_stream *stream,
|
||||
usize_t inx,
|
||||
usize_t scksum,
|
||||
usize_t scksum ATTRIBUTE((unused)),
|
||||
usize_t pos)
|
||||
{
|
||||
/* If we are maintaining previous duplicates. */
|
||||
|
@ -4856,7 +4881,7 @@ xd3_check_smatch (const uint8_t *ref0, const uint8_t *inp0,
|
|||
static usize_t
|
||||
xd3_smatch (xd3_stream *stream,
|
||||
usize_t base,
|
||||
usize_t scksum,
|
||||
usize_t scksum IFN_DEBUG2(ATTRIBUTE((unused))),
|
||||
usize_t *match_offset)
|
||||
{
|
||||
usize_t cmp_len;
|
||||
|
|
|
@ -98,35 +98,42 @@
|
|||
* the 32bit boundary [xdelta3-test.h]).
|
||||
*/
|
||||
#ifndef _WIN32
|
||||
#include <stdint.h>
|
||||
typedef unsigned int usize_t;
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#if XD3_USE_LARGEFILE64
|
||||
/* 64 bit file offsets: uses GetFileSizeEx and SetFilePointerEx.
|
||||
* requires Win2000 or newer version of WinNT */
|
||||
#define WINVER 0x0500
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#else
|
||||
/* 32 bit (DWORD) file offsets: uses GetFileSize and
|
||||
* SetFilePointer. compatible with win9x-me and WinNT4 */
|
||||
#define WINVER 0x0400
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#if XD3_USE_LARGEFILE64
|
||||
/* 64 bit file offsets: uses GetFileSizeEx and SetFilePointerEx.
|
||||
* requires Win2000 or newer version of WinNT */
|
||||
#ifndef WINVER
|
||||
#define WINVER 0x0500
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#endif
|
||||
#else
|
||||
/* 32 bit (DWORD) file offsets: uses GetFileSize and
|
||||
* SetFilePointer. compatible with win9x-me and WinNT4 */
|
||||
#ifndef WINVER
|
||||
#define WINVER 0x0400
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#endif
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef _MSC_VER
|
||||
#define inline
|
||||
typedef signed int ssize_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned long uint32_t;
|
||||
typedef ULONGLONG uint64_t;
|
||||
#else
|
||||
/* mingw32, lcc and watcom provide a proper header */
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <windows.h>
|
||||
typedef unsigned int usize_t;
|
||||
#ifdef _MSC_VER
|
||||
#define inline
|
||||
typedef signed int ssize_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned long uint32_t;
|
||||
typedef ULONGLONG uint64_t;
|
||||
#else
|
||||
/* mingw32, lcc and watcom provide a proper header */
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* TODO: note that SIZEOF_USIZE_T is never set to 8, although it should be for
|
||||
* a 64bit platform. OTOH, may be that using 32bits is appropriate even on a
|
||||
|
@ -290,7 +297,7 @@ typedef int (xd3_comp_table_func) (xd3_stream *stream,
|
|||
do { if (! (x)) { DP(RINT "%s:%d: XD3 assertion failed: %s\n", __FILE__, __LINE__, #x); \
|
||||
abort (); } } while (0)
|
||||
#else
|
||||
#define XD3_ASSERT(x) (void)0
|
||||
#define XD3_ASSERT(x)
|
||||
#endif /* XD3_DEBUG */
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
|
Loading…
Reference in a new issue