From: John L. <jr...@us...> - 2007-06-26 22:16:42
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv3484/wxLua/modules/wxbind/src Modified Files: wx_bind.cpp Log Message: "fix" for wxGetTranslation. Seems like passing an empty wxString for const wxChar* parameter fails if the function checks that the input == NULL. This should evaluate to true, str.c_str()[0] == 0, so what's really the problem? Index: wx_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wx_bind.cpp,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** wx_bind.cpp 26 Jun 2007 03:22:07 -0000 1.119 --- wx_bind.cpp 26 Jun 2007 22:16:38 -0000 1.120 *************** *** 5477,5481 **** #if (wxCHECK_VERSION(2,8,0)) && (wxUSE_INTL) static wxLuaArgTag s_wxluatagArray_wxLua_function_wxGetTranslation[] = { &s_wxluaarg_String, &s_wxluaarg_String, NULL }; ! // %wxchkver_2_8 %function wxString wxGetTranslation(const wxString& sz, const wxString& domain="") static int LUACALL wxLua_function_wxGetTranslation(lua_State *L) { --- 5477,5481 ---- #if (wxCHECK_VERSION(2,8,0)) && (wxUSE_INTL) static wxLuaArgTag s_wxluatagArray_wxLua_function_wxGetTranslation[] = { &s_wxluaarg_String, &s_wxluaarg_String, NULL }; ! // %wxchkver_2_8 %function wxString wxGetTranslation(const wxString& sz, const wxChar* domain=NULL) static int LUACALL wxLua_function_wxGetTranslation(lua_State *L) { *************** *** 5484,5493 **** // get number of arguments int argCount = lua_gettop(L); ! // const wxString domain = "" ! const wxString domain = (argCount >= 2 ? wxlState.GetwxStringType(2) : wxString(wxEmptyString)); // const wxString sz const wxString sz = wxlState.GetwxStringType(1); // call wxGetTranslation ! returns = (wxGetTranslation(sz, domain)); // push the result string wxlState.lua_PushString(returns); --- 5484,5493 ---- // get number of arguments int argCount = lua_gettop(L); ! // const wxChar domain = NULL ! wxString domain = (argCount >= 2 ? wxlState.GetwxStringType(2) : wxEmptyString); // const wxString sz const wxString sz = wxlState.GetwxStringType(1); // call wxGetTranslation ! returns = (wxGetTranslation(sz, domain.IsEmpty() ? NULL : domain.c_str())); // push the result string wxlState.lua_PushString(returns); *************** *** 5525,5529 **** #if (wxCHECK_VERSION(2,8,0)) && (wxUSE_INTL) static wxLuaArgTag s_wxluatagArray_wxLua_function_wxGetTranslationPlural[] = { &s_wxluaarg_String, &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_String, NULL }; ! // %wxchkver_2_8 %rename wxGetTranslationPlural %function wxString wxGetTranslation(const wxString& sz1, const wxString& sz2, size_t n, const wxString& domain="") static int LUACALL wxLua_function_wxGetTranslationPlural(lua_State *L) { --- 5525,5529 ---- #if (wxCHECK_VERSION(2,8,0)) && (wxUSE_INTL) static wxLuaArgTag s_wxluatagArray_wxLua_function_wxGetTranslationPlural[] = { &s_wxluaarg_String, &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_String, NULL }; ! // %wxchkver_2_8 %rename wxGetTranslationPlural %function wxString wxGetTranslation(const wxString& sz1, const wxString& sz2, size_t n, const wxChar* domain=NULL) static int LUACALL wxLua_function_wxGetTranslationPlural(lua_State *L) { *************** *** 5532,5537 **** // get number of arguments int argCount = lua_gettop(L); ! // const wxString domain = "" ! const wxString domain = (argCount >= 4 ? wxlState.GetwxStringType(4) : wxString(wxEmptyString)); // size_t n size_t n = (size_t)wxlua_getnumbertype(L, 3); --- 5532,5537 ---- // get number of arguments int argCount = lua_gettop(L); ! // const wxChar domain = NULL ! wxString domain = (argCount >= 4 ? wxlState.GetwxStringType(4) : wxEmptyString); // size_t n size_t n = (size_t)wxlua_getnumbertype(L, 3); *************** *** 5541,5545 **** const wxString sz1 = wxlState.GetwxStringType(1); // call wxGetTranslation ! returns = (wxGetTranslation(sz1, sz2, n, domain)); // push the result string wxlState.lua_PushString(returns); --- 5541,5545 ---- const wxString sz1 = wxlState.GetwxStringType(1); // call wxGetTranslation ! returns = (wxGetTranslation(sz1, sz2, n, domain.IsEmpty() ? NULL : domain.c_str())); // push the result string wxlState.lua_PushString(returns); |