diff --git a/extend/lcodec/src/websocket.h b/extend/lcodec/src/websocket.h index cc4861f7..ebfb7c52 100644 --- a/extend/lcodec/src/websocket.h +++ b/extend/lcodec/src/websocket.h @@ -105,7 +105,7 @@ namespace lcodec { protected: char* xor_byte(char* buffer, char* mask, size_t blen, size_t mlen) { - for (int i = 0; i < blen; i++) { + for (size_t i = 0; i < blen; i++) { buffer[i] = buffer[i] ^ mask[i % mlen]; } return buffer; diff --git a/extend/lssl/src/ssl/lssl.cpp b/extend/lssl/src/ssl/lssl.cpp index f1d8f934..3ea18b0a 100644 --- a/extend/lssl/src/ssl/lssl.cpp +++ b/extend/lssl/src/ssl/lssl.cpp @@ -77,17 +77,17 @@ namespace lssl { } static int lfromhex(lua_State* L) { - int sz = 0; + size_t sz = 0; const unsigned char* text = (const unsigned char*)luaL_checklstring(L, 1, &sz); if (sz & 2) { - return luaL_error(L, "Invalid hex text size %d", (int)sz); + return luaL_error(L, "Invalid hex text size %lu", (int)sz); } char tmp[UCHAR_MAX]; char* buffer = tmp; if (sz > UCHAR_MAX * 2) { buffer = (char*)lua_newuserdata(L, sz / 2); } - int i; + size_t i; for (i = 0; i < sz; i += 2) { char hi, low; HEX(hi, text[i]); @@ -281,7 +281,7 @@ namespace lssl { } static int lxor_byte(lua_State* L) { - int len1, len2; + size_t len1, len2; const char* s1 = luaL_checklstring(L, 1, &len1); const char* s2 = luaL_checklstring(L, 2, &len2); if (len2 == 0) { @@ -289,7 +289,7 @@ namespace lssl { } luaL_Buffer b; char* buffer = luaL_buffinitsize(L, &b, len1); - int i; + size_t i; for (i = 0; i < len1; i++) { buffer[i] = s1[i] ^ s2[i % len2]; }