Skip to content

Commit

Permalink
修复编译警告
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyoo0812 committed May 8, 2024
1 parent 7048490 commit 6bded17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion extend/lcodec/src/websocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions extend/lssl/src/ssl/lssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -281,15 +281,15 @@ 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) {
return luaL_error(L, "Can't xor empty string");
}
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];
}
Expand Down

0 comments on commit 6bded17

Please sign in to comment.