minor formatting change
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11995 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
bdea09ed83
commit
2535297efb
8 changed files with 22 additions and 24 deletions
|
|
@ -12,11 +12,11 @@
|
|||
%{
|
||||
#include <stdlib.h>
|
||||
|
||||
wchar_t* str2wstr(const char* str, int len)
|
||||
wchar_t* str2wstr(const char *str, int len)
|
||||
{
|
||||
wchar_t* p;
|
||||
if (str==0 || len<1) return 0;
|
||||
p=(wchar*)malloc((len+1)*sizeof(wchar_t));
|
||||
p=(wchar *)malloc((len+1)*sizeof(wchar_t));
|
||||
if (p==0) return 0;
|
||||
if (mbstowcs(p, str, len)==-1)
|
||||
{
|
||||
|
|
@ -28,13 +28,13 @@ wchar_t* str2wstr(const char* str, int len)
|
|||
}
|
||||
%}
|
||||
|
||||
%typemap(in, checkfn="SWIG_lua_isnilstring", fragment="SWIG_lua_isnilstring") wchar_t*
|
||||
%typemap(in, checkfn="SWIG_lua_isnilstring", fragment="SWIG_lua_isnilstring") wchar_t *
|
||||
%{
|
||||
$1 = str2wstr(lua_tostring( L, $input ),lua_strlen( L, $input ));
|
||||
if ($1==0) {lua_pushfstring(L,"Error in converting to wchar (arg %d)",$input);goto fail;}
|
||||
%}
|
||||
|
||||
%typemap(freearg) wchar_t*
|
||||
%typemap(freearg) wchar_t *
|
||||
%{
|
||||
free($1);
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue