Changed: Disable snprintf_s usage to get around auto-vectorization in the 2015 STL strnlen implementation

This commit is contained in:
jaynus 2015-05-13 11:17:43 -07:00 committed by KoffeinFlummi
parent 98df03ca27
commit 710db5a492
2 changed files with 12 additions and 10 deletions

View File

@ -23,7 +23,9 @@ if(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "-std=c++11 -march=i686 -m32 -O2 -s -fPIC -fpermissive") SET(CMAKE_CXX_FLAGS "-std=c++11 -march=i686 -m32 -O2 -s -fPIC -fpermissive")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++") set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++")
else() elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(ERROR "SUPPORT NOT COMPLETE")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall /arch:SSE2 /Qpar-report:2") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall /arch:SSE2 /Qpar-report:2")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /D _DEBUG /MTd /Zi /Ob0 /Od /RTC1") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /D _DEBUG /MTd /Zi /Ob0 /Od /RTC1")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} /MT /O1 /Ob1 /D NDEBUG") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} /MT /O1 /Ob1 /D NDEBUG")

View File

@ -238,7 +238,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
ZERO_OUTPUT(); ZERO_OUTPUT();
if (!strcmp(function, "version")) { if (!strcmp(function, "version")) {
int n = sprintf_s(output, outputSize, "%s", ACE_FULL_VERSION_STR); int n = sprintf(output, "%s", ACE_FULL_VERSION_STR);
EXTENSION_RETURN(); EXTENSION_RETURN();
} }
@ -258,7 +258,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
velocity = strtod(strtok_s(NULL, ":", &next_token), NULL); velocity = strtod(strtok_s(NULL, ":", &next_token), NULL);
retard = calculateRetard(dragModel, ballisticCoefficient, velocity); retard = calculateRetard(dragModel, ballisticCoefficient, velocity);
int n = sprintf_s(output, outputSize, "%f", retard); int n = sprintf(output, "%f", retard);
EXTENSION_RETURN(); EXTENSION_RETURN();
} else if (!strcmp(mode, "atmosphericCorrection")) { } else if (!strcmp(mode, "atmosphericCorrection")) {
double ballisticCoefficient = 1.0; double ballisticCoefficient = 1.0;
@ -274,7 +274,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
atmosphereModel = strtok_s(NULL, ":", &next_token); atmosphereModel = strtok_s(NULL, ":", &next_token);
ballisticCoefficient = calculateAtmosphericCorrection(ballisticCoefficient, temperature, pressure, humidity, atmosphereModel); ballisticCoefficient = calculateAtmosphericCorrection(ballisticCoefficient, temperature, pressure, humidity, atmosphereModel);
int n = sprintf_s(output, outputSize, "%f", ballisticCoefficient); int n = sprintf(output, "%f", ballisticCoefficient);
EXTENSION_RETURN(); EXTENSION_RETURN();
} else if (!strcmp(mode, "new")) { } else if (!strcmp(mode, "new")) {
unsigned int index = 0; unsigned int index = 0;
@ -369,7 +369,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
bulletDatabase[index].frames = 0.0; bulletDatabase[index].frames = 0.0;
bulletDatabase[index].randSeed = 0; bulletDatabase[index].randSeed = 0;
int n = sprintf_s(output, outputSize, "%s", ""); int n = sprintf(output, "%s", "");
EXTENSION_RETURN(); EXTENSION_RETURN();
} else if (!strcmp(mode, "simulate")) { } else if (!strcmp(mode, "simulate")) {
// simulate:0:[-0.109985,542.529,-3.98301]:[3751.57,5332.23,214.252]:[0.598153,2.38829,0]:28.6:0:0.481542:0:215.16 // simulate:0:[-0.109985,542.529,-3.98301]:[3751.57,5332.23,214.252]:[0.598153,2.38829,0]:28.6:0:0.481542:0:215.16
@ -586,7 +586,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
velocityOffset[2] += (distribution(bulletDatabase[index].randGenerator) * 0.8 - 0.4) * coef; velocityOffset[2] += (distribution(bulletDatabase[index].randGenerator) * 0.8 - 0.4) * coef;
}; };
int n = sprintf_s(output, outputSize, "_bullet setVelocity (_bulletVelocity vectorAdd [%f, %f, %f]); _bullet setPosASL (_bulletPosition vectorAdd [%f, %f, %f]);", velocityOffset[0], velocityOffset[1], velocityOffset[2], positionOffset[0], positionOffset[1], positionOffset[2]); int n = sprintf(output, "_bullet setVelocity (_bulletVelocity vectorAdd [%f, %f, %f]); _bullet setPosASL (_bulletPosition vectorAdd [%f, %f, %f]);", velocityOffset[0], velocityOffset[1], velocityOffset[2], positionOffset[0], positionOffset[1], positionOffset[2]);
EXTENSION_RETURN(); EXTENSION_RETURN();
} else if (!strcmp(mode, "set")) { } else if (!strcmp(mode, "set")) {
int height = 0; int height = 0;
@ -601,7 +601,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
map->gridBuildingNums.push_back(numObjects); map->gridBuildingNums.push_back(numObjects);
map->gridSurfaceIsWater.push_back(surfaceIsWater); map->gridSurfaceIsWater.push_back(surfaceIsWater);
int n = sprintf_s(output, outputSize, "%s", ""); int n = sprintf(output, "%s", "");
EXTENSION_RETURN(); EXTENSION_RETURN();
} else if (!strcmp(mode, "init")) { } else if (!strcmp(mode, "init")) {
int mapSize = 0; int mapSize = 0;
@ -616,7 +616,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
map = &mapDatabase[worldName]; map = &mapDatabase[worldName];
if (map->gridHeights.size() == gridCells) { if (map->gridHeights.size() == gridCells) {
int n = sprintf_s(output, outputSize, "%s", "Terrain already initialized"); int n = sprintf(output, "%s", "Terrain already initialized");
EXTENSION_RETURN(); EXTENSION_RETURN();
} }
@ -629,10 +629,10 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
map->gridBuildingNums.reserve(gridCells); map->gridBuildingNums.reserve(gridCells);
map->gridSurfaceIsWater.reserve(gridCells); map->gridSurfaceIsWater.reserve(gridCells);
int n = sprintf_s(output, outputSize, "%s", ""); int n = sprintf(output, "%s", "");
EXTENSION_RETURN(); EXTENSION_RETURN();
} }
int n = sprintf_s(output, outputSize, "%s", ""); int n = sprintf(output, "%s", "");
EXTENSION_RETURN(); EXTENSION_RETURN();
} }