fix strict aliasing issues

Patch by Przemysław Iskra (#3805)
This commit is contained in:
Ludwig Nussel 2008-11-03 17:03:54 +00:00
parent f86f8e8ed8
commit c754d6fdfb
15 changed files with 91 additions and 108 deletions

View file

@ -36,9 +36,9 @@ void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) {
}
int PASSFLOAT( float x ) {
float floatTemp;
floatTemp = x;
return *(int *)&floatTemp;
floatint_t fi;
fi.f = x;
return fi.i;
}
void trap_Printf( const char *fmt ) {
@ -290,9 +290,9 @@ void trap_AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs
}
float trap_AAS_Time(void) {
int temp;
temp = syscall( BOTLIB_AAS_TIME );
return (*(float*)&temp);
floatint_t fi;
fi.i = syscall( BOTLIB_AAS_TIME );
return fi.f;
}
int trap_AAS_PointAreaNum(vec3_t point) {
@ -476,15 +476,15 @@ void trap_BotFreeCharacter(int character) {
}
float trap_Characteristic_Float(int character, int index) {
int temp;
temp = syscall( BOTLIB_AI_CHARACTERISTIC_FLOAT, character, index );
return (*(float*)&temp);
floatint_t fi;
fi.i = syscall( BOTLIB_AI_CHARACTERISTIC_FLOAT, character, index );
return fi.f;
}
float trap_Characteristic_BFloat(int character, int index, float min, float max) {
int temp;
temp = syscall( BOTLIB_AI_CHARACTERISTIC_BFLOAT, character, index, PASSFLOAT(min), PASSFLOAT(max) );
return (*(float*)&temp);
floatint_t fi;
fi.i = syscall( BOTLIB_AI_CHARACTERISTIC_BFLOAT, character, index, PASSFLOAT(min), PASSFLOAT(max) );
return fi.f;
}
int trap_Characteristic_Integer(int character, int index) {
@ -652,9 +652,9 @@ int trap_BotGetMapLocationGoal(char *name, void /* struct bot_goal_s */ *goal) {
}
float trap_BotAvoidGoalTime(int goalstate, int number) {
int temp;
temp = syscall( BOTLIB_AI_AVOID_GOAL_TIME, goalstate, number );
return (*(float*)&temp);
floatint_t fi;
fi.i = syscall( BOTLIB_AI_AVOID_GOAL_TIME, goalstate, number );
return fi.f;
}
void trap_BotSetAvoidGoalTime(int goalstate, int number, float avoidtime) {