]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - fs.c
Removed a couple of warnings when compiling with GCC
[xonotic/darkplaces.git] / fs.c
diff --git a/fs.c b/fs.c
index b3584555beeed328b7e7dce33ed71a61f967e192..157a9c7b7cd501c6c92634efd06187b6e363c984 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -405,10 +405,10 @@ qboolean PK3_GetEndOfCentralDir (const char *packfile, FILE *packhandle, pk3_end
        buffer = Mem_Alloc (tempmempool, maxsize);
 #ifdef FS_USESYSCALLS
        lseek (packhandle, filesize - maxsize, SEEK_SET);
-       if (read (packhandle, buffer, maxsize) != (int) maxsize)
+       if (read (packhandle, buffer, maxsize) != (ssize_t) maxsize)
 #else
        fseek (packhandle, filesize - maxsize, SEEK_SET);
-       if (fread (buffer, 1, maxsize, packhandle) != (unsigned int) maxsize)
+       if (fread (buffer, 1, maxsize, packhandle) != (size_t) maxsize)
 #endif
        {
                Mem_Free (buffer);
@@ -1031,6 +1031,10 @@ void FS_Init (void)
                        Cvar_SetQuick (&scr_screenshot_name, com_modname);
                }
        }
+
+       // If "-condebug" is in the command line, remove the previous log file
+       if (COM_CheckParm ("-condebug") != 0)
+               unlink (va("%s/qconsole.log", fs_gamedir));
 }
 
 
@@ -1164,7 +1168,7 @@ static searchpath_t *FS_FindFile (const char *name, int* index, qboolean quiet)
                                if (!diff)
                                {
                                        if (!quiet)
-                                               Sys_Printf("FS_FindFile: %s in %s\n",
+                                               Con_DPrintf("FS_FindFile: %s in %s\n",
                                                                        pak->files[middle].name, pak->filename);
 
                                        if (index != NULL)
@@ -1186,7 +1190,7 @@ static searchpath_t *FS_FindFile (const char *name, int* index, qboolean quiet)
                        if (FS_SysFileExists (netpath))
                        {
                                if (!quiet)
-                                       Sys_Printf("FS_FindFile: %s\n", netpath);
+                                       Con_DPrintf("FS_FindFile: %s\n", netpath);
 
                                if (index != NULL)
                                        *index = -1;
@@ -1196,7 +1200,7 @@ static searchpath_t *FS_FindFile (const char *name, int* index, qboolean quiet)
        }
 
        if (!quiet)
-               Sys_Printf("FS_FindFile: can't find %s\n", name);
+               Con_DPrintf("FS_FindFile: can't find %s\n", name);
 
        if (index != NULL)
                *index = -1;
@@ -1627,7 +1631,11 @@ int FS_Seek (qfile_t* file, long offset, int whence)
        // Quick path for unpacked files
        if (! (file->flags & FS_FLAG_PACKED))
 #ifdef FS_USESYSCALLS
-               return lseek (file->stream, offset, whence);
+       {
+               if (lseek (file->stream, offset, whence) == -1)
+                       return -1;
+               return 0;
+       }
 #else
                return fseek (file->stream, offset, whence);
 #endif
@@ -2106,7 +2114,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet)
                                                        if (liststart == NULL)
                                                                liststart = listcurrent;
                                                        if (!quiet)
-                                                               Sys_Printf("SearchPackFile: %s : %s\n", pak->filename, temp);
+                                                               Con_DPrintf("SearchPackFile: %s : %s\n", pak->filename, temp);
                                                }
                                        }
                                        // strip off one path element at a time until empty
@@ -2145,7 +2153,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet)
                                                        if (liststart == NULL)
                                                                liststart = listcurrent;
                                                        if (!quiet)
-                                                               Sys_Printf("SearchDirFile: %s\n", temp);
+                                                               Con_DPrintf("SearchDirFile: %s\n", temp);
                                                }
                                        }
                                }