X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fhttp.cc;h=917e668fad7df9a060e4b429b86af5520ec04a64;hb=e23d774aaee5cf66ff4dc563f5b0a2cad293dd82;hp=d7faf19d90d44508feea535e04ff565d5b26f158;hpb=a1f2b0b98e03369ed051b232f1fc33ed1d611b16;p=awesomized%2Flibmemcached diff --git a/libtest/http.cc b/libtest/http.cc index d7faf19d..917e668f 100644 --- a/libtest/http.cc +++ b/libtest/http.cc @@ -34,11 +34,11 @@ * */ -#include +#include "libtest/yatlcon.h" #include -#if defined(HAVE_CURL_CURL_H) && HAVE_CURL_CURL_H +#if defined(HAVE_LIBCURL) && HAVE_LIBCURL #include #else class CURL; @@ -47,14 +47,14 @@ class CURL; static void cleanup_curl(void) { -#if defined(HAVE_CURL_CURL_H) && HAVE_CURL_CURL_H +#if defined(HAVE_LIBCURL) && HAVE_LIBCURL curl_global_cleanup(); #endif } static void initialize_curl_startup() { -#if defined(HAVE_CURL_CURL_H) && HAVE_CURL_CURL_H +#if defined(HAVE_LIBCURL) && HAVE_LIBCURL if (curl_global_init(CURL_GLOBAL_ALL)) { fatal_message("curl_global_init(CURL_GLOBAL_ALL) failed"); @@ -68,7 +68,7 @@ static void initialize_curl_startup() } static pthread_once_t start_key_once= PTHREAD_ONCE_INIT; -void initialize_curl(void) +static void initialize_curl(void) { int ret; if ((ret= pthread_once(&start_key_once, initialize_curl_startup)) != 0) @@ -82,20 +82,21 @@ namespace http { #define YATL_USERAGENT "YATL/1.0" -extern "C" size_t - http_get_result_callback(void *ptr, size_t size, size_t nmemb, void *data) - { - vchar_t *_body= (vchar_t*)data; - - _body->resize(size * nmemb); - memcpy(&_body[0], ptr, _body->size()); +static size_t http_get_result_callback(void *ptr, size_t size, size_t nmemb, void *data) +{ + vchar_t *_body= (vchar_t*)data; - return _body->size(); - } + _body->resize(size * nmemb); + memcpy(&_body[0], ptr, _body->size()); + return _body->size(); +} static void init(CURL *curl, const std::string& url) { + (void)http_get_result_callback; + (void)curl; + (void)url; if (HAVE_LIBCURL) { #if defined(HAVE_LIBCURL) && HAVE_LIBCURL @@ -132,7 +133,7 @@ bool GET::execute() curl_easy_cleanup(curl); - return retref == CURLE_OK; + return bool(retref == CURLE_OK); #endif } @@ -155,6 +156,8 @@ bool POST::execute() curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, _response); curl_easy_cleanup(curl); + + return bool(retref == CURLE_OK); #endif }