Skip to content

Commit

Permalink
优化编译警告
Browse files Browse the repository at this point in the history
  • Loading branch information
hero1s committed May 8, 2024
1 parent 99cafac commit 92048e3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/plugins/src/lcodec/mysql.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ namespace lcodec {
size_t column_count = decode_length_encoded_number();
// field metadata
mysql_columns columns;
for (int i = 0; i < column_count; ++i) {
for (size_t i = 0; i < column_count; ++i) {
recv_packet();
field_decode(columns);
}
Expand Down
2 changes: 1 addition & 1 deletion core/plugins/src/lcodec/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
4 changes: 2 additions & 2 deletions extend/luakit/include/lua_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace luakit {
index = lua_absindex(L, index);
value_encode(buff, type_tab_head);
if (is_lua_array(L, index)) {
size_t rawlen = lua_rawlen(L, index);
int rawlen = lua_rawlen(L, index);
for (int i = 1; i <= rawlen; ++i) {
lua_rawgeti(L, index, i);
integer_encode(buff, i);
Expand Down Expand Up @@ -281,7 +281,7 @@ namespace luakit {
index = lua_absindex(L, index);
serialize_value(buff, "{");
if (is_lua_array(L, index)) {
size_t rawlen = lua_rawlen(L, index);
int rawlen = lua_rawlen(L, index);
for (int i = 1; i <= rawlen; ++i){
if (size++ > 0) {
serialize_value(buff, ",");
Expand Down
2 changes: 1 addition & 1 deletion extend/luakit/include/lua_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace luakit {

protected:
lua_State* m_L = nullptr;
uint32_t m_index = LUA_NOREF;
int32_t m_index = LUA_NOREF;
};

template <>
Expand Down
12 changes: 6 additions & 6 deletions extend/luaxml/src/luaxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace luaxml {
push_elem2lua(L, it.second[0]);
} else {
lua_createtable(L, 0, 4);
for (int i = 0; i < child_size; ++i) {
for (size_t i = 0; i < child_size; ++i) {
push_elem2lua(L, it.second[i]);
lua_seti(L, -2, i + 1);
}
Expand All @@ -74,7 +74,7 @@ namespace luaxml {
switch (lua_type(L, -1)) {
case LUA_TSTRING: printer->PushAttribute(key, lua_tostring(L, -1)); break;
case LUA_TBOOLEAN: printer->PushAttribute(key, lua_toboolean(L, -1)); break;
case LUA_TNUMBER: lua_isinteger(L, -1) ? printer->PushAttribute(key, int64_t(lua_tointeger(L, -1))) : printer->PushAttribute(key, double(lua_tonumber(L, -1))); break;
case LUA_TNUMBER: lua_isinteger(L, -1) ? printer->PushAttribute(key, int64_t(lua_tointeger(L, -1))) : printer->PushAttribute(key, lua_tonumber(L, -1)); break;
}
lua_pop(L, 1);
}
Expand All @@ -84,7 +84,7 @@ namespace luaxml {
switch (lua_geti(L, -2, 1)) {
case LUA_TSTRING: printer->PushText(lua_tostring(L, -1)); break;
case LUA_TBOOLEAN: printer->PushText(lua_toboolean(L, -1)); break;
case LUA_TNUMBER: lua_isinteger(L, -1) ? printer->PushText(int64_t(lua_tointeger(L, -1))) : printer->PushText(double(lua_tonumber(L, -1))); break;
case LUA_TNUMBER: lua_isinteger(L, -1) ? printer->PushText(int64_t(lua_tointeger(L, -1))) : printer->PushText(lua_tonumber(L, -1)); break;
}
lua_pushnil(L);
lua_seti(L, -4, 1);
Expand All @@ -103,13 +103,13 @@ namespace luaxml {
case LUA_TTABLE: load_table4lua(L, printer); break;
case LUA_TSTRING: printer->PushText(lua_tostring(L, -1)); break;
case LUA_TBOOLEAN: printer->PushText(lua_toboolean(L, -1)); break;
case LUA_TNUMBER: lua_isinteger(L, -1) ? printer->PushText(int64_t(lua_tointeger(L, -1))) : printer->PushText(double(lua_tonumber(L, -1))); break;
case LUA_TNUMBER: lua_isinteger(L, -1) ? printer->PushText(int64_t(lua_tointeger(L, -1))) : printer->PushText(lua_tonumber(L, -1)); break;
}
printer->CloseElement();
return;
}
lua_pushstring(L, key);
size_t raw_len = lua_rawlen(L, -2);
int raw_len = lua_rawlen(L, -2);
for (int i = 1; i <= raw_len; ++i) {
lua_rawgeti(L, -2, i);
load_elem4lua(L, printer);
Expand All @@ -134,7 +134,7 @@ namespace luaxml {

static int encode_xml(lua_State* L) {
XMLPrinter printer;
const char* header = luaL_optstring(L, 3, nullptr);
const char* header = luaL_optstring(L, 2, nullptr);
if (header) {
printer.PushDeclaration(header);
} else {
Expand Down

0 comments on commit 92048e3

Please sign in to comment.