支持gcc4.7~gcc4.9

This commit is contained in:
xiongziliang 2017-06-09 17:45:13 +08:00
parent 9cd016c9eb
commit 1d1182efd2
3 changed files with 16 additions and 16 deletions

View File

@ -27,19 +27,19 @@ void HttpClientImp::sendRequest(const string& url) {
#else
_sslBox.reset(new SSL_Box(false));
_sslBox->setOnDecData([this](const char *data, uint32_t len){
#ifdef ANDROID
#if defined(__GNUC__) && (__GNUC__ < 5)
public_onRecvBytes(data,len);
#else//ANDROID
#else//defined(__GNUC__) && (__GNUC__ < 5)
HttpClient::onRecvBytes(data,len);
#endif//ANDROID
#endif//defined(__GNUC__) && (__GNUC__ < 5)
});
_sslBox->setOnEncData([this](const char *data, uint32_t len){
#ifdef ANDROID
#if defined(__GNUC__) && (__GNUC__ < 5)
public_send(data,len);
#else//ANDROID
#else//defined(__GNUC__) && (__GNUC__ < 5)
HttpClient::send(data,len);
#endif//ANDROID
#endif//defined(__GNUC__) && (__GNUC__ < 5)
});
#endif //ENABLE_OPENSSL

View File

@ -24,14 +24,14 @@ public:
virtual ~HttpClientImp();
virtual void sendRequest(const string &url) override;
#ifdef ANDROID
#if defined(__GNUC__) && (__GNUC__ < 5)
void public_onRecvBytes(const char *data,int len){
HttpClient::onRecvBytes(data,len);
}
void public_send(const char *data, uint32_t len){
HttpClient::send(data,len);
}
#endif //ANDROID
#endif //defined(__GNUC__) && (__GNUC__ < 5)
private:
#ifdef ENABLE_OPENSSL
virtual void onRecvBytes(const char *data,int size) override;

View File

@ -22,18 +22,18 @@ public:
HttpsSession(const std::shared_ptr<ThreadPool> &pTh, const Socket::Ptr &pSock):
HttpSession(pTh,pSock){
m_sslBox.setOnEncData([&](const char *data, uint32_t len){
#ifdef ANDROID
#if defined(__GNUC__) && (__GNUC__ < 5)
public_send(data,len);
#else//ANDROID
#else//defined(__GNUC__) && (__GNUC__ < 5)
HttpSession::send(data,len);
#endif//ANDROID
#endif//defined(__GNUC__) && (__GNUC__ < 5)
});
m_sslBox.setOnDecData([&](const char *data, uint32_t len){
#ifdef ANDROID
#if defined(__GNUC__) && (__GNUC__ < 5)
public_onRecv(data,len);
#else//ANDROID
#else//defined(__GNUC__) && (__GNUC__ < 5)
HttpSession::onRecv(data,len);
#endif//ANDROID
#endif//defined(__GNUC__) && (__GNUC__ < 5)
});
}
virtual ~HttpsSession(){
@ -43,14 +43,14 @@ public:
TimeTicker();
m_sslBox.onRecv(pBuf->data(), pBuf->size());
}
#ifdef ANDROID
#if defined(__GNUC__) && (__GNUC__ < 5)
int public_send(const char *data, uint32_t len){
return HttpSession::send(data,len);
}
void public_onRecv(const char *data, uint32_t len){
HttpSession::onRecv(data,len);
}
#endif//ANDROID
#endif//defined(__GNUC__) && (__GNUC__ < 5)
private:
virtual int send(const string &buf) override{
TimeTicker();