Module: sip-router Branch: sr_3.0 Commit: 90031b9224f2cf74c37770f6da8300969f4a63dc URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=90031b92...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Mon Oct 12 18:03:48 2009 +0200
cfgutils(k): gcc 2.95 compile fixes
- variables must be declared at the beginning of a block
---
modules_k/cfgutils/cfgutils.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/modules_k/cfgutils/cfgutils.c b/modules_k/cfgutils/cfgutils.c index 8b6f37f..828a460 100644 --- a/modules_k/cfgutils/cfgutils.c +++ b/modules_k/cfgutils/cfgutils.c @@ -488,11 +488,6 @@ error: */ static int MD5File(char *dest, const char *file_name) { - if (!dest || !file_name) { - LM_ERR("invalid parameter value\n"); - return -1; - } - MD5_CTX context; FILE *input; unsigned char buffer[32768]; @@ -500,6 +495,12 @@ static int MD5File(char *dest, const char *file_name) unsigned int counter, size; struct stat stats; + + if (!dest || !file_name) { + LM_ERR("invalid parameter value\n"); + return -1; + } + if (stat(file_name, &stats) != 0) { LM_ERR("could not stat file %s\n", file_name); return -1; @@ -588,12 +589,13 @@ static int get_prob(struct sip_msg *bar, char *foo1, char *foo2)
static int rand_event(struct sip_msg *bar, char *foo1, char *foo2) { + double tmp; /* most of the time this will be disabled completly. Tis will also fix the * problem with the corner cases if rand() returned zero or RAND_MAX */ if ((*probability) == 0) return -1; if ((*probability) == 100) return 1;
- double tmp = ((double) rand() / RAND_MAX); + tmp = ((double) rand() / RAND_MAX); LM_DBG("generated random %f\n", tmp); if (tmp < ((double) (*probability) / 100)) { LM_DBG("return true\n");