shithub: qk1

Download patch

ref: 44d88b57a48cbed929495b3cb9e92d49eaf530cb
parent: cff9f164d3ee4e480522f28d440daaa841e8ce32
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon May 29 14:36:01 EDT 2023

qw: remove broken Sys_FileTime

--- a/qw/common.c
+++ b/qw/common.c
@@ -1304,7 +1304,6 @@
 	char		netpath[MAX_OSPATH];
 	pack_t		*pak;
 	int			i;
-	int			findtime;
 
 	file_from_pak = 0;
 		
@@ -1342,14 +1341,10 @@
 			}
 			
 			sprintf (netpath, "%s/%s",search->filename, filename);
-			
-			findtime = Sys_FileTime (netpath);
-			if (findtime == -1)
+			*file = fopen (netpath, "rb");
+			if (!*file)
 				continue;
-				
 			Sys_Printf ("FindFile: %s\n",netpath);
-
-			*file = fopen (netpath, "rb");
 			return COM_filelength (*file);
 		}
 		
--- a/qw/sv_ccmds.c
+++ b/qw/sv_ccmds.c
@@ -753,6 +753,7 @@
 	client_t *cl;
 	char		pcxname[80]; 
 	char		checkname[MAX_OSPATH];
+	FILE		*f;
 	int			i;
 
 	for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++)
@@ -778,8 +779,9 @@
 		pcxname[strlen(pcxname) - 6] = i/10 + '0'; 
 		pcxname[strlen(pcxname) - 5] = i%10 + '0'; 
 		sprintf (checkname, "%s/snap/%s", gamedirfile, pcxname);
-		if (Sys_FileTime(checkname) == -1)
+		if ((f = fopen(checkname, "rb")) == NULL)
 			break;	// file doesn't exist
+		fclose(f);
 	} 
 	if (i==100) 
 	{
--- a/qw/sys.c
+++ b/qw/sys.c
@@ -52,19 +52,6 @@
 }
 
 int
-Sys_FileTime(char *path)
-{
-	Dir *d;
-	ulong t;
-
-	t = 0;
-	if((d = dirstat(path)) != nil)
-		t = d->mtime;
-	free(d);
-	return t;
-}
-
-int
 Sys_mkdir(char *path)
 {
 	int d;
--- a/qw/sys.h
+++ b/qw/sys.h
@@ -7,7 +7,6 @@
 };
 extern int svonly;
 
-int Sys_FileTime(char *);
 int Sys_mkdir(char *);
 vlong flen(int);