[iortcw] 47/95: All: Remove FS_Read2

Simon McVittie smcv at debian.org
Fri Sep 8 10:42:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to tag 1.51
in repository iortcw.

commit cdf2ce22bcca9e85e3d9d0917db78170494b1ce0
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Mon Mar 20 19:21:04 2017 -0400

    All: Remove FS_Read2
---
 MP/code/client/cl_ui.c    |  2 +-
 MP/code/qcommon/files.c   | 33 ---------------------------------
 MP/code/qcommon/md5.c     |  2 +-
 MP/code/qcommon/qcommon.h |  1 -
 MP/code/server/sv_bot.c   |  2 +-
 MP/code/server/sv_game.c  |  2 +-
 SP/code/qcommon/files.c   | 35 +----------------------------------
 SP/code/qcommon/md5.c     |  2 +-
 SP/code/qcommon/qcommon.h |  1 -
 9 files changed, 6 insertions(+), 74 deletions(-)

diff --git a/MP/code/client/cl_ui.c b/MP/code/client/cl_ui.c
index bb8ee82..eb3ba2a 100644
--- a/MP/code/client/cl_ui.c
+++ b/MP/code/client/cl_ui.c
@@ -800,7 +800,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
 		return FS_FOpenFileByMode( VMA( 1 ), VMA( 2 ), args[3] );
 
 	case UI_FS_READ:
-		FS_Read2( VMA( 1 ), args[2], args[3] );
+		FS_Read( VMA( 1 ), args[2], args[3] );
 		return 0;
 
 	case UI_FS_WRITE:
diff --git a/MP/code/qcommon/files.c b/MP/code/qcommon/files.c
index c262e6b..0c37070 100644
--- a/MP/code/qcommon/files.c
+++ b/MP/code/qcommon/files.c
@@ -284,7 +284,6 @@ typedef struct {
 	int zipFilePos;
 	int zipFileLen;
 	qboolean zipFile;
-	qboolean streamed;
 	char name[MAX_ZPATH];
 } fileHandleData_t;
 
@@ -1741,25 +1740,6 @@ FS_Read
 Properly handles partial reads
 =================
 */
