More MinGW fixes because Thanks MinGW SeemsGood

This commit is contained in:
ThePhD 2017-08-14 10:00:17 -04:00
parent 9b1c70cdf8
commit 488edd9cd1
2 changed files with 13 additions and 8 deletions

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script. // This file was generated with a script.
// Generated 2017-08-14 00:39:04.525857 UTC // Generated 2017-08-14 13:59:52.716584 UTC
// This header was generated with sol v2.18.0 (revision 3a12435) // This header was generated with sol v2.18.0 (revision 9b1c70c)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP #ifndef SOL_SINGLE_INCLUDE_HPP
@ -2018,7 +2018,7 @@ int strerror_r(int errnum, char *buf, size_t len) {
// pthreads isn't guaranteed either // pthreads isn't guaranteed either
// let's just hope the stdc lib devs use thread_local on their stuff // let's just hope the stdc lib devs use thread_local on their stuff
char* hopeitsthreadlocal = strerror(errnum); 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 // if this triggers we attempted to overwrite the buffer
// how fun // how fun
errno = ERANGE; errno = ERANGE;
@ -2291,9 +2291,11 @@ inline void lua_len(lua_State *L, int i) {
if (luaL_callmeta(L, i, "__len")) if (luaL_callmeta(L, i, "__len"))
break; break;
/* maybe fall through */ /* maybe fall through */
luaL_error(L, "attempt to get length of a %s value", lua_typename(L, lua_type(L, i)));
break;
default: default:
luaL_error(L, "attempt to get length of a %s value", luaL_error(L, "attempt to get length of a %s value", lua_typename(L, lua_type(L, i)));
lua_typename(L, lua_type(L, i))); break;
} }
} }

View File

@ -32,6 +32,7 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#define PACKAGE_KEY "_sol.package" #define PACKAGE_KEY "_sol.package"
@ -339,7 +340,7 @@ int strerror_r(int errnum, char *buf, size_t len) {
// pthreads isn't guaranteed either // pthreads isn't guaranteed either
// let's just hope the stdc lib devs use thread_local on their stuff // let's just hope the stdc lib devs use thread_local on their stuff
char* hopeitsthreadlocal = strerror(errnum); 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 // if this triggers we attempted to overwrite the buffer
// how fun // how fun
errno = ERANGE; errno = ERANGE;
@ -619,9 +620,11 @@ inline void lua_len(lua_State *L, int i) {
if (luaL_callmeta(L, i, "__len")) if (luaL_callmeta(L, i, "__len"))
break; break;
/* maybe fall through */ /* maybe fall through */
luaL_error(L, "attempt to get length of a %s value", lua_typename(L, lua_type(L, i)));
break;
default: default:
luaL_error(L, "attempt to get length of a %s value", luaL_error(L, "attempt to get length of a %s value", lua_typename(L, lua_type(L, i)));
lua_typename(L, lua_type(L, i))); break;
} }
} }