summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--outchannel.c10
-rw-r--r--parse.c28
-rw-r--r--parse.h2
-rwxr-xr-xstringbuf.c84
-rwxr-xr-xstringbuf.h32
-rw-r--r--syslogd.c146
-rw-r--r--template.c24
8 files changed, 165 insertions, 163 deletions
diff --git a/NEWS b/NEWS
index 860ddfe2..247989f4 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ Version 1.15.0 (RGer), 2007-07-??
and thus properties. This was a much-requested feature. It makes
life easy when it eG comes to splitting files based on the sender
address.
+- applied a patch from Bartosz Kuzma to compile cleanly under NetBSD
+- begun to change char to unsigned char
---------------------------------------------------------------------------
Version 1.14.2 (RGer), 2007-07-03
** this release fixes all known nits with IPv6 **
diff --git a/outchannel.c b/outchannel.c
index 2b64dba2..ef4f1ac6 100644
--- a/outchannel.c
+++ b/outchannel.c
@@ -62,11 +62,11 @@ static void skip_Comma(char **pp)
assert(*pp != NULL);
p = *pp;
- while(isspace(*p))
+ while(isspace((int)*p))
++p;
if(*p == ',')
++p;
- while(isspace(*p))
+ while(isspace((int)*p))
++p;
*pp = p;
}
@@ -99,7 +99,7 @@ static int get_Field(char **pp, char **pField)
*pp = p;
rsCStrFinish(pStrB);
- *pField = rsCStrConvSzStrAndDestruct(pStrB);
+ *pField = (char*) rsCStrConvSzStrAndDestruct(pStrB);
return 0;
}
@@ -122,7 +122,7 @@ static int get_off_t(char **pp, off_t *pOff_t)
p = *pp;
val = 0;
- while(*p && isdigit(*p)) {
+ while(*p && isdigit((int)*p)) {
val = val * 10 + (*p - '0');
++p;
}
@@ -163,7 +163,7 @@ static int get_restOfLine(char **pp, char **pBuf)
*pp = p;
rsCStrFinish(pStrB);
- *pBuf = rsCStrConvSzStrAndDestruct(pStrB);
+ *pBuf = (char*) rsCStrConvSzStrAndDestruct(pStrB);
return 0;
}
diff --git a/parse.c b/parse.c
index 4631be84..bf92e00b 100644
--- a/parse.c
+++ b/parse.c
@@ -64,7 +64,7 @@ rsRetVal rsParsConstruct(rsParsObj **ppThis)
* classical zero-terinated C-String.
* rgerhards, 2005-09-27
*/
-rsRetVal rsParsConstructFromSz(rsParsObj **ppThis, char *psz)
+rsRetVal rsParsConstructFromSz(rsParsObj **ppThis, unsigned char *psz)
{
rsParsObj *pThis;
rsCStrObj *pCS;
@@ -118,7 +118,7 @@ rsRetVal rsParsAssignString(rsParsObj *pThis, rsCStrObj *pCStr)
*/
rsRetVal parsInt(rsParsObj *pThis, int* pInt)
{
- char *pC;
+ unsigned char *pC;
int iVal;
rsCHECKVALIDOBJECT(pThis, OIDrsPars);
@@ -132,10 +132,10 @@ rsRetVal parsInt(rsParsObj *pThis, int* pInt)
*/
if(pThis->iCurrPos >= rsCStrLen(pThis->pCStr))
return RS_RET_NO_MORE_DATA;
- if(!isdigit(*pC))
+ if(!isdigit((int)*pC))
return RS_RET_NO_DIGIT;
- while(pThis->iCurrPos < rsCStrLen(pThis->pCStr) && isdigit(*pC)) {
+ while(pThis->iCurrPos < rsCStrLen(pThis->pCStr) && isdigit((int)*pC)) {
iVal = iVal * 10 + *pC - '0';
++pThis->iCurrPos;
++pC;
@@ -155,7 +155,7 @@ rsRetVal parsInt(rsParsObj *pThis, int* pInt)
*/
rsRetVal parsSkipAfterChar(rsParsObj *pThis, char c)
{
- register char *pC;
+ register unsigned char *pC;
rsRetVal iRet;
rsCHECKVALIDOBJECT(pThis, OIDrsPars);
@@ -189,14 +189,14 @@ rsRetVal parsSkipAfterChar(rsParsObj *pThis, char c)
*/
rsRetVal parsSkipWhitespace(rsParsObj *pThis)
{
- register char *pC;
+ register unsigned char *pC;
rsCHECKVALIDOBJECT(pThis, OIDrsPars);
pC = rsCStrGetBufBeg(pThis->pCStr);
while(pThis->iCurrPos < rsCStrLen(pThis->pCStr)) {
- if(!isspace(*(pC+pThis->iCurrPos)))
+ if(!isspace((int)*(pC+pThis->iCurrPos)))
break;
++pThis->iCurrPos;
}
@@ -218,7 +218,7 @@ rsRetVal parsSkipWhitespace(rsParsObj *pThis)
*/
rsRetVal parsDelimCStr(rsParsObj *pThis, rsCStrObj **ppCStr, char cDelim, int bTrimLeading, int bTrimTrailing)
{
- register char *pC;
+ register unsigned char *pC;
rsCStrObj *pCStr;
rsRetVal iRet;
@@ -284,7 +284,7 @@ rsRetVal parsDelimCStr(rsParsObj *pThis, rsCStrObj **ppCStr, char cDelim, int bT
*/
rsRetVal parsQuotedCStr(rsParsObj *pThis, rsCStrObj **ppCStr)
{
- register char *pC;
+ register unsigned char *pC;
rsCStrObj *pCStr;
rsRetVal iRet;
@@ -352,8 +352,8 @@ rsRetVal parsQuotedCStr(rsParsObj *pThis, rsCStrObj **ppCStr)
*/
rsRetVal parsIPv4WithBits(rsParsObj *pThis, unsigned long *pIP, int *pBits)
{
- register char *pC;
- char *pszIP;
+ register unsigned char *pC;
+ unsigned char *pszIP;
rsCStrObj *pCStr;
rsRetVal iRet;
@@ -371,7 +371,7 @@ rsRetVal parsIPv4WithBits(rsParsObj *pThis, unsigned long *pIP, int *pBits)
* whitespace. Validity will be checked down below.
*/
while(pThis->iCurrPos < rsCStrLen(pThis->pCStr)
- && *pC != '/' && *pC != ',' && !isspace(*pC)) {
+ && *pC != '/' && *pC != ',' && !isspace((int)*pC)) {
if((iRet = rsCStrAppendChar(pCStr, *pC)) != RS_RET_OK) {
RSFREEOBJ(pCStr);
return(iRet);
@@ -398,7 +398,7 @@ rsRetVal parsIPv4WithBits(rsParsObj *pThis, unsigned long *pIP, int *pBits)
if((pszIP = rsCStrConvSzStrAndDestruct(pCStr)) == NULL)
return RS_RET_ERR;
- if((*pIP = inet_addr(pszIP)) == -1) {
+ if((*pIP = inet_addr((char*) pszIP)) == -1) {
free(pszIP);
return RS_RET_INVALID_IP;
}
@@ -420,7 +420,7 @@ rsRetVal parsIPv4WithBits(rsParsObj *pThis, unsigned long *pIP, int *pBits)
/* skip to next processable character */
while(pThis->iCurrPos < rsCStrLen(pThis->pCStr)
- && (*pC == ',' || isspace(*pC))) {
+ && (*pC == ',' || isspace((int)*pC))) {
++pThis->iCurrPos;
++pC;
}
diff --git a/parse.h b/parse.h
index e6852ef1..63a7d7cd 100644
--- a/parse.h
+++ b/parse.h
@@ -76,7 +76,7 @@ rsRetVal parsDelimCStr(rsParsObj *pThis, rsCStrObj **ppCStr, char cDelim, int bT
rsRetVal parsSkipAfterChar(rsParsObj *pThis, char c);
rsRetVal parsQuotedCStr(rsParsObj *pThis, rsCStrObj **ppCStr);
-rsRetVal rsParsConstructFromSz(rsParsObj **ppThis, char *psz);
+rsRetVal rsParsConstructFromSz(rsParsObj **ppThis, unsigned char *psz);
rsRetVal rsParsDestruct(rsParsObj *pThis);
rsRetVal parsIPv4WithBits(rsParsObj *pThis, unsigned long *pIP, int *pBits);
int parsIsAtEndOfParseString(rsParsObj *pThis);
diff --git a/stringbuf.c b/stringbuf.c
index fa26dc09..656a3238 100755
--- a/stringbuf.c
+++ b/stringbuf.c
@@ -47,7 +47,7 @@ rsCStrObj *rsCStrConstruct(void)
/* construct from sz string
* rgerhards 2005-09-15
*/
-rsRetVal rsCStrConstructFromszStr(rsCStrObj **ppThis, char *sz)
+rsRetVal rsCStrConstructFromszStr(rsCStrObj **ppThis, unsigned char *sz)
{
rsCStrObj *pThis;
@@ -56,8 +56,8 @@ rsRetVal rsCStrConstructFromszStr(rsCStrObj **ppThis, char *sz)
if((pThis = rsCStrConstruct()) == NULL)
return RS_RET_OUT_OF_MEMORY;
- pThis->iBufSize = pThis->iStrLen = strlen(sz);
- if((pThis->pBuf = (char*) malloc(sizeof(char) * pThis->iStrLen)) == NULL) {
+ pThis->iBufSize = pThis->iStrLen = strlen((char*)(char *) sz);
+ if((pThis->pBuf = (unsigned char*) malloc(sizeof(unsigned char) * pThis->iStrLen)) == NULL) {
RSFREEOBJ(pThis);
return RS_RET_OUT_OF_MEMORY;
}
@@ -84,7 +84,7 @@ rsRetVal rsCStrConstructFromCStr(rsCStrObj **ppThis, rsCStrObj *pFrom)
return RS_RET_OUT_OF_MEMORY;
pThis->iBufSize = pThis->iStrLen = pFrom->iStrLen;
- if((pThis->pBuf = (char*) malloc(sizeof(char) * pThis->iStrLen)) == NULL) {
+ if((pThis->pBuf = (unsigned char*) malloc(sizeof(unsigned char) * pThis->iStrLen)) == NULL) {
RSFREEOBJ(pThis);
return RS_RET_OUT_OF_MEMORY;
}
@@ -118,7 +118,7 @@ void rsCStrDestruct(rsCStrObj *pThis)
}
-rsRetVal rsCStrAppendStrWithLen(rsCStrObj *pThis, char* psz, size_t iStrLen)
+rsRetVal rsCStrAppendStrWithLen(rsCStrObj *pThis, unsigned char* psz, size_t iStrLen)
{
rsRetVal iRet;
int iOldAllocInc;
@@ -131,7 +131,7 @@ rsRetVal rsCStrAppendStrWithLen(rsCStrObj *pThis, char* psz, size_t iStrLen)
* alloc increment. If so, we temporarily increase the alloc
* increment to the length of the string. This will ensure that
* one string copy will be needed at most. As this is a very
- * costly operation, it outweights the cost of the strlen() and
+ * costly operation, it outweights the cost of the strlen((char*)) and
* related stuff - at least I think so.
* rgerhards 2005-09-22
*/
@@ -157,35 +157,35 @@ rsRetVal rsCStrAppendStrWithLen(rsCStrObj *pThis, char* psz, size_t iStrLen)
* need to change existing code.
* rgerhards, 2007-07-03
*/
-rsRetVal rsCStrAppendStr(rsCStrObj *pThis, char* psz)
+rsRetVal rsCStrAppendStr(rsCStrObj *pThis, unsigned char* psz)
{
- return rsCStrAppendStrWithLen(pThis, psz, strlen(psz));
+ return rsCStrAppendStrWithLen(pThis, psz, strlen((char*)(char*) psz));
}
rsRetVal rsCStrAppendInt(rsCStrObj *pThis, int i)
{
rsRetVal iRet;
- char szBuf[32];
+ unsigned char szBuf[32];
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
- if((iRet = srUtilItoA(szBuf, sizeof(szBuf), i)) != RS_RET_OK)
+ if((iRet = srUtilItoA((char*) szBuf, sizeof(szBuf), i)) != RS_RET_OK)
return iRet;
return rsCStrAppendStr(pThis, szBuf);
}
-rsRetVal rsCStrAppendChar(rsCStrObj *pThis, char c)
+rsRetVal rsCStrAppendChar(rsCStrObj *pThis, unsigned char c)
{
- char* pNewBuf;
+ unsigned char* pNewBuf;
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
if(pThis->iStrLen >= pThis->iBufSize)
{ /* need more memory! */
- if((pNewBuf = (char*) malloc((pThis->iBufSize + pThis->iAllocIncrement) * sizeof(char))) == NULL)
+ if((pNewBuf = (unsigned char*) malloc((pThis->iBufSize + pThis->iAllocIncrement) * sizeof(unsigned char))) == NULL)
return RS_RET_OUT_OF_MEMORY;
memcpy(pNewBuf, pThis->pBuf, pThis->iBufSize);
pThis->iBufSize += pThis->iAllocIncrement;
@@ -215,7 +215,7 @@ rsRetVal rsCStrAppendChar(rsCStrObj *pThis, char c)
* not modified by this function.
* rgerhards, 2005-10-18
*/
-rsRetVal rsCStrSetSzStr(rsCStrObj *pThis, char *pszNew)
+rsRetVal rsCStrSetSzStr(rsCStrObj *pThis, unsigned char *pszNew)
{
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
@@ -229,13 +229,13 @@ rsRetVal rsCStrSetSzStr(rsCStrObj *pThis, char *pszNew)
pThis->pBuf = NULL;
pThis->pszBuf = NULL;
} else {
- pThis->iStrLen = strlen(pszNew);
+ pThis->iStrLen = strlen((char*)pszNew);
pThis->iBufSize = pThis->iStrLen;
pThis->pszBuf = NULL;
/* iAllocIncrement is NOT modified! */
/* now save the new value */
- if((pThis->pBuf = (char*) malloc(sizeof(char) * pThis->iStrLen)) == NULL) {
+ if((pThis->pBuf = (unsigned char*) malloc(sizeof(unsigned char) * pThis->iStrLen)) == NULL) {
RSFREEOBJ(pThis);
return RS_RET_OUT_OF_MEMORY;
}
@@ -254,11 +254,11 @@ rsRetVal rsCStrSetSzStr(rsCStrObj *pThis, char *pszNew)
* "" is returned.
* rgerhards 2005-10-19
*/
-char* rsCStrGetSzStrNoNULL(rsCStrObj *pThis)
+unsigned char* rsCStrGetSzStrNoNULL(rsCStrObj *pThis)
{
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
if(pThis->pBuf == NULL)
- return "";
+ return (unsigned char*) "";
else
return rsCStrGetSzStr(pThis);
}
@@ -272,7 +272,7 @@ char* rsCStrGetSzStrNoNULL(rsCStrObj *pThis)
* rsCStrGetSzStrNoNULL() instead.
* rgerhards, 2005-09-15
*/
-char* rsCStrGetSzStr(rsCStrObj *pThis)
+unsigned char* rsCStrGetSzStr(rsCStrObj *pThis)
{
int i;
@@ -281,7 +281,7 @@ char* rsCStrGetSzStr(rsCStrObj *pThis)
if(pThis->pBuf != NULL)
if(pThis->pszBuf == NULL) {
/* we do not yet have a usable sz version - so create it... */
- if((pThis->pszBuf = malloc(pThis->iStrLen + 1 * sizeof(char))) == NULL) {
+ if((pThis->pszBuf = malloc(pThis->iStrLen + 1 * sizeof(unsigned char))) == NULL) {
/* TODO: think about what to do - so far, I have no bright
* idea... rgerhards 2005-09-07
*/
@@ -322,9 +322,9 @@ char* rsCStrGetSzStr(rsCStrObj *pThis)
*
* rgerhards, 2005-09-07
*/
-char* rsCStrConvSzStrAndDestruct(rsCStrObj *pThis)
+unsigned char* rsCStrConvSzStrAndDestruct(rsCStrObj *pThis)
{
- char* pRetBuf;
+ unsigned char* pRetBuf;
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
@@ -352,14 +352,14 @@ rsRetVal rsCStrFinish(rsCStrObj *pThis)
* string size, and then copy the old one over.
* This new buffer is then to be returned.
*/
- if((pRetBuf = malloc((pThis->iBufSize) * sizeof(char))) == NULL)
+ if((pRetBuf = malloc((pThis->iBufSize) * sizeof(unsigned char))) == NULL)
{ /* OK, in this case we use the previous buffer. At least
* we have it ;)
*/
}
else
{ /* got the new buffer, so let's use it */
- char* pBuf;
+ unsigned char* pBuf;
memcpy(pBuf, pThis->pBuf, pThis->iBufPtr + 1);
pThis->pBuf = pBuf;
}
@@ -422,12 +422,12 @@ rsRetVal rsCStrTruncate(rsCStrObj *pThis, int nTrunc)
rsRetVal rsCStrTrimTrailingWhiteSpace(rsCStrObj *pThis)
{
register int i;
- register char *pC;
+ register unsigned char *pC;
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
i = pThis->iStrLen;
pC = pThis->pBuf + i - 1;
- while(i > 0 && isspace(*pC)) {
+ while(i > 0 && isspace((int)*pC)) {
--pC;
--i;
}
@@ -475,14 +475,14 @@ int rsCStrCStrCmp(rsCStrObj *pCS1, rsCStrObj *pCS2)
* comparison operation. Maybe it also has other needs.
* rgerhards 2005-10-19
*/
-int rsCStrSzStrStartsWithCStr(rsCStrObj *pCS1, char *psz, int iLenSz)
+int rsCStrSzStrStartsWithCStr(rsCStrObj *pCS1, unsigned char *psz, int iLenSz)
{
register int i;
int iMax;
rsCHECKVALIDOBJECT(pCS1, OIDrsCStr);
assert(psz != NULL);
- assert(iLenSz == strlen(psz)); /* just make sure during debugging! */
+ assert(iLenSz == strlen((char*)psz)); /* just make sure during debugging! */
if(iLenSz >= pCS1->iStrLen) {
/* we need to checkusing pCS1->iStrLen charactes at maximum, thus
* we move it to iMax.
@@ -507,13 +507,13 @@ int rsCStrSzStrStartsWithCStr(rsCStrObj *pCS1, char *psz, int iLenSz)
/* check if a CStr object starts with a sz-type string.
* rgerhards 2005-09-26
*/
-int rsCStrStartsWithSzStr(rsCStrObj *pCS1, char *psz, int iLenSz)
+int rsCStrStartsWithSzStr(rsCStrObj *pCS1, unsigned char *psz, int iLenSz)
{
register int i;
rsCHECKVALIDOBJECT(pCS1, OIDrsCStr);
assert(psz != NULL);
- assert(iLenSz == strlen(psz)); /* just make sure during debugging! */
+ assert(iLenSz == strlen((char*)psz)); /* just make sure during debugging! */
if(pCS1->iStrLen >= iLenSz) {
/* we are using iLenSz below, because we need to check
* iLenSz characters at maximum (start with!)
@@ -555,13 +555,13 @@ int rsCStrStartsWithSzStr(rsCStrObj *pCS1, char *psz, int iLenSz)
* program bug and will lead to unpredictable results and program aborts).
* rgerhards 2005-09-26
*/
-int rsCStrOffsetSzStrCmp(rsCStrObj *pCS1, int iOffset, char *psz, int iLenSz)
+int rsCStrOffsetSzStrCmp(rsCStrObj *pCS1, int iOffset, unsigned char *psz, int iLenSz)
{
rsCHECKVALIDOBJECT(pCS1, OIDrsCStr);
assert(iOffset >= 0);
assert(iOffset < pCS1->iStrLen);
assert(psz != NULL);
- assert(iLenSz == strlen(psz)); /* just make sure during debugging! */
+ assert(iLenSz == strlen((char*)psz)); /* just make sure during debugging! */
if((pCS1->iStrLen - iOffset) == iLenSz) {
/* we are using iLenSz below, because the lengths
* are equal and iLenSz is faster to access
@@ -591,19 +591,19 @@ int rsCStrOffsetSzStrCmp(rsCStrObj *pCS1, int iOffset, char *psz, int iLenSz)
* There must not only the sz string but also its length be
* provided. If the caller does not know the length he can
* call with
- * rsCstrSzStrCmp(pCS, psz, strlen(psz));
- * we are not doing the strlen() ourselfs as the caller might
+ * rsCstrSzStrCmp(pCS, psz, strlen((char*)psz));
+ * we are not doing the strlen((char*)) ourselfs as the caller might
* already know the length and in such cases we can save the
* overhead of doing it one more time (strelen() is costly!).
* The bottom line is that the provided length MUST be correct!
* The to sz string pointer must not be NULL!
* rgerhards 2005-09-26
*/
-int rsCStrSzStrCmp(rsCStrObj *pCS1, char *psz, int iLenSz)
+int rsCStrSzStrCmp(rsCStrObj *pCS1, unsigned char *psz, int iLenSz)
{
rsCHECKVALIDOBJECT(pCS1, OIDrsCStr);
assert(psz != NULL);
- assert(iLenSz == strlen(psz)); /* just make sure during debugging! */
+ assert(iLenSz == strlen((char*)psz)); /* just make sure during debugging! */
if(pCS1->iStrLen == iLenSz)
/* we are using iLenSz below, because the lengths
* are equal and iLenSz is faster to access
@@ -632,7 +632,7 @@ int rsCStrSzStrCmp(rsCStrObj *pCS1, char *psz, int iLenSz)
* returned. Both parameters MUST be given (NULL is not allowed).
* rgerhards 2005-09-19
*/
-int rsCStrLocateInSzStr(rsCStrObj *pThis, char *sz)
+int rsCStrLocateInSzStr(rsCStrObj *pThis, unsigned char *sz)
{
int i;
int iMax;
@@ -647,13 +647,13 @@ int rsCStrLocateInSzStr(rsCStrObj *pThis, char *sz)
* the to-be-located string must be able to be present in the
* searched string (it needs its size ;)).
*/
- iMax = strlen(sz) - pThis->iStrLen;
+ iMax = strlen((char*)sz) - pThis->iStrLen;
bFound = 0;
i = 0;
while(i <= iMax && !bFound) {
int iCheck;
- char *pComp = sz + i;
+ unsigned char *pComp = sz + i;
for(iCheck = 0 ; iCheck < pThis->iStrLen ; ++iCheck)
if(*(pComp + iCheck) != *(pThis->pBuf + iCheck))
break;
@@ -676,7 +676,7 @@ int rsCStrLocateInSzStr(rsCStrObj *pThis, char *sz)
* some time later. However, it is not fully tested, so start with testing
* it before you put it to first use).
*/
-int rsCStrLocateSzStr(rsCStrObj *pThis, char *sz)
+int rsCStrLocateSzStr(rsCStrObj *pThis, unsigned char *sz)
{
int iLenSz;
int i;
@@ -687,7 +687,7 @@ int rsCStrLocateSzStr(rsCStrObj *pThis, char *sz)
if(sz == NULL)
return 0;
- iLenSz = strlen(sz);
+ iLenSz = strlen((char*)sz);
if(iLenSz == 0)
return 0;
@@ -701,7 +701,7 @@ int rsCStrLocateSzStr(rsCStrObj *pThis, char *sz)
i = 0;
while(i < iMax && !bFound) {
int iCheck;
- char *pComp = pThis->pBuf + i;
+ unsigned char *pComp = pThis->pBuf + i;
for(iCheck = 0 ; iCheck < iLenSz ; ++iCheck)
if(*(pComp + iCheck) != *(sz + iCheck))
break;
diff --git a/stringbuf.h b/stringbuf.h
index 5f9a0879..de66051c 100755
--- a/stringbuf.h
+++ b/stringbuf.h
@@ -27,8 +27,8 @@ struct rsCStrObject
#ifndef NDEBUG
rsObjID OID; /**< object ID */
#endif
- char *pBuf; /**< pointer to the string buffer, may be NULL if string is empty */
- char *pszBuf; /**< pointer to the sz version of the string (after it has been created )*/
+ unsigned char *pBuf; /**< pointer to the string buffer, may be NULL if string is empty */
+ unsigned char *pszBuf; /**< pointer to the sz version of the string (after it has been created )*/
int iBufSize; /**< current maximum size of the string buffer */
int iStrLen; /**< length of the string in characters. */
int iAllocIncrement; /**< the amount of bytes the string should be expanded if it needs to */
@@ -40,7 +40,7 @@ typedef struct rsCStrObject rsCStrObj;
* Construct a rsCStr object.
*/
rsCStrObj *rsCStrConstruct(void);
-rsRetVal rsCStrConstructFromszStr(rsCStrObj **ppThis, char *sz);
+rsRetVal rsCStrConstructFromszStr(rsCStrObj **ppThis, unsigned char *sz);
rsRetVal rsCStrConstructFromCStr(rsCStrObj **ppThis, rsCStrObj *pFrom);
/**
@@ -54,7 +54,7 @@ void rsCStrDestruct(rsCStrObj *pThis);
*
* \param c Character to append to string.
*/
-rsRetVal rsCStrAppendChar(rsCStrObj *pThis, char c);
+rsRetVal rsCStrAppendChar(rsCStrObj *pThis, unsigned char c);
/**
* Finish the string buffer dynamic allocation.
@@ -77,7 +77,7 @@ rsRetVal rsCStrTrimTrailingWhiteSpace(rsCStrObj *pThis);
*
* \param psz pointer to string to be appended. Must not be NULL.
*/
-rsRetVal rsCStrAppendStr(rsCStrObj *pThis, char* psz);
+rsRetVal rsCStrAppendStr(rsCStrObj *pThis, unsigned char* psz);
/**
* Append a string to the buffer.
@@ -85,7 +85,7 @@ rsRetVal rsCStrAppendStr(rsCStrObj *pThis, char* psz);
* \param psz pointer to string to be appended. Must not be NULL.
* \param iStrLen the length of the string pointed to by psz
*/
-rsRetVal rsCStrAppendStrWithLen(rsCStrObj *pThis, char* psz, size_t iStrLen);
+rsRetVal rsCStrAppendStrWithLen(rsCStrObj *pThis, unsigned char* psz, size_t iStrLen);
/**
* Set a new allocation incremet. This will influence
@@ -110,17 +110,17 @@ void rsCStrSetAllocIncrement(rsCStrObj *pThis, int iNewIncrement);
rsRetVal rsCStrAppendInt(rsCStrObj *pThis, int i);
-char* rsCStrGetSzStr(rsCStrObj *pThis);
-char* rsCStrGetSzStrNoNULL(rsCStrObj *pThis);
-rsRetVal rsCStrSetSzStr(rsCStrObj *pThis, char *pszNew);
-char* rsCStrConvSzStrAndDestruct(rsCStrObj *pThis);
+unsigned char* rsCStrGetSzStr(rsCStrObj *pThis);
+unsigned char* rsCStrGetSzStrNoNULL(rsCStrObj *pThis);
+rsRetVal rsCStrSetSzStr(rsCStrObj *pThis, unsigned char *pszNew);
+unsigned char* rsCStrConvSzStrAndDestruct(rsCStrObj *pThis);
int rsCStrCStrCmp(rsCStrObj *pCS1, rsCStrObj *pCS2);
-int rsCStrSzStrCmp(rsCStrObj *pCS1, char *psz, int iLenSz);
-int rsCStrOffsetSzStrCmp(rsCStrObj *pCS1, int iOffset, char *psz, int iLenSz);
-int rsCStrLocateSzStr(rsCStrObj *pCStr, char *sz);
-int rsCStrLocateInSzStr(rsCStrObj *pThis, char *sz);
-int rsCStrStartsWithSzStr(rsCStrObj *pCS1, char *psz, int iLenSz);
-int rsCStrSzStrStartsWithCStr(rsCStrObj *pCS1, char *psz, int iLenSz);
+int rsCStrSzStrCmp(rsCStrObj *pCS1, unsigned char *psz, int iLenSz);
+int rsCStrOffsetSzStrCmp(rsCStrObj *pCS1, int iOffset, unsigned char *psz, int iLenSz);
+int rsCStrLocateSzStr(rsCStrObj *pCStr, unsigned char *sz);
+int rsCStrLocateInSzStr(rsCStrObj *pThis, unsigned char *sz);
+int rsCStrStartsWithSzStr(rsCStrObj *pCS1, unsigned char *psz, int iLenSz);
+int rsCStrSzStrStartsWithCStr(rsCStrObj *pCS1, unsigned char *psz, int iLenSz);
/* now come inline-like functions */
#ifdef NDEBUG
diff --git a/syslogd.c b/syslogd.c
index 6ea5260e..ec65aaac 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -964,7 +964,7 @@ static void reapchild();
static char *cvthname(struct sockaddr_storage *f);
static void debug_switch();
static rsRetVal cfline(char *line, register struct filed *f);
-static int decode(char *name, struct code *codetab);
+static int decode(unsigned char *name, struct code *codetab);
static void sighup_handler();
static void die(int sig);
#ifdef WITH_DB
@@ -3010,7 +3010,7 @@ static rsRetVal MsgSetAPPNAME(struct msg *pMsg, char* pszAPPNAME)
rsCStrSetAllocIncrement(pMsg->pCSAPPNAME, 128);
}
/* if we reach this point, we have the object */
- return rsCStrSetSzStr(pMsg->pCSAPPNAME, pszAPPNAME);
+ return rsCStrSetSzStr(pMsg->pCSAPPNAME, (unsigned char*) pszAPPNAME);
}
@@ -3049,7 +3049,7 @@ static char *getAPPNAME(struct msg *pM)
assert(pM != NULL);
if(pM->pCSAPPNAME == NULL)
tryEmulateAPPNAME(pM);
- return (pM->pCSAPPNAME == NULL) ? "" : rsCStrGetSzStrNoNULL(pM->pCSAPPNAME);
+ return (pM->pCSAPPNAME == NULL) ? "" : (char*) rsCStrGetSzStrNoNULL(pM->pCSAPPNAME);
}
@@ -3067,7 +3067,7 @@ static rsRetVal MsgSetPROCID(struct msg *pMsg, char* pszPROCID)
rsCStrSetAllocIncrement(pMsg->pCSPROCID, 128);
}
/* if we reach this point, we have the object */
- return rsCStrSetSzStr(pMsg->pCSPROCID, pszPROCID);
+ return rsCStrSetSzStr(pMsg->pCSPROCID, (unsigned char*) pszPROCID);
}
/* rgerhards, 2005-11-24
@@ -3088,7 +3088,7 @@ static char *getPROCID(struct msg *pM)
assert(pM != NULL);
if(pM->pCSPROCID == NULL)
aquirePROCIDFromTAG(pM);
- return (pM->pCSPROCID == NULL) ? "-" : rsCStrGetSzStrNoNULL(pM->pCSPROCID);
+ return (pM->pCSPROCID == NULL) ? "-" : (char*) rsCStrGetSzStrNoNULL(pM->pCSPROCID);
}
@@ -3104,7 +3104,7 @@ static rsRetVal MsgSetMSGID(struct msg *pMsg, char* pszMSGID)
rsCStrSetAllocIncrement(pMsg->pCSMSGID, 128);
}
/* if we reach this point, we have the object */
- return rsCStrSetSzStr(pMsg->pCSMSGID, pszMSGID);
+ return rsCStrSetSzStr(pMsg->pCSMSGID, (unsigned char*) pszMSGID);
}
/* rgerhards, 2005-11-24
@@ -3121,7 +3121,7 @@ static int getMSGIDLen(struct msg *pM)
*/
static char *getMSGID(struct msg *pM)
{
- return (pM->pCSMSGID == NULL) ? "-" : rsCStrGetSzStrNoNULL(pM->pCSMSGID);
+ return (pM->pCSMSGID == NULL) ? "-" : (char*) rsCStrGetSzStrNoNULL(pM->pCSMSGID);
}
@@ -3261,7 +3261,7 @@ static rsRetVal MsgSetStructuredData(struct msg *pMsg, char* pszStrucData)
rsCStrSetAllocIncrement(pMsg->pCSStrucData, 128);
}
/* if we reach this point, we have the object */
- return rsCStrSetSzStr(pMsg->pCSStrucData, pszStrucData);
+ return rsCStrSetSzStr(pMsg->pCSStrucData, (unsigned char*) pszStrucData);
}
/* get the length of the "STRUCTURED-DATA" sz string
@@ -3280,7 +3280,7 @@ static int getStructuredDataLen(struct msg *pM)
*/
static char *getStructuredData(struct msg *pM)
{
- return (pM->pCSStrucData == NULL) ? "-" : rsCStrGetSzStrNoNULL(pM->pCSStrucData);
+ return (pM->pCSStrucData == NULL) ? "-" : (char*) rsCStrGetSzStrNoNULL(pM->pCSStrucData);
}
@@ -3441,7 +3441,7 @@ static char *getProgramName(struct msg *pM)
return ""; /* best we can do */
}
- return (pM->pCSProgName == NULL) ? "" : rsCStrGetSzStrNoNULL(pM->pCSProgName);
+ return (pM->pCSProgName == NULL) ? "" : (char*) rsCStrGetSzStrNoNULL(pM->pCSProgName);
}
@@ -3624,7 +3624,7 @@ static char *MsgGetProp(struct msg *pMsg, struct templateEntry *pTpe,
assert(pTpe != NULL);
pName = pTpe->data.field.pPropRepl;
} else {
- pName = rsCStrGetSzStr(pCSPropName);
+ pName = (char*) rsCStrGetSzStr(pCSPropName);
}
*pbMustBeFreed = 0;
@@ -4561,14 +4561,14 @@ int shouldProcessThisMessage(struct filed *f, struct msg *pMsg)
* it is the one most often used, so this saves us time!
*/
} else if(f->eHostnameCmpMode == HN_COMP_MATCH) {
- if(rsCStrSzStrCmp(f->pCSHostnameComp, getHOSTNAME(pMsg), getHOSTNAMELen(pMsg))) {
+ if(rsCStrSzStrCmp(f->pCSHostnameComp, (unsigned char*) getHOSTNAME(pMsg), getHOSTNAMELen(pMsg))) {
/* not equal, so we are already done... */
dprintf("hostname filter '+%s' does not match '%s'\n",
rsCStrGetSzStr(f->pCSHostnameComp), getHOSTNAME(pMsg));
return 0;
}
} else { /* must be -hostname */
- if(!rsCStrSzStrCmp(f->pCSHostnameComp, getHOSTNAME(pMsg), getHOSTNAMELen(pMsg))) {
+ if(!rsCStrSzStrCmp(f->pCSHostnameComp, (unsigned char*) getHOSTNAME(pMsg), getHOSTNAMELen(pMsg))) {
/* not equal, so we are already done... */
dprintf("hostname filter '-%s' does not match '%s'\n",
rsCStrGetSzStr(f->pCSHostnameComp), getHOSTNAME(pMsg));
@@ -4577,7 +4577,7 @@ int shouldProcessThisMessage(struct filed *f, struct msg *pMsg)
}
if(f->pCSProgNameComp != NULL) {
- if(rsCStrSzStrCmp(f->pCSProgNameComp, getProgramName(pMsg), getProgramNameLen(pMsg))) {
+ if(rsCStrSzStrCmp(f->pCSProgNameComp, (unsigned char*) getProgramName(pMsg), getProgramNameLen(pMsg))) {
/* not equal, so we are already done... */
dprintf("programname filter '%s' does not match '%s'\n",
rsCStrGetSzStr(f->pCSProgNameComp), getProgramName(pMsg));
@@ -4602,17 +4602,17 @@ int shouldProcessThisMessage(struct filed *f, struct msg *pMsg)
/* Now do the compares (short list currently ;)) */
switch(f->f_filterData.prop.operation ) {
case FIOP_CONTAINS:
- if(rsCStrLocateInSzStr(f->f_filterData.prop.pCSCompValue, pszPropVal) != -1)
+ if(rsCStrLocateInSzStr(f->f_filterData.prop.pCSCompValue, (unsigned char*) pszPropVal) != -1)
iRet = 1;
break;
case FIOP_ISEQUAL:
if(rsCStrSzStrCmp(f->f_filterData.prop.pCSCompValue,
- pszPropVal, strlen(pszPropVal)) == 0)
+ (unsigned char*) pszPropVal, strlen(pszPropVal)) == 0)
iRet = 1; /* process message! */
break;
case FIOP_STARTSWITH:
if(rsCStrSzStrStartsWithCStr(f->f_filterData.prop.pCSCompValue,
- pszPropVal, strlen(pszPropVal)) == 0)
+ (unsigned char*) pszPropVal, strlen(pszPropVal)) == 0)
iRet = 1; /* process message! */
break;
default:
@@ -5302,7 +5302,7 @@ static int parseLegacySyslogMsg(struct msg *pMsg, int flags)
}
rsCStrFinish(pStrB);
- pszTAG = rsCStrConvSzStrAndDestruct(pStrB);
+ pszTAG = (char*) rsCStrConvSzStrAndDestruct(pStrB);
if(pszTAG == NULL)
{ /* rger, 2005-11-10: no TAG found - this implies that what
* we have considered to be the HOSTNAME is most probably the
@@ -5493,7 +5493,7 @@ void doSQLEscape(char **pp, size_t *pLen, unsigned short *pbMustBeFreed, int esc
char *p;
int iLen;
rsCStrObj *pStrB;
- char *pszGenerated;
+ unsigned char *pszGenerated;
assert(pp != NULL);
assert(*pp != NULL);
@@ -5558,7 +5558,7 @@ void doSQLEscape(char **pp, size_t *pLen, unsigned short *pbMustBeFreed, int esc
if(*pbMustBeFreed)
free(*pp); /* discard previous value */
- *pp = pszGenerated;
+ *pp = (char*) pszGenerated;
*pLen = iLen;
*pbMustBeFreed = 1;
}
@@ -5607,7 +5607,7 @@ char *iovAsString(struct filed *f)
}
rsCStrFinish(pStrB);
- f->f_psziov = rsCStrConvSzStrAndDestruct(pStrB);
+ f->f_psziov = (char*) rsCStrConvSzStrAndDestruct(pStrB);
return f->f_psziov;
}
@@ -5731,7 +5731,7 @@ void iovCreate(struct filed *f)
* worse. So we prefer to let the caller deal with it.
* rgerhards, 2007-07-03
*/
-static char *tplToString(char *tplName, struct msg *pMsg)
+static unsigned char *tplToString(unsigned char *tplName, struct msg *pMsg)
{
struct template *pTpl;
struct templateEntry *pTpe;
@@ -5744,7 +5744,7 @@ static char *tplToString(char *tplName, struct msg *pMsg)
assert(tplName != NULL);
assert(pMsg != NULL);
- if((pTpl = tplFind(tplName, strlen(tplName))) == NULL)
+ if((pTpl = tplFind((char*)tplName, strlen((char*) tplName))) == NULL)
return NULL;
/* we now loop through the template. We obtain one value
@@ -5761,7 +5761,7 @@ static char *tplToString(char *tplName, struct msg *pMsg)
while(pTpe != NULL) {
if(pTpe->eEntryType == CONSTANT) {
if((iRet = rsCStrAppendStrWithLen(pCStr,
- pTpe->data.constant.pConstant,
+ (unsigned char *) pTpe->data.constant.pConstant,
pTpe->data.constant.iLenConstant)
) != RS_RET_OK) {
dprintf("error %d during tplToString()\n", iRet);
@@ -5770,7 +5770,7 @@ static char *tplToString(char *tplName, struct msg *pMsg)
return NULL;
}
} else if(pTpe->eEntryType == FIELD) {
- pVal = MsgGetProp(pMsg, pTpe, NULL, &bMustBeFreed);
+ pVal = (char*) MsgGetProp(pMsg, pTpe, NULL, &bMustBeFreed);
iLenVal = strlen(pVal);
/* we now need to check if we should use SQL option. In this case,
* we must go over the generated string and escape '\'' characters.
@@ -5783,7 +5783,7 @@ static char *tplToString(char *tplName, struct msg *pMsg)
else if(pTpl->optFormatForSQL == 2)
doSQLEscape(&pVal, &iLenVal, &bMustBeFreed, 0);
/* value extracted, so lets copy */
- if((iRet = rsCStrAppendStrWithLen(pCStr, pVal, iLenVal)) != RS_RET_OK) {
+ if((iRet = rsCStrAppendStrWithLen(pCStr, (unsigned char*) pVal, iLenVal)) != RS_RET_OK) {
dprintf("error %d during tplToString()\n", iRet);
/* it does not make sense to continue now */
rsCStrDestruct(pCStr);
@@ -5847,24 +5847,24 @@ int resolveFileSizeLimit(struct filed *f)
*/
static int prepareDynFile(struct filed *f)
{
- char *newFileName;
+ unsigned char *newFileName;
assert(f != NULL);
- if((newFileName = tplToString(f->f_un.f_file.f_fname, f->f_pMsg)) == NULL) {
+ if((newFileName = tplToString((unsigned char *) f->f_un.f_file.f_fname, f->f_pMsg)) == NULL) {
/* memory shortage - there is nothing we can do to resolve it.
* We silently ignore it, this is probably the best we can do.
*/
dprintf("prepareDynfile(): could not create file name, discarding this reques\n");
return -1;
}
- if(strcmp(newFileName, f->f_un.f_file.pCurrName)) {
+ if(strcmp((char*) newFileName, f->f_un.f_file.pCurrName)) {
dprintf("Requested log file different from currently open one - switching.\n");
dprintf("Current file: '%s'\n", f->f_un.f_file.pCurrName);
dprintf("New file : '%s'\n", newFileName);
close(f->f_file);
- f->f_file = open(newFileName, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY, 0644);
+ f->f_file = open((char*) newFileName, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY, 0644);
free(f->f_un.f_file.pCurrName);
- f->f_un.f_file.pCurrName = newFileName;
+ f->f_un.f_file.pCurrName = (char*) newFileName;
} else { /* we are all set, the log file is already open */
free(newFileName);
@@ -5980,7 +5980,7 @@ void fprintlog(register struct filed *f)
char *msg;
char *psz; /* for shell support */
int esize; /* for shell support */
- char *exec; /* for shell support */
+ unsigned char *exec; /* for shell support */
rsCStrObj *pCSCmdLine; /* for shell support: command to execute */
rsRetVal iRet;
#ifdef SYSLOG_INET
@@ -6225,11 +6225,11 @@ void fprintlog(register struct filed *f)
dprintf("memory shortage - can not execute\n");
break;
}
- if((iRet = rsCStrAppendStr(pCSCmdLine, f->f_un.f_file.f_fname)) != RS_RET_OK) {
+ if((iRet = rsCStrAppendStr(pCSCmdLine, (unsigned char*) f->f_un.f_file.f_fname)) != RS_RET_OK) {
dprintf("error %d during build command line(1)\n", iRet);
break;
}
- if((iRet = rsCStrAppendStr(pCSCmdLine, " \"")) != RS_RET_OK) {
+ if((iRet = rsCStrAppendStr(pCSCmdLine, (unsigned char*) " \"")) != RS_RET_OK) {
dprintf("error %d during build command line(2)\n", iRet);
break;
}
@@ -6257,7 +6257,7 @@ void fprintlog(register struct filed *f)
rsCStrFinish(pCSCmdLine);
exec = rsCStrConvSzStrAndDestruct(pCSCmdLine);
dprintf("Executing \"%s\"\n",exec);
- system(exec); /* rgerhards: TODO: need to change this for root jail support! */
+ system((char*) exec); /* rgerhards: TODO: need to change this for root jail support! */
free(exec);
break;
@@ -6789,7 +6789,7 @@ static rsRetVal addAllowedSenderLine(char* pName, char** ppRestOfConfLine)
* for this.
*/
/* create parser object starting with line string without leading colon */
- if((iRet = rsParsConstructFromSz(&pPars, *ppRestOfConfLine) != RS_RET_OK)) {
+ if((iRet = rsParsConstructFromSz(&pPars, (unsigned char*) *ppRestOfConfLine) != RS_RET_OK)) {
logerrorInt("Error %d constructing parser object - ignoring allowed sender list", iRet);
return(iRet);
}
@@ -7312,10 +7312,10 @@ static void cflineSetTemplateAndIOV(struct filed *f, char *pTemplateName)
* to be \0 in this case.
* rgerhards 2004-11-19
*/
-static void cflineParseTemplateName(struct filed *f, char** pp,
+static void cflineParseTemplateName(struct filed *f, unsigned char** pp,
register char* pTemplateName, int iLenTemplate)
{
- register char *p;
+ register unsigned char *p;
int i;
assert(f != NULL);
@@ -7344,7 +7344,7 @@ static void cflineParseTemplateName(struct filed *f, char** pp,
* filed struct.
* rgerhards 2004-11-18
*/
-static void cflineParseFileName(struct filed *f, char* p)
+static void cflineParseFileName(struct filed *f, unsigned char* p)
{
register char *pName;
int i;
@@ -7393,7 +7393,7 @@ static void cflineParseFileName(struct filed *f, char* p)
* removed.
* rgerhards 2005-06-21
*/
-static void cflineParseOutchannel(struct filed *f, char* p)
+static void cflineParseOutchannel(struct filed *f, unsigned char* p)
{
int i;
struct outchannel *pOch;
@@ -7478,17 +7478,17 @@ static void cflineParseOutchannel(struct filed *f, char* p)
* passed back to the caller.
* rgerhards 2005-09-15
*/
-static rsRetVal cflineProcessTradPRIFilter(char **pline, register struct filed *f)
+static rsRetVal cflineProcessTradPRIFilter(unsigned char **pline, register struct filed *f)
{
- char *p;
- register char *q;
+ unsigned char *p;
+ register unsigned char *q;
register int i, i2;
- char *bp;
+ unsigned char *bp;
int pri;
int singlpri = 0;
int ignorepri = 0;
- char buf[MAXLINE];
- char xbuf[200];
+ unsigned char buf[MAXLINE];
+ unsigned char xbuf[200];
assert(pline != NULL);
assert(*pline != NULL);
@@ -7543,8 +7543,8 @@ static rsRetVal cflineProcessTradPRIFilter(char **pline, register struct filed *
}
if (pri < 0) {
- (void) snprintf(xbuf, sizeof(xbuf), "unknown priority name \"%s\"", buf);
- logerror(xbuf);
+ snprintf((char*) xbuf, sizeof(xbuf), "unknown priority name \"%s\"", buf);
+ logerror((char*) xbuf);
return RS_RET_ERR;
}
@@ -7590,8 +7590,8 @@ static rsRetVal cflineProcessTradPRIFilter(char **pline, register struct filed *
i = decode(buf, FacNames);
if (i < 0) {
- (void) snprintf(xbuf, sizeof(xbuf), "unknown facility name \"%s\"", buf);
- logerror(xbuf);
+ snprintf((char*) xbuf, sizeof(xbuf), "unknown facility name \"%s\"", buf);
+ logerror((char*) xbuf);
return RS_RET_ERR;
}
@@ -7643,7 +7643,7 @@ static rsRetVal cflineProcessTradPRIFilter(char **pline, register struct filed *
* of the action part. A pointer to that beginnig is passed back to the caller.
* rgerhards 2005-09-15
*/
-static rsRetVal cflineProcessPropFilter(char **pline, register struct filed *f)
+static rsRetVal cflineProcessPropFilter(unsigned char **pline, register struct filed *f)
{
rsParsObj *pPars;
rsCStrObj *pCSCompOp;
@@ -7699,15 +7699,15 @@ static rsRetVal cflineProcessPropFilter(char **pline, register struct filed *f)
iOffset = 0;
}
- if(!rsCStrOffsetSzStrCmp(pCSCompOp, iOffset, "contains", 8)) {
+ if(!rsCStrOffsetSzStrCmp(pCSCompOp, iOffset, (unsigned char*) "contains", 8)) {
f->f_filterData.prop.operation = FIOP_CONTAINS;
- } else if(!rsCStrOffsetSzStrCmp(pCSCompOp, iOffset, "isequal", 7)) {
+ } else if(!rsCStrOffsetSzStrCmp(pCSCompOp, iOffset, (unsigned char*) "isequal", 7)) {
f->f_filterData.prop.operation = FIOP_ISEQUAL;
- } else if(!rsCStrOffsetSzStrCmp(pCSCompOp, iOffset, "startswith", 10)) {
+ } else if(!rsCStrOffsetSzStrCmp(pCSCompOp, iOffset, (unsigned char*) "startswith", 10)) {
f->f_filterData.prop.operation = FIOP_STARTSWITH;
} else {
logerrorSz("error: invalid compare operation '%s' - ignoring selector",
- rsCStrGetSzStr(pCSCompOp));
+ (char*) rsCStrGetSzStr(pCSCompOp));
}
RSFREEOBJ(pCSCompOp); /* no longer needed */
@@ -7739,7 +7739,7 @@ static rsRetVal cflineProcessPropFilter(char **pline, register struct filed *f)
* from the config file ("+/-hostname"). It stores it for further reference.
* rgerhards 2005-10-19
*/
-static rsRetVal cflineProcessHostSelector(char **pline, register struct filed *f)
+static rsRetVal cflineProcessHostSelector(unsigned char **pline, register struct filed *f)
{
rsRetVal iRet;
@@ -7792,7 +7792,7 @@ static rsRetVal cflineProcessHostSelector(char **pline, register struct filed *f
* from the config file ("!tagname"). It stores it for further reference.
* rgerhards 2005-10-18
*/
-static rsRetVal cflineProcessTagSelector(char **pline, register struct filed *f)
+static rsRetVal cflineProcessTagSelector(unsigned char **pline, register struct filed *f)
{
rsRetVal iRet;
@@ -7846,8 +7846,8 @@ static rsRetVal cflineProcessTagSelector(char **pline, register struct filed *f)
*/
static rsRetVal cfline(char *line, register struct filed *f)
{
- char *p;
- register char *q;
+ unsigned char *p;
+ register unsigned char *q;
register int i;
int syncfile;
rsRetVal iRet;
@@ -7864,7 +7864,7 @@ static rsRetVal cfline(char *line, register struct filed *f)
dprintf("cfline(%s)", line);
errno = 0; /* keep strerror() stuff out of logerror messages */
- p = line;
+ p = (unsigned char*) line;
/* check which filter we need to pull... */
switch(*p) {
@@ -7992,7 +7992,7 @@ static rsRetVal cfline(char *line, register struct filed *f)
f->f_un.f_forw.port = NULL;
if(*p == ':') { /* process port */
register int i = 0;
- char * tmp;
+ unsigned char * tmp;
*p = '\0'; /* trick to obtain hostname (later)! */
tmp = ++p;
@@ -8039,7 +8039,7 @@ static rsRetVal cfline(char *line, register struct filed *f)
}
/* first set the f->f_type */
- strcpy(f->f_un.f_forw.f_hname, q);
+ strcpy(f->f_un.f_forw.f_hname, (char*) q);
memset(&hints, 0, sizeof(hints));
/* port must be numeric, because config file syntax requests this */
hints.ai_flags = AI_NUMERICSERV;
@@ -8152,7 +8152,7 @@ static rsRetVal cfline(char *line, register struct filed *f)
f->f_type = F_TTY;
untty();
}
- if (strcmp(p, ctty) == 0)
+ if (strcmp((char*) p, ctty) == 0)
f->f_type = F_CONSOLE;
break;
@@ -8163,7 +8163,7 @@ static rsRetVal cfline(char *line, register struct filed *f)
/* we have a template specifier! */
p += 2; /* eat "*;" */
cflineParseTemplateName(f, &p, szTemplateName,
- sizeof(szTemplateName) / sizeof(char));
+ sizeof(szTemplateName) / sizeof(unsigned char));
}
else /* assign default format if none given! */
szTemplateName[0] = '\0';
@@ -8279,7 +8279,7 @@ static rsRetVal cfline(char *line, register struct filed *f)
for (i = 0; i < MAXUNAMES && *p && *p != ';'; i++) {
for (q = p; *q && *q != ',' && *q != ';'; )
q++;
- (void) strncpy(f->f_un.f_uname[i], p, UNAMESZ);
+ (void) strncpy((char*) f->f_un.f_uname[i], (char*) p, UNAMESZ);
if ((q - p) > UNAMESZ)
f->f_un.f_uname[i][UNAMESZ] = '\0';
else
@@ -8319,11 +8319,11 @@ static rsRetVal cfline(char *line, register struct filed *f)
/* Decode a symbolic name to a numeric value
*/
-int decode(char *name, struct code *codetab)
+int decode(unsigned char *name, struct code *codetab)
{
register struct code *c;
- register char *p;
- char buf[80];
+ register unsigned char *p;
+ unsigned char buf[80];
assert(name != NULL);
assert(codetab != NULL);
@@ -8332,14 +8332,14 @@ int decode(char *name, struct code *codetab)
if (isdigit(*name))
{
dprintf ("\n");
- return (atoi(name));
+ return (atoi((char*) name));
}
- (void) strncpy(buf, name, 79);
+ strncpy((char*) buf, (char*) name, 79);
for (p = buf; *p; p++)
- if (isupper(*p))
- *p = tolower(*p);
+ if (isupper((int) *p))
+ *p = tolower((int) *p);
for (c = codetab; c->c_name; c++)
- if (!strcmp(buf, c->c_name))
+ if (!strcmp((char*) buf, (char*) c->c_name))
{
dprintf (" ==> %d\n", c->c_val);
return (c->c_val);
diff --git a/template.c b/template.c
index b749a6bd..00dda0d0 100644
--- a/template.c
+++ b/template.c
@@ -130,7 +130,7 @@ static int do_Constant(char **pp, struct template *pTpl)
case '8':
case '9':
i = 0;
- while(*p && isdigit(*p)) {
+ while(*p && isdigit((int)*p)) {
i = i * 10 + *p++ - '0';
}
rsCStrAppendChar(pStrB, i);
@@ -160,7 +160,7 @@ static int do_Constant(char **pp, struct template *pTpl)
* 2005-09-09 rgerhards
*/
pTpe->data.constant.iLenConstant = rsCStrLen(pStrB);
- pTpe->data.constant.pConstant = rsCStrConvSzStrAndDestruct(pStrB);
+ pTpe->data.constant.pConstant = (char*) rsCStrConvSzStrAndDestruct(pStrB);
*pp = p;
@@ -190,7 +190,7 @@ static void doOptions(char **pp, struct templateEntry *pTpe)
while((i < sizeof(Buf) / sizeof(char)) &&
*p && *p != '%' && *p != ',') {
/* inner loop - until end of ONE option */
- Buf[i++] = tolower(*p);
+ Buf[i++] = tolower((int)*p);
++p;
}
Buf[i] = '\0'; /* terminate */
@@ -267,7 +267,7 @@ static int do_Parameter(char **pp, struct template *pTpl)
/* got the name*/
rsCStrFinish(pStrB);
- pTpe->data.field.pPropRepl = rsCStrConvSzStrAndDestruct(pStrB);
+ pTpe->data.field.pPropRepl = (char*) rsCStrConvSzStrAndDestruct(pStrB);
/* Check frompos, if it has an R, then topos should be a regex */
if(*p == ':') {
@@ -303,7 +303,7 @@ static int do_Parameter(char **pp, struct template *pTpl)
* **DECIMAL** ASCII value of the delimiter character.
*/
pTpe->data.field.has_fields = 1;
- if(!isdigit(*p)) {
+ if(!isdigit((int)*p)) {
/* complain and use default */
logerrorSz
("error: invalid character in frompos after \"F,\", property: '%%%s' - using 9 (HT) as field delimiter",
@@ -311,7 +311,7 @@ static int do_Parameter(char **pp, struct template *pTpl)
pTpe->data.field.field_delim = 9;
} else {
iNum = 0;
- while(isdigit(*p))
+ while(isdigit((int)*p))
iNum = iNum * 10 + *p++ - '0';
if(iNum < 0 || iNum > 255) {
logerrorInt
@@ -332,7 +332,7 @@ static int do_Parameter(char **pp, struct template *pTpl)
} else {
/* we now have a simple offset in frompos (the previously "normal" case) */
iNum = 0;
- while(isdigit(*p))
+ while(isdigit((int)*p))
iNum = iNum * 10 + *p++ - '0';
pTpe->data.field.iFromPos = iNum;
/* skip to next known good */
@@ -408,7 +408,7 @@ static int do_Parameter(char **pp, struct template *pTpl)
#endif /* #ifdef FEATURE_REGEXP */
iNum = 0;
- while(isdigit(*p))
+ while(isdigit((int)*p))
iNum = iNum * 10 + *p++ - '0';
pTpe->data.field.iToPos = iNum;
/* skip to next known good */
@@ -476,7 +476,7 @@ struct template *tplAddLine(char* pName, char** ppRestOfConfLine)
p = *ppRestOfConfLine;
assert(p != NULL);
- while(isspace(*p))/* skip whitespace */
+ while(isspace((int)*p))/* skip whitespace */
++p;
if(*p != '"') {
@@ -518,21 +518,21 @@ struct template *tplAddLine(char* pName, char** ppRestOfConfLine)
* an error occurs - whichever is first.
*/
while(*p) {
- while(isspace(*p))/* skip whitespace */
+ while(isspace((int)*p))/* skip whitespace */
++p;
if(*p != ',')
break;
++p; /* eat ',' */
- while(isspace(*p))/* skip whitespace */
+ while(isspace((int)*p))/* skip whitespace */
++p;
/* read option word */
i = 0;
while(i < sizeof(optBuf) / sizeof(char) - 1
&& *p && *p != '=' && *p !=',' && *p != '\n') {
- optBuf[i++] = tolower(*p);
+ optBuf[i++] = tolower((int)*p);
++p;
}
optBuf[i] = '\0';