mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
769f99f590
During 2.3 development, there's been a gradual shift to using SDL stdlib functions instead of libc functions, but there are still some libc functions (or the same libc function but from the STL) in the code. Well, this patch replaces all the rest of them in one fell swoop. SDL's stdlib can replace most of these, but its SDL_min() and SDL_max() are inadequate - they aren't really functions, they're more like macros with a nasty penchant for double-evaluation. So I just made my own VVV_min() and VVV_max() functions and placed them in Maths.h instead, then replaced all the previous usages of min(), max(), std::min(), std::max(), SDL_min(), and SDL_max() with VVV_min() and VVV_max(). Additionally, there's no SDL_isxdigit(), so I just implemented my own VVV_isxdigit(). SDL has SDL_malloc() and SDL_free(), but they have some refcounting built in to them, so in order to use them with LodePNG, I have to replace the malloc() and free() that LodePNG uses. Which isn't too hard, I did it in a new file called ThirdPartyDeps.c, and LodePNG is now compiled with the LODEPNG_NO_COMPILE_ALLOCATORS definition. Lastly, I also refactored the awful strcpy() and strcat() usages in PLATFORM_migrateSaveData() to use SDL_snprintf() instead. I know save migration is getting axed in 2.4, but it still bothers me to have something like that in the codebase otherwise. Without further ado, here is the full list of functions that the codebase now uses: - SDL_strlcpy() instead of strcpy() - SDL_strlcat() instead of strcat() - SDL_snprintf() instead of sprintf(), strcpy(), or strcat() (see above) - VVV_min() instead of min(), std::min(), or SDL_min() - VVV_max() instead of max(), std::max(), or SDL_max() - VVV_isxdigit() instead of isxdigit() - SDL_strcmp() instead of strcmp() - SDL_strcasecmp() instead of strcasecmp() or Win32 strcmpi() - SDL_strstr() instead of strstr() - SDL_strlen() instead of strlen() - SDL_sscanf() instead of sscanf() - SDL_getenv() instead of getenv() - SDL_malloc() instead of malloc() (replacing in LodePNG as well) - SDL_free() instead of free() (replacing in LodePNG as well) |
||
---|---|---|
.. | ||
BinaryBlob.cpp | ||
BinaryBlob.h | ||
BlockV.cpp | ||
BlockV.h | ||
Credits.h | ||
editor.cpp | ||
editor.h | ||
Ent.cpp | ||
Ent.h | ||
Entity.cpp | ||
Entity.h | ||
Enums.h | ||
FileSystemUtils.cpp | ||
FileSystemUtils.h | ||
Finalclass.cpp | ||
Finalclass.h | ||
Game.cpp | ||
Game.h | ||
GOGNetwork.c | ||
Graphics.cpp | ||
Graphics.h | ||
GraphicsResources.cpp | ||
GraphicsResources.h | ||
GraphicsUtil.cpp | ||
GraphicsUtil.h | ||
Input.cpp | ||
Input.h | ||
KeyPoll.cpp | ||
KeyPoll.h | ||
Labclass.cpp | ||
Labclass.h | ||
Logic.cpp | ||
Logic.h | ||
main.cpp | ||
MakeAndPlay.h | ||
Map.cpp | ||
Map.h | ||
Maths.h | ||
Music.cpp | ||
Music.h | ||
Network.c | ||
Network.h | ||
Otherlevel.cpp | ||
Otherlevel.h | ||
preloader.cpp | ||
preloader.h | ||
Render.cpp | ||
Render.h | ||
RenderFixed.cpp | ||
RenderFixed.h | ||
Screen.cpp | ||
Screen.h | ||
ScreenSettings.h | ||
Script.cpp | ||
Script.h | ||
Scripts.cpp | ||
SoundSystem.cpp | ||
SoundSystem.h | ||
Spacestation2.cpp | ||
Spacestation2.h | ||
SteamNetwork.c | ||
TerminalScripts.cpp | ||
Textbox.cpp | ||
Textbox.h | ||
ThirdPartyDeps.c | ||
Tower.cpp | ||
Tower.h | ||
TowerBG.h | ||
UtilityClass.cpp | ||
UtilityClass.h | ||
Version.h | ||
Version.h.in | ||
WarpClass.cpp | ||
WarpClass.h | ||
XMLUtils.cpp | ||
XMLUtils.h |