X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Fcm_lib.c;h=ac6b699abcb7dffe9bda002fe9c8cb8daf9d8567;hb=b3d5c17f74361fcdcb9b9febff450292197e3a57;hp=20ec8207d255419e8a1559e21a0145bf9dcadca2;hpb=9c8b78da0f4ef42dae5e30a3061463b81327e7a0;p=o-du%2Fl2.git diff --git a/src/cm/cm_lib.c b/src/cm/cm_lib.c index 20ec8207d..ac6b699ab 100644 --- a/src/cm/cm_lib.c +++ b/src/cm/cm_lib.c @@ -174,8 +174,8 @@ #endif #ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */ -EXTERN Data *startPtr128; -EXTERN Size regMemSize; +Data *startPtr128; +Size regMemSize; #endif /* @@ -196,27 +196,15 @@ EXTERN Size regMemSize; * File: cm_lib.c * */ -#ifdef ANSI -U8 *cmMemcpy -( -U8 *tgt, -CONSTANT U8 *src, -PTR len -) -#else -U8 *cmMemcpy(tgt, src, len) -U8 *tgt; -CONSTANT U8 *src; -PTR len; -#endif +uint8_t *cmMemcpy(uint8_t *tgt,const uint8_t *src,PTR len) { /*cm_lib_c_001.main_14 : Fix for TRACE5 feature crash due to missing TRC MACRO*/ #ifdef MS_MBUF_CORRUPTION /* checking for valid memory address */ if ((tgt > startPtr128) && (tgt < (startPtr128+regMemSize))) { - if ((*((U32 *)(tgt + 4)) == 0xDEADDEAD) || (*((U32 *)(tgt + 24)) == 0xDEADDEAD) || - (*((U32 *)(tgt + 44)) == 0xDEADDEAD) || (*((U32 *)(tgt + 80)) == 0xDEADDEAD)) + if ((*((uint32_t *)(tgt + 4)) == 0xDEADDEAD) || (*((uint32_t *)(tgt + 24)) == 0xDEADDEAD) || + (*((uint32_t *)(tgt + 44)) == 0xDEADDEAD) || (*((uint32_t *)(tgt + 80)) == 0xDEADDEAD)) { Data *crashPtr=NULLP; *crashPtr = 9; @@ -224,8 +212,8 @@ if ((tgt > startPtr128) && (tgt < (startPtr128+regMemSize))) } if ((src > startPtr128) && (src < (startPtr128+regMemSize))) { - if ((*((U32 *)(src + 4)) == 0xDEADDEAD) || (*((U32 *)(src + 24)) == 0xDEADDEAD) || - (*((U32 *)(src + 44)) == 0xDEADDEAD) || (*((U32 *)(src + 80)) == 0xDEADDEAD)) + if ((*((uint32_t *)(src + 4)) == 0xDEADDEAD) || (*((uint32_t *)(src + 24)) == 0xDEADDEAD) || + (*((uint32_t *)(src + 44)) == 0xDEADDEAD) || (*((uint32_t *)(src + 80)) == 0xDEADDEAD)) { Data *crashPtr=NULLP; *crashPtr = 9; @@ -261,23 +249,11 @@ if ((src > startPtr128) && (src < (startPtr128+regMemSize))) * File: cm_lib.c * */ -#ifdef ANSI -S16 cmMemcmp -( -CONSTANT U8 *s1, -CONSTANT U8 *s2, -PTR len -) -#else -S16 cmMemcmp (s1, s2, len) -CONSTANT U8 *s1; -CONSTANT U8 *s2; -PTR len; -#endif +S16 cmMemcmp(const uint8_t *s1,const uint8_t *s2,PTR len) { /*cm_lib_c_001.main_14 : Fix for TRACE5 feature crash due to missing TRC MACRO*/ #if MEMCMP_AVAIL /* memcmp is available */ - return ((S16) memcmp((CONSTANT Void *)s1, (CONSTANT Void *)s2, (size_t)len)); + return ((S16) memcmp((const Void *)s1, (const Void *)s2, (size_t)len)); #else /* MEMCMP_AVAIL: memcmp is not available */ while (len--) { @@ -309,26 +285,14 @@ PTR len; * File: cm_lib.c * */ -#ifdef ANSI -U8 *cmMemset -( -U8 *str, -U8 val, -PTR len -) -#else -U8 *cmMemset(str, val, len) -U8 *str; -U8 val; -PTR len; -#endif +uint8_t *cmMemset(uint8_t *str,uint8_t val,PTR len) { /*cm_lib_c_001.main_14 : Fix for TRACE5 feature crash due to missing TRC MACRO*/ #if MS_MBUF_CORRUPTION /* checking for valid memory address */ if ((str > startPtr128) && (str < (startPtr128+regMemSize))) { - if ((*((U32 *)(str + 4)) == 0xDEADDEAD) || (*((U32 *)(str + 24)) == 0xDEADDEAD) || - (*((U32 *)(str + 44)) == 0xDEADDEAD) || (*((U32 *)(str + 80)) == 0xDEADDEAD)) + if ((*((uint32_t *)(str + 4)) == 0xDEADDEAD) || (*((uint32_t *)(str + 24)) == 0xDEADDEAD) || + (*((uint32_t *)(str + 44)) == 0xDEADDEAD) || (*((uint32_t *)(str + 80)) == 0xDEADDEAD)) { Data *crashPtr=NULLP; *crashPtr = 9; @@ -387,21 +351,11 @@ if ((str > startPtr128) && (str < (startPtr128+regMemSize))) * File: cm_lib.c * */ -#ifdef ANSI -S16 cmStrcmp -( -CONSTANT U8 *s1, -CONSTANT U8 *s2 -) -#else -S16 cmStrcmp (s1, s2) -CONSTANT U8 *s1; -CONSTANT U8 *s2; -#endif +S16 cmStrcmp(const uint8_t *s1,const uint8_t *s2) { /*cm_lib_c_001.main_14 : Fix for TRACE5 feature crash due to missing TRC MACRO*/ #if (STRCMP_AVAIL) - return (strcmp((CONSTANT S8 *)s1, (CONSTANT S8 *)s2)); + return (strcmp((const char *)s1, (const char *)s2)); #else /* STRCMP_AVAIL */ while (*s1 && *s2) @@ -451,23 +405,16 @@ CONSTANT U8 *s2; * File: cm_lib.c * */ -#ifdef ANSI S16 cmStrncmp ( -CONSTANT U8 *s1, -CONSTANT U8 *s2, +const uint8_t *s1, +const uint8_t *s2, MsgLen len /* cm_lib_c_001.main_12: Changing from S16 to MsgLen.*/ ) -#else -S16 cmStrncmp (s1, s2, len) -CONSTANT U8 *s1; -CONSTANT U8 *s2; -MsgLen len; -#endif { /*cm_lib_c_001.main_14 : Fix for TRACE5 feature crash due to missing TRC MACRO*/ #if (STRNCMP_AVAIL) - return (strncmp((CONSTANT S8 *)s1, (CONSTANT S8 *)s2, (size_t) len)); + return (strncmp((const char *)s1, (const char *)s2, (size_t) len)); #else /* STRNCMP_AVAIL */ while (*s1 && *s2 && len--) @@ -505,20 +452,11 @@ MsgLen len; * File: cm_lib.c * */ -#ifdef ANSI -MsgLen cmStrlen -( -CONSTANT U8 *s -) -#else -/* cm_lib_c_001.main_12: Changing from S16 to MsgLen.*/ -MsgLen cmStrlen (s) -CONSTANT U8 *s; -#endif +MsgLen cmStrlen(const uint8_t *s) { #if (STRLEN_AVAIL) /*cm_lib_c_001.main_15 : Fix for warning due to mixed declation*/ - return ((MsgLen)strlen((CONSTANT S8 *)s)); + return ((MsgLen)strlen((const char *)s)); #else /* STRLEN_AVAIL */ MsgLen i;