]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
added a 64bif fs_offset_t type to clean up most of the mess
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 5 Jul 2005 12:51:27 +0000 (12:51 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 5 Jul 2005 12:51:27 +0000 (12:51 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5502 d7cf8633-e32d-0410-b094-e92efae38249

15 files changed:
cl_demo.c
console.c
fs.c
fs.h
host_cmd.c
image.c
jpeg.c
keys.c
menu.c
model_brush.c
prvm_cmds.c
prvm_edict.c
qtypes.h
snd_main.c
wad.c

index 865a1b36a5d3152cafdbd76c08ac5bd5043f8002..2ab796bcd22418cf891383062d83ed8969f69d2a 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -189,7 +189,7 @@ void CL_ReadDemoMessage(void)
                        cl.mviewangles[0][i] = LittleFloat(f);
                }
 
-               if (FS_Read(cls.demofile, net_message.data, net_message.cursize) == (size_t)net_message.cursize)
+               if (FS_Read(cls.demofile, net_message.data, net_message.cursize) == net_message.cursize)
                {
                        MSG_BeginReading();
                        CL_ParseServerMessage();
index dca8f08a571023540188fa3722b4fea564e1a1bc..b99f7c4b02b0f8a6dde2dba2959d7d873ec668fe 100644 (file)
--- a/console.c
+++ b/console.c
@@ -780,7 +780,7 @@ void Con_DrawNotify (void)
                        sprintf(temptext, "say_team:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1));
                else
                        sprintf(temptext, "say:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1));
-               while (strlen(temptext) >= (size_t) con_linewidth)
+               while ((int)strlen(temptext) >= con_linewidth)
                {
                        DrawQ_ColoredString( 0, v, temptext, con_linewidth, 8, 8, 1.0, 1.0, 1.0, 1.0, 0, &colorindex );
                        strcpy(temptext, &temptext[con_linewidth]);
diff --git a/fs.c b/fs.c
index d914b717dce03c773e2975c4e5f07452dbb86dac..36cca0e477a6ccd8029d4755af7c78568baaef32 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -148,9 +148,9 @@ struct qfile_s
 {
        qfile_flags_t   flags;
        int                             handle;                                 // file descriptor
-       size_t                  real_length;                    // uncompressed file size (for files opened in "read" mode)
-       size_t                  position;                               // current position in the file
-       size_t                  offset;                                 // offset into the package (0 if external file)
+       fs_offset_t             real_length;                    // uncompressed file size (for files opened in "read" mode)
+       fs_offset_t             position;                               // current position in the file
+       fs_offset_t             offset;                                 // offset into the package (0 if external file)
        int                             ungetc;                                 // single stored character from ungetc, cleared to EOF when read
 
        // Contents buffer
@@ -244,8 +244,8 @@ void FS_Dir_f(void);
 void FS_Ls_f(void);
 
 static packfile_t* FS_AddFileToPack (const char* name, pack_t* pack,
-                                                                        size_t offset, size_t packsize,
-                                                                        size_t realsize, packfile_flags_t flags);
+                                                                       fs_offset_t offset, fs_offset_t packsize,
+                                                                       fs_offset_t realsize, packfile_flags_t flags);
 
 
 /*
@@ -258,7 +258,7 @@ VARIABLES
 
 mempool_t *fs_mempool;
 
-size_t fs_filesize;
+fs_offset_t fs_filesize;
 
 pack_t *packlist = NULL;
 
@@ -384,7 +384,7 @@ qboolean PK3_GetEndOfCentralDir (const char *packfile, int packhandle, pk3_endOf
                maxsize = ZIP_MAX_COMMENTS_SIZE + ZIP_END_CDIR_SIZE;
        buffer = Mem_Alloc (tempmempool, maxsize);
        lseek (packhandle, filesize - maxsize, SEEK_SET);
-       if (read (packhandle, buffer, maxsize) != (ssize_t) maxsize)
+       if (read (packhandle, buffer, maxsize) != (fs_offset_t) maxsize)
        {
                Mem_Free (buffer);
                return false;
@@ -433,7 +433,7 @@ int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd)
 {
        qbyte *central_dir, *ptr;
        unsigned int ind;
-       size_t remaining;
+       fs_offset_t remaining;
 
        // Load the central directory in memory
        central_dir = Mem_Alloc (tempmempool, eocd->cdir_size);
@@ -448,7 +448,7 @@ int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd)
        ptr = central_dir;
        for (ind = 0; ind < eocd->nbentries; ind++)
        {
-               size_t namesize, count;
+               fs_offset_t namesize, count;
 
                // Checking the remaining size
                if (remaining < ZIP_CDIR_CHUNK_BASE_SIZE)
@@ -475,7 +475,7 @@ int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd)
                if ((ptr[8] & 0x29) == 0 && (ptr[38] & 0x18) == 0)
                {
                        // Still enough bytes for the name?
-                       if (remaining < namesize || namesize >= sizeof (*pack->files))
+                       if (remaining < namesize || namesize >= (int)sizeof (*pack->files))
                        {
                                Mem_Free (central_dir);
                                return -1;
@@ -485,12 +485,11 @@ int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd)
                        if (ptr[ZIP_CDIR_CHUNK_BASE_SIZE + namesize - 1] != '/')
                        {
                                char filename [sizeof (pack->files[0].name)];
-                               size_t offset, packsize, realsize;
+                               fs_offset_t offset, packsize, realsize;
                                packfile_flags_t flags;
 
                                // Extract the name (strip it if necessary)
-                               if (namesize >= sizeof (filename))
-                                       namesize = sizeof (filename) - 1;
+                               namesize = min(namesize, (int)sizeof (filename) - 1);
                                memcpy (filename, &ptr[ZIP_CDIR_CHUNK_BASE_SIZE], namesize);
                                filename[namesize] = '\0';
 
@@ -598,7 +597,7 @@ Find where the true file data offset is
 qboolean PK3_GetTrueFileOffset (packfile_t *pfile, pack_t *pack)
 {
        qbyte buffer [ZIP_LOCAL_CHUNK_BASE_SIZE];
-       size_t count;
+       fs_offset_t count;
 
        // Already found?
        if (pfile->flags & PACKFILE_FLAG_TRUEOFFS)
@@ -638,8 +637,8 @@ Add a file to the list of files contained into a package
 ====================
 */
 static packfile_t* FS_AddFileToPack (const char* name, pack_t* pack,
-                                                                        size_t offset, size_t packsize,
-                                                                        size_t realsize, packfile_flags_t flags)
+                                                                        fs_offset_t offset, fs_offset_t packsize,
+                                                                        fs_offset_t realsize, packfile_flags_t flags)
 {
        int (*strcmp_funct) (const char* str1, const char* str2);
        int left, right, middle;
@@ -792,8 +791,8 @@ pack_t *FS_LoadPackPAK (const char *packfile)
        // parse the directory
        for (i = 0;i < numpackfiles;i++)
        {
-               size_t offset = LittleLong (info[i].filepos);
-               size_t size = LittleLong (info[i].filelen);
+               fs_offset_t offset = LittleLong (info[i].filepos);
+               fs_offset_t size = LittleLong (info[i].filelen);
 
                FS_AddFileToPack (info[i].name, pack, offset, size, size, PACKFILE_FLAG_TRUEOFFS);
        }
@@ -1478,9 +1477,9 @@ FS_Write
 Write "datasize" bytes into a file
 ====================
 */
-size_t FS_Write (qfile_t* file, const void* data, size_t datasize)
+fs_offset_t FS_Write (qfile_t* file, const void* data, size_t datasize)
 {
-       ssize_t result;
+       fs_offset_t result;
 
        // If necessary, seek to the exact file position we're supposed to be
        if (file->buff_ind != file->buff_len)
@@ -1509,9 +1508,9 @@ FS_Read
 Read up to "buffersize" bytes from a file
 ====================
 */
-size_t FS_Read (qfile_t* file, void* buffer, size_t buffersize)
+fs_offset_t FS_Read (qfile_t* file, void* buffer, size_t buffersize)
 {
-       size_t count, done;
+       fs_offset_t count, done;
 
        if (buffersize == 0)
                return 0;
@@ -1532,7 +1531,7 @@ size_t FS_Read (qfile_t* file, void* buffer, size_t buffersize)
        {
                count = file->buff_len - file->buff_ind;
 
-               done += (buffersize > count) ? count : buffersize;
+               done += ((fs_offset_t)buffersize > count) ? count : (fs_offset_t)buffersize;
                memcpy (buffer, &file->buff[file->buff_ind], done);
                file->buff_ind += done;
 
@@ -1554,8 +1553,8 @@ size_t FS_Read (qfile_t* file, void* buffer, size_t buffersize)
                // If we have a lot of data to get, put them directly into "buffer"
                if (buffersize > sizeof (file->buff) / 2)
                {
-                       if (count > buffersize)
-                               count = buffersize;
+                       if (count > (fs_offset_t)buffersize)
+                               count = (fs_offset_t)buffersize;
                        lseek (file->handle, file->offset + file->position, SEEK_SET);
                        nb = read (file->handle, &((qbyte*)buffer)[done], count);
                        if (nb > 0)
@@ -1569,8 +1568,8 @@ size_t FS_Read (qfile_t* file, void* buffer, size_t buffersize)
                }
                else
                {
-                       if (count > sizeof (file->buff))
-                               count = sizeof (file->buff);
+                       if (count > (fs_offset_t)sizeof (file->buff))
+                               count = (fs_offset_t)sizeof (file->buff);
                        lseek (file->handle, file->offset + file->position, SEEK_SET);
                        nb = read (file->handle, file->buff, count);
                        if (nb > 0)
@@ -1606,10 +1605,10 @@ size_t FS_Read (qfile_t* file, void* buffer, size_t buffersize)
                                return done;
 
                        count = ztk->comp_length - ztk->in_position;
-                       if (count > sizeof (ztk->input))
-                               count = sizeof (ztk->input);
+                       if (count > (fs_offset_t)sizeof (ztk->input))
+                               count = (fs_offset_t)sizeof (ztk->input);
                        lseek (file->handle, file->offset + ztk->in_position, SEEK_SET);
-                       if (read (file->handle, ztk->input, count) != (ssize_t)count)
+                       if (read (file->handle, ztk->input, count) != (fs_offset_t)count)
                        {
                                Con_Printf ("FS_Read: unexpected end of file");
                                break;
@@ -1719,7 +1718,7 @@ Print a string into a file
 int FS_VPrintf (qfile_t* file, const char* format, va_list ap)
 {
        int len;
-       size_t buff_size;
+       fs_offset_t buff_size;
        char *tempbuff = NULL;
 
        buff_size = 1024;
@@ -1783,11 +1782,11 @@ FS_Seek
 Move the position index in a file
 ====================
 */
-int FS_Seek (qfile_t* file, long offset, int whence)
+int FS_Seek (qfile_t* file, fs_offset_t offset, int whence)
 {
        ztoolkit_t *ztk;
        qbyte* buffer;
-       size_t buffersize;
+       fs_offset_t buffersize;
 
        // Compute the file offset
        switch (whence)
@@ -1810,8 +1809,8 @@ int FS_Seek (qfile_t* file, long offset, int whence)
                return -1;
 
        // If we have the data in our read buffer, we don't need to actually seek
-       if (file->position - file->buff_len <= (size_t)offset &&
-               (size_t)offset <= file->position)
+       if (file->position - (fs_offset_t)file->buff_len <= offset
+               && offset <= file->position)
        {
                file->buff_ind = offset + file->buff_len - file->position;
                return 0;
@@ -1834,7 +1833,7 @@ int FS_Seek (qfile_t* file, long offset, int whence)
        ztk = file->ztk;
 
        // If we have to go back in the file, we need to restart from the beginning
-       if ((size_t)offset <= file->position)
+       if (offset <= file->position)
        {
                ztk->in_ind = 0;
                ztk->in_len = 0;
@@ -1853,10 +1852,10 @@ int FS_Seek (qfile_t* file, long offset, int whence)
        buffer = Mem_Alloc (tempmempool, buffersize);
 
        // Skip all data until we reach the requested offset
-       while ((size_t)offset > file->position)
+       while (offset > file->position)
        {
-               size_t diff = offset - file->position;
-               size_t count, len;
+               fs_offset_t diff = offset - file->position;
+               fs_offset_t count, len;
 
                count = (diff > buffersize) ? buffersize : diff;
                len = FS_Read (file, buffer, count);
@@ -1879,7 +1878,7 @@ FS_Tell
 Give the current position in a file
 ====================
 */
-size_t FS_Tell (qfile_t* file)
+fs_offset_t FS_Tell (qfile_t* file)
 {
        return file->position - file->buff_len + file->buff_ind;
 }
@@ -1934,7 +1933,7 @@ FS_WriteFile
 The filename will be prefixed by the current game directory
 ============
 */
-qboolean FS_WriteFile (const char *filename, void *data, size_t len)
+qboolean FS_WriteFile (const char *filename, void *data, fs_offset_t len)
 {
        qfile_t *file;
 
@@ -2075,7 +2074,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet)
        fssearch_t *search;
        searchpath_t *searchpath;
        pack_t *pak;
-       size_t i, basepathlength, numfiles, numchars;
+       int i, basepathlength, numfiles, numchars;
        stringlist_t *dir, *dirfile, *liststart, *listcurrent, *listtemp;
        const char *slash, *backslash, *colon, *separator;
        char *basepath;
@@ -2114,7 +2113,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet)
                {
                        // look through all the pak file elements
                        pak = searchpath->pack;
-                       for (i = 0;i < (size_t)pak->numfiles;i++)
+                       for (i = 0;i < pak->numfiles;i++)
                        {
                                strcpy(temp, pak->files[i].name);
                                while (temp[0])
@@ -2217,12 +2216,12 @@ void FS_FreeSearch(fssearch_t *search)
 extern int con_linewidth;
 int FS_ListDirectory(const char *pattern, int oneperline)
 {
-       size_t numfiles;
-       size_t numcolumns;
-       size_t numlines;
-       size_t columnwidth;
-       size_t linebufpos;
-       size_t i, j, k, l;
+       int numfiles;
+       int numcolumns;
+       int numlines;
+       int columnwidth;
+       int linebufpos;
+       int i, j, k, l;
        const char *name;
        char linebuf[4096];
        fssearch_t *search;
@@ -2261,11 +2260,11 @@ int FS_ListDirectory(const char *pattern, int oneperline)
                                        if (l < numfiles)
                                        {
                                                name = search->filenames[l];
-                                               for (j = 0;name[j] && linebufpos + 1 < sizeof(linebuf);j++)
+                                               for (j = 0;name[j] && linebufpos + 1 < (int)sizeof(linebuf);j++)
                                                        linebuf[linebufpos++] = name[j];
                                                // space out name unless it's the last on the line
                                                if (k + 1 < numcolumns && l + 1 < numfiles)
-                                                       for (;j < columnwidth && linebufpos + 1 < sizeof(linebuf);j++)
+                                                       for (;j < columnwidth && linebufpos + 1 < (int)sizeof(linebuf);j++)
                                                                linebuf[linebufpos++] = ' ';
                                        }
                                }
diff --git a/fs.h b/fs.h
index 7e9192a593e1d78c6440669940f04b60611fab06..0047c0761b1455df77c431c4d5a6849bd65efff1 100644 (file)
--- a/fs.h
+++ b/fs.h
 
 typedef struct qfile_s qfile_t;
 
+#ifdef WIN32
+typedef _int64 fs_offset_t;
+#else
+typedef long long fs_offset_t;
+#endif
+
+
 
 // ------ Variables ------ //
 
 extern char fs_gamedir [MAX_OSPATH];
 extern char fs_basedir [MAX_OSPATH];
 
-extern size_t fs_filesize;  // set by FS_Open (in "read" mode) and FS_LoadFile
+extern fs_offset_t fs_filesize;  // set by FS_Open (in "read" mode) and FS_LoadFile
 
 
 // ------ Main functions ------ //
@@ -46,15 +53,15 @@ extern size_t fs_filesize;  // set by FS_Open (in "read" mode) and FS_LoadFile
 
 qfile_t *FS_Open (const char* filepath, const char* mode, qboolean quiet, qboolean nonblocking);
 int FS_Close (qfile_t* file);
-size_t FS_Write (qfile_t* file, const void* data, size_t datasize);
-size_t FS_Read (qfile_t* file, void* buffer, size_t buffersize);
+fs_offset_t FS_Write (qfile_t* file, const void* data, size_t datasize);
+fs_offset_t FS_Read (qfile_t* file, void* buffer, size_t buffersize);
 int FS_Print(qfile_t* file, const char *msg);
 int FS_Printf(qfile_t* file, const char* format, ...);
 int FS_VPrintf(qfile_t* file, const char* format, va_list ap);
 int FS_Getc (qfile_t* file);
 int FS_UnGetc (qfile_t* file, unsigned char c);
-int FS_Seek (qfile_t* file, long offset, int whence);
-size_t FS_Tell (qfile_t* file);
+int FS_Seek (qfile_t* file, fs_offset_t offset, int whence);
+fs_offset_t FS_Tell (qfile_t* file);
 void FS_Purge (qfile_t* file);
 
 typedef struct fssearch_s
@@ -70,7 +77,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet);
 void FS_FreeSearch(fssearch_t *search);
 
 qbyte *FS_LoadFile (const char *path, mempool_t *pool, qboolean quiet);
-qboolean FS_WriteFile (const char *filename, void *data, size_t len);
+qboolean FS_WriteFile (const char *filename, void *data, fs_offset_t len);
 
 
 // ------ Other functions ------ //
index 00ea8a1a61b231eda7f8e2466472f970632d6c5e..b3cd8a7f75b5e6221e8e2e505f22a2e750d35fd9 100644 (file)
@@ -971,7 +971,7 @@ void Host_Say_Team_f(void)
 void Host_Tell_f(void)
 {
        client_t *save;
-       size_t j;
+       int j;
        const char *p1, *p2;
        char text[1024]; // LordHavoc: FIXME: temporary buffer overflow fix (was 64)
        qboolean fromServer = false;
@@ -1018,13 +1018,13 @@ void Host_Tell_f(void)
        }
        while (p2 > p1 && (p2[-1] == '\n' || p2[-1] == '\r'))
                p2--;
-       for (j = strlen(text);j < (sizeof(text) - 2) && p1 < p2;)
+       for (j = (int)strlen(text);j < (int)(sizeof(text) - 2) && p1 < p2;)
                text[j++] = *p1++;
        text[j++] = '\n';
        text[j++] = 0;
 
        save = host_client;
-       for (j = 0, host_client = svs.clients;j < (size_t)svs.maxclients;j++, host_client++)
+       for (j = 0, host_client = svs.clients;j < svs.maxclients;j++, host_client++)
                if (host_client->spawned && !strcasecmp(host_client->name, Cmd_Argv(1)))
                        SV_ClientPrint(text);
        host_client = save;
diff --git a/image.c b/image.c
index 6af0ee2a1689d04d340782af429029a5c8f9c601..1c2af789c08d237f193845880108a3cdf1f22877 100644 (file)
--- a/image.c
+++ b/image.c
@@ -568,7 +568,7 @@ qbyte *LoadLMP (const qbyte *f, int matchwidth, int matchheight, qboolean loadAs
        if ((matchwidth && image_width != matchwidth) || (matchheight && image_height != matchheight))
                return NULL;
 
-       if (fs_filesize < (size_t)(8 + image_width * image_height))
+       if (fs_filesize < (fs_offset_t)(8 + image_width * image_height))
        {
                Con_Print("LoadLMP: invalid LMP file\n");
                return NULL;
diff --git a/jpeg.c b/jpeg.c
index 6a28208ababbecfccefa973f1f1bbb4208f1cff7..420fda737a3e411161a79293161d4c276edb7e80 100644 (file)
--- a/jpeg.c
+++ b/jpeg.c
@@ -628,7 +628,7 @@ static void JPEG_TermDestination (j_compress_ptr cinfo)
 
        // Write any data remaining in the buffer
        if (datacount > 0)
-               if (FS_Write (dest->outfile, dest->buffer, datacount) != datacount)
+               if (FS_Write (dest->outfile, dest->buffer, datacount) != (fs_offset_t)datacount)
                        error_in_jpeg = true;
 }
 
diff --git a/keys.c b/keys.c
index 4be917f352ad3a9412ce74101d798fd67c06fc7a..2b0017a05551057ec59f8c50e7ffe6a3584ff9b4 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -348,7 +348,7 @@ Key_Console (int key, char ascii)
        // delete char on cursor
        if (key == K_DEL || key == K_KP_DEL)
        {
-               if ((size_t)key_linepos < strlen(key_lines[edit_line]))
+               if (key_linepos < (int)strlen(key_lines[edit_line]))
                        strcpy(key_lines[edit_line] + key_linepos, key_lines[edit_line] + key_linepos + 1);
                return;
        }
@@ -358,7 +358,7 @@ Key_Console (int key, char ascii)
        // otherwise just go right one
        if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW)
        {
-               if ((size_t)key_linepos < strlen(key_lines[edit_line]))
+               if (key_linepos < (int)strlen(key_lines[edit_line]))
                        key_linepos++;
 
                return;
diff --git a/menu.c b/menu.c
index efbe4e3bbe57083cccb6900052493a557c517a4b..337328aecfb65b0af8c17c298b00c740df1b2c13 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -819,7 +819,7 @@ int         loadable[MAX_SAVEGAMES];
 
 void M_ScanSaves (void)
 {
-       size_t  i, j, len;
+       int             i, j, len;
        char    name[MAX_OSPATH];
        char    buf[SAVEGAME_COMMENT_LENGTH + 256];
        const char *t;
index b5c5cb94330b05547406e942fcba72b56f3712f2..765006484aded14b2359d0a1e8227a952877f948 100644 (file)
@@ -1337,7 +1337,7 @@ static void Mod_Q1BSP_LoadLighting(lump_t *l)
                data = (qbyte*) FS_LoadFile(litfilename, tempmempool, false);
                if (data)
                {
-                       if (fs_filesize == (size_t)(8 + l->filelen * 3) && data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T')
+                       if (fs_filesize == (fs_offset_t)(8 + l->filelen * 3) && data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T')
                        {
                                i = LittleLong(((int *)data)[1]);
                                if (i == 1)
index cf72710d3674ccb847dfd3451afc8c824cd8bd98..fbb54af8c51edbd360552703c9a8e2203c42da5b 100644 (file)
@@ -74,9 +74,9 @@ checkextension(extensionname)
 // kind of helper function
 static qboolean checkextension(const char *name)
 {
-       size_t len;
+       int len;
        char *e, *start;
-       len = strlen(name);
+       len = (int)strlen(name);
 
        for (e = prog->extensionstring;*e;e++)
        {
@@ -87,7 +87,7 @@ static qboolean checkextension(const char *name)
                start = e;
                while (*e && *e != ' ')
                        e++;
-               if ((size_t)(e - start) == len && !strncasecmp(start, name, len))
+               if ((e - start) == len && !strncasecmp(start, name, len))
                        return true;
        }
        return false;
@@ -1677,7 +1677,7 @@ fputs(float fhandle, string s)
 //void(float fhandle, string s) fputs = #113; // writes a line of text to the end of the file
 void VM_fputs(void)
 {
-       size_t stringlength;
+       int stringlength;
        char string[VM_STRINGTEMP_LENGTH];
        int filenum;
 
@@ -1695,7 +1695,7 @@ void VM_fputs(void)
                return;
        }
        VM_VarString(1, string, sizeof(string));
-       if ((stringlength = strlen(string)))
+       if ((stringlength = (int)strlen(string)))
                FS_Write(VM_FILES[filenum], string, stringlength);
        if (developer.integer)
                Con_Printf("fputs: %s: %s\n", PRVM_NAME, string);
index 1d28aa26c194fc0385d1a773bac5bfd8bd59f169..35d5fde04ead699236aaea61a28139feba044616 100644 (file)
@@ -1283,7 +1283,7 @@ void PRVM_LoadProgs (const char * filename, int numrequiredfunc, char **required
        }
 
        prog->progs = (dprograms_t *)FS_LoadFile (filename, prog->progs_mempool, false);
-       if (prog->progs == NULL || fs_filesize < sizeof(dprograms_t))
+       if (prog->progs == NULL || fs_filesize < (fs_offset_t)sizeof(dprograms_t))
                PRVM_ERROR ("PRVM_LoadProgs: couldn't load %s for %s", filename, PRVM_NAME);
 
        Con_DPrintf("%s programs occupy %iK.\n", PRVM_NAME, fs_filesize/1024);
index 480b1e7fd6a4583e81e0065049b578dc10775cc8..24ab64b4a6a23f90aadea273d098efb4613da46c 100644 (file)
--- a/qtypes.h
+++ b/qtypes.h
@@ -9,7 +9,9 @@ typedef unsigned char qbyte;
 
 typedef enum {false, true} qboolean;
 
-#ifdef WIN32
+#ifdef WIN64
+# define ssize_t long long
+#elifdef WIN32
 # define ssize_t long
 #endif
 
index 6451829f10280fe9ed9afb3f45c7d682cd55b34b..fe590b1234d7e63ea81a5ef93f25854b653efc21 100644 (file)
@@ -569,7 +569,7 @@ int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f
 {
        channel_t *target_chan, *check;
        int             ch_idx;
-       size_t  skip;
+       int             skip;
 
        if (!sound_started || !sfx || nosound.integer)
                return -1;
@@ -603,8 +603,8 @@ int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f
                if (check->sfx == sfx && !check->pos)
                {
                        skip = 0.1 * sfx->format.speed;
-                       if (skip > sfx->total_length)
-                               skip = sfx->total_length;
+                       if (skip > (int)sfx->total_length)
+                               skip = (int)sfx->total_length;
                        if (skip > 0)
                                skip = rand() % skip;
                        target_chan->pos += skip;
diff --git a/wad.c b/wad.c
index 333e619bccdc14a3ed61e1cd054effcb984af9e1..b0ea75f15b302bdf61e0402650215ad356b84dd0 100644 (file)
--- a/wad.c
+++ b/wad.c
@@ -178,7 +178,7 @@ void W_LoadTextureWadFile (char *filename, int complain)
        if (!(lumps = Mem_Alloc(tempmempool, sizeof(lumpinfo_t)*numlumps)))
        {Con_Print("W_LoadTextureWadFile: unable to allocate temporary memory for lump table\n");return;}
 
-       if (FS_Read(file, lumps, sizeof(lumpinfo_t) * numlumps) != sizeof(lumpinfo_t) * (size_t)numlumps)
+       if (FS_Read(file, lumps, sizeof(lumpinfo_t) * numlumps) != (fs_offset_t)sizeof(lumpinfo_t) * numlumps)
        {Con_Print("W_LoadTextureWadFile: unable to read lump table\n");return;}
 
        for (i=0, lump_p = lumps ; i<numlumps ; i++,lump_p++)
@@ -260,7 +260,7 @@ qbyte *W_GetTexture(char *name)
                                tex = Mem_Alloc(tempmempool, texwadlump[i].size);
                                if (!tex)
                                        return NULL;
-                               if (FS_Read(file, tex, texwadlump[i].size) < (size_t)texwadlump[i].size)
+                               if (FS_Read(file, tex, texwadlump[i].size) < texwadlump[i].size)
                                {Con_Print("W_GetTexture: corrupt WAD3 file\n");return NULL;}
 
                                tex->width = LittleLong(tex->width);