diff --git a/common/snd_oss.c b/common/snd_oss.c index d409221..0f53a55 100644 --- a/common/snd_oss.c +++ b/common/snd_oss.c @@ -38,6 +38,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # include #endif +#ifndef MAP_FAILED +# define MAP_FAILED ((void*)-1) +#endif + static int audio_fd; static int snd_inited; @@ -141,8 +145,7 @@ qboolean SNDDMA_Init(void) shm->buffer = (unsigned char *) mmap(NULL, info.fragstotal * info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0); -// if (!shm->buffer || shm->buffer == (unsigned char *)-1) - if (!shm->buffer) + if (shm->buffer == MAP_FAILED) { perror("/dev/dsp"); Con_Printf("Could not mmap /dev/dsp\n"); diff --git a/uquake/sys_unix.c b/uquake/sys_unix.c index 201a60c..d3b394a 100644 --- a/uquake/sys_unix.c +++ b/uquake/sys_unix.c @@ -17,22 +17,23 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// sys_sun.h -- Sun system driver +// sys_unix.c -- Unix system driver #include "quakedef.h" -#include "errno.h" +#include +#include +#include +#include +#include #include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include + +#ifndef MAP_FAILED +# define MAP_FAILED ((void*)-1) +#endif qboolean isDedicated; @@ -101,9 +102,9 @@ int Sys_FileOpenRead (char *path, int *hndl) sys_handles[i].hFile = f; sys_handles[i].nLen = filelength(f); sys_handles[i].nPos = 0; - sys_handles[i].pMap = mmap( 0, sys_handles[i].nLen, PROT_READ, MAP_SHARED, fileno( sys_handles[i].hFile ), 0 ); - if (!sys_handles[i].pMap || (sys_handles[i].pMap == (char *)-1)) - { + sys_handles[i].pMap = mmap(NULL, sys_handles[i].nLen, PROT_READ, + MAP_SHARED, fileno(sys_handles[i].hFile), 0 ); + if (sys_handles[i].pMap == MAP_FAILED) { printf( "mmap %s failed!", path ); sys_handles[i].pMap = NULL; }