Skip to content

Commit

Permalink
清理不必要的编译告警
Browse files Browse the repository at this point in the history
  • Loading branch information
fasiondog committed Jun 26, 2022
1 parent 459a7d6 commit 1094c80
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
6 changes: 4 additions & 2 deletions hikyuu_cpp/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,8 @@ TransList H5KDataDriver::_getTransList(const string& market, const string& code,
uint64_t number = pBuf[i].datetime / 100;
uint64_t second = pBuf[i].datetime - number * 100;
Datetime d(number);
record.datetime = Datetime(d.year(), d.month(), d.day(), d.hour(), d.minute(), second);
record.datetime =
Datetime(d.year(), d.month(), d.day(), d.hour(), d.minute(), (long)second);
record.price = price_t(pBuf[i].price) * 0.001;
record.vol = price_t(pBuf[i].vol);
record.direct = TransRecord::DIRECT(pBuf[i].buyorsell);
Expand Down Expand Up @@ -1102,7 +1103,8 @@ TransList H5KDataDriver::_getTransList(const string& market, const string& code,
uint64_t number = pBuf[i].datetime / 100;
uint64_t second = pBuf[i].datetime - number * 100;
Datetime d(number);
record.datetime = Datetime(d.year(), d.month(), d.day(), d.hour(), d.minute(), second);
record.datetime =
Datetime(d.year(), d.month(), d.day(), d.hour(), d.minute(), (long)second);
record.price = price_t(pBuf[i].price) * 0.001;
record.vol = price_t(pBuf[i].vol);
record.direct = TransRecord::DIRECT(pBuf[i].buyorsell);
Expand Down
15 changes: 12 additions & 3 deletions hikyuu_cpp/hikyuu/global/agent/SpotAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const char* SpotAgent::ms_pubUrl = "ipc:///tmp/hikyuu_real_pub.ipc";
const char* SpotAgent::ms_startTag = ":spot:[start spot]";
const char* SpotAgent::ms_endTag = ":spot:[end spot]";
const char* SpotAgent::ms_spotTopic = ":spot:";
const int SpotAgent::ms_spotTopicLength = strlen(SpotAgent::ms_spotTopic);
const int SpotAgent::ms_startTagLength = strlen(SpotAgent::ms_startTag);
const int SpotAgent::ms_endTagLength = strlen(SpotAgent::ms_endTag);
const size_t SpotAgent::ms_spotTopicLength = strlen(SpotAgent::ms_spotTopic);
const size_t SpotAgent::ms_startTagLength = strlen(SpotAgent::ms_startTag);
const size_t SpotAgent::ms_endTagLength = strlen(SpotAgent::ms_endTag);

Datetime SpotAgent::ms_start_rev_time;

Expand Down Expand Up @@ -111,6 +111,11 @@ void SpotAgent::parseSpotData(const void* buf, size_t buf_len) {
flatbuffers::Verifier verify(spot_list_buf, buf_len);
HKU_CHECK(VerifySpotListBuffer(verify), "Invalid data!");

#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4267)
#endif

// 更新日线数据
auto* spot_list = GetSpotList(spot_list_buf);
auto* spots = spot_list->spot();
Expand All @@ -125,6 +130,10 @@ void SpotAgent::parseSpotData(const void* buf, size_t buf_len) {
}
}
}

#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}

void SpotAgent::work_thread() {
Expand Down
8 changes: 4 additions & 4 deletions hikyuu_cpp/hikyuu/global/agent/SpotAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ class HKU_API SpotAgent {
static const char* ms_pubUrl; // 数据发送服务地址
static const char* ms_startTag; // 批次数据接收起始标记,用于判断启动了新的批次数据接收
static const char* ms_endTag; // 批次数据接收接收标记,用于判断该批次数据更新结束
static const char* ms_spotTopic; // 向数据发送服务订阅的主题
static const int ms_startTagLength; // 批次数据接收起始标记长度
static const int ms_endTagLength; // 批次数据接收结束标记长度
static const int ms_spotTopicLength; // 订阅主题标记长度
static const char* ms_spotTopic; // 向数据发送服务订阅的主题
static const size_t ms_startTagLength; // 批次数据接收起始标记长度
static const size_t ms_endTagLength; // 批次数据接收结束标记长度
static const size_t ms_spotTopicLength; // 订阅主题标记长度

static Datetime ms_start_rev_time; // 批次数据接收开始时间

Expand Down
9 changes: 9 additions & 0 deletions hikyuu_cpp/hikyuu/utilities/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

namespace hku {

#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996)
#endif

inline std::string getUserHome() {
char const *home = getenv("HOME");
if (home) {
Expand All @@ -32,4 +37,8 @@ inline std::string getUserHome() {
return "";
}

#if defined(_MSC_VER)
#pragma warning(pop)
#endif

} // namespace hku
2 changes: 0 additions & 2 deletions hikyuu_cpp/hikyuu/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ target("hikyuu")
add_cxflags("-wd4251") --template dll export warning
add_cxflags("-wd4267")
add_cxflags("-wd4834") --C++17 discarding return value of function with 'nodiscard' attribute
add_cxflags("-wd4996")
add_cxflags("-wd4244") --discable double to int
add_cxflags("-wd4566")
else
add_rpathdirs("$ORIGIN")
add_cxflags("-Wno-sign-compare", "-Wno-missing-braces")
Expand Down

0 comments on commit 1094c80

Please sign in to comment.