Skip to content

Commit 8478243

Browse files
committed
Amendments to allow for error code from _pcre_valid_utf8 being > 0, not >= 0
1 parent d72fa69 commit 8478243

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

ProcessPreviousLine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ assemble the full text of the original line.
557557
{
558558
iBad = _pcre_valid_utf8 ((const unsigned char *) (const char *) strCurrentLine,
559559
strCurrentLine.GetLength ());
560-
if (iBad >= 0)
560+
if (iBad > 0)
561561
{
562562
m_iUTF8ErrorCount++;
563563

Utilities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2889,7 +2889,7 @@ int UMessageBox (const char * sText, UINT nType, const char * sTitle)
28892889
iBad = _pcre_valid_utf8 ((unsigned char *) sTitle, strlen (sTitle));
28902890

28912891
// use PCRE to validate the title next - if bad, use "MUSHclient" title
2892-
if (iBad >= 0)
2892+
if (iBad > 0)
28932893
sTitle = "MUSHclient";
28942894

28952895
iLength = MultiByteToWideChar (CP_UTF8, 0, sTitle, -1, NULL, 0);

miniwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ static long CalculateUTF8length (LPCTSTR Text, size_t length)
764764
{
765765

766766
int iBad = _pcre_valid_utf8 ((unsigned char *) Text, length);
767-
if (iBad >= 0)
767+
if (iBad > 0)
768768
return -1;
769769

770770
// string is OK, calculate its length

scripting/lua_utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ const char * data = luaL_checkstring (L, 1);
11141114
int iBad = _pcre_valid_utf8 ((unsigned char *) data, strlen (data));
11151115
11161116
// use PCRE to validate the string first
1117-
if (iBad >= 0)
1117+
if (iBad > 0)
11181118
luaL_error (L, "Bad UTF-8 string. Error at column %d", iBad + 1);
11191119
11201120
// find how big table has to be
@@ -1157,7 +1157,7 @@ const char * data = luaL_checkstring (L, 1);
11571157
int iBad = _pcre_valid_utf8 ((unsigned char *) data, strlen (data));
11581158
11591159
// use PCRE to validate the string first
1160-
if (iBad >= 0)
1160+
if (iBad > 0)
11611161
luaL_error (L, "Bad UTF-8 string. Error at column %d", iBad + 1);
11621162
11631163
lua_newtable (L); // table of wide characters
@@ -1348,7 +1348,7 @@ const char * data = luaL_checklstring (L, 1, &length);
13481348

13491349
int iBad = _pcre_valid_utf8 ((unsigned char *) data, length);
13501350

1351-
if (iBad >= 0)
1351+
if (iBad > 0)
13521352
{
13531353
lua_pushnil (L);
13541354
lua_pushnumber (L, iBad + 1);
@@ -1393,7 +1393,7 @@ static int utf8sub (lua_State *L) {
13931393

13941394
int iBad = _pcre_valid_utf8 ((unsigned char *) s, length);
13951395

1396-
if (iBad >= 0)
1396+
if (iBad > 0)
13971397
{
13981398
lua_pushnil (L);
13991399
lua_pushnumber (L, iBad + 1);

0 commit comments

Comments
 (0)