diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-10-26 08:13:41 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-10-26 08:13:41 +0000 |
| commit | 0099de9043f43bcf0bced4b97e1d695451bc09c8 (patch) | |
| tree | 3eedde7aeb3d0f9586a75d878854c44216ae535f /src/libs | |
| parent | 32a7e5581f81f8c0d2e73b479c02abc8f62da933 (diff) | |
- fixed several warnings when compiling with -Wall flag (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2222 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/libs')
| -rw-r--r-- | src/libs/zbxcommon/Makefile.am | 2 | ||||
| -rw-r--r-- | src/libs/zbxcommon/base64.c | 1 | ||||
| -rw-r--r-- | src/libs/zbxcommon/comms.c | 1 | ||||
| -rw-r--r-- | src/libs/zbxcommon/misc.c | 28 | ||||
| -rw-r--r-- | src/libs/zbxcommon/str.c | 3 | ||||
| -rw-r--r-- | src/libs/zbxcommon/xml.c | 1 | ||||
| -rw-r--r-- | src/libs/zbxsysinfo/common/file.c | 2 | ||||
| -rw-r--r-- | src/libs/zbxsysinfo/common/ntp.c | 7 |
8 files changed, 38 insertions, 7 deletions
diff --git a/src/libs/zbxcommon/Makefile.am b/src/libs/zbxcommon/Makefile.am index 4d35fbb8..57a91218 100644 --- a/src/libs/zbxcommon/Makefile.am +++ b/src/libs/zbxcommon/Makefile.am @@ -1,3 +1,3 @@ SUBDIRS= lib_LIBRARIES=libzbxcommon.a -libzbxcommon_a_SOURCES=base64.c regexp.c xml.c comms.c str.c +libzbxcommon_a_SOURCES=base64.c misc.c regexp.c xml.c comms.c str.c diff --git a/src/libs/zbxcommon/base64.c b/src/libs/zbxcommon/base64.c index 73e84518..c5b8d330 100644 --- a/src/libs/zbxcommon/base64.c +++ b/src/libs/zbxcommon/base64.c @@ -113,7 +113,6 @@ void str_base64_encode(char *p_str, char *p_b64str, int in_size) int i; unsigned char from1=0,from2=0,from3=0; unsigned char to1=0,to2=0,to3=0,to4=0; - char *p_b64init = p_b64str; if ( 0 == in_size ) { diff --git a/src/libs/zbxcommon/comms.c b/src/libs/zbxcommon/comms.c index a6ebdcb7..beeb525b 100644 --- a/src/libs/zbxcommon/comms.c +++ b/src/libs/zbxcommon/comms.c @@ -1,4 +1,5 @@ #include <string.h> +#include <stdio.h> #include "common.h" #include "log.h" diff --git a/src/libs/zbxcommon/misc.c b/src/libs/zbxcommon/misc.c new file mode 100644 index 00000000..f239ab25 --- /dev/null +++ b/src/libs/zbxcommon/misc.c @@ -0,0 +1,28 @@ +#include "common.h" + +#include <math.h> + +/****************************************************************************** + * * + * Function: cmp_double * + * * + * Purpose: compares two float values * + * * + * Parameters: a,b - floats to compare * + * * + * Return value: 0 - the values are equal * + * 1 - otherwise * + * * + * Author: Alexei Vladishev * + * * + * Comments: equal == differs less than 0.000001 * + * * + ******************************************************************************/ +int cmp_double(double a,double b) +{ + if(fabs(a-b)<0.000001) + { + return 0; + } + return 1; +} diff --git a/src/libs/zbxcommon/str.c b/src/libs/zbxcommon/str.c index 93a34180..538132d6 100644 --- a/src/libs/zbxcommon/str.c +++ b/src/libs/zbxcommon/str.c @@ -1,6 +1,7 @@ #include "common.h" #include <string.h> +#include <stdlib.h> /* Has to be rewritten to avoi malloc */ char *string_replace(char *str, const char *sub_str1, const char *sub_str2) @@ -27,7 +28,7 @@ char *string_replace(char *str, const char *sub_str1, const char *sub_str2) diff = strlen(sub_str2) - len; /* allocate new memory */ - if ( (new_str=(char *)malloc((strlen(str) + count*diff)*sizeof(char))) + if ( (new_str=(char *)malloc((size_t)(strlen(str) + count*diff)*sizeof(char))) == NULL ) return NULL; diff --git a/src/libs/zbxcommon/xml.c b/src/libs/zbxcommon/xml.c index cac640f4..19024c00 100644 --- a/src/libs/zbxcommon/xml.c +++ b/src/libs/zbxcommon/xml.c @@ -1,6 +1,7 @@ #include "common.h" #include "log.h" +#include <stdio.h> #include <string.h> /* Get DATA from <tag>DATA</tag> */ diff --git a/src/libs/zbxsysinfo/common/file.c b/src/libs/zbxsysinfo/common/file.c index 62bb7cf0..1064653a 100644 --- a/src/libs/zbxsysinfo/common/file.c +++ b/src/libs/zbxsysinfo/common/file.c @@ -30,6 +30,8 @@ /* FILE */ #include <stdio.h> +#include <stdlib.h> + #include "common.h" #include "sysinfo.h" diff --git a/src/libs/zbxsysinfo/common/ntp.c b/src/libs/zbxsysinfo/common/ntp.c index d700b387..4b7f65c8 100644 --- a/src/libs/zbxsysinfo/common/ntp.c +++ b/src/libs/zbxsysinfo/common/ntp.c @@ -7,6 +7,8 @@ #include <stdio.h> #include <string.h> +#include <unistd.h> + #include "config.h" #include "common.h" #include "sysinfo.h" @@ -193,7 +195,7 @@ systems do not set the return value from (s)printf. */ errno = 0; if ((gmt = localtime(&now)) == NULL) { - printf("unable to work out local time",NULL); + printf("unable to work out local time"); return -1; } len = 24; @@ -216,14 +218,11 @@ int check_ntp(char *host, int port, int *value_int) int s; int len; unsigned char c[MAX_STRING_LEN]; - char *e; struct hostent *hp; struct sockaddr_in servaddr_in; - struct linger ling; - char text[50]; ntp_data data; |
