Regex: Fix compilation.

This commit is contained in:
Arkshine 2014-07-18 12:42:13 +02:00
parent 62e4eb29eb
commit 0ec65bef5b

View File

@ -3,6 +3,11 @@
#include <string.h> #include <string.h>
#include "utils.h" #include "utils.h"
#if defined(WIN32)
#define strcasecmp stricmp
#define strncasecmp _strnicmp
#endif
int UTIL_CheckValidChar(char *c) int UTIL_CheckValidChar(char *c)
{ {
int count; int count;
@ -91,7 +96,7 @@ char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t se
/* If the search matches and the replace length is 0, /* If the search matches and the replace length is 0,
* we can just terminate the string and be done. * we can just terminate the string and be done.
*/ */
if ((caseSensitive ? strcmp(subject, search) : stricmp(subject, search)) == 0 && replaceLen == 0) if ((caseSensitive ? strcmp(subject, search) : strcasecmp(subject, search)) == 0 && replaceLen == 0)
{ {
*subject = '\0'; *subject = '\0';
return subject; return subject;
@ -108,7 +113,7 @@ char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t se
while (*ptr != '\0' && (browsed <= textLen - searchLen)) while (*ptr != '\0' && (browsed <= textLen - searchLen))
{ {
/* See if we get a comparison */ /* See if we get a comparison */
if ((caseSensitive ? strncmp(ptr, search, searchLen) : strnicmp(ptr, search, searchLen)) == 0) if ((caseSensitive ? strncmp(ptr, search, searchLen) : strncasecmp(ptr, search, searchLen)) == 0)
{ {
if (replaceLen > searchLen) if (replaceLen > searchLen)
{ {