mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-02-02 01:41:11 +00:00
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
This commit is contained in:
parent
089003b7f6
commit
d5b689e7af
|
@ -68,7 +68,9 @@ bool MinidumpFileWriter::Close() {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
if (file_ != -1) {
|
if (file_ != -1) {
|
||||||
ftruncate(file_, position_);
|
if (-1 == ftruncate(file_, position_)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#if __linux__
|
#if __linux__
|
||||||
result = (sys_close(file_) == 0);
|
result = (sys_close(file_) == 0);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -128,7 +128,9 @@ bool LibcurlWrapper::SendRequest(const std::string& url,
|
||||||
|
|
||||||
CURLcode err_code = CURLE_OK;
|
CURLcode err_code = CURLE_OK;
|
||||||
err_code = (*easy_perform_)(curl_);
|
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
|
#ifndef NDEBUG
|
||||||
if (err_code != CURLE_OK)
|
if (err_code != CURLE_OK)
|
||||||
fprintf(stderr, "Failed to send http request to %s, error: %s\n",
|
fprintf(stderr, "Failed to send http request to %s, error: %s\n",
|
||||||
|
@ -177,8 +179,8 @@ bool LibcurlWrapper::Init() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SET_AND_CHECK_FUNCTION_POINTER(var, function_name) \
|
#define SET_AND_CHECK_FUNCTION_POINTER(var, function_name, type) \
|
||||||
*(void**) (&var) = dlsym(curl_lib_, function_name); \
|
var = reinterpret_cast<type>(dlsym(curl_lib_, function_name)); \
|
||||||
if (!var) { \
|
if (!var) { \
|
||||||
LOG(WARNING) << "Could not find libcurl function " << function_name; \
|
LOG(WARNING) << "Could not find libcurl function " << function_name; \
|
||||||
init_ok_ = false; \
|
init_ok_ = false; \
|
||||||
|
@ -188,21 +190,34 @@ bool LibcurlWrapper::Init() {
|
||||||
bool LibcurlWrapper::SetFunctionPointers() {
|
bool LibcurlWrapper::SetFunctionPointers() {
|
||||||
|
|
||||||
SET_AND_CHECK_FUNCTION_POINTER(easy_init_,
|
SET_AND_CHECK_FUNCTION_POINTER(easy_init_,
|
||||||
"curl_easy_init");
|
"curl_easy_init",
|
||||||
|
CURL*(*)());
|
||||||
|
|
||||||
SET_AND_CHECK_FUNCTION_POINTER(easy_setopt_,
|
SET_AND_CHECK_FUNCTION_POINTER(easy_setopt_,
|
||||||
"curl_easy_setopt");
|
"curl_easy_setopt",
|
||||||
SET_AND_CHECK_FUNCTION_POINTER(formadd_,
|
CURLcode(*)(CURL*, CURLoption, ...));
|
||||||
"curl_formadd");
|
|
||||||
SET_AND_CHECK_FUNCTION_POINTER(slist_append_,
|
SET_AND_CHECK_FUNCTION_POINTER(formadd_, "curl_formadd",
|
||||||
"curl_slist_append");
|
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_,
|
SET_AND_CHECK_FUNCTION_POINTER(easy_perform_,
|
||||||
"curl_easy_perform");
|
"curl_easy_perform",
|
||||||
|
CURLcode(*)(CURL*));
|
||||||
|
|
||||||
SET_AND_CHECK_FUNCTION_POINTER(easy_cleanup_,
|
SET_AND_CHECK_FUNCTION_POINTER(easy_cleanup_,
|
||||||
"curl_easy_cleanup");
|
"curl_easy_cleanup",
|
||||||
|
void(*)(CURL*));
|
||||||
|
|
||||||
SET_AND_CHECK_FUNCTION_POINTER(slist_free_all_,
|
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_,
|
SET_AND_CHECK_FUNCTION_POINTER(formfree_,
|
||||||
"curl_formfree");
|
"curl_formfree",
|
||||||
|
void(*)(curl_httppost*));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue