From 0105de5aeed6816adc5383c14db47a909308be09 Mon Sep 17 00:00:00 2001 From: tma Date: Sat, 10 May 2008 18:51:02 +0000 Subject: * Fix a bunch of compile warnings * Only call pkg-config if it exists * Remove cl_consoleHistory from README git-svn-id: svn://svn.icculus.org/quake3/trunk@1342 edf5b092-35ff-0310-97b2-ce42778d08ea --- Makefile | 22 ++++++++++++---------- README | 1 - code/client/snd_openal.c | 38 +++++++++++++++++++++++++------------- code/qcommon/net_ip.c | 31 +++++++++++++++++-------------- 4 files changed, 54 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index 7a8d932..f1005e3 100644 --- a/Makefile +++ b/Makefile @@ -160,13 +160,15 @@ TEMPDIR=/tmp # set PKG_CONFIG_PATH to influence this, e.g. # PKG_CONFIG_PATH=/opt/cross/i386-mingw32msvc/lib/pkgconfig -CURL_CFLAGS=$(shell pkg-config --cflags libcurl) -CURL_LIBS=$(shell pkg-config --libs libcurl) -OPENAL_CFLAGS=$(shell pkg-config --cflags openal) -OPENAL_LIBS=$(shell pkg-config --libs openal) -# FIXME: introduce CLIENT_CFLAGS -SDL_CFLAGS=$(shell pkg-config --cflags sdl|sed 's/-Dmain=SDL_main//') -SDL_LIBS=$(shell pkg-config --libs sdl) +ifeq ($(shell which pkg-config > /dev/null; echo $$?),0) + CURL_CFLAGS=$(shell pkg-config --cflags libcurl) + CURL_LIBS=$(shell pkg-config --libs libcurl) + OPENAL_CFLAGS=$(shell pkg-config --cflags openal) + OPENAL_LIBS=$(shell pkg-config --libs openal) + # FIXME: introduce CLIENT_CFLAGS + SDL_CFLAGS=$(shell pkg-config --cflags sdl|sed 's/-Dmain=SDL_main//') + SDL_LIBS=$(shell pkg-config --libs sdl) +endif # version info VERSION=1.35 @@ -383,9 +385,9 @@ else # ifeq darwin ifeq ($(PLATFORM),mingw32) -ifndef WINDRES -WINDRES=windres -endif + ifndef WINDRES + WINDRES=windres + endif ARCH=x86 diff --git a/README b/README index 3e88789..f7653e0 100644 --- a/README +++ b/README @@ -134,7 +134,6 @@ New cvars backend s_muteWhenMinimized - mute sound when minimized in_joystickNo - select which joystick to use - cl_consoleHistory - read only, stores the console history cl_platformSensitivity - read only, indicates the mouse input scaling r_ext_texture_filter_anisotropic - anisotropic texture filtering diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c index e358516..74be8f2 100644 --- a/code/client/snd_openal.c +++ b/code/client/snd_openal.c @@ -476,9 +476,9 @@ typedef struct src_s } src_t; #ifdef MACOS_X - #define MAX_SRC 64 + #define MAX_SRC 64 #else - #define MAX_SRC 128 + #define MAX_SRC 128 #endif static src_t srcList[MAX_SRC]; static int srcCount = 0; @@ -873,10 +873,13 @@ S_AL_UpdateEntityPosition static void S_AL_UpdateEntityPosition( int entityNum, const vec3_t origin ) { - S_AL_SanitiseVector( (vec_t *)origin ); + vec3_t sanOrigin; + + VectorCopy( origin, sanOrigin ); + S_AL_SanitiseVector( sanOrigin ); if ( entityNum < 0 || entityNum > MAX_GENTITIES ) Com_Error( ERR_DROP, "S_UpdateEntityPosition: bad entitynum %i", entityNum ); - VectorCopy( origin, entityList[entityNum].origin ); + VectorCopy( sanOrigin, entityList[entityNum].origin ); } /* @@ -894,8 +897,8 @@ static qboolean S_AL_CheckInput(int entityNum, sfxHandle_t sfx) if (sfx < 0 || sfx >= numSfx) { Com_Printf(S_COLOR_RED "ERROR: S_AL_CheckInput: handle %i out of range\n", sfx); - return qtrue; - } + return qtrue; + } return qfalse; } @@ -1070,12 +1073,17 @@ S_AL_AddLoopingSound static void S_AL_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx ) { + vec3_t sanOrigin, sanVelocity; + if(S_AL_CheckInput(entityNum, sfx)) return; - S_AL_SanitiseVector( (vec_t *)origin ); - S_AL_SanitiseVector( (vec_t *)velocity ); - S_AL_SrcLoop(SRCPRI_ENTITY, sfx, origin, velocity, entityNum); + VectorCopy( origin, sanOrigin ); + VectorCopy( velocity, sanVelocity ); + S_AL_SanitiseVector( sanOrigin ); + S_AL_SanitiseVector( sanVelocity ); + + S_AL_SrcLoop(SRCPRI_ENTITY, sfx, sanOrigin, sanVelocity, entityNum); } /* @@ -1086,20 +1094,24 @@ S_AL_AddRealLoopingSound static void S_AL_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx ) { + vec3_t sanOrigin, sanVelocity; + if(S_AL_CheckInput(entityNum, sfx)) return; - S_AL_SanitiseVector( (vec_t *)origin ); - S_AL_SanitiseVector( (vec_t *)velocity ); + VectorCopy( origin, sanOrigin ); + VectorCopy( velocity, sanVelocity ); + S_AL_SanitiseVector( sanOrigin ); + S_AL_SanitiseVector( sanVelocity ); // There are certain maps (*cough* Q3:TA mpterra*) that have large quantities // of ET_SPEAKERS in the PVS at any given time. OpenAL can't cope with mixing // large numbers of sounds, so this culls them by distance - if( DistanceSquared( origin, lastListenerOrigin ) > (s_alMaxDistance->value + s_alGraceDistance->value) * + if( DistanceSquared( sanOrigin, lastListenerOrigin ) > (s_alMaxDistance->value + s_alGraceDistance->value) * (s_alMaxDistance->value + s_alGraceDistance->value) ) return; - S_AL_SrcLoop(SRCPRI_AMBIENT, sfx, origin, velocity, entityNum); + S_AL_SrcLoop(SRCPRI_AMBIENT, sfx, sanOrigin, sanVelocity, entityNum); } /* diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c index 862f91a..a2960c4 100644 --- a/code/qcommon/net_ip.c +++ b/code/qcommon/net_ip.c @@ -483,7 +483,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) { if(ip_socket != INVALID_SOCKET) { fromlen = sizeof(from); - ret = recvfrom( ip_socket, net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen ); + ret = recvfrom( ip_socket, (void *)net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen ); if (ret == SOCKET_ERROR) { @@ -527,7 +527,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) { if(ip6_socket != INVALID_SOCKET) { fromlen = sizeof(from); - ret = recvfrom(ip6_socket, net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen); + ret = recvfrom(ip6_socket, (void *)net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen); if (ret == SOCKET_ERROR) { @@ -555,7 +555,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) { if(multicast6_socket != INVALID_SOCKET && multicast6_socket != ip6_socket) { fromlen = sizeof(from); - ret = recvfrom(multicast6_socket, net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen); + ret = recvfrom(multicast6_socket, (void *)net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen); if (ret == SOCKET_ERROR) { @@ -835,7 +835,6 @@ int NET_IP6Socket( char *net_interface, int port, struct sockaddr_in6 *bindto, i SOCKET newsocket; struct sockaddr_in6 address; qboolean _true = qtrue; - int i = 1; *err = 0; @@ -865,11 +864,15 @@ int NET_IP6Socket( char *net_interface, int port, struct sockaddr_in6 *bindto, i } #ifdef IPV6_V6ONLY - // ipv4 addresses should not be allowed to connect via this socket. - if(setsockopt(newsocket, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &i, sizeof(i)) == SOCKET_ERROR) { - // win32 systems don't seem to support this anyways. - Com_DPrintf("WARNING: NET_IP6Socket: setsockopt IPV6_V6ONLY: %s\n", NET_ErrorString()); + int i; + + // ipv4 addresses should not be allowed to connect via this socket. + if(setsockopt(newsocket, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &i, sizeof(i)) == SOCKET_ERROR) + { + // win32 systems don't seem to support this anyways. + Com_DPrintf("WARNING: NET_IP6Socket: setsockopt IPV6_V6ONLY: %s\n", NET_ErrorString()); + } } #endif @@ -1074,14 +1077,14 @@ void NET_OpenSocks( int port ) { if ( rfc1929 ) { buf[2] = 2; // method #2 - method id #02: username/password } - if ( send( socks_socket, buf, len, 0 ) == SOCKET_ERROR ) { + if ( send( socks_socket, (void *)buf, len, 0 ) == SOCKET_ERROR ) { err = socketError; Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() ); return; } // get the response - len = recv( socks_socket, buf, 64, 0 ); + len = recv( socks_socket, (void *)buf, 64, 0 ); if ( len == SOCKET_ERROR ) { err = socketError; Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() ); @@ -1121,14 +1124,14 @@ void NET_OpenSocks( int port ) { } // send it - if ( send( socks_socket, buf, 3 + ulen + plen, 0 ) == SOCKET_ERROR ) { + if ( send( socks_socket, (void *)buf, 3 + ulen + plen, 0 ) == SOCKET_ERROR ) { err = socketError; Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() ); return; } // get the response - len = recv( socks_socket, buf, 64, 0 ); + len = recv( socks_socket, (void *)buf, 64, 0 ); if ( len == SOCKET_ERROR ) { err = socketError; Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() ); @@ -1151,14 +1154,14 @@ void NET_OpenSocks( int port ) { buf[3] = 1; // address type: IPV4 *(int *)&buf[4] = INADDR_ANY; *(short *)&buf[8] = htons( (short)port ); // port - if ( send( socks_socket, buf, 10, 0 ) == SOCKET_ERROR ) { + if ( send( socks_socket, (void *)buf, 10, 0 ) == SOCKET_ERROR ) { err = socketError; Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() ); return; } // get the response - len = recv( socks_socket, buf, 64, 0 ); + len = recv( socks_socket, (void *)buf, 64, 0 ); if( len == SOCKET_ERROR ) { err = socketError; Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() ); -- cgit v1.2.3