Skip to content
Snippets Groups Projects
Commit 887adbb2 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

BUG: fix compilation adding missing include

parent db5eed6a
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,8 @@
#include <cstring>
#endif
#include <cstdio>
namespace otb
{
......@@ -107,7 +109,6 @@ int CurlHelper::RetrieveFileMulti(const std::vector<std::string>& listURLs,
#ifdef OTB_USE_CURL
#ifdef OTB_CURL_MULTI_AVAILABLE
otbMsgDevMacro(<< "Using curl multi");
//std::string m_Browser = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11";
CURLM * multiHandle;
std::vector<CURL *> listCurlHandles;
......@@ -278,4 +279,15 @@ int CurlHelper::RetrieveFileMulti(const std::vector<std::string>& listURLs,
#endif
}
size_t CurlHelper::write_data(void* ptr, size_t size, size_t nmemb, void* data)
{
size_t written;
FILE * fDescriptor = (FILE *)(data);
written = fwrite(ptr,size,nmemb,fDescriptor);
return written;
}
}
......@@ -28,6 +28,10 @@ namespace otb
* \class CurlHelper
* \brief Class to use the curl capabilities from OTB
*
* This class is responsible for behaving properly when curl is
* not available, i.e. the compilation should pass, the runtime should
* not segfault but of course, the behaviour will be different.
*
*/
class ITK_EXPORT CurlHelper : public itk::Object
{
......@@ -49,10 +53,10 @@ public:
const std::vector<std::string>& listFiles,
int maxConnect) const;
protected:
CurlHelper()
{
m_Browser = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11";
}
CurlHelper() :
m_Browser("Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.8.1.11) "
"Gecko/20071127 Firefox/2.0.0.11")
{}
~CurlHelper() {}
......@@ -66,18 +70,9 @@ private:
}
// Need to use our writing function to handle windows segfaults
// Need to be static cause the CURL_OPT is excpecting a pure C
// Need to be static cause the CURL_OPT is expecting a pure C
// function or a static c++ method.
static size_t write_data(void* ptr, size_t size, size_t nmemb, void* data)
{
size_t written;
FILE * fDescriptor = (FILE *)(data);
written = fwrite(ptr,size,nmemb,fDescriptor);
return written;
}
static size_t write_data(void* ptr, size_t size, size_t nmemb, void* data);
// Browser Agent used
std::string m_Browser;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment