(totalcnt - writecnt) * sizeof(char), input);
if (writecnt >= totalcnt) {
totalcnt += MEMBLK;
- if (((*buffer) =
+ if (((*buffer) = (char *)
rrd_realloc((*buffer),
(totalcnt + 4) * sizeof(char))) == NULL) {
perror("Realloc Buffer:");
{
if (argc >= 2) {
const size_t len = strlen(args[0]) + strlen(args[1]) + 2;
- char *xyz = malloc(len);
+ char *xyz = (char *) malloc(len);
if (xyz == NULL) {
return stralloc("[ERROR: allocating setenv buffer]");
readfile(filename, &buffer, 0);
if (rrd_test_error()) {
const size_t len = strlen(rrd_get_error()) + DS_NAM_SIZE;
- char *err = malloc(len);
+ char *err = (char *) malloc(len);
snprintf(err, len, "[ERROR: %s]", rrd_get_error());
rrd_clear_error();
for (c = buf; *c != '\0'; c++)
if (*c == '"')
qc++;
- if ((buf2 = malloc((strlen(buf) + 4 * qc + 4))) == NULL) {
+ if ((buf2 = (char *) malloc((strlen(buf) + 4 * qc + 4))) == NULL) {
perror("Malloc Buffer");
exit(1);
};
return NULL;
}
- buf2 = malloc(strlen(buf) + 1);
+ buf2 = (char *) malloc(strlen(buf) + 1);
if (!buf2) {
perror("cgigetqp(): Malloc Path Buffer");
exit(1);
} else {
if (rrd_test_error()) {
const size_t len = strlen(rrd_get_error()) + DS_NAM_SIZE;
- char *err = malloc(len);
+ char *err = (char *) malloc(len);
snprintf(err, len, "[ERROR: %s]", rrd_get_error());
rrd_clear_error();
return err;
char *buf;
if (argc == 2) {
- buf = malloc(255);
+ buf = (char *) malloc(255);
if (buf == NULL) {
return stralloc("[ERROR: allocating strftime buffer]");
};
last = rrd_last(argc, (char **) args - 1);
if (rrd_test_error()) {
const size_t len = strlen(rrd_get_error()) + DS_NAM_SIZE;
- char *err = malloc(len);
+ char *err = (char *) malloc(len);
snprintf(err, len, "[ERROR: %s]", rrd_get_error());
rrd_clear_error();
return err;
char *buf;
if (argc == 1) {
- buf = malloc(255);
+ buf = (char *) malloc(255);
if (buf == NULL) {
return stralloc("[ERROR: allocating strftime buffer]");
};
if (argc == argsz) {
/* resize argument array */
argsz *= 2;
- argv = rrd_realloc(argv, argsz * sizeof(char *));
+ argv = (char **) rrd_realloc(argv, argsz * sizeof(char *));
if (*argv == NULL) {
return NULL;
}
/* make sure we do not shrink the mallocd block */
size_t newbufsize = i + strlen(end) + valln + 1;
- *buf = rrd_realloc(*buf, newbufsize);
+ *buf = (char *) rrd_realloc(*buf, newbufsize);
if (*buf == NULL) {
perror("Realoc buf:");
#ifndef __RRD_CLIENT_H
#define __RRD_CLIENT_H 1
-#ifndef WIN32
# ifdef HAVE_STDINT_H
# include <stdint.h>
-# else
-# ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-# else
-# error "you should have stdint.h or inttypes.h to compile this"
-# endif
# endif
-#else
+
+# ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+# endif
+
+# if !(defined(HAVE_STDINT_H) || defined(HAVE_INTTYPES_H))
# include <stdlib.h>
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef unsigned long int uint32_t;
typedef signed long long int int64_t;
typedef unsigned long long int uint64_t;
-#endif
+# endif
/* max length of socket command or response */
#define RRD_CMD_MAX 4096
#include "rrd_rpncalc.h"
#include "rrd_hw.h"
#include "rrd_client.h"
-#include "../rrd_config.h"
+#include "rrd_config.h"
#include "rrd_is_thread_safe.h"
/* this may configure __EXTENSIONS__ without which pango will fail to compile
so load this early */
-#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
-#include "../win32/config.h"
-#else
-#ifdef HAVE_CONFIG_H
-#include "../rrd_config.h"
-#endif
-#endif
+#include "rrd_config.h"
#include <cairo.h>
#include <cairo-pdf.h>
const size_t vlen = strlen(pa->kv_args[i].value);
const size_t len = res ? strlen(res) : 0;
- char *t = realloc(res,len + 3 + klen + vlen);
+ char *t = (char *) realloc(res,len + 3 + klen + vlen);
if (! t) { return res; }
res=t;
strncat(res,pa->kv_args[i].key, klen);
int addToArguments(parsedargs_t* pa, char*key, char*value, int cnt) {
/* resize the field */
- keyvalue_t* t=realloc(pa->kv_args,(pa->kv_cnt+1)*sizeof(keyvalue_t));
+ keyvalue_t * t = (keyvalue_t *) realloc(pa->kv_args, (pa->kv_cnt + 1) * sizeof(keyvalue_t));
if (!t) {
rrd_set_error("could not realloc memory");
return -1;
}
break;
case 0:
- case ':':
+ case ':': {
/* null and : separate the string */
*pos=0;
/* handle the case where we have got an = */
}
/* and reset field */
- field=NULL;
+ field=NULL; }
break;
default:
break;
gdp->cf=cf_conv(cf);
if (((int)gdp->cf)==-1) {
rrd_set_error("bad CF: %s",cf); return NULL; }
- } else { if (bitscmp(PARSE_CF)) {gdp->cf=-1;}}
+ } else { if (bitscmp(PARSE_CF)) { gdp->cf = (cf_en) -1; }}
if ((color)&&(parse_color(color,&(gdp->col)))) { return NULL; }
if ((color2)&&(parse_color(color2,&(gdp->col2)))) { return NULL; }
if (rpn) {gdp->rpn=rpn;}
}
/* convert to enum but handling LINE special*/
- enum gf_en gf=-1;
+ enum gf_en gf = (gf_en) -1;
gf=gf_conv(cmd);
if ((int)gf == -1) {
if (strncmp("LINE",cmd,4)==0) {
* rrd_tool.c Startup wrapper
*****************************************************************************/
+#include "rrd_config.h"
+
#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(HAVE_CONFIG_H)
-#include "../win32/config.h"
#include <stdlib.h>
#include <sys/stat.h>
#include <io.h>
#include <fcntl.h>
-#else
-#ifdef HAVE_CONFIG_H
-#include "../rrd_config.h"
-#endif
#endif
#include "rrd_tool.h"
if (feof(stream))
return *aLinePtr = 0;
- if (!(linebuf = malloc(bufsize))) {
+ if (!(linebuf = (char *) malloc(bufsize))) {
perror("fgetslong: malloc");
exit(1);
}
if (linebuf[eolpos - 1] == '\n')
return *aLinePtr = linebuf;
bufsize += MAX_LENGTH;
- if (!(linebuf = realloc(linebuf, bufsize))) {
+ if (!(linebuf = (char *) realloc(linebuf, bufsize))) {
free(linebuf);
perror("fgetslong: realloc");
exit(1);
#ifndef _RRD_TOOL_H
#define _RRD_TOOL_H
-#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
-#include "../win32/config.h"
-#else
-#ifdef HAVE_CONFIG_H
-#include "../rrd_config.h"
-#endif
-#endif
+#include "rrd_config.h"
#include "rrd.h"
#endif
#include <locale.h>
-
-#include <inttypes.h>
#include <stdint.h>
#include "rrd_hw.h"
sb->allocated+=8192;
sb->allocated-=(sb->allocated%8192);
/* and allocate it */
- sb->data=malloc(sb->allocated);
+ sb->data = (unsigned char *) malloc(sb->allocated);
if (! sb->data) {
rrd_set_error("malloc issue");
return 1;
char* entry;
switch (im->gdes[i].gf) {
case GF_PRINT:
- case GF_GPRINT:
+ case GF_GPRINT: {
/* PRINT and GPRINT can now print VDEF generated values.
* There's no need to do any calculations on them as these
* calculations were already made.
} else {
snprintf(buf,sizeof(buf)," <%s>%s</%s>\n",usetag,dbuf,usetag);
}
- addToBuffer(usebuffer,buf,0);
+ addToBuffer(usebuffer,buf,0); }
break;
case GF_COMMENT:
if (json) {
* $Id$
*****************************************************************************/
-#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(HAVE_CONFIG_H)
-#include "../win32/config.h"
-#else
-#ifdef HAVE_CONFIG_H
-#include "../rrd_config.h"
-#endif
-#endif
+#include "rrd_config.h"
#include "rrd.h"
#include "plbasename.h"