Move replace functions from logic to core (bug 4406 part 7, r=fyren).
1.1 --- a/core/logic/Profiler.cpp Fri May 14 19:43:53 2010 -0700
1.2 +++ b/core/logic/Profiler.cpp Fri May 14 20:04:30 2010 -0700
1.3 @@ -36,6 +36,7 @@
1.4 #include <time.h>
1.5 #endif
1.6 #include <IPluginSys.h>
1.7 +#include "stringutil.h"
1.8
1.9 ProfileEngine g_Profiler;
1.10 IProfiler *sm_profiler = &g_Profiler;
1.11 @@ -386,9 +387,9 @@
1.12 {
1.13 ar = report->GetReport(i);
1.14
1.15 - smcore.strncopy(new_name, ar->atom_name, sizeof(new_name));
1.16 - smcore.ReplaceAll(new_name, sizeof(new_name), "<", "<", true);
1.17 - smcore.ReplaceAll(new_name, sizeof(new_name), ">", ">", true);
1.18 + strncopy(new_name, ar->atom_name, sizeof(new_name));
1.19 + UTIL_ReplaceAll(new_name, sizeof(new_name), "<", "<", true);
1.20 + UTIL_ReplaceAll(new_name, sizeof(new_name), ">", ">", true);
1.21
1.22 fprintf(fp, " <item name=\"%s\" numcalls=\"%d\" mintime=\"%f\" maxtime=\"%f\" totaltime=\"%f\"/>\n",
1.23 new_name,
2.1 --- a/core/logic/Translator.cpp Fri May 14 19:43:53 2010 -0700
2.2 +++ b/core/logic/Translator.cpp Fri May 14 20:04:30 2010 -0700
2.3 @@ -123,11 +123,11 @@
2.4 {
2.5 if (m_File.compare("common.cfg") == 0)
2.6 {
2.7 - smcore.ReplaceAll(path, sizeof(path), "common.cfg", "common.phrases.txt", true);
2.8 + UTIL_ReplaceAll(path, sizeof(path), "common.cfg", "common.phrases.txt", true);
2.9 } else if (strstr(path, ".cfg")) {
2.10 - smcore.ReplaceAll(path, sizeof(path), ".cfg", ".txt", true);
2.11 + UTIL_ReplaceAll(path, sizeof(path), ".cfg", ".txt", true);
2.12 } else if (strstr(path, ".txt")) {
2.13 - smcore.ReplaceAll(path, sizeof(path), ".txt", ".cfg", true);
2.14 + UTIL_ReplaceAll(path, sizeof(path), ".txt", ".cfg", true);
2.15 }
2.16 }
2.17
3.1 --- a/core/logic/common_logic.cpp Fri May 14 19:43:53 2010 -0700
3.2 +++ b/core/logic/common_logic.cpp Fri May 14 20:04:30 2010 -0700
3.3 @@ -74,7 +74,9 @@
3.4 UTIL_CRC32,
3.5 stristr,
3.6 CoreTranslate,
3.7 - AddCorePhraseFile
3.8 + AddCorePhraseFile,
3.9 + UTIL_ReplaceAll,
3.10 + UTIL_ReplaceEx
3.11 };
3.12
3.13 static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
4.1 --- a/core/logic/intercom.h Fri May 14 19:43:53 2010 -0700
4.2 +++ b/core/logic/intercom.h Fri May 14 20:04:30 2010 -0700
4.3 @@ -42,7 +42,7 @@
4.4 * Add 1 to the RHS of this expression to bump the intercom file
4.5 * This is to prevent mismatching core/logic binaries
4.6 */
4.7 -#define SM_LOGIC_MAGIC (0x0F47C0DE - 10)
4.8 +#define SM_LOGIC_MAGIC (0x0F47C0DE - 11)
4.9
4.10 #if defined SM_LOGIC
4.11 class IVEngineServer
4.12 @@ -107,7 +107,6 @@
4.13 void (*LogError)(const char*, ...);
4.14 const char * (*GetCvarString)(ConVar*);
4.15 size_t (*Format)(char*, size_t, const char*, ...);
4.16 - unsigned int (*ReplaceAll)(char*, size_t, const char *, const char *, bool);
4.17 void (*GenerateError)(IPluginContext *, cell_t, int, const char *, ...);
4.18 bool (*gnprintf)(char *, size_t, const char *, IPhraseCollection *, void **,
4.19 unsigned int, unsigned int &, size_t *, const char **);
4.20 @@ -126,6 +125,8 @@
4.21 const char *(*stristr)(const char *, const char *);
4.22 bool (*CoreTranslate)(char *, size_t, const char *, unsigned int, size_t *, ...);
4.23 void (*AddCorePhraseFile)(const char *filename);
4.24 + unsigned int (*ReplaceAll)(char*, size_t, const char *, const char *, bool);
4.25 + char *(*ReplaceEx)(char *, size_t, const char *, size_t, const char *, size_t, bool);
4.26 };
4.27
4.28 typedef void (*LogicInitFunction)(const sm_core_t *core, sm_logic_t *logic);
5.1 --- a/core/logic/smn_banning.cpp Fri May 14 19:43:53 2010 -0700
5.2 +++ b/core/logic/smn_banning.cpp Fri May 14 20:04:30 2010 -0700
5.3 @@ -34,6 +34,7 @@
5.4 #include <IGameHelpers.h>
5.5 #include <IPlayerHelpers.h>
5.6 #include <IForwardSys.h>
5.7 +#include "stringutil.h"
5.8
5.9 #define BANFLAG_AUTO (1<<0) /**< Auto-detects whether to ban by steamid or IP */
5.10 #define BANFLAG_IP (1<<1) /**< Always ban by IP address */
5.11 @@ -117,8 +118,8 @@
5.12
5.13 /* Sanitize the input */
5.14 char identity[64];
5.15 - smcore.strncopy(identity, r_identity, sizeof(identity));
5.16 - smcore.ReplaceAll(identity, sizeof(identity), ";", "", true);
5.17 + strncopy(identity, r_identity, sizeof(identity));
5.18 + UTIL_ReplaceAll(identity, sizeof(identity), ";", "", true);
5.19
5.20 cell_t handled = 0;
5.21 if (ban_cmd[0] != '\0' && g_pOnBanIdentity->GetFunctionCount() > 0)
5.22 @@ -194,8 +195,8 @@
5.23 }
5.24
5.25 char identity[64];
5.26 - smcore.strncopy(identity, r_identity, sizeof(identity));
5.27 - smcore.ReplaceAll(identity, sizeof(identity), ";", "", true);
5.28 + strncopy(identity, r_identity, sizeof(identity));
5.29 + UTIL_ReplaceAll(identity, sizeof(identity), ";", "", true);
5.30
5.31 cell_t handled = 0;
5.32 if (ban_cmd[0] != '\0' && g_pOnRemoveBan->GetFunctionCount() > 0)
6.1 --- a/core/logic/stringutil.cpp Fri May 14 19:43:53 2010 -0700
6.2 +++ b/core/logic/stringutil.cpp Fri May 14 20:04:30 2010 -0700
6.3 @@ -81,4 +81,191 @@
6.4 return (dest - start);
6.5 }
6.6
6.7 +unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive)
6.8 +{
6.9 + size_t searchLen = strlen(search);
6.10 + size_t replaceLen = strlen(replace);
6.11
6.12 + char *ptr = subject;
6.13 + unsigned int total = 0;
6.14 + while ((ptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
6.15 + {
6.16 + total++;
6.17 + if (*ptr == '\0')
6.18 + {
6.19 + break;
6.20 + }
6.21 + }
6.22 +
6.23 + return total;
6.24 +}
6.25 +
6.26 +/**
6.27 + * NOTE: Do not edit this for the love of god unless you have
6.28 + * read the test cases and understand the code behind each one.
6.29 + * While I don't guarantee there aren't mistakes, I do guarantee
6.30 + * that plugins will end up relying on tiny idiosyncrasies of this
6.31 + * function, just like they did with AMX Mod X.
6.32 + *
6.33 + * There are explicitly more cases than the AMX Mod X version because
6.34 + * we're not doing a blind copy. Each case is specifically optimized
6.35 + * for what needs to be done. Even better, we don't have to error on
6.36 + * bad buffer sizes. Instead, this function will smartly cut off the
6.37 + * string in a way that pushes old data out.
6.38 + */
6.39 +char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive)
6.40 +{
6.41 + char *ptr = subject;
6.42 + size_t browsed = 0;
6.43 + size_t textLen = strlen(subject);
6.44 +
6.45 + /* It's not possible to search or replace */
6.46 + if (searchLen > textLen)
6.47 + {
6.48 + return NULL;
6.49 + }
6.50 +
6.51 + /* Handle the case of one byte replacement.
6.52 + * It's only valid in one case.
6.53 + */
6.54 + if (maxLen == 1)
6.55 + {
6.56 + /* If the search matches and the replace length is 0,
6.57 + * we can just terminate the string and be done.
6.58 + */
6.59 + if ((caseSensitive ? strcmp(subject, search) : strcasecmp(subject, search)) == 0 && replaceLen == 0)
6.60 + {
6.61 + *subject = '\0';
6.62 + return subject;
6.63 + }
6.64 + else
6.65 + {
6.66 + return NULL;
6.67 + }
6.68 + }
6.69 +
6.70 + /* Subtract one off the maxlength so we can include the null terminator */
6.71 + maxLen--;
6.72 +
6.73 + while (*ptr != '\0' && (browsed <= textLen - searchLen))
6.74 + {
6.75 + /* See if we get a comparison */
6.76 + if ((caseSensitive ? strncmp(ptr, search, searchLen) : strncasecmp(ptr, search, searchLen)) == 0)
6.77 + {
6.78 + if (replaceLen > searchLen)
6.79 + {
6.80 + /* First, see if we have enough space to do this operation */
6.81 + if (maxLen - textLen < replaceLen - searchLen)
6.82 + {
6.83 + /* First, see if the replacement length goes out of bounds. */
6.84 + if (browsed + replaceLen >= maxLen)
6.85 + {
6.86 + /* EXAMPLE CASE:
6.87 + * Subject: AABBBCCC
6.88 + * Buffer : 12 bytes
6.89 + * Search : BBB
6.90 + * Replace: DDDDDDDDDD
6.91 + * OUTPUT : AADDDDDDDDD
6.92 + * POSITION: ^
6.93 + */
6.94 + /* If it does, we'll just bound the length and do a strcpy. */
6.95 + replaceLen = maxLen - browsed;
6.96 + /* Note, we add one to the final result for the null terminator */
6.97 + strncopy(ptr, replace, replaceLen+1);
6.98 + }
6.99 + else
6.100 + {
6.101 + /* EXAMPLE CASE:
6.102 + * Subject: AABBBCCC
6.103 + * Buffer : 12 bytes
6.104 + * Search : BBB
6.105 + * Replace: DDDDDDD
6.106 + * OUTPUT : AADDDDDDDCC
6.107 + * POSITION: ^
6.108 + */
6.109 + /* We're going to have some bytes left over... */
6.110 + size_t origBytesToCopy = (textLen - (browsed + searchLen)) + 1;
6.111 + size_t realBytesToCopy = (maxLen - (browsed + replaceLen)) + 1;
6.112 + char *moveFrom = ptr + searchLen + (origBytesToCopy - realBytesToCopy);
6.113 + char *moveTo = ptr + replaceLen;
6.114 +
6.115 + /* First, move our old data out of the way. */
6.116 + memmove(moveTo, moveFrom, realBytesToCopy);
6.117 +
6.118 + /* Now, do our replacement. */
6.119 + memcpy(ptr, replace, replaceLen);
6.120 + }
6.121 + }
6.122 + else
6.123 + {
6.124 + /* EXAMPLE CASE:
6.125 + * Subject: AABBBCCC
6.126 + * Buffer : 12 bytes
6.127 + * Search : BBB
6.128 + * Replace: DDDD
6.129 + * OUTPUT : AADDDDCCC
6.130 + * POSITION: ^
6.131 + */
6.132 + /* Yes, we have enough space. Do a normal move operation. */
6.133 + char *moveFrom = ptr + searchLen;
6.134 + char *moveTo = ptr + replaceLen;
6.135 +
6.136 + /* First move our old data out of the way. */
6.137 + size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
6.138 + memmove(moveTo, moveFrom, bytesToCopy);
6.139 +
6.140 + /* Now do our replacement. */
6.141 + memcpy(ptr, replace, replaceLen);
6.142 + }
6.143 + }
6.144 + else if (replaceLen < searchLen)
6.145 + {
6.146 + /* EXAMPLE CASE:
6.147 + * Subject: AABBBCCC
6.148 + * Buffer : 12 bytes
6.149 + * Search : BBB
6.150 + * Replace: D
6.151 + * OUTPUT : AADCCC
6.152 + * POSITION: ^
6.153 + */
6.154 + /* If the replacement does not grow the string length, we do not
6.155 + * need to do any fancy checking at all. Yay!
6.156 + */
6.157 + char *moveFrom = ptr + searchLen; /* Start after the search pointer */
6.158 + char *moveTo = ptr + replaceLen; /* Copy to where the replacement ends */
6.159 +
6.160 + /* Copy our replacement in, if any */
6.161 + if (replaceLen)
6.162 + {
6.163 + memcpy(ptr, replace, replaceLen);
6.164 + }
6.165 +
6.166 + /* Figure out how many bytes to move down, including null terminator */
6.167 + size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
6.168 +
6.169 + /* Move the rest of the string down */
6.170 + memmove(moveTo, moveFrom, bytesToCopy);
6.171 + }
6.172 + else
6.173 + {
6.174 + /* EXAMPLE CASE:
6.175 + * Subject: AABBBCCC
6.176 + * Buffer : 12 bytes
6.177 + * Search : BBB
6.178 + * Replace: DDD
6.179 + * OUTPUT : AADDDCCC
6.180 + * POSITION: ^
6.181 + */
6.182 + /* We don't have to move anything around, just do a straight copy */
6.183 + memcpy(ptr, replace, replaceLen);
6.184 + }
6.185 +
6.186 + return ptr + replaceLen;
6.187 + }
6.188 + ptr++;
6.189 + browsed++;
6.190 + }
6.191 +
6.192 + return NULL;
6.193 +}
6.194 +
7.1 --- a/core/logic/stringutil.h Fri May 14 19:43:53 2010 -0700
7.2 +++ b/core/logic/stringutil.h Fri May 14 20:04:30 2010 -0700
7.3 @@ -34,6 +34,10 @@
7.4
7.5 const char *stristr(const char *str, const char *substr);
7.6 unsigned int strncopy(char *dest, const char *src, size_t count);
7.7 +unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search,
7.8 + const char *replace, bool caseSensitive = true);
7.9 +char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen,
7.10 + const char *replace, size_t replaceLen, bool caseSensitive = true);
7.11
7.12 #endif /* _INCLUDE_SOURCEMOD_COMMON_STRINGUTIL_H_ */
7.13
8.1 --- a/core/logic_bridge.cpp Fri May 14 19:43:53 2010 -0700
8.2 +++ b/core/logic_bridge.cpp Fri May 14 20:04:30 2010 -0700
8.3 @@ -135,7 +135,6 @@
8.4 log_error,
8.5 get_cvar_string,
8.6 UTIL_Format,
8.7 - UTIL_ReplaceAll,
8.8 generate_error,
8.9 gnprintf,
8.10 &serverGlobals
9.1 --- a/core/sm_stringutil.cpp Fri May 14 19:43:53 2010 -0700
9.2 +++ b/core/sm_stringutil.cpp Fri May 14 20:04:30 2010 -0700
9.3 @@ -1331,194 +1331,6 @@
9.4 return ptr;
9.5 }
9.6
9.7 -unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive)
9.8 -{
9.9 - size_t searchLen = strlen(search);
9.10 - size_t replaceLen = strlen(replace);
9.11 -
9.12 - char *ptr = subject;
9.13 - unsigned int total = 0;
9.14 - while ((ptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
9.15 - {
9.16 - total++;
9.17 - if (*ptr == '\0')
9.18 - {
9.19 - break;
9.20 - }
9.21 - }
9.22 -
9.23 - return total;
9.24 -}
9.25 -
9.26 -/**
9.27 - * NOTE: Do not edit this for the love of god unless you have
9.28 - * read the test cases and understand the code behind each one.
9.29 - * While I don't guarantee there aren't mistakes, I do guarantee
9.30 - * that plugins will end up relying on tiny idiosyncrasies of this
9.31 - * function, just like they did with AMX Mod X.
9.32 - *
9.33 - * There are explicitly more cases than the AMX Mod X version because
9.34 - * we're not doing a blind copy. Each case is specifically optimized
9.35 - * for what needs to be done. Even better, we don't have to error on
9.36 - * bad buffer sizes. Instead, this function will smartly cut off the
9.37 - * string in a way that pushes old data out.
9.38 - */
9.39 -char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive)
9.40 -{
9.41 - char *ptr = subject;
9.42 - size_t browsed = 0;
9.43 - size_t textLen = strlen(subject);
9.44 -
9.45 - /* It's not possible to search or replace */
9.46 - if (searchLen > textLen)
9.47 - {
9.48 - return NULL;
9.49 - }
9.50 -
9.51 - /* Handle the case of one byte replacement.
9.52 - * It's only valid in one case.
9.53 - */
9.54 - if (maxLen == 1)
9.55 - {
9.56 - /* If the search matches and the replace length is 0,
9.57 - * we can just terminate the string and be done.
9.58 - */
9.59 - if ((caseSensitive ? strcmp(subject, search) : strcasecmp(subject, search)) == 0 && replaceLen == 0)
9.60 - {
9.61 - *subject = '\0';
9.62 - return subject;
9.63 - }
9.64 - else
9.65 - {
9.66 - return NULL;
9.67 - }
9.68 - }
9.69 -
9.70 - /* Subtract one off the maxlength so we can include the null terminator */
9.71 - maxLen--;
9.72 -
9.73 - while (*ptr != '\0' && (browsed <= textLen - searchLen))
9.74 - {
9.75 - /* See if we get a comparison */
9.76 - if ((caseSensitive ? strncmp(ptr, search, searchLen) : strncasecmp(ptr, search, searchLen)) == 0)
9.77 - {
9.78 - if (replaceLen > searchLen)
9.79 - {
9.80 - /* First, see if we have enough space to do this operation */
9.81 - if (maxLen - textLen < replaceLen - searchLen)
9.82 - {
9.83 - /* First, see if the replacement length goes out of bounds. */
9.84 - if (browsed + replaceLen >= maxLen)
9.85 - {
9.86 - /* EXAMPLE CASE:
9.87 - * Subject: AABBBCCC
9.88 - * Buffer : 12 bytes
9.89 - * Search : BBB
9.90 - * Replace: DDDDDDDDDD
9.91 - * OUTPUT : AADDDDDDDDD
9.92 - * POSITION: ^
9.93 - */
9.94 - /* If it does, we'll just bound the length and do a strcpy. */
9.95 - replaceLen = maxLen - browsed;
9.96 - /* Note, we add one to the final result for the null terminator */
9.97 - strncopy(ptr, replace, replaceLen+1);
9.98 - }
9.99 - else
9.100 - {
9.101 - /* EXAMPLE CASE:
9.102 - * Subject: AABBBCCC
9.103 - * Buffer : 12 bytes
9.104 - * Search : BBB
9.105 - * Replace: DDDDDDD
9.106 - * OUTPUT : AADDDDDDDCC
9.107 - * POSITION: ^
9.108 - */
9.109 - /* We're going to have some bytes left over... */
9.110 - size_t origBytesToCopy = (textLen - (browsed + searchLen)) + 1;
9.111 - size_t realBytesToCopy = (maxLen - (browsed + replaceLen)) + 1;
9.112 - char *moveFrom = ptr + searchLen + (origBytesToCopy - realBytesToCopy);
9.113 - char *moveTo = ptr + replaceLen;
9.114 -
9.115 - /* First, move our old data out of the way. */
9.116 - memmove(moveTo, moveFrom, realBytesToCopy);
9.117 -
9.118 - /* Now, do our replacement. */
9.119 - memcpy(ptr, replace, replaceLen);
9.120 - }
9.121 - }
9.122 - else
9.123 - {
9.124 - /* EXAMPLE CASE:
9.125 - * Subject: AABBBCCC
9.126 - * Buffer : 12 bytes
9.127 - * Search : BBB
9.128 - * Replace: DDDD
9.129 - * OUTPUT : AADDDDCCC
9.130 - * POSITION: ^
9.131 - */
9.132 - /* Yes, we have enough space. Do a normal move operation. */
9.133 - char *moveFrom = ptr + searchLen;
9.134 - char *moveTo = ptr + replaceLen;
9.135 -
9.136 - /* First move our old data out of the way. */
9.137 - size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
9.138 - memmove(moveTo, moveFrom, bytesToCopy);
9.139 -
9.140 - /* Now do our replacement. */
9.141 - memcpy(ptr, replace, replaceLen);
9.142 - }
9.143 - }
9.144 - else if (replaceLen < searchLen)
9.145 - {
9.146 - /* EXAMPLE CASE:
9.147 - * Subject: AABBBCCC
9.148 - * Buffer : 12 bytes
9.149 - * Search : BBB
9.150 - * Replace: D
9.151 - * OUTPUT : AADCCC
9.152 - * POSITION: ^
9.153 - */
9.154 - /* If the replacement does not grow the string length, we do not
9.155 - * need to do any fancy checking at all. Yay!
9.156 - */
9.157 - char *moveFrom = ptr + searchLen; /* Start after the search pointer */
9.158 - char *moveTo = ptr + replaceLen; /* Copy to where the replacement ends */
9.159 -
9.160 - /* Copy our replacement in, if any */
9.161 - if (replaceLen)
9.162 - {
9.163 - memcpy(ptr, replace, replaceLen);
9.164 - }
9.165 -
9.166 - /* Figure out how many bytes to move down, including null terminator */
9.167 - size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
9.168 -
9.169 - /* Move the rest of the string down */
9.170 - memmove(moveTo, moveFrom, bytesToCopy);
9.171 - }
9.172 - else
9.173 - {
9.174 - /* EXAMPLE CASE:
9.175 - * Subject: AABBBCCC
9.176 - * Buffer : 12 bytes
9.177 - * Search : BBB
9.178 - * Replace: DDD
9.179 - * OUTPUT : AADDDCCC
9.180 - * POSITION: ^
9.181 - */
9.182 - /* We don't have to move anything around, just do a straight copy */
9.183 - memcpy(ptr, replace, replaceLen);
9.184 - }
9.185 -
9.186 - return ptr + replaceLen;
9.187 - }
9.188 - ptr++;
9.189 - browsed++;
9.190 - }
9.191 -
9.192 - return NULL;
9.193 -}
9.194 -
9.195 char *UTIL_TrimWhitespace(char *str, size_t &len)
9.196 {
9.197 char *end = str + len - 1;
10.1 --- a/core/sm_stringutil.h Fri May 14 19:43:53 2010 -0700
10.2 +++ b/core/sm_stringutil.h Fri May 14 20:04:30 2010 -0700
10.3 @@ -56,8 +56,6 @@
10.4 size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...);
10.5 size_t UTIL_FormatArgs(char *buffer, size_t maxlength, const char *fmt, va_list ap);
10.6 char *sm_strdup(const char *str);
10.7 -unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive = true);
10.8 -char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive = true);
10.9 char *UTIL_TrimWhitespace(char *str, size_t &len);
10.10 size_t UTIL_DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr);
10.11 char *UTIL_ToLowerCase(const char *str);
11.1 --- a/core/smn_string.cpp Fri May 14 19:43:53 2010 -0700
11.2 +++ b/core/smn_string.cpp Fri May 14 20:04:30 2010 -0700
11.3 @@ -514,7 +514,7 @@
11.4 return pContext->ThrowNativeError("Cannot replace searches of empty strings");
11.5 }
11.6
11.7 - return UTIL_ReplaceAll(text, maxlength, search, replace, caseSensitive);
11.8 + return logicore.ReplaceAll(text, maxlength, search, replace, caseSensitive);
11.9 }
11.10
11.11 static cell_t ReplaceStringEx(IPluginContext *pContext, const cell_t *params)
11.12 @@ -546,7 +546,7 @@
11.13 return pContext->ThrowNativeError("Cannot replace searches of empty strings");
11.14 }
11.15
11.16 - char *ptr = UTIL_ReplaceEx(text, maxlength, search, searchLen, replace, replaceLen, caseSensitive);
11.17 + char *ptr = logicore.ReplaceEx(text, maxlength, search, searchLen, replace, replaceLen, caseSensitive);
11.18
11.19 if (ptr == NULL)
11.20 {