changed some things to size_t to reduce warnings on MSVC x64
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 5 Jul 2005 09:10:43 +0000 (09:10 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 5 Jul 2005 09:10:43 +0000 (09:10 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5492 d7cf8633-e32d-0410-b094-e92efae38249

snd_main.h
snd_mix.c
snd_ogg.c
sys_win.c
zone.c
zone.h

index d2e37f3..2df3654 100644 (file)
@@ -80,9 +80,9 @@ typedef struct
        int                             master_vol;             // 0-255 master volume
        int                             leftvol;                // 0-255 volume
        int                             rightvol;               // 0-255 volume
-       int                             end;                    // end time in global paintsamples
-       int                             lastptime;              // last time this channel was painted
-       int                             pos;                    // sample position in sfx
+       size_t                  end;                    // end time in global paintsamples
+       size_t                  lastptime;              // last time this channel was painted
+       size_t                  pos;                    // sample position in sfx
        int                             entnum;                 // to allow overriding a specific sound
        int                             entchannel;
        vec3_t                  origin;                 // origin of sound effect
index 2f1a7d4..2315f7c 100644 (file)
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -238,9 +238,7 @@ void S_PaintChannels(int endtime)
                        // if the channel is paused
                        if (ch->flags & CHANNELFLAG_PAUSED)
                        {
-                               size_t pausedtime;
-
-                               pausedtime = end - paintedtime;
+                               int pausedtime = end - paintedtime;
                                ch->lastptime += pausedtime;
                                ch->end += pausedtime;
                                continue;
index 73aa52f..61085b6 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -452,7 +452,7 @@ static const sfxbuffer_t* OGG_FetchSound (channel_t* ch, unsigned int start, uns
        if (sb->offset <= start && sb->offset + sb->length >= start + nbsamples)
                return sb;
 
-       newlength = sb->offset + sb->length - start;
+       newlength = (int)(sb->offset + sb->length) - start;
 
        // If we need to skip some data before decompressing the rest, or if the stream has looped
        if (newlength < 0 || sb->offset > start)
@@ -492,8 +492,8 @@ static const sfxbuffer_t* OGG_FetchSound (channel_t* ch, unsigned int start, uns
                done += ret;
 
        // Resample in the sfxbuffer
-       newlength = ResampleSfx (resampling_buffer, (size_t)done / factor, &per_sfx->format, sb->data + sb->length * factor, sfx->name);
-       sb->length += newlength;
+       newlength = ResampleSfx (resampling_buffer, (size_t)done / (size_t)factor, &per_sfx->format, sb->data + sb->length * factor, sfx->name);
+       sb->length += newlength;
 
        return sb;
 }
index 71aae13..c0ae22a 100644 (file)
--- a/sys_win.c
+++ b/sys_win.c
@@ -108,7 +108,7 @@ void Sys_PrintToTerminal(const char *text)
        DWORD dummy;
        extern HANDLE houtput;
        if (cls.state == ca_dedicated)
-               WriteFile(houtput, text, strlen (text), &dummy, NULL);
+               WriteFile(houtput, text, (DWORD) strlen(text), &dummy, NULL);
 }
 
 /*
@@ -316,6 +316,9 @@ void Sys_InitConsole (void)
                hinput = GetStdHandle (STD_INPUT_HANDLE);
                houtput = GetStdHandle (STD_OUTPUT_HANDLE);
 
+#ifdef WIN64
+#define atoi _atoi64
+#endif
        // give QHOST a chance to hook into the console
                if ((t = COM_CheckParm ("-HFILE")) > 0)
                {
diff --git a/zone.c b/zone.c
index d8c54d0..3096583 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -26,7 +26,7 @@ cvar_t developer_memorydebug = {0, "developer_memorydebug", "0"};
 
 mempool_t *poolchain = NULL;
 
-void *_Mem_Alloc(mempool_t *pool, int size, const char *filename, int fileline)
+void *_Mem_Alloc(mempool_t *pool, size_t size, const char *filename, int fileline)
 {
 #if MEMCLUMPING
        int i, j, k, needed, endbit, largest;
diff --git a/zone.h b/zone.h
index 3410c0e..1d41184 100644 (file)
--- a/zone.h
+++ b/zone.h
@@ -125,7 +125,7 @@ mempool_t;
 #define Mem_FreePool(pool) _Mem_FreePool(pool, __FILE__, __LINE__)
 #define Mem_EmptyPool(pool) _Mem_EmptyPool(pool, __FILE__, __LINE__)
 
-void *_Mem_Alloc(mempool_t *pool, int size, const char *filename, int fileline);
+void *_Mem_Alloc(mempool_t *pool, size_t size, const char *filename, int fileline);
 void _Mem_Free(void *data, const char *filename, int fileline);
 mempool_t *_Mem_AllocPool(const char *name, int flags, mempool_t *parent, const char *filename, int fileline);
 void _Mem_FreePool(mempool_t **pool, const char *filename, int fileline);