From a767ce58a0210c1ca21d7482d1208e3e0d916d15 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Mon, 28 Sep 2009 09:42:04 +0000 Subject: fixed some compiler warnings, added tests --- src/check_curl.c | 10 +++++----- src/curlhelper.c | 2 +- tests/GNUmakefile | 8 ++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/check_curl.c b/src/check_curl.c index 3080304..b8adbc6 100644 --- a/src/check_curl.c +++ b/src/check_curl.c @@ -81,7 +81,7 @@ int main( int argc, char *argv[] ) { } /* start up curl */ - if( curl_global_init( CURL_GLOBAL_ALL ) != CURLE_OK ) { + if( curl_global_init( (long)CURL_GLOBAL_ALL ) != CURLE_OK ) { printf( "HTTP CRITICAL - curl_global_init failed!\n" ); cmdline_parser_free( &args_info ); exit( STATE_UNKNOWN ); @@ -126,7 +126,7 @@ int main( int argc, char *argv[] ) { curl_easy_setopt( curl, CURLOPT_USERAGENT, args_info.useragent_arg ); /* compose URL */ - snprintf( b, 2048, "http%s://%s%s", + snprintf( b, (size_t)2048, "http%s://%s%s", args_info.ssl_given ? "s" : "", args_info.ip_arg, args_info.url_given ? args_info.url_arg : "/" ); @@ -139,7 +139,7 @@ int main( int argc, char *argv[] ) { /* compose HTTP headers */ #if 0 /* FIXME: doesn't work with curl 7.15.2 (Centos 5.2)!! Check out why */ if( args_info.host_given ) { - snprintf( b, 2048, "Host: %s", args_info.host_arg ); + snprintf( b, (size_t), "Host: %s", args_info.host_arg ); header_list = curl_slist_append( header_list, b ); } curl_easy_setopt( curl, CURLOPT_HTTPHEADER, header_list ); @@ -192,12 +192,12 @@ int main( int argc, char *argv[] ) { * performance data to the answer always */ curl_easy_getinfo( curl, CURLINFO_TOTAL_TIME, &total_time ); - snprintf( perfstring, 1024, "time=%.6gs;%.6g;%.6g;%.6g size=%dB;;;0", + snprintf( perfstring, (size_t)1024, "time=%.6gs;%.6g;%.6g;%.6g size=%dB;;;0", total_time, args_info.warning_given ? args_info.warning_arg : 0.0, args_info.critical_given ? args_info.critical_arg : 0.0, 0.0, - body_buf.buflen ); + (int)body_buf.buflen ); /* -s: check if the excepted string matches */ if( args_info.string_given ) { diff --git a/src/curlhelper.c b/src/curlhelper.c index 3c44f2c..8b4d087 100644 --- a/src/curlhelper.c +++ b/src/curlhelper.c @@ -26,7 +26,7 @@ int curlhelp_initbuffer( curlhelp_curlbuf *buf ) { buf->bufsize = 2048; buf->buflen = 0; - buf->buf = (char *)malloc( 2048 ); + buf->buf = (char *)malloc( (size_t)2048 ); if( buf->buf == NULL ) return -1; return 0; } diff --git a/tests/GNUmakefile b/tests/GNUmakefile index f95b1fd..c9b4ae9 100644 --- a/tests/GNUmakefile +++ b/tests/GNUmakefile @@ -21,3 +21,11 @@ local_clean: local_distclean: local_test: + $(TOPDIR)/src/check_curl --config-file clientcertcheck + $(TOPDIR)/src/check_curl --config-file connect_failure + $(TOPDIR)/src/check_curl --config-file DNS_failure + $(TOPDIR)/src/check_curl --config-file iis + $(TOPDIR)/src/check_curl --config-file not_found + $(TOPDIR)/src/check_curl --config-file openssl.org + $(TOPDIR)/src/check_curl --config-file PortalZH + $(TOPDIR)/src/check_curl --config-file useragent -- cgit v1.2.3-54-g00ecf