From: havoc Date: Sat, 2 Jul 2005 03:06:23 +0000 (+0000) Subject: fix Black's mistake of using 'long' (32bit/64bit depending on architecture) type... X-Git-Tag: xonotic-v0.1.0preview~4706 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0f50ec2cb291f937ab0a001c9f5bd1e0b367bb74;p=xonotic%2Fdarkplaces.git fix Black's mistake of using 'long' (32bit/64bit depending on architecture) type in reading .lno files, changed to int (32bit) so that the code works on 64bit architectures git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5480 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/prvm_edict.c b/prvm_edict.c index e1143248..fd4440b8 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -1228,7 +1228,7 @@ PRVM_LoadLNO */ void PRVM_LoadLNO( const char *progname ) { qbyte *lno; - unsigned long *header; + unsigned int *header; char filename[512]; FS_StripExtension( progname, filename, sizeof( filename ) ); @@ -1248,20 +1248,20 @@ void PRVM_LoadLNO( const char *progname ) { SafeWrite (h, &numstatements, sizeof(int)); SafeWrite (h, statement_linenums, numstatements*sizeof(int)); */ - if( (unsigned) fs_filesize < (6 + prog->progs->numstatements) * sizeof( long ) ) { + if( (unsigned) fs_filesize < (6 + prog->progs->numstatements) * sizeof( int ) ) { return; } - header = (unsigned long *) lno; - if( header[ 0 ] == *(unsigned long *) "LNOF" && + header = (unsigned int *) lno; + if( header[ 0 ] == *(unsigned int *) "LNOF" && LittleLong( header[ 1 ] ) == 1 && - LittleLong( header[ 2 ] ) == prog->progs->numglobaldefs && - LittleLong( header[ 3 ] ) == prog->progs->numglobals && - LittleLong( header[ 4 ] ) == prog->progs->numfielddefs && - LittleLong( header[ 5 ] ) == prog->progs->numstatements ) + (unsigned int)LittleLong( header[ 2 ] ) == (unsigned int)prog->progs->numglobaldefs && + (unsigned int)LittleLong( header[ 3 ] ) == (unsigned int)prog->progs->numglobals && + (unsigned int)LittleLong( header[ 4 ] ) == (unsigned int)prog->progs->numfielddefs && + (unsigned int)LittleLong( header[ 5 ] ) == (unsigned int)prog->progs->numstatements ) { - prog->statement_linenums = Mem_Alloc(prog->progs_mempool, prog->progs->numstatements * sizeof( long ) ); - memcpy( prog->statement_linenums, (long *) lno + 6, prog->progs->numstatements * sizeof( long ) ); + prog->statement_linenums = Mem_Alloc(prog->progs_mempool, prog->progs->numstatements * sizeof( int ) ); + memcpy( prog->statement_linenums, (int *) lno + 6, prog->progs->numstatements * sizeof( int ) ); } Mem_Free( lno ); }