-int FS_Read2( void *buffer, int len, fileHandle_t f ) {
-	if ( !fs_searchpaths ) {
-		Com_Error( ERR_FATAL, "Filesystem call made without initialization" );
-	}
-
-	if ( !f ) {
-		return 0;
-	}
-	if ( fsh[f].streamed ) {
-		int r;
-		fsh[f].streamed = qfalse;
-		r = FS_Read( buffer, len, f );
-		fsh[f].streamed = qtrue;
-		return r;
-	} else {
-		return FS_Read( buffer, len, f );
-	}
-}
-
 int FS_Read( void *buffer, int len, fileHandle_t f ) {
 	int block, remaining;
 	int read;
@@ -1886,14 +1866,6 @@ int FS_Seek( fileHandle_t f, long offset, int origin ) {
 		return -1;
 	}
 
-	if (fsh[f].streamed) {
-		int r;
-		fsh[f].streamed = qfalse;
-	 	r = FS_Seek( f, offset, origin );
-		fsh[f].streamed = qtrue;
-		return r;
-	}
-
 	if (fsh[f].zipFile == qtrue) {
 		//FIXME: this is really, really crappy
 		//(but better than what was here before)
@@ -4391,11 +4363,6 @@ int	FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
 
 	if ( *f ) {
 		fsh[*f].fileSize = r;
-		fsh[*f].streamed = qfalse;
-
-		if (mode == FS_READ) {
-			fsh[*f].streamed = qtrue;
-		}
 	}
 	fsh[*f].handleSync = sync;
 
diff --git a/MP/code/qcommon/md5.c b/MP/code/qcommon/md5.c
index 51ef2bb..ea2de56 100644
--- a/MP/code/qcommon/md5.c
+++ b/MP/code/qcommon/md5.c
@@ -292,7 +292,7 @@ char *Com_MD5File( const char *fn, int length, const char *prefix, int prefix_le
 		MD5Update(&md5 , (unsigned char *)prefix, prefix_len);
 
 	for(;;) {
-		r = FS_Read2(buffer, sizeof(buffer), f);
+		r = FS_Read(buffer, sizeof(buffer), f);
 		if(r < 1)
 			break;
 		if(r + total > length)
diff --git a/MP/code/qcommon/qcommon.h b/MP/code/qcommon/qcommon.h
index 1f23d0f..db22e30 100644
--- a/MP/code/qcommon/qcommon.h
+++ b/MP/code/qcommon/qcommon.h
@@ -738,7 +738,6 @@ int     FS_Delete( char *filename );    // only works inside the 'save' director
 
 int     FS_Write( const void *buffer, int len, fileHandle_t f );
 
-int		FS_Read2( void *buffer, int len, fileHandle_t f );
 int     FS_Read( void *buffer, int len, fileHandle_t f );
 // properly handles partial reads and reads from other dlls
 
diff --git a/MP/code/server/sv_bot.c b/MP/code/server/sv_bot.c
index ca7d87f..74d624c 100644
--- a/MP/code/server/sv_bot.c
+++ b/MP/code/server/sv_bot.c
@@ -612,7 +612,7 @@ void SV_BotInitBotLib( void ) {
 
 	// file system acess
 	botlib_import.FS_FOpenFile = FS_FOpenFileByMode;
-	botlib_import.FS_Read = FS_Read2;
+	botlib_import.FS_Read = FS_Read;
 	botlib_import.FS_Write = FS_Write;
 	botlib_import.FS_FCloseFile = FS_FCloseFile;
 	botlib_import.FS_Seek = FS_Seek;
diff --git a/MP/code/server/sv_game.c b/MP/code/server/sv_game.c
index 2c9ceda..e868901 100644
--- a/MP/code/server/sv_game.c
+++ b/MP/code/server/sv_game.c
@@ -343,7 +343,7 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) {
 	case G_FS_FOPEN_FILE:
 		return FS_FOpenFileByMode( VMA( 1 ), VMA( 2 ), args[3] );
 	case G_FS_READ:
-		FS_Read2( VMA( 1 ), args[2], args[3] );
+		FS_Read( VMA( 1 ), args[2], args[3] );
 		return 0;
 	case G_FS_WRITE:
 		return FS_Write( VMA( 1 ), args[2], args[3] );
diff --git a/SP/code/qcommon/files.c b/SP/code/qcommon/files.c
index 15910bd..c9a55b5 100644
--- a/SP/code/qcommon/files.c
+++ b/SP/code/qcommon/files.c
@@ -311,7 +311,6 @@ typedef struct {
 	int zipFilePos;
 	int zipFileLen;
 	qboolean zipFile;
-	qboolean streamed;
 	char name[MAX_ZPATH];
 } fileHandleData_t;
 
@@ -1766,30 +1765,11 @@ int FS_Delete( char *filename ) {
 
 /*
 =================
-FS_Read2
+FS_Read
 
 Properly handles partial reads
 =================
 */
-int FS_Read2( void *buffer, int len, fileHandle_t f ) {
-	if ( !fs_searchpaths ) {
-		Com_Error( ERR_FATAL, "Filesystem call made without initialization" );
-	}
-
-	if ( !f ) {
-		return 0;
-	}
-	if ( fsh[f].streamed ) {
-		int r;
-		fsh[f].streamed = qfalse;
-		r = FS_Read( buffer, len, f );
-		fsh[f].streamed = qtrue;
-		return r;
-	} else {
-		return FS_Read( buffer, len, f );
-	}
-}
-
 int FS_Read( void *buffer, int len, fileHandle_t f ) {
 	int block, remaining;
 	int read;
@@ -1917,14 +1897,6 @@ int FS_Seek( fileHandle_t f, long offset, int origin ) {
 		return -1;
 	}
 
-	if ( fsh[f].streamed ) {
-		int r;
-		fsh[f].streamed = qfalse;
-		r = FS_Seek( f, offset, origin );
-		fsh[f].streamed = qtrue;
-		return r;
-	}
-
 	if ( fsh[f].zipFile == qtrue ) {
 		//FIXME: this is really, really crappy
 		//(but better than what was here before)
@@ -4400,11 +4372,6 @@ int     FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode )
 
 	if ( *f ) {
 		fsh[*f].fileSize = r;
-		fsh[*f].streamed = qfalse;
-
-		if (mode == FS_READ) {
-			fsh[*f].streamed = qtrue;
-		}
 	}
 	fsh[*f].handleSync = sync;
 
diff --git a/SP/code/qcommon/md5.c b/SP/code/qcommon/md5.c
index d47560e..cee93a3 100644
--- a/SP/code/qcommon/md5.c
+++ b/SP/code/qcommon/md5.c
@@ -290,7 +290,7 @@ char *Com_MD5File( const char *fn, int length, const char *prefix, int prefix_le
 		MD5Update(&md5 , (unsigned char *)prefix, prefix_len);
 
 	for(;;) {
-		r = FS_Read2(buffer, sizeof(buffer), f);
+		r = FS_Read(buffer, sizeof(buffer), f);
 		if(r < 1)
 			break;
 		if(r + total > length)
diff --git a/SP/code/qcommon/qcommon.h b/SP/code/qcommon/qcommon.h
index f424036..e07f68b 100644
--- a/SP/code/qcommon/qcommon.h
+++ b/SP/code/qcommon/qcommon.h
@@ -699,7 +699,6 @@ int     FS_Delete( char *filename );    // only works inside the 'save' director
 
 int     FS_Write( const void *buffer, int len, fileHandle_t f );
 
-int	FS_Read2( void *buffer, int len, fileHandle_t f );
 int     FS_Read( void *buffer, int len, fileHandle_t f );
 // properly handles partial reads and reads from other dlls
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list