Skip to content

Commit c7989ba

Browse files
committed
A couple of tidy ups regarding strings
1 parent 1b6558e commit c7989ba

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Utilities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ void MakeTableItem (lua_State *L, const char * name, const CString & str)
15321532
void MakeTableItem (lua_State *L, const char * name, const string & str)
15331533
{
15341534
lua_pushstring (L, name);
1535-
lua_pushstring (L, str.c_str ());
1535+
lua_pushlstring (L, str.c_str (), str.size ());
15361536
lua_rawset(L, -3);
15371537
}
15381538

scripting/lua_scripting.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ bool CScriptEngine::ExecuteLua (DISPID & dispid, // dispatch ID, will be set to
470470

471471
for (i = 0; i <= ncapt; i++)
472472
{
473-
lua_pushstring(L, regexp->GetWildcard (i).c_str ());
473+
string wildcard (regexp->GetWildcard (i));
474+
lua_pushlstring (L, wildcard.c_str (), wildcard.size ());
474475
lua_rawseti (L, -2, i);
475476
}
476477

@@ -508,7 +509,10 @@ bool CScriptEngine::ExecuteLua (DISPID & dispid, // dispatch ID, will be set to
508509

509510
lua_pushstring (L, (LPCTSTR) name);
510511
if (n >= 0 && n <= ncapt)
511-
lua_pushstring(L, regexp->GetWildcard (n).c_str ());
512+
{
513+
string wildcard (regexp->GetWildcard (n));
514+
lua_pushlstring (L, wildcard.c_str (), wildcard.size ());
515+
}
512516
else
513517
lua_pushnil (L); /* n out of range */
514518
lua_settable (L, -3);

0 commit comments

Comments
 (0)