gcc 4.0 signedness warning fixes and uninitialized vector fixes
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 20 Oct 2005 22:14:19 +0000 (22:14 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 20 Oct 2005 22:14:19 +0000 (22:14 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5741 d7cf8633-e32d-0410-b094-e92efae38249

25 files changed:
cl_particles.c
cl_screen.c
collision.c
gl_backend.c
gl_draw.c
gl_rmain.c
gl_textures.c
host.c
host_cmd.c
lhnet.c
model_brush.c
model_shared.c
model_sprite.c
netconn.c
polygon.c
polygon.h
prvm_cmds.c
snd_coreaudio.c
snd_mix.c
snd_ogg.c
snd_wav.c
sv_main.c
vid_agl.c
vid_sdl.c
view.c

index 25d9079..cb3cf0c 100644 (file)
@@ -558,7 +558,7 @@ void CL_ReadPointFile_f (void)
 #if WORKINGLQUAKE
        pointfile = COM_LoadTempFile (name);
 #else
-       pointfile = FS_LoadFile(name, tempmempool, true);
+       pointfile = (char *)FS_LoadFile(name, tempmempool, true);
 #endif
        if (!pointfile)
        {
@@ -567,6 +567,7 @@ void CL_ReadPointFile_f (void)
        }
 
        Con_Printf("Reading %s...\n", name);
+       VectorClear(leakorg);
        c = 0;
        s = 0;
        pointfilepos = pointfile;
index 917ddab..687f611 100644 (file)
@@ -1299,7 +1299,7 @@ showlmp_t showlmp[SHOWLMP_MAXLABELS];
 void SHOWLMP_decodehide(void)
 {
        int i;
-       qbyte *lmplabel;
+       char *lmplabel;
        lmplabel = MSG_ReadString();
        for (i = 0;i < SHOWLMP_MAXLABELS;i++)
                if (showlmp[i].isactive && strcmp(showlmp[i].label, lmplabel) == 0)
@@ -1312,7 +1312,7 @@ void SHOWLMP_decodehide(void)
 void SHOWLMP_decodeshow(void)
 {
        int i, k;
-       qbyte lmplabel[256], picname[256];
+       char lmplabel[256], picname[256];
        float x, y;
        strlcpy (lmplabel,MSG_ReadString(), sizeof (lmplabel));
        strlcpy (picname, MSG_ReadString(), sizeof (picname));
index 693d653..6fc28f0 100644 (file)
@@ -522,6 +522,7 @@ void Collision_TraceBrushBrushFloat(trace_t *trace, const colbrushf_t *thisbrush
        float enterfrac, leavefrac, d1, d2, f, imove, newimpactnormal[3], enterfrac2;
        const colplanef_t *startplane, *endplane;
 
+       VectorClear(newimpactnormal);
        enterfrac = -1;
        enterfrac2 = -1;
        leavefrac = 1;
@@ -662,6 +663,7 @@ void Collision_TraceLineBrushFloat(trace_t *trace, const vec3_t linestart, const
        float enterfrac, leavefrac, d1, d2, f, imove, newimpactnormal[3], enterfrac2;
        const colplanef_t *startplane, *endplane;
 
+       VectorClear(newimpactnormal);
        enterfrac = -1;
        enterfrac2 = -1;
        leavefrac = 1;
index 8ad00d6..38c4707 100644 (file)
@@ -174,9 +174,9 @@ static void gl_backend_start(void)
        if (gl_support_fragment_shader)
        {
                CHECKGLERROR
-               qglGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &backendimageunits);
+               qglGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, (int *)&backendimageunits);
                CHECKGLERROR
-               qglGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &backendarrayunits);
+               qglGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, (int *)&backendarrayunits);
                CHECKGLERROR
                Con_Printf("GLSL shader support detected: texture units = %i texenv, %i image, %i array\n", backendunits, backendimageunits, backendarrayunits);
        }
index ecd5154..c0aa4f3 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -147,8 +147,9 @@ static rtexture_t *draw_generatemousepointer(void)
 // must match NUMCROSSHAIRS in r_crosshairs.c
 #define NUMCROSSHAIRS 6
 
-static qbyte *crosshairtexdata[NUMCROSSHAIRS] =
+static qbyte crosshairtexdata[NUMCROSSHAIRS][16*16] =
 {
+       {
        "................"
        "................"
        "................"
@@ -165,7 +166,8 @@ static qbyte *crosshairtexdata[NUMCROSSHAIRS] =
        "................"
        "................"
        "................"
-       ,
+       },
+       {
        "................"
        "................"
        "................"
@@ -182,7 +184,8 @@ static qbyte *crosshairtexdata[NUMCROSSHAIRS] =
        "................"
        "................"
        "................"
-       ,
+       },
+       {
        "................"
        ".......77......."
        ".......77......."
@@ -199,7 +202,8 @@ static qbyte *crosshairtexdata[NUMCROSSHAIRS] =
        ".......77......."
        ".......77......."
        "................"
-       ,
+       },
+       {
        "................"
        "................"
        "................"
@@ -216,7 +220,8 @@ static qbyte *crosshairtexdata[NUMCROSSHAIRS] =
        "........7......."
        "........7......."
        "................"
-       ,
+       },
+       {
        "................"
        "................"
        "................"
@@ -233,7 +238,8 @@ static qbyte *crosshairtexdata[NUMCROSSHAIRS] =
        "................"
        "................"
        "................"
-       ,
+       },
+       {
        "................"
        "................"
        "................"
@@ -250,6 +256,7 @@ static qbyte *crosshairtexdata[NUMCROSSHAIRS] =
        "................"
        "................"
        "................"
+       }
 };
 
 static rtexture_t *draw_generatecrosshair(int num)
@@ -323,7 +330,7 @@ cachepic_t  *Draw_CachePic (const char *path, qboolean persistent)
                        return &video->cpif;
        }
 
-       crc = CRC_Block(path, strlen(path));
+       crc = CRC_Block((qbyte *)path, strlen(path));
        hashkey = ((crc >> 8) ^ crc) % CACHEPICHASHSIZE;
        for (pic = cachepichash[hashkey];pic;pic = pic->chain)
                if (!strcmp (path, pic->name))
@@ -407,7 +414,7 @@ cachepic_t *Draw_NewPic(const char *picname, int width, int height, int alpha, q
        int crc, hashkey;
        cachepic_t *pic;
 
-       crc = CRC_Block(picname, strlen(picname));
+       crc = CRC_Block((qbyte *)picname, strlen(picname));
        hashkey = ((crc >> 8) ^ crc) % CACHEPICHASHSIZE;
        for (pic = cachepichash[hashkey];pic;pic = pic->chain)
                if (!strcmp (picname, pic->name))
@@ -453,7 +460,7 @@ void Draw_FreePic(const char *picname)
        int hashkey;
        cachepic_t *pic;
        // this doesn't really free the pic, but does free it's texture
-       crc = CRC_Block(picname, strlen(picname));
+       crc = CRC_Block((qbyte *)picname, strlen(picname));
        hashkey = ((crc >> 8) ^ crc) % CACHEPICHASHSIZE;
        for (pic = cachepichash[hashkey];pic;pic = pic->chain)
        {
index deaa8db..6a1693e 100644 (file)
@@ -297,6 +297,7 @@ static void R_BuildNormalizationCube(void)
                                t = (y + 0.5f) * (2.0f / NORMSIZE) - 1.0f;
                                switch(side)
                                {
+                               default:
                                case 0:
                                        v[0] = 1;
                                        v[1] = -t;
@@ -379,7 +380,7 @@ void gl_main_newmap(void)
                if (l >= 0 && !strcmp(entname + l, ".bsp"))
                {
                        strcpy(entname + l, ".ent");
-                       if ((entities = FS_LoadFile(entname, tempmempool, true)))
+                       if ((entities = (char *)FS_LoadFile(entname, tempmempool, true)))
                        {
                                CL_ParseEntityLump(entities);
                                Mem_Free(entities);
index 9c69e29..51ae4f6 100644 (file)
@@ -238,7 +238,7 @@ void R_FreeTexture(rtexture_t *rt)
                        else
                                Host_Error("R_FreeTexture: image not linked in pool\n");
                        if (image->texnum)
-                               qglDeleteTextures(1, &image->texnum);
+                               qglDeleteTextures(1, (GLuint *)&image->texnum);
                        if (image->blockallocation)
                                Mem_Free(image->blockallocation);
                        Mem_Free(image);
@@ -986,7 +986,7 @@ static void R_FindImageForTexture(gltexture_t *glt)
        image->bytesperpixel = texinfo->internalbytesperpixel;
        image->sides = image->texturetype == GLTEXTURETYPE_CUBEMAP ? 6 : 1;
        // get a texture number to use
-       qglGenTextures(1, &image->texnum);
+       qglGenTextures(1, (GLuint *)&image->texnum);
        *imagechainpointer = image;
        image->texturecount++;
 
diff --git a/host.c b/host.c
index 0fae48f..99a1adc 100644 (file)
--- a/host.c
+++ b/host.c
@@ -477,7 +477,7 @@ void Host_ShutdownServer(qboolean crash)
 {
        int i, count;
        sizebuf_t buf;
-       char message[4];
+       qbyte message[4];
 
        Con_DPrintf("Host_ShutdownServer\n");
 
index 65d516a..303ea03 100644 (file)
@@ -586,7 +586,7 @@ void Host_Loadgame_f (void)
 
        cls.demonum = -1;               // stop demo loop in case this fails
 
-       t = text = FS_LoadFile (filename, tempmempool, false);
+       t = text = (char *)FS_LoadFile (filename, tempmempool, false);
        if (!text)
        {
                Con_Print("ERROR: couldn't open.\n");
@@ -904,7 +904,7 @@ void Host_Say(qboolean teamonly)
        const char *p1;
        char *p2;
        // LordHavoc: 256 char say messages
-       unsigned char text[256];
+       char text[256];
        qboolean fromServer = false;
 
        if (cmd_source == src_command)
diff --git a/lhnet.c b/lhnet.c
index f2f7b57..b80f098 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -634,7 +634,7 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength,
        }
        else if (lhnetsocket->address.addresstype == LHNETADDRESSTYPE_INET4)
        {
-               int inetaddresslength;
+               unsigned int inetaddresslength;
                address->addresstype = LHNETADDRESSTYPE_NONE;
                inetaddresslength = sizeof(address->addressdata.inet4);
                value = recvfrom(lhnetsocket->inetsocket, content, maxcontentlength, 0, (struct sockaddr *)&address->addressdata.inet4, &inetaddresslength);
@@ -669,7 +669,7 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength,
        }
        else if (lhnetsocket->address.addresstype == LHNETADDRESSTYPE_INET6)
        {
-               int inetaddresslength;
+               unsigned int inetaddresslength;
                address->addresstype = LHNETADDRESSTYPE_NONE;
                inetaddresslength = sizeof(address->addressdata.inet6);
                value = recvfrom(lhnetsocket->inetsocket, content, maxcontentlength, 0, (struct sockaddr *)&address->addressdata.inet6, &inetaddresslength);
index 02b137d..2c3a0e9 100644 (file)
@@ -3733,7 +3733,7 @@ static void Mod_Q3BSP_LoadTextures(lump_t *l)
        {
                for (i = 0;i < search->numfilenames;i++)
                {
-                       if ((f = FS_LoadFile(search->filenames[i], tempmempool, false)))
+                       if ((f = (char *)FS_LoadFile(search->filenames[i], tempmempool, false)))
                        {
                                text = f;
                                while (COM_ParseToken(&text, false))
index 684be27..7ff896c 100644 (file)
@@ -851,6 +851,8 @@ void Mod_ShadowMesh_CalcBBox(shadowmesh_t *firstmesh, vec3_t mins, vec3_t maxs,
        shadowmesh_t *mesh;
        vec3_t nmins, nmaxs, ncenter, temp;
        float nradius2, dist2, *v;
+       VectorClear(nmins);
+       VectorClear(nmaxs);
        // calculate bbox
        for (mesh = firstmesh;mesh;mesh = mesh->next)
        {
@@ -1075,7 +1077,7 @@ tag_torso,
 */
        memset(tagsets, 0, sizeof(tagsets));
        memset(word, 0, sizeof(word));
-       for (i = 0;i < MAX_SKINS && (data = text = FS_LoadFile(va("%s_%i.skin", loadmodel->name, i), tempmempool, true));i++)
+       for (i = 0;i < MAX_SKINS && (data = text = (char *)FS_LoadFile(va("%s_%i.skin", loadmodel->name, i), tempmempool, true));i++)
        {
                numtags = 0;
 
index a74f9bb..ec41b6e 100644 (file)
@@ -38,7 +38,7 @@ void Mod_SpriteInit (void)
 }
 
 static int alphaonlytable[4] = {255 | 0x80000000, 255 | 0x80000000, 255 | 0x80000000, 3};
-static void Mod_Sprite_SharedSetup(const qbyte *datapointer, int version, const int *palette, const int *alphapalette)
+static void Mod_Sprite_SharedSetup(const qbyte *datapointer, int version, const unsigned int *palette, const unsigned int *alphapalette)
 {
        int                                     i, j, groupframes, realframes, x, y, origin[2], width, height;
        dspriteframetype_t      *pinframetype;
@@ -310,7 +310,7 @@ void Mod_IDSP_Load(model_t *mod, void *buffer, void *bufferend)
                        alphapalette[i][3] = palette[i][3];
                }
 
-               Mod_Sprite_SharedSetup(datapointer, LittleLong (pinhlsprite->version), (int *)(&palette[0][0]), (int *)(&alphapalette[0][0]));
+               Mod_Sprite_SharedSetup(datapointer, LittleLong (pinhlsprite->version), (unsigned int *)(&palette[0][0]), (unsigned int *)(&alphapalette[0][0]));
        }
        else
                Host_Error("Mod_IDSP_Load: %s has wrong version number (%i). Only %i (quake), %i (HalfLife), and %i (sprite32) supported",
index a82f977..748db1b 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -1169,7 +1169,7 @@ int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length,
                        if (developer.integer)
                                Con_Printf("Datagram_ParseConnectionless: received CCREP_REJECT from %s.\n", addressstring2);
                        cls.connect_trying = false;
-                       M_Update_Return_Reason(data);
+                       M_Update_Return_Reason((char *)data);
                        break;
 #if 0
                case CCREP_SERVER_INFO:
index 9a11365..403dca3 100644 (file)
--- a/polygon.c
+++ b/polygon.c
@@ -96,9 +96,9 @@ void PolygonD_QuadForPlane(double *outpoints, double planenormalx, double planen
        outpoints[11] = planedist * planenormalz - quadsize * quadright[2] - quadsize * quadup[2];
 }
 
-void PolygonF_Divide(unsigned int innumpoints, const float *inpoints, float planenormalx, float planenormaly, float planenormalz, float planedist, float epsilon, unsigned int outfrontmaxpoints, float *outfrontpoints, unsigned int *neededfrontpoints, unsigned int outbackmaxpoints, float *outbackpoints, unsigned int *neededbackpoints)
+void PolygonF_Divide(int innumpoints, const float *inpoints, float planenormalx, float planenormaly, float planenormalz, float planedist, float epsilon, int outfrontmaxpoints, float *outfrontpoints, int *neededfrontpoints, int outbackmaxpoints, float *outbackpoints, int *neededbackpoints)
 {
-       unsigned int i, frontcount, backcount;
+       int i, frontcount, backcount;
        const float *n, *p;
        float frac, pdist, ndist;
        frontcount = 0;
@@ -154,9 +154,9 @@ void PolygonF_Divide(unsigned int innumpoints, const float *inpoints, float plan
                *neededbackpoints = backcount;
 }
 
-void PolygonD_Divide(unsigned int innumpoints, const double *inpoints, double planenormalx, double planenormaly, double planenormalz, double planedist, double epsilon, unsigned int outfrontmaxpoints, double *outfrontpoints, unsigned int *neededfrontpoints, unsigned int outbackmaxpoints, double *outbackpoints, unsigned int *neededbackpoints)
+void PolygonD_Divide(int innumpoints, const double *inpoints, double planenormalx, double planenormaly, double planenormalz, double planedist, double epsilon, int outfrontmaxpoints, double *outfrontpoints, int *neededfrontpoints, int outbackmaxpoints, double *outbackpoints, int *neededbackpoints)
 {
-       unsigned int i, frontcount, backcount;
+       int i, frontcount, backcount;
        const double *n, *p;
        double frac, pdist, ndist;
        frontcount = 0;
index d4a2106..e5826b8 100644 (file)
--- a/polygon.h
+++ b/polygon.h
@@ -8,7 +8,7 @@ Polygon clipping routines written by Forest Hale and placed into public domain.
 
 void PolygonF_QuadForPlane(float *outpoints, float planenormalx, float planenormaly, float planenormalz, float planedist, float quadsize);
 void PolygonD_QuadForPlane(double *outpoints, double planenormalx, double planenormaly, double planenormalz, double planedist, double quadsize);
-void PolygonF_Divide(unsigned int innumpoints, const float *inpoints, float planenormalx, float planenormaly, float planenormalz, float planedist, float epsilon, unsigned int outfrontmaxpoints, float *outfrontpoints, unsigned int *neededfrontpoints, unsigned int outbackmaxpoints, float *outbackpoints, unsigned int *neededbackpoints);
-void PolygonD_Divide(unsigned int innumpoints, const double *inpoints, double planenormalx, double planenormaly, double planenormalz, double planedist, double epsilon, unsigned int outfrontmaxpoints, double *outfrontpoints, unsigned int *neededfrontpoints, unsigned int outbackmaxpoints, double *outbackpoints, unsigned int *neededbackpoints);
+void PolygonF_Divide(int innumpoints, const float *inpoints, float planenormalx, float planenormaly, float planenormalz, float planedist, float epsilon, int outfrontmaxpoints, float *outfrontpoints, int *neededfrontpoints, int outbackmaxpoints, float *outbackpoints, int *neededbackpoints);
+void PolygonD_Divide(int innumpoints, const double *inpoints, double planenormalx, double planenormaly, double planenormalz, double planedist, double epsilon, int outfrontmaxpoints, double *outfrontpoints, int *neededfrontpoints, int outbackmaxpoints, double *outbackpoints, int *neededbackpoints);
 
 #endif
index fbb54af..44872af 100644 (file)
@@ -2104,7 +2104,7 @@ loadfromfile(string file)
 void VM_loadfromfile(void)
 {
        const char *filename;
-       qbyte *data;
+       char *data;
 
        VM_SAFEPARMCOUNT(1,VM_loadfromfile);
 
@@ -2121,7 +2121,7 @@ void VM_loadfromfile(void)
        }
 
        // not conform with VM_fopen
-       data = FS_LoadFile(filename, tempmempool, false);
+       data = (char *)FS_LoadFile(filename, tempmempool, false);
        if (data == NULL)
                PRVM_G_FLOAT(OFS_RETURN) = -1;
 
index 3a132f9..5788387 100644 (file)
@@ -63,12 +63,12 @@ OSStatus audioDeviceIOProc(AudioDeviceID inDevice,
        unsigned int sampleIndex;
        float *outBuffer;
        float scale;
-       
+
        offset = (s_chunkCount * submissionChunk) % maxMixedSamples;
        samples = s_mixedSamples + offset;
-       
+
        outBuffer = (float *)outOutputData->mBuffers[0].mData;
-       
+
        // If we have run out of samples, return silence
        if (s_chunkCount * submissionChunk > shm->format.channels * paintedtime)
        {
@@ -83,7 +83,7 @@ OSStatus audioDeviceIOProc(AudioDeviceID inDevice,
 
                s_chunkCount++; // this is the next buffer we will submit
        }
-       
+
        return 0;
 }
 
@@ -110,14 +110,14 @@ qboolean SNDDMA_Init(void)
                Con_Printf("AudioHardwareGetProperty returned %d\n", status);
                return false;
        }
-       
+
        if (outputDeviceID == kAudioDeviceUnknown)
        {
                Con_Printf("AudioHardwareGetProperty: outputDeviceID is kAudioDeviceUnknown\n");
                return false;
        }
 
-       // Configure the output device  
+       // Configure the output device
        // TODO: support "-sndspeed", "-sndmono" and "-sndstereo"
        propertySize = sizeof(bufferByteCount);
        bufferByteCount = CHUNK_SIZE * sizeof(float);
@@ -127,7 +127,7 @@ qboolean SNDDMA_Init(void)
                Con_Printf("AudioDeviceSetProperty: returned %d when setting kAudioDevicePropertyBufferSize to %d\n", status, CHUNK_SIZE);
                return false;
        }
-       
+
        propertySize = sizeof(bufferByteCount);
        status = AudioDeviceGetProperty(outputDeviceID, 0, false, kAudioDevicePropertyBufferSize, &propertySize, &bufferByteCount);
        if (status)
@@ -164,7 +164,7 @@ qboolean SNDDMA_Init(void)
                Con_Printf("Default Audio Device doesn't support Linear PCM!\n");
                return false;
        }
-       
+
        // Start sound running
        status = AudioDeviceAddIOProc(outputDeviceID, audioDeviceIOProc, NULL);
        if (status)
@@ -200,7 +200,7 @@ qboolean SNDDMA_Init(void)
        s_isRunning = true;
 
        Con_Printf("   Initialization successful\n");
-       
+
        return true;
 }
 
@@ -228,29 +228,29 @@ Reset the sound device for exiting
 void SNDDMA_Shutdown(void)
 {
        OSStatus status;
-       
+
        if (!s_isRunning)
                return;
-               
+
        status = AudioDeviceStop(outputDeviceID, audioDeviceIOProc);
        if (status)
        {
                Con_Printf("AudioDeviceStop: returned %d\n", status);
                return;
        }
-       
+
        s_isRunning = false;
-       
+
        status = AudioDeviceRemoveIOProc(outputDeviceID, audioDeviceIOProc);
        if (status)
        {
                Con_Printf("AudioDeviceRemoveIOProc: returned %d\n", status);
                return;
        }
-       
+
        Mem_Free(s_mixedSamples);
        s_mixedSamples = NULL;
-       shm->samples = NULL;
+       shm->buffer = NULL;
 }
 
 /*
index 76614bf..80363c8 100644 (file)
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -355,7 +355,7 @@ qboolean SND_PaintChannelFrom8 (channel_t *ch, int count)
        // Stereo sound support
        if (ch->sfx->format.channels == 2)
        {
-               sfx = sb->data + (ch->pos - sb->offset) * 2;
+               sfx = (signed char *)sb->data + (ch->pos - sb->offset) * 2;
                for (i = 0;i < count;i++)
                {
                        paintbuffer[i].left += (*sfx++ * leftvol) >> 8;
@@ -364,13 +364,12 @@ qboolean SND_PaintChannelFrom8 (channel_t *ch, int count)
        }
        else
        {
-               sfx = sb->data + ch->pos - sb->offset;
+               sfx = (signed char *)sb->data + ch->pos - sb->offset;
                for (i = 0;i < count;i++)
                {
                        paintbuffer[i].left += (*sfx * leftvol) >> 8;
                        paintbuffer[i].right += (*sfx++ * rightvol) >> 8;
                }
-
        }
        ch->pos += count;
        return true;
index a95ce23..7cba800 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -498,7 +498,7 @@ static const sfxbuffer_t* OGG_FetchSound (channel_t* ch, unsigned int start, uns
        bigendian = 0;
 #endif
        done = 0;
-       while ((ret = qov_read (&per_ch->vf, &resampling_buffer[done], (int)(newlength - done), bigendian, 2, 1, &per_ch->bs)) > 0)
+       while ((ret = qov_read (&per_ch->vf, (char *)&resampling_buffer[done], (int)(newlength - done), bigendian, 2, 1, &per_ch->bs)) > 0)
                done += ret;
 
        // Resample in the sfxbuffer
@@ -529,7 +529,7 @@ static void OGG_FetchEnd (channel_t* ch)
 
                Mem_Free (per_ch);
                ch->fetcher_data = NULL;
-               
+
                format = &ch->sfx->format;
                buff_len = STREAM_BUFFER_SIZE(format);
                ch->sfx->memsize -= sizeof (*per_ch) - sizeof (per_ch->sb.data) + buff_len;
@@ -678,7 +678,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s)
                s->loopstart = -1;
                s->flags &= ~SFXFLAG_STREAMED;
 
-               sb->length = (unsigned int)ResampleSfx (buff, (size_t)done / (vi->channels * 2), &s->format, sb->data, s->name);
+               sb->length = (unsigned int)ResampleSfx ((qbyte *)buff, (size_t)done / (vi->channels * 2), &s->format, sb->data, s->name);
                s->format.speed = shm->format.speed;
                s->total_length = sb->length;
                sb->offset = 0;
index d8af145..1aa9690 100644 (file)
--- a/snd_wav.c
+++ b/snd_wav.c
@@ -86,7 +86,7 @@ static void FindNextChunk(char *name)
                }
                data_p -= 8;
                last_chunk = data_p + 8 + ( (iff_chunk_len + 1) & ~1 );
-               if (!strncmp(data_p, name, 4))
+               if (!strncmp((const char *)data_p, name, 4))
                        return;
        }
 }
@@ -139,7 +139,7 @@ static wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength)
 
        // find "RIFF" chunk
        FindChunk("RIFF");
-       if (!(data_p && !strncmp(data_p+8, "WAVE", 4)))
+       if (!(data_p && !strncmp((const char *)data_p+8, "WAVE", 4)))
        {
                Con_Print("Missing RIFF/WAVE chunks\n");
                return info;
@@ -179,7 +179,7 @@ static wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength)
                FindNextChunk ("LIST");
                if (data_p)
                {
-                       if (!strncmp (data_p + 28, "mark", 4))
+                       if (!strncmp ((const char *)data_p + 28, "mark", 4))
                        {       // this is not a proper parse, but it works with cooledit...
                                data_p += 24;
                                i = GetLittleLong ();   // samples in loop
index cf61df4..4cb6c95 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -1524,8 +1524,8 @@ Tell all the clients that the server is changing levels
 */
 void SV_SendReconnect (void)
 {
-       char    data[128];
-       sizebuf_t       msg;
+       qbyte data[128];
+       sizebuf_t msg;
 
        msg.data = data;
        msg.cursize = 0;
@@ -1623,7 +1623,7 @@ void SV_SpawnServer (const char *server)
 {
        prvm_edict_t *ent;
        int i;
-       qbyte *entities;
+       char *entities;
        model_t *worldmodel;
        char modelname[sizeof(sv.modelname)];
 
@@ -1793,7 +1793,7 @@ void SV_SpawnServer (const char *server)
        // load replacement entity file if found
        entities = NULL;
        if (sv_entpatch.integer)
-               entities = FS_LoadFile(va("maps/%s.ent", sv.name), tempmempool, true);
+               entities = (char *)FS_LoadFile(va("maps/%s.ent", sv.name), tempmempool, true);
        if (entities)
        {
                Con_Printf("Loaded maps/%s.ent\n", sv.name);
index 6e3f566..6fa1e75 100644 (file)
--- a/vid_agl.c
+++ b/vid_agl.c
@@ -198,16 +198,16 @@ void VID_Shutdown(void)
 {
        if (context == NULL || window == NULL)
                return;
-       
+
        IN_Activate(false);
        VID_RestoreSystemGamma();
-       
+
        if (context != NULL)
        {
                qaglDestroyContext(context);
                context = NULL;
        }
-       
+
        if (window != NULL)
        {
                DisposeWindow(window);
@@ -227,7 +227,7 @@ static qboolean AsyncEvent_Collapsed = false;
 static OSStatus MainWindowEventHandler (EventHandlerCallRef nextHandler, EventRef event, void *userData)
 {
        OSStatus err = noErr;
-       
+
        switch (GetEventKind (event))
        {
                case kEventWindowClosed:
@@ -271,7 +271,7 @@ static void VID_ProcessPendingAsyncEvents (void)
                vid_activewindow = false;
                VID_RestoreSystemGamma();
        }
-       
+
        // Closed
        if (AsyncEvent_Quitting)
        {
@@ -347,7 +347,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp)
                Con_Printf("Unable to create window (error %d)\n", carbonError);
                return false;
        }
-       
+
        // Set the window title
        CFStringRef windowTitle = CFSTR("DarkPlaces AGL");
        SetWindowTitleWithCFString(window, windowTitle);
@@ -356,7 +356,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp)
        // Install the callback function for the window events we can't get
        // through ReceiveNextEvent (i.e. close, collapse, and expand)
        InstallWindowEventHandler (window, NewEventHandlerUPP (MainWindowEventHandler),
-                                                          GetEventTypeCount(winEvents), winEvents, window, NULL); 
+                                                          GetEventTypeCount(winEvents), winEvents, window, NULL);
 
        screen = GetGWorldDevice(GetWindowPort(window));
        if (screen == NULL)
@@ -385,7 +385,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp)
                Sys_Error ("aglSetDrawable failed\n");
        if (!qaglSetCurrentContext(context))
                Sys_Error ("aglSetCurrentContext failed\n");
-       
+
        scr_width = width;
        scr_height = height;
 
@@ -399,10 +399,10 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp)
                vid_isfullscreen = true;
        }
 
-       gl_renderer = qglGetString(GL_RENDERER);
-       gl_vendor = qglGetString(GL_VENDOR);
-       gl_version = qglGetString(GL_VERSION);
-       gl_extensions = qglGetString(GL_EXTENSIONS);
+       gl_renderer = (const char *)qglGetString(GL_RENDERER);
+       gl_vendor = (const char *)qglGetString(GL_VENDOR);
+       gl_version = (const char *)qglGetString(GL_VERSION);
+       gl_extensions = (const char *)qglGetString(GL_EXTENSIONS);
        gl_platform = "AGL";
        gl_videosyncavailable = false;
 
@@ -529,8 +529,8 @@ void Sys_SendKeyEvents(void)
 {
        EventRef theEvent;
        EventTargetRef theTarget;
-       
-       // Start by processing the asynchronous events we received since the previous frame 
+
+       // Start by processing the asynchronous events we received since the previous frame
        VID_ProcessPendingAsyncEvents();
 
        theTarget = GetEventDispatcherTarget();
@@ -573,7 +573,7 @@ void Sys_SendKeyEvents(void)
                                        case kEventMouseMoved:
                                        {
                                                HIPoint deltaPos;
-                                               
+
                                                GetEventParameter(theEvent, kEventParamMouseDelta, typeHIPoint, NULL, sizeof(deltaPos), NULL, &deltaPos);
                                                //Con_Printf(">> kEventMouseMoved (%f, %f) <<\n", deltaPos.x, deltaPos.y);
 
@@ -627,7 +627,7 @@ void Sys_SendKeyEvents(void)
                                                Handle_Key(keycode, false);
                                                //Con_Printf(">> kEventRawKeyUp (%d) <<\n", keycode);
                                                break;
-                                       
+
                                        case kEventRawKeyModifiersChanged:
                                        {
                                                UInt32 keymod = 0;
index 295d8bc..940f57d 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -426,10 +426,10 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp)
        // enable key repeat since everyone expects it
        SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
 
-       gl_renderer = qglGetString(GL_RENDERER);
-       gl_vendor = qglGetString(GL_VENDOR);
-       gl_version = qglGetString(GL_VERSION);
-       gl_extensions = qglGetString(GL_EXTENSIONS);
+       gl_renderer = (const char *)qglGetString(GL_RENDERER);
+       gl_vendor = (const char *)qglGetString(GL_VENDOR);
+       gl_version = (const char *)qglGetString(GL_VERSION);
+       gl_extensions = (const char *)qglGetString(GL_EXTENSIONS);
        gl_platform = "SDL";
        // Knghtbrd: should assign platform-specific extensions here
        //TODO: maybe ;)
diff --git a/view.c b/view.c
index bc02ec6..60da3e3 100644 (file)
--- a/view.c
+++ b/view.c
@@ -321,6 +321,7 @@ void V_CalcRefdef (void)
        entity_t *ent;
        float vieworg[3], gunorg[3], viewangles[3];
        trace_t trace;
+       VectorClear(gunorg);
        Matrix4x4_CreateIdentity(&viewmodelmatrix);
        Matrix4x4_CreateIdentity(&r_refdef.viewentitymatrix);
        if (cls.state == ca_connected && cls.signon == SIGNONS)