From 0abb4824ab9dca2b84df89e360c93f5d0d46947a Mon Sep 17 00:00:00 2001 From: lhzw Date: Sat, 13 Feb 2016 17:19:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0gnu=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E5=99=A8=E5=88=86=E6=94=AF=EF=BC=8C=E5=8F=AF=E5=9C=A8linux?= =?UTF-8?q?=E4=B8=8B=E7=BC=96=E8=AF=91=E9=80=9A=E8=BF=87=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vn.ctp/vnctpmd/vnctpmd/vnctpmd.cpp | 7 +++++-- vn.ctp/vnctpmd/vnctpmd/vnctpmd.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/vn.ctp/vnctpmd/vnctpmd/vnctpmd.cpp b/vn.ctp/vnctpmd/vnctpmd/vnctpmd.cpp index fbc26008..8da203fb 100644 --- a/vn.ctp/vnctpmd/vnctpmd/vnctpmd.cpp +++ b/vn.ctp/vnctpmd/vnctpmd/vnctpmd.cpp @@ -1,7 +1,6 @@ // vnctpmd.cpp : 定义 DLL 应用程序的导出函数。 // -#include "stdafx.h" #include "vnctpmd.h" ///------------------------------------------------------------------------------------- @@ -46,7 +45,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 } } }; @@ -817,4 +820,4 @@ BOOST_PYTHON_MODULE(vnctpmd) .def("onRspUnSubForQuoteRsp", pure_virtual(&MdApiWrap::onRspUnSubForQuoteRsp)) .def("onRtnForQuoteRsp", pure_virtual(&MdApiWrap::onRtnForQuoteRsp)) ; -}; \ No newline at end of file +}; diff --git a/vn.ctp/vnctpmd/vnctpmd/vnctpmd.h b/vn.ctp/vnctpmd/vnctpmd/vnctpmd.h index 20ab5b39..aa94f580 100644 --- a/vn.ctp/vnctpmd/vnctpmd/vnctpmd.h +++ b/vn.ctp/vnctpmd/vnctpmd/vnctpmd.h @@ -1,7 +1,9 @@ //说明部分 //系统 +#ifdef WIN32 #include "stdafx.h" +#endif #include #include