SHA256
12
0
forked from pool/wxlua
wxlua/wxMemoryBuffer.patch

107 lines
5.3 KiB
Diff
Raw Normal View History

From b8e7d43a4fe1897cb4e1f7b6749ee3184d3a9011 Mon Sep 17 00:00:00 2001
Message-Id: <b8e7d43a4fe1897cb4e1f7b6749ee3184d3a9011.1593283264.git.matthias@mailaender.name>
From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= <matthias@mailaender.name>
Date: Sat, 27 Jun 2020 20:40:47 +0200
Subject: [PATCH] Fix undefined reference to `wxluatype_wxMemoryBuffer'
---
wxLua/bindings/wxwidgets/wxbase_rules.lua | 1 +
wxLua/modules/wxbind/src/wxbase_bind.cpp | 1 +
wxLua/modules/wxlua/wxlbind.cpp | 1 +
wxLua/modules/wxlua/wxlbind.h | 1 +
wxLua/modules/wxlua/wxllua.cpp | 9 +++------
5 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/wxLua/bindings/wxwidgets/wxbase_rules.lua b/wxLua/bindings/wxwidgets/wxbase_rules.lua
index 3b98165..e6b76ff 100644
--- a/wxLua/bindings/wxwidgets/wxbase_rules.lua
+++ b/wxLua/bindings/wxwidgets/wxbase_rules.lua
@@ -183,6 +183,7 @@ wxLuaBinding_class_implementation =
p_wxluatype_wxSortedArrayString = &wxluatype_wxSortedArrayString;
p_wxluatype_wxArrayInt = &wxluatype_wxArrayInt;
p_wxluatype_wxArrayDouble = &wxluatype_wxArrayDouble;
+ p_wxluatype_wxMemoryBuffer = &wxluatype_wxMemoryBuffer;
return ret;
}
diff --git a/wxLua/modules/wxbind/src/wxbase_bind.cpp b/wxLua/modules/wxbind/src/wxbase_bind.cpp
index 6be3088..d34ec0c 100644
--- a/wxLua/modules/wxbind/src/wxbase_bind.cpp
+++ b/wxLua/modules/wxbind/src/wxbase_bind.cpp
@@ -3138,6 +3138,7 @@ bool wxLuaBinding_wxbase::RegisterBinding(const wxLuaState& wxlState)
p_wxluatype_wxSortedArrayString = &wxluatype_wxSortedArrayString;
p_wxluatype_wxArrayInt = &wxluatype_wxArrayInt;
p_wxluatype_wxArrayDouble = &wxluatype_wxArrayDouble;
+ p_wxluatype_wxMemoryBuffer = &wxluatype_wxMemoryBuffer;
return ret;
}
diff --git a/wxLua/modules/wxlua/wxlbind.cpp b/wxLua/modules/wxlua/wxlbind.cpp
index c7a1ab2..abeeabf 100644
--- a/wxLua/modules/wxlua/wxlbind.cpp
+++ b/wxLua/modules/wxlua/wxlbind.cpp
@@ -55,6 +55,7 @@ int* p_wxluatype_wxArrayString = &wxluatype_TUNKNOWN;
int* p_wxluatype_wxSortedArrayString = &wxluatype_TUNKNOWN;
int* p_wxluatype_wxArrayInt = &wxluatype_TUNKNOWN;
int* p_wxluatype_wxArrayDouble = &wxluatype_TUNKNOWN;
+int* p_wxluatype_wxMemoryBuffer = &wxluatype_TUNKNOWN;
int* p_wxluatype_wxPoint = &wxluatype_TUNKNOWN;
// ----------------------------------------------------------------------------
diff --git a/wxLua/modules/wxlua/wxlbind.h b/wxLua/modules/wxlua/wxlbind.h
index 90aef63..71141ec 100644
--- a/wxLua/modules/wxlua/wxlbind.h
+++ b/wxLua/modules/wxlua/wxlbind.h
@@ -123,6 +123,7 @@ extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxArrayString; // wxLua type for
extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxSortedArrayString; // wxLua type for wxSortedArrayString
extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxArrayInt; // wxLua type for wxArrayInt
extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxArrayDouble; // wxLua type for wxArrayDouble
+extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxMemoryBuffer; // wxLua type for wxMemoryBuffer
extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxPoint; // wxLua type for wxPoint
// ----------------------------------------------------------------------------
diff --git a/wxLua/modules/wxlua/wxllua.cpp b/wxLua/modules/wxlua/wxllua.cpp
index d910816..2214b13 100644
--- a/wxLua/modules/wxlua/wxllua.cpp
+++ b/wxLua/modules/wxlua/wxllua.cpp
@@ -982,15 +982,13 @@ const wxLuaBindClass* LUACALL wxluaT_getclass(lua_State* L, const char* class_na
bool wxluaT_isuserdatatype(lua_State* L, int stack_idx, int wxl_type)
{
- extern int wxluatype_wxMemoryBuffer;
-
int stack_type = wxluaT_type(L, stack_idx);
if (wxlua_iswxuserdatatype(stack_type) &&
((wxluatype_NULL == stack_type) || // FIXME, how to check when NULL is valid or not?
((wxl_type == WXLUA_TSTRING) &&
((wxluaT_isderivedtype(L, stack_type, *p_wxluatype_wxString) >= 0) ||
- (wxluaT_isderivedtype(L, stack_type, wxluatype_wxMemoryBuffer) >= 0))) ||
+ (wxluaT_isderivedtype(L, stack_type, *p_wxluatype_wxMemoryBuffer) >= 0))) ||
(wxluaT_isderivedtype(L, stack_type, wxl_type) >= 0)))
return true;
@@ -1407,7 +1405,6 @@ const char* LUACALL wxlua_getstringtypelen(lua_State *L, int stack_idx, size_t *
return lua_tolstring(L, stack_idx, len);
else if (wxlua_iswxuserdata(L, stack_idx))
{
- extern int wxluatype_wxMemoryBuffer;
int stack_type = wxluaT_type(L, stack_idx);
if (wxluaT_isderivedtype(L, stack_type, *p_wxluatype_wxString) >= 0)
@@ -1419,9 +1416,9 @@ const char* LUACALL wxlua_getstringtypelen(lua_State *L, int stack_idx, size_t *
*len = strlen(retp);
return retp;
}
- else if (wxluaT_isderivedtype(L, stack_type, wxluatype_wxMemoryBuffer) >= 0)
+ else if (wxluaT_isderivedtype(L, stack_type, *p_wxluatype_wxMemoryBuffer) >= 0)
{
- wxMemoryBuffer * wxmem = (wxMemoryBuffer *)wxluaT_getuserdatatype(L, stack_idx, wxluatype_wxMemoryBuffer);
+ wxMemoryBuffer * wxmem = (wxMemoryBuffer *)wxluaT_getuserdatatype(L, stack_idx, *p_wxluatype_wxMemoryBuffer);
const char *datap = (const char *)wxmem->GetData();
if (len != NULL)
*len = wxmem->GetDataLen();
--
2.26.2