* Fix to qvm compilation on big endian architectures

This commit is contained in:
Tim Angus 2007-10-13 12:03:47 +00:00
parent 8f43965e13
commit 6dffd08e74
4 changed files with 24 additions and 104 deletions

View file

@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "../../qcommon/q_platform.h"
#include "cmdlib.h"
#include "mathlib.h"
#include "../../qcommon/qfiles.h"
@ -1356,6 +1357,7 @@ void WriteVmFile( void ) {
vmHeader_t header;
FILE *f;
int headerSize;
int i;
report( "%i total errors\n", errorCount );
@ -1400,6 +1402,13 @@ void WriteVmFile( void ) {
report( "Writing to %s\n", imageName );
#ifdef Q3_BIG_ENDIAN
// byte swap the header
for ( i = 0 ; i < sizeof( vmHeader_t ) / 4 ; i++ ) {
((int *)&header)[i] = LittleLong( ((int *)&header)[i] );
}
#endif
CreatePath( imageName );
f = SafeOpenWrite( imageName );
SafeWrite( f, &header, headerSize );