From 2ff2ddd995e1b6cf947a25ff9b50e0e31facdf84 Mon Sep 17 00:00:00 2001 From: lhzw Date: Sat, 13 Feb 2016 20:14:09 +0800 Subject: [PATCH] =?UTF-8?q?linux=E4=B8=8B=E4=B8=8D=E5=8C=85=E5=90=AB?= =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6stdafx.h=EF=BC=8C=E4=BD=BF=E7=94=A8s?= =?UTF-8?q?trncpy()=EF=BC=9B=20=E7=94=B1=E4=BA=8Elinux=20api=E4=B8=AD?= =?UTF-8?q?=E6=97=A0OptionValue=E5=8F=8AOptionCloseProfit=EF=BC=8C?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E7=BC=96=E8=AF=91=E6=8E=89=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vn.ctp/vnctptd/vnctptd/vnctptd.cpp | 13 ++++++++++--- vn.ctp/vnctptd/vnctptd/vnctptd.h | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/vn.ctp/vnctptd/vnctptd/vnctptd.cpp b/vn.ctp/vnctptd/vnctptd/vnctptd.cpp index 6b6b70e6..86302272 100644 --- a/vn.ctp/vnctptd/vnctptd/vnctptd.cpp +++ b/vn.ctp/vnctptd/vnctptd/vnctptd.cpp @@ -1,7 +1,6 @@ // vnctptd.cpp : 定义 DLL 应用程序的导出函数。 // -#include "stdafx.h" #include "vnctptd.h" @@ -47,7 +46,11 @@ void getChar(dict d, string key, char *value) const char *buffer = s.c_str(); //对字符串指针赋值必须使用strcpy_s, vs2013使用strcpy编译通不过 //+1应该是因为C++字符串的结尾符号?不是特别确定,不加这个1会出错 +#ifdef _MSC_VER //WIN32 strcpy_s(value, strlen(buffer) + 1, buffer); +#elif __GNUC__ + strncpy(value, buffer, strlen(buffer) + 1); +#endif } } } @@ -3888,7 +3891,9 @@ void TdApi::processRspQryInvestorPosition(Task task) data["Position"] = task_data.Position; data["FrozenCommission"] = task_data.FrozenCommission; data["CombShortFrozen"] = task_data.CombShortFrozen; +#ifdef WIN32 data["OptionValue"] = task_data.OptionValue; +#endif data["CloseProfitByDate"] = task_data.CloseProfitByDate; data["SettlementPrice"] = task_data.SettlementPrice; data["LongFrozenAmount"] = task_data.LongFrozenAmount; @@ -3925,7 +3930,10 @@ void TdApi::processRspQryTradingAccount(Task task) data["AccountID"] = task_data.AccountID; data["Available"] = task_data.Available; data["FundMortgageAvailable"] = task_data.FundMortgageAvailable; +#ifdef WIN32 + data["OptionValue"] = task_data.OptionValue; data["OptionCloseProfit"] = task_data.OptionCloseProfit; +#endif data["PreCredit"] = task_data.PreCredit; data["PreMortgage"] = task_data.PreMortgage; data["InterestBase"] = task_data.InterestBase; @@ -3941,7 +3949,6 @@ void TdApi::processRspQryTradingAccount(Task task) data["BrokerID"] = task_data.BrokerID; data["FrozenCash"] = task_data.FrozenCash; data["Withdraw"] = task_data.Withdraw; - data["OptionValue"] = task_data.OptionValue; data["Balance"] = task_data.Balance; data["SpecProductMargin"] = task_data.SpecProductMargin; data["SpecProductPositionProfitByAlg"] = task_data.SpecProductPositionProfitByAlg; @@ -9153,4 +9160,4 @@ BOOST_PYTHON_MODULE(vnctptd) .def("onRtnCancelAccountByBank", pure_virtual(&TdApiWrap::onRtnCancelAccountByBank)) .def("onRtnChangeAccountByBank", pure_virtual(&TdApiWrap::onRtnChangeAccountByBank)) ; -} \ No newline at end of file +} diff --git a/vn.ctp/vnctptd/vnctptd/vnctptd.h b/vn.ctp/vnctptd/vnctptd/vnctptd.h index 59e4c60c..6349e631 100644 --- a/vn.ctp/vnctptd/vnctptd/vnctptd.h +++ b/vn.ctp/vnctptd/vnctptd/vnctptd.h @@ -7,7 +7,9 @@ //系统 +#ifdef WIN32 #include "stdafx.h" +#endif #include #include