From 488edd9cd1b48ee6650d6f05d3348d2c2f6ed387 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Mon, 14 Aug 2017 10:00:17 -0400 Subject: [PATCH] More MinGW fixes because Thanks MinGW SeemsGood --- single/sol/sol.hpp | 12 +++++++----- sol/compatibility/5.x.x.inl | 9 ++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index 8410e11c..26a769ac 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2017-08-14 00:39:04.525857 UTC -// This header was generated with sol v2.18.0 (revision 3a12435) +// Generated 2017-08-14 13:59:52.716584 UTC +// This header was generated with sol v2.18.0 (revision 9b1c70c) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -2018,7 +2018,7 @@ int strerror_r(int errnum, char *buf, size_t len) { // pthreads isn't guaranteed either // let's just hope the stdc lib devs use thread_local on their stuff char* hopeitsthreadlocal = strerror(errnum); - if (snprintf(buf, len, "%s", hopeitsthreadlocal) >= len) { + if (snprintf(buf, len, "%s", hopeitsthreadlocal) >= (ptrdiff_t)len) { // if this triggers we attempted to overwrite the buffer // how fun errno = ERANGE; @@ -2291,9 +2291,11 @@ inline void lua_len(lua_State *L, int i) { if (luaL_callmeta(L, i, "__len")) break; /* maybe fall through */ + luaL_error(L, "attempt to get length of a %s value", lua_typename(L, lua_type(L, i))); + break; default: - luaL_error(L, "attempt to get length of a %s value", - lua_typename(L, lua_type(L, i))); + luaL_error(L, "attempt to get length of a %s value", lua_typename(L, lua_type(L, i))); + break; } } diff --git a/sol/compatibility/5.x.x.inl b/sol/compatibility/5.x.x.inl index 0249bb10..c5aa4977 100644 --- a/sol/compatibility/5.x.x.inl +++ b/sol/compatibility/5.x.x.inl @@ -32,6 +32,7 @@ #include #include +#include #define PACKAGE_KEY "_sol.package" @@ -339,7 +340,7 @@ int strerror_r(int errnum, char *buf, size_t len) { // pthreads isn't guaranteed either // let's just hope the stdc lib devs use thread_local on their stuff char* hopeitsthreadlocal = strerror(errnum); - if (snprintf(buf, len, "%s", hopeitsthreadlocal) >= len) { + if (snprintf(buf, len, "%s", hopeitsthreadlocal) >= (ptrdiff_t)len) { // if this triggers we attempted to overwrite the buffer // how fun errno = ERANGE; @@ -619,9 +620,11 @@ inline void lua_len(lua_State *L, int i) { if (luaL_callmeta(L, i, "__len")) break; /* maybe fall through */ + luaL_error(L, "attempt to get length of a %s value", lua_typename(L, lua_type(L, i))); + break; default: - luaL_error(L, "attempt to get length of a %s value", - lua_typename(L, lua_type(L, i))); + luaL_error(L, "attempt to get length of a %s value", lua_typename(L, lua_type(L, i))); + break; } }