Skip to content

Commit

Permalink
Win32: Fixed build; added strcasestr()
Browse files Browse the repository at this point in the history
It seems the Windows C runtime library doesn't include
strcasestr().
  • Loading branch information
skyjake committed Mar 7, 2012
1 parent de6b747 commit 4eec14b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doomsday/engine/portable/include/de_platform.h
Expand Up @@ -64,6 +64,8 @@
#define strdup _strdup
#define spawnlp _spawnlp

const char* strcasestr(const char* text, const char* sub);

#endif // WIN32

/*
Expand Down
2 changes: 2 additions & 0 deletions doomsday/engine/portable/src/r_model.c
Expand Up @@ -1178,6 +1178,8 @@ static int destroyModelInRepository(StringPoolId id, void* parm)
}
M_Free(m->vertexUsage);
M_Free(m);

return 0;
}

static void clearModelList(void)
Expand Down
17 changes: 17 additions & 0 deletions doomsday/engine/win32/src/dd_winit.c
Expand Up @@ -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;
}

0 comments on commit 4eec14b

Please sign in to comment.