From 6bded177ba5a7f8637972d5af1402aef53d32b3d Mon Sep 17 00:00:00 2001 From: xiyoo0812 Date: Wed, 8 May 2024 13:50:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91=E8=AD=A6?= =?UTF-8?q?=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/lcodec/src/websocket.h | 2 +- extend/lssl/src/ssl/lssl.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) 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]; }