Skip to content

Commit

Permalink
* Fix a bunch of compile warnings
Browse files Browse the repository at this point in the history
* Only call pkg-config if it exists
* Remove cl_consoleHistory from README
  • Loading branch information
timangus committed May 10, 2008
1 parent c45d540 commit a857487
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 38 deletions.
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -383,9 +385,9 @@ else # ifeq darwin

ifeq ($(PLATFORM),mingw32)

ifndef WINDRES
WINDRES=windres
endif
ifndef WINDRES
WINDRES=windres
endif

ARCH=x86

Expand Down
1 change: 0 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 25 additions & 13 deletions code/client/snd_openal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
}

/*
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
}

/*
Expand All @@ -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);
}

/*
Expand Down
31 changes: 17 additions & 14 deletions code/qcommon/net_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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() );
Expand Down Expand Up @@ -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() );
Expand All @@ -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() );
Expand Down

0 comments on commit a857487

Please sign in to comment.