aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/libcurl_wrapper.cc
diff options
context:
space:
mode:
authornealsid <nealsid@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-04-26 23:52:50 +0000
committernealsid <nealsid@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-04-26 23:52:50 +0000
commitd5b689e7af360245691e1801196d912e8774408f (patch)
treec8318fa4b8a38e496984c6627d5534a0f9e25696 /src/common/linux/libcurl_wrapper.cc
parentBreakpad processor: Work around overload resolution problems in stream pos_ty... (diff)
downloadbreakpad-d5b689e7af360245691e1801196d912e8774408f.tar.xz
Patch from Zhurun to fix build breaks in gcc 4.4.1
CR URL: http://breakpad.appspot.com/100001/show A=Zhurun R=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@573 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/linux/libcurl_wrapper.cc')
-rw-r--r--src/common/linux/libcurl_wrapper.cc41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/common/linux/libcurl_wrapper.cc b/src/common/linux/libcurl_wrapper.cc
index 5bea3afa..78b96163 100644
--- a/src/common/linux/libcurl_wrapper.cc
+++ b/src/common/linux/libcurl_wrapper.cc
@@ -128,7 +128,9 @@ bool LibcurlWrapper::SendRequest(const std::string& url,
CURLcode err_code = CURLE_OK;
err_code = (*easy_perform_)(curl_);
- *(void**) (&easy_strerror_) = dlsym(curl_lib_, "curl_easy_strerror");
+ easy_strerror_ = reinterpret_cast<const char* (*)(CURLcode)>
+ (dlsym(curl_lib_, "curl_easy_strerror"));
+
#ifndef NDEBUG
if (err_code != CURLE_OK)
fprintf(stderr, "Failed to send http request to %s, error: %s\n",
@@ -177,8 +179,8 @@ bool LibcurlWrapper::Init() {
return true;
}
-#define SET_AND_CHECK_FUNCTION_POINTER(var, function_name) \
- *(void**) (&var) = dlsym(curl_lib_, function_name); \
+#define SET_AND_CHECK_FUNCTION_POINTER(var, function_name, type) \
+ var = reinterpret_cast<type>(dlsym(curl_lib_, function_name)); \
if (!var) { \
LOG(WARNING) << "Could not find libcurl function " << function_name; \
init_ok_ = false; \
@@ -188,21 +190,34 @@ bool LibcurlWrapper::Init() {
bool LibcurlWrapper::SetFunctionPointers() {
SET_AND_CHECK_FUNCTION_POINTER(easy_init_,
- "curl_easy_init");
+ "curl_easy_init",
+ CURL*(*)());
+
SET_AND_CHECK_FUNCTION_POINTER(easy_setopt_,
- "curl_easy_setopt");
- SET_AND_CHECK_FUNCTION_POINTER(formadd_,
- "curl_formadd");
- SET_AND_CHECK_FUNCTION_POINTER(slist_append_,
- "curl_slist_append");
+ "curl_easy_setopt",
+ CURLcode(*)(CURL*, CURLoption, ...));
+
+ SET_AND_CHECK_FUNCTION_POINTER(formadd_, "curl_formadd",
+ CURLFORMcode(*)(curl_httppost**, curl_httppost**, ...));
+
+ SET_AND_CHECK_FUNCTION_POINTER(slist_append_, "curl_slist_append",
+ curl_slist*(*)(curl_slist*, const char*));
+
SET_AND_CHECK_FUNCTION_POINTER(easy_perform_,
- "curl_easy_perform");
+ "curl_easy_perform",
+ CURLcode(*)(CURL*));
+
SET_AND_CHECK_FUNCTION_POINTER(easy_cleanup_,
- "curl_easy_cleanup");
+ "curl_easy_cleanup",
+ void(*)(CURL*));
+
SET_AND_CHECK_FUNCTION_POINTER(slist_free_all_,
- "curl_slist_free_all");
+ "curl_slist_free_all",
+ void(*)(curl_slist*));
+
SET_AND_CHECK_FUNCTION_POINTER(formfree_,
- "curl_formfree");
+ "curl_formfree",
+ void(*)(curl_httppost*));
return true;
}