[iortcw] 385/497: All: Unify MP/SP checking route cache CRCs only if little endian

Simon McVittie smcv at debian.org
Fri Sep 8 10:37:33 UTC 2017


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

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit c8d86da2d32cb38d4d7314a2c27ab62ea23a641d
Author: Zack Middleton <zturtleman at gmail.com>
Date:   Thu Jul 30 22:37:27 2015 -0500

    All: Unify MP/SP checking route cache CRCs only if little endian
---
 MP/code/botlib/be_aas_route.c | 41 ++++++++++++++++++++---------------------
 SP/code/botlib/be_aas_route.c | 40 ++++++++++++++++++++--------------------
 2 files changed, 40 insertions(+), 41 deletions(-)

diff --git a/MP/code/botlib/be_aas_route.c b/MP/code/botlib/be_aas_route.c
index 612c43e..a733b41 100644
--- a/MP/code/botlib/be_aas_route.c
+++ b/MP/code/botlib/be_aas_route.c
@@ -1149,28 +1149,27 @@ int AAS_ReadRouteCache( void ) {
 		//AAS_Error("route cache dump has wrong number of clusters\n");
 		return qfalse;
 	} //end if
-#if defined( MACOSX )
-	// the crc table stuff is endian orientated....
-#else
-	if ( routecacheheader.areacrc !=
-		 CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas ) ) {
-		botimport.FS_FCloseFile( fp );
-		//AAS_Error("route cache dump area CRC incorrect\n");
-		return qfalse;
-	} //end if
-	if ( routecacheheader.clustercrc !=
-		 CRC_ProcessString( (unsigned char *)( *aasworld ).clusters, sizeof( aas_cluster_t ) * ( *aasworld ).numclusters ) ) {
-		botimport.FS_FCloseFile( fp );
-		//AAS_Error("route cache dump cluster CRC incorrect\n");
-		return qfalse;
-	} //end if
-	if ( routecacheheader.reachcrc !=
-		 CRC_ProcessString( (unsigned char *)( *aasworld ).reachability, sizeof( aas_reachability_t ) * ( *aasworld ).reachabilitysize ) ) {
-		botimport.FS_FCloseFile( fp );
-		//AAS_Error("route cache dump reachability CRC incorrect\n");
-		return qfalse;
+	// crc code is only good on little endian machines
+	if ( 1 == LittleLong( 1 ) ) {
+		if ( routecacheheader.areacrc !=
+			 CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas ) ) {
+			botimport.FS_FCloseFile( fp );
+			//AAS_Error("route cache dump area CRC incorrect\n");
+			return qfalse;
+		} //end if
+		if ( routecacheheader.clustercrc !=
+			 CRC_ProcessString( (unsigned char *)( *aasworld ).clusters, sizeof( aas_cluster_t ) * ( *aasworld ).numclusters ) ) {
+			botimport.FS_FCloseFile( fp );
+			//AAS_Error("route cache dump cluster CRC incorrect\n");
+			return qfalse;
+		} //end if
+		if ( routecacheheader.reachcrc !=
+			 CRC_ProcessString( (unsigned char *)( *aasworld ).reachability, sizeof( aas_reachability_t ) * ( *aasworld ).reachabilitysize ) ) {
+			botimport.FS_FCloseFile( fp );
+			//AAS_Error("route cache dump reachability CRC incorrect\n");
+			return qfalse;
+		} //end if
 	} //end if
-#endif
 	//read all the portal cache
 	for ( i = 0; i < routecacheheader.numportalcache; i++ )
 	{
diff --git a/SP/code/botlib/be_aas_route.c b/SP/code/botlib/be_aas_route.c
index 4c88493..073b8ce 100644
--- a/SP/code/botlib/be_aas_route.c
+++ b/SP/code/botlib/be_aas_route.c
@@ -1150,27 +1150,27 @@ int AAS_ReadRouteCache( void ) {
 		//AAS_Error("route cache dump has wrong number of clusters\n");
 		return qfalse;
 	} //end if
-#ifdef _WIN32
-	// crc code is only good on intel machines
-	if ( routecacheheader.areacrc !=
-		 CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas ) ) {
-		botimport.FS_FCloseFile( fp );
-		//AAS_Error("route cache dump area CRC incorrect\n");
-		return qfalse;
-	} //end if
-	if ( routecacheheader.clustercrc !=
-		 CRC_ProcessString( (unsigned char *)( *aasworld ).clusters, sizeof( aas_cluster_t ) * ( *aasworld ).numclusters ) ) {
-		botimport.FS_FCloseFile( fp );
-		//AAS_Error("route cache dump cluster CRC incorrect\n");
-		return qfalse;
-	} //end if
-	if ( routecacheheader.reachcrc !=
-		 CRC_ProcessString( (unsigned char *)( *aasworld ).reachability, sizeof( aas_reachability_t ) * ( *aasworld ).reachabilitysize ) ) {
-		botimport.FS_FCloseFile( fp );
-		//AAS_Error("route cache dump reachability CRC incorrect\n");
-		return qfalse;
+	// crc code is only good on little endian machines
+	if ( 1 == LittleLong( 1 ) ) {
+		if ( routecacheheader.areacrc !=
+			 CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas ) ) {
+			botimport.FS_FCloseFile( fp );
+			//AAS_Error("route cache dump area CRC incorrect\n");
+			return qfalse;
+		} //end if
+		if ( routecacheheader.clustercrc !=
+			 CRC_ProcessString( (unsigned char *)( *aasworld ).clusters, sizeof( aas_cluster_t ) * ( *aasworld ).numclusters ) ) {
+			botimport.FS_FCloseFile( fp );
+			//AAS_Error("route cache dump cluster CRC incorrect\n");
+			return qfalse;
+		} //end if
+		if ( routecacheheader.reachcrc !=
+			 CRC_ProcessString( (unsigned char *)( *aasworld ).reachability, sizeof( aas_reachability_t ) * ( *aasworld ).reachabilitysize ) ) {
+			botimport.FS_FCloseFile( fp );
+			//AAS_Error("route cache dump reachability CRC incorrect\n");
+			return qfalse;
+		} //end if
 	} //end if
-#endif
 	//read all the portal cache
 	for ( i = 0; i < routecacheheader.numportalcache; i++ )
 	{

-- 
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