From 4eec14b11ef2aa3fa9068bfcfd937ae2b0b160f1 Mon Sep 17 00:00:00 2001 From: skyjake Date: Wed, 7 Mar 2012 14:27:27 +0200 Subject: [PATCH] Win32: Fixed build; added strcasestr() It seems the Windows C runtime library doesn't include strcasestr(). --- doomsday/engine/portable/include/de_platform.h | 2 ++ doomsday/engine/portable/src/r_model.c | 2 ++ doomsday/engine/win32/src/dd_winit.c | 17 +++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/doomsday/engine/portable/include/de_platform.h b/doomsday/engine/portable/include/de_platform.h index 7a2f90fe30..1142ef50aa 100644 --- a/doomsday/engine/portable/include/de_platform.h +++ b/doomsday/engine/portable/include/de_platform.h @@ -64,6 +64,8 @@ #define strdup _strdup #define spawnlp _spawnlp +const char* strcasestr(const char* text, const char* sub); + #endif // WIN32 /* diff --git a/doomsday/engine/portable/src/r_model.c b/doomsday/engine/portable/src/r_model.c index 5af2a4e840..977ca2da3a 100644 --- a/doomsday/engine/portable/src/r_model.c +++ b/doomsday/engine/portable/src/r_model.c @@ -1178,6 +1178,8 @@ static int destroyModelInRepository(StringPoolId id, void* parm) } M_Free(m->vertexUsage); M_Free(m); + + return 0; } static void clearModelList(void) diff --git a/doomsday/engine/win32/src/dd_winit.c b/doomsday/engine/win32/src/dd_winit.c index 1d23a89364..a2b68d0e01 100644 --- a/doomsday/engine/win32/src/dd_winit.c +++ b/doomsday/engine/win32/src/dd_winit.c @@ -646,3 +646,20 @@ void DD_Shutdown(void) free(utf8ConvBuf); utf8ConvBuf = 0; #endif } + +/** + * Windows implementation for the *nix strcasestr() function. + */ +const char* strcasestr(const char *text, const char *sub) +{ + int textLen = strlen(text); + int subLen = strlen(sub); + int i; + + for(i = 0; i < textLen - subLen; ++i) + { + const char* start = text + i; + if(!strnicmp(start, sub, subLen)) return start; + } + return 0; +}