diff options
-rw-r--r-- | action.c | 20 | ||||
-rw-r--r-- | action.h | 3 | ||||
-rw-r--r-- | plugins/omstdout/omstdout.c | 2 | ||||
-rw-r--r-- | runtime/msg.c | 2 | ||||
-rw-r--r-- | runtime/net.c | 8 | ||||
-rw-r--r-- | runtime/rsyslog.h | 28 |
6 files changed, 34 insertions, 29 deletions
@@ -200,7 +200,7 @@ rsRetVal actionDestruct(action_t *pThis) /* message ptr cleanup */ for(i = 0 ; i < pThis->iNumTpls ; ++i) { - if(pThis->ppMsgs[i] != NULL) { + if(((uchar**)pThis->ppMsgs)[i] != NULL) { switch(pThis->eParamPassing) { case ACT_ARRAY_PASSING: #if 0 /* later! */ @@ -214,7 +214,7 @@ rsRetVal actionDestruct(action_t *pThis) #endif break; case ACT_STRING_PASSING: - d_free(pThis->ppMsgs[i]); + d_free(((uchar**)pThis->ppMsgs)[i]); break; default: assert(0); @@ -475,10 +475,10 @@ actionCallDoAction(action_t *pAction, msg_t *pMsg) for(i = 0 ; i < pAction->iNumTpls ; ++i) { switch(pAction->eParamPassing) { case ACT_STRING_PASSING: - CHKiRet(tplToString(pAction->ppTpl[i], pMsg, &(pAction->ppMsgs[i]), &(pAction->lenMsgs[i]))); + CHKiRet(tplToString(pAction->ppTpl[i], pMsg, &(((uchar**)pAction->ppMsgs)[i]), &(pAction->lenMsgs[i]))); break; case ACT_ARRAY_PASSING: - CHKiRet(tplToArray(pAction->ppTpl[i], pMsg, (uchar***) &(pAction->ppMsgs[i]))); + CHKiRet(tplToArray(pAction->ppTpl[i], pMsg, (uchar***) &(((uchar**)pAction->ppMsgs)[i]))); break; default:assert(0); /* software bug if this happens! */ } @@ -526,16 +526,16 @@ actionCallDoAction(action_t *pAction, msg_t *pMsg) finalize_it: /* cleanup */ for(i = 0 ; i < pAction->iNumTpls ; ++i) { - if(pAction->ppMsgs[i] != NULL) { + if(((uchar**)pAction->ppMsgs)[i] != NULL) { switch(pAction->eParamPassing) { case ACT_ARRAY_PASSING: iArr = 0; - while(((char **)pAction->ppMsgs[i])[iArr] != NULL) { - d_free(((char **)pAction->ppMsgs[i])[iArr++]); - ((char **)pAction->ppMsgs[i])[iArr++] = NULL; + while((((uchar***)pAction->ppMsgs)[i][iArr]) != NULL) { + d_free(((uchar ***)pAction->ppMsgs)[i][iArr++]); + ((uchar ***)pAction->ppMsgs)[i][iArr++] = NULL; } - d_free(pAction->ppMsgs[i]); - pAction->ppMsgs[i] = NULL; + d_free(((uchar**)pAction->ppMsgs)[i]); + ((uchar**)pAction->ppMsgs)[i] = NULL; break; case ACT_STRING_PASSING: break; @@ -74,7 +74,8 @@ struct action_s { SYNC_OBJ_TOOL; /* required for mutex support */ pthread_mutex_t mutActExec; /* mutex to guard actual execution of doAction for single-threaded modules */ uchar *pszName; /* action name (for documentation) */ - uchar **ppMsgs; /* pointer to action-calling parameters (kept in structure to save alloc() time!) */ + //uchar **ppMsgs; /* pointer to action-calling parameters (kept in structure to save alloc() time!) */ + void *ppMsgs; /* pointer to action-calling parameters (kept in structure to save alloc() time!) */ size_t *lenMsgs; /* length of message in ppMsgs */ }; typedef struct action_s action_t; diff --git a/plugins/omstdout/omstdout.c b/plugins/omstdout/omstdout.c index b3ec6287..929de703 100644 --- a/plugins/omstdout/omstdout.c +++ b/plugins/omstdout/omstdout.c @@ -103,7 +103,7 @@ CODESTARTdoAction * So this code here is also more or less an example of how to do that. * rgerhards, 2009-04-03 */ - szParams = (char**) (ppString[0]); + szParams = (char**)(void*) (ppString[0]); /* In array-passing mode, ppString[] contains a NULL-terminated array * of char *pointers. */ diff --git a/runtime/msg.c b/runtime/msg.c index 91057f97..6d7e6a89 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -3048,7 +3048,7 @@ static rsRetVal msgConstructFinalizer(msg_t *pThis) * rgerhards, 2008-01-14 */ static rsRetVal -MsgGetSeverity(obj_t *pThis, int *piSeverity) +MsgGetSeverity(obj_t_ptr pThis, int *piSeverity) { ISOBJ_TYPE_assert(pThis, msg); assert(piSeverity != NULL); diff --git a/runtime/net.c b/runtime/net.c index fe6eef5b..4eb5a3bb 100644 --- a/runtime/net.c +++ b/runtime/net.c @@ -502,8 +502,8 @@ static inline void MaskIP4 (struct in_addr *addr, uint8_t bits) { addr->s_addr &= htonl(0xffffffff << (32 - bits)); } -#define SIN(sa) ((struct sockaddr_in *)(sa)) -#define SIN6(sa) ((struct sockaddr_in6 *)(sa)) +#define SIN(sa) ((struct sockaddr_in *)(void*)(sa)) +#define SIN6(sa) ((struct sockaddr_in6 *)(void*)(sa)) /* This is a cancel-safe getnameinfo() version, because we learned @@ -1165,12 +1165,12 @@ void debugListenInfo(int fd, char *type) switch(sa.sa_family) { case PF_INET: szFamily = "IPv4"; - ipv4 = (struct sockaddr_in*) &sa; + ipv4 = (struct sockaddr_in*)(void*) &sa; port = ntohs(ipv4->sin_port); break; case PF_INET6: szFamily = "IPv6"; - ipv6 = (struct sockaddr_in6*) &sa; + ipv6 = (struct sockaddr_in6*)(void*) &sa; port = ntohs(ipv6->sin6_port); break; default: diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h index acc31a99..b7117029 100644 --- a/runtime/rsyslog.h +++ b/runtime/rsyslog.h @@ -60,12 +60,8 @@ #endif -/* under Solaris (actually only SPARC), we need to redefine some types - * to be void, so that we get void* pointers. Otherwise, we will see -* alignment errors. -*/ - /* define some base data types */ + typedef unsigned char uchar;/* get rid of the unhandy "unsigned char" */ typedef struct thrdInfo thrdInfo_t; typedef struct obj_s obj_t; @@ -83,13 +79,6 @@ typedef struct nsd_gsspi_s nsd_gsspi_t; typedef struct nsd_nss_s nsd_nss_t; typedef struct nsdsel_ptcp_s nsdsel_ptcp_t; typedef struct nsdsel_gtls_s nsdsel_gtls_t; -#ifdef OS_SOLARIS - typedef void nsd_t; - typedef void nsdsel_t; -#else - typedef obj_t nsd_t; - typedef obj_t nsdsel_t; -#endif typedef struct msg msg_t; typedef struct prop_s prop_t; typedef struct interface_s interface_t; @@ -108,6 +97,21 @@ typedef rsRetVal (*prsf_t)(struct vmstk_s*, int); /* pointer to a RainerScript f typedef struct tcpLstnPortList_s tcpLstnPortList_t; // TODO: rename? typedef struct strmLstnPortList_s strmLstnPortList_t; // TODO: rename? +/* under Solaris (actually only SPARC), we need to redefine some types + * to be void, so that we get void* pointers. Otherwise, we will see + * alignment errors. + */ +#ifdef OS_SOLARIS + typedef void * obj_t_ptr; + typedef void nsd_t; + typedef void nsdsel_t; +#else + typedef obj_t obj_t_ptr; + typedef obj_t nsd_t; + typedef obj_t nsdsel_t; +#endif + + /* some universal 64 bit define... */ typedef long long int64; typedef long long unsigned uint64; |