Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into self_login
Browse files Browse the repository at this point in the history
  • Loading branch information
wangpeng committed Sep 27, 2023
2 parents 5d80c86 + ffd8ea4 commit f7be5d0
Show file tree
Hide file tree
Showing 134 changed files with 892 additions and 969 deletions.
1 change: 1 addition & 0 deletions core/luabus/luabus.mak
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ MYCFLAGS += -Wsign-compare
MYCFLAGS += -Wno-sign-compare
MYCFLAGS += -Wno-unused-variable
MYCFLAGS += -Wno-unused-parameter
MYCFLAGS += -Wno-unused-but-set-variable
MYCFLAGS += -Wno-unused-but-set-parameter
MYCFLAGS += -Wno-unknown-pragmas

Expand Down
2 changes: 1 addition & 1 deletion core/luabus/luabus.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\..\extend\lua\lua;..\..\extend\ltimer\ltimer;..\..\extend\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion core/quanta/quanta.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\..\extend\lua\lua;..\..\extend\fmt\include;..\..\extend\luakit\include;..\..\extend\lualog\lualog;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;FMT_HEADER_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/laoi/laoi.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lbson/lbson.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lcodec/lcodec.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lcrypt/lcrypt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LCRYPT_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lcurl/lcurl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;.\;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/ldetour/ldetour.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>src\detour;..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/ljson/ljson.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lmake/tmpl/vcxproj.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>{{%= FMT_INCLUDES %}};%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;{{%= FMT_DEFINES %}};%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lstdfs/lstdfs.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/ltimer/ltimer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lua/lua.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>.\lua;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;MAKE_LUA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lua/luac.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>.\lua;.\luac;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;MAKE_LUAC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lua/lualib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>.\lua;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
2 changes: 1 addition & 1 deletion extend/lualog/lualog.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\fmt\include;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;FMT_HEADER_ONLY;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
12 changes: 6 additions & 6 deletions extend/lualog/lualog/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ namespace logger {

// class log_message
// --------------------------------------------------------------------------------
void log_message::option(log_level level, vstring msg, vstring tag, vstring feature, vstring source, int line) {
void log_message::option(log_level level, cstring& msg, cstring& tag, cstring& feature, cstring& source, int line) {
log_time_ = log_time::now();
feature_ = feature;
source_ = source;
feature_ = std::move(feature);
source_ = std::move(source);
msg_ = std::move(msg);
tag_ = std::move(tag);
level_ = level;
line_ = line;
msg_ = msg;
tag_ = tag;
}

// class log_message_pool
Expand Down Expand Up @@ -367,7 +367,7 @@ namespace logger {
}
}

void log_service::output(log_level level, vstring msg, vstring tag, vstring feature, vstring source, int line) {
void log_service::output(log_level level, cstring& msg, cstring& tag, cstring& feature, cstring& source, int line) {
if (!log_filter_.is_filter(level)) {
auto logmsg_ = message_pool_->allocate();
logmsg_->option(level, msg, tag, feature, source, line);
Expand Down
6 changes: 3 additions & 3 deletions extend/lualog/lualog/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace logger {
void set_grow(bool grow) { grow_ = grow; }
log_level level() const { return level_; }
const log_time& get_log_time()const { return log_time_; }
void option(log_level level, vstring msg, vstring tag, vstring feature, vstring source, int line);
void option(log_level level, cstring& msg, cstring& tag, cstring& feature, cstring& source, int line);

private:
int line_ = 0;
Expand Down Expand Up @@ -239,7 +239,7 @@ namespace logger {
virtual bool add_file_dest(vstring feature, vstring fname) = 0;
virtual void set_dest_clean_time(vstring feature, size_t clean_time) = 0;
virtual void option(vstring log_path, vstring service, vstring index) = 0;
virtual void output(log_level level, vstring msg, vstring tag, vstring feature = "", vstring source = "", int line = 0) = 0;
virtual void output(log_level level, cstring& msg, cstring& tag, cstring& feature = "", cstring& source = "", int line = 0) = 0;
};

class log_service : public logger {
Expand Down Expand Up @@ -268,7 +268,7 @@ namespace logger {
bool is_filter(log_level lv) { return log_filter_.is_filter(lv); }
void filter(log_level lv, bool on) { log_filter_.filter(lv, on); }

void output(log_level level, vstring msg, vstring tag, vstring feature, vstring source, int line);
void output(log_level level, cstring& msg, cstring& tag, cstring& feature, cstring& source, int line);

protected:
path build_path(vstring feature, vstring fpath);
Expand Down
80 changes: 74 additions & 6 deletions extend/lualog/lualog/lualog.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,58 @@
#define LUA_LIB
#include "logger.h"

using namespace std;
using namespace luakit;

namespace logger {

thread_local luabuf buf;
string read_args(lua_State* L, int flag, int index) {
switch (lua_type(L, index)) {
case LUA_TNIL: return "nil";
case LUA_TTHREAD: return "thread";
case LUA_TFUNCTION: return "function";
case LUA_TUSERDATA: return "userdata";
case LUA_TLIGHTUSERDATA: return "userdata";
case LUA_TSTRING: return lua_tostring(L, index);
case LUA_TBOOLEAN: return (lua_tointeger(L, index) == 1) ? "true" : "false";
case LUA_TTABLE:
if ((flag & 0x01) == 0x01) {
buf.clean();
serialize_one(L, &buf, index, 1, (flag & 0x02) == 0x02);
return string((char*)buf.head(), buf.size());
}
return luaL_tolstring(L, index, nullptr);
case LUA_TNUMBER:
if (lua_isinteger(L, index)) {
return fmt::format("{}", lua_tointeger(L, index));
}
return fmt::format("{}", lua_tonumber(L, index));
}
return "unsuppert data type";
}

int zformat(lua_State* L, log_level lvl, cstring& tag, cstring& feature, cstring& msg) {
if (lvl == log_level::LOG_LEVEL_FATAL) {
lua_pushlstring(L, msg.c_str(), msg.size());
get_logger()->output(lvl, msg, tag, feature);
return 1;
}
get_logger()->output(lvl, msg, tag, feature);
return 0;
}

template<size_t... integers>
int tformat(lua_State* L, log_level lvl, cstring& tag, cstring& feature, int flag, vstring vfmt, std::index_sequence<integers...>&&) {
try {
auto msg = fmt::format(vfmt, read_args(L, flag, integers + 6)...);
return zformat(L, lvl, tag, feature, msg);
} catch (const exception& e) {
luaL_error(L, "log format failed: %s!", e.what());
}
return 0;
}

luakit::lua_table open_lualog(lua_State* L) {
luakit::kit_state kit_state(L);
auto lualog = kit_state.new_table();
Expand All @@ -14,6 +64,30 @@ namespace logger {
"ERROR", log_level::LOG_LEVEL_ERROR,
"FATAL", log_level::LOG_LEVEL_FATAL
);

lualog.set_function("print", [](lua_State* L) {
log_level lvl = (log_level)lua_tointeger(L, 1);
if (get_logger()->is_filter(lvl)) return 0;
size_t flag = lua_tointeger(L, 2);
sstring tag = lua_to_native<sstring>(L, 3);
sstring feature = lua_to_native<sstring>(L, 4);
vstring vfmt = lua_to_native<vstring>(L, 5);
int arg_num = lua_gettop(L) - 5;
switch (arg_num) {
case 0: return zformat(L, lvl, tag, feature, string(vfmt.data(), vfmt.size()));
case 1: return tformat(L, lvl, tag, feature, flag, vfmt, make_index_sequence<1>{});
case 2: return tformat(L, lvl, tag, feature, flag, vfmt, make_index_sequence<2>{});
case 3: return tformat(L, lvl, tag, feature, flag, vfmt, make_index_sequence<3>{});
case 4: return tformat(L, lvl, tag, feature, flag, vfmt, make_index_sequence<4>{});
case 5: return tformat(L, lvl, tag, feature, flag, vfmt, make_index_sequence<5>{});
case 6: return tformat(L, lvl, tag, feature, flag, vfmt, make_index_sequence<6>{});
case 7: return tformat(L, lvl, tag, feature, flag, vfmt, make_index_sequence<7>{});
case 8: return tformat(L, lvl, tag, feature, flag, vfmt, make_index_sequence<8>{});
default: luaL_error(L, "log format args is more than 8!"); break;
}
return 0;
});

lualog.set_function("daemon", [](bool status) { get_logger()->daemon(status); });
lualog.set_function("set_max_line", [](size_t line) { get_logger()->set_max_line(line); });
lualog.set_function("set_clean_time", [](size_t time) { get_logger()->set_clean_time(time); });
Expand All @@ -28,12 +102,6 @@ namespace logger {
lualog.set_function("add_dest", [](vstring feature, vstring log_path) { return get_logger()->add_dest(feature, log_path); });
lualog.set_function("add_file_dest", [](vstring feature, vstring fname) { return get_logger()->add_file_dest(feature, fname); });
lualog.set_function("set_dest_clean_time", [](vstring feature, size_t time) { get_logger()->set_dest_clean_time(feature, time); });
lualog.set_function("info", [](vstring msg, vstring tag, vstring feature) { get_logger()->output(log_level::LOG_LEVEL_INFO, msg, tag, feature); });
lualog.set_function("warn", [](vstring msg, vstring tag, vstring feature) { get_logger()->output(log_level::LOG_LEVEL_WARN, msg, tag, feature); });
lualog.set_function("dump", [](vstring msg, vstring tag, vstring feature) { get_logger()->output(log_level::LOG_LEVEL_DUMP, msg, tag, feature); });
lualog.set_function("debug", [](vstring msg, vstring tag, vstring feature) { get_logger()->output(log_level::LOG_LEVEL_DEBUG, msg, tag, feature); });
lualog.set_function("error", [](vstring msg, vstring tag, vstring feature) { get_logger()->output(log_level::LOG_LEVEL_ERROR, msg, tag, feature); });
lualog.set_function("fatal", [](vstring msg, vstring tag, vstring feature) { get_logger()->output(log_level::LOG_LEVEL_FATAL, msg, tag, feature); });
lualog.set_function("option", [](vstring log_path, vstring service, vstring index) { get_logger()->option(log_path, service, index); });
return lualog;
}
Expand Down
2 changes: 1 addition & 1 deletion extend/luapb/luapb.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
3 changes: 2 additions & 1 deletion extend/luapb/src/luapb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ namespace luapb {
pb_header* header =(pb_header*)m_slice->peek(sizeof(pb_header));
if (!header) return 0;
m_packet_len = header->len;
if (m_packet_len < sizeof(pb_header)) return -1;
if (m_packet_len >= 0xffff) return -1;
if (!m_slice->peek(m_packet_len)) return 0;
if (m_packet_len > 0xffff) return -1;
if (m_packet_len > data_len) return 0;
return m_packet_len;
}
Expand Down
2 changes: 1 addition & 1 deletion extend/luaxlsx/luaxlsx.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\lua\lua;..\luakit\include;$(SolutionDir)extend\mimalloc\mimalloc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
Loading

0 comments on commit f7be5d0

Please sign in to comment.