Skip to content

Commit

Permalink
More MinGW fixes because Thanks MinGW SeemsGood
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhD committed Aug 14, 2017
1 parent 9b1c70c commit 488edd9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
12 changes: 7 additions & 5 deletions single/sol/sol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}

Expand Down
9 changes: 6 additions & 3 deletions sol/compatibility/5.x.x.inl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <errno.h>
#include <string.h>
#include <stdio.h>

#define PACKAGE_KEY "_sol.package"

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 488edd9

Please sign in to comment.