summaryrefslogtreecommitdiffstats
path: root/srUtils.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-06 11:49:06 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-06 11:49:06 +0000
commit35306d123149bbbb80414691022def865bc2d80d (patch)
tree684718f58c81d6af64cbdf02ad078b068fd7a65a /srUtils.c
parente5a6c66766afd57105dda0cfabacb11d2b8e1d6b (diff)
downloadrsyslog-35306d123149bbbb80414691022def865bc2d80d.tar.gz
rsyslog-35306d123149bbbb80414691022def865bc2d80d.tar.xz
rsyslog-35306d123149bbbb80414691022def865bc2d80d.zip
- fixed a bug with integer conversion in srUtils.c
- changed some lib functions to work on long instead of int to care for 64 bit platforms (just to be on the save side)
Diffstat (limited to 'srUtils.c')
-rwxr-xr-xsrUtils.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/srUtils.c b/srUtils.c
index a0dae0b7..b500cab3 100755
--- a/srUtils.c
+++ b/srUtils.c
@@ -58,11 +58,11 @@
* public members *
* ################################################################# */
-rsRetVal srUtilItoA(char *pBuf, int iLenBuf, int iToConv)
+rsRetVal srUtilItoA(char *pBuf, int iLenBuf, long iToConv)
{
int i;
int bIsNegative;
- char szBuf[32]; /* sufficiently large for my lifespan and those of my children... ;) */
+ char szBuf[64]; /* sufficiently large for my lifespan and those of my children... ;) */
assert(pBuf != NULL);
assert(iLenBuf > 1); /* This is actually an app error and as thus checked for... */
@@ -79,9 +79,10 @@ rsRetVal srUtilItoA(char *pBuf, int iLenBuf, int iToConv)
i = 0;
do
{
- szBuf[i] = iToConv % 10 + '0';
+ szBuf[i++] = iToConv % 10 + '0';
iToConv /= 10;
} while(iToConv > 0); /* warning: do...while()! */
+ --i; /* undo last increment - we were pointing at NEXT location */
/* make sure we are within bounds... */
if(i + 2 > iLenBuf) /* +2 because: a) i starts at zero! b) the \0 byte */