Commit 45286744 authored by capresti's avatar capresti
Browse files

- Fix for issue #1

git-svn-id: http://luainterface.googlecode.com/svn/trunk@5 63eb109e-e254-0410-a61e-ed0b8f8614f5
parent dca120aa
...@@ -13,6 +13,7 @@ using namespace System::Security; ...@@ -13,6 +13,7 @@ using namespace System::Security;
// #include <atlstr.h> // #include <atlstr.h>
#include <stdio.h> #include <stdio.h>
#using <mscorlib.dll> #using <mscorlib.dll>
#include <string.h>
// #define LUA_BUILD_AS_DLL // #define LUA_BUILD_AS_DLL
#define LUA_LIB #define LUA_LIB
...@@ -660,7 +661,8 @@ namespace Lua511 ...@@ -660,7 +661,8 @@ namespace Lua511
char *cs1 = (char *) Marshal::StringToHGlobalAnsi(buff).ToPointer(); char *cs1 = (char *) Marshal::StringToHGlobalAnsi(buff).ToPointer();
char *cs2 = (char *) Marshal::StringToHGlobalAnsi(name).ToPointer(); char *cs2 = (char *) Marshal::StringToHGlobalAnsi(name).ToPointer();
int result = ::luaL_loadbuffer(toState, cs1, buff->Length, cs2); //CP: fix for MBCS, changed to use cs1's length (reported by qingrui.li)
int result = ::luaL_loadbuffer(toState, cs1, strlen(cs1), cs2);
Marshal::FreeHGlobal(IntPtr(cs1)); Marshal::FreeHGlobal(IntPtr(cs1));
Marshal::FreeHGlobal(IntPtr(cs2)); Marshal::FreeHGlobal(IntPtr(cs2));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment