diff options
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsip-simple/errno.c | 12 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_errno.c | 32 |
2 files changed, 30 insertions, 14 deletions
diff --git a/pjsip/src/pjsip-simple/errno.c b/pjsip/src/pjsip-simple/errno.c index a2e588d9..3f5c2e6b 100644 --- a/pjsip/src/pjsip-simple/errno.c +++ b/pjsip/src/pjsip-simple/errno.c @@ -23,6 +23,9 @@ * MUST KEEP THIS ARRAY SORTED!! * Message must be limited to 64 chars! */ + +#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0) + static const struct { int code; @@ -46,6 +49,8 @@ static const struct }; +#endif /* PJ_HAS_ERROR_STRING */ + /* * pjsipsimple_strerror() @@ -55,6 +60,8 @@ PJ_DEF(pj_str_t) pjsipsimple_strerror( pj_status_t statcode, { pj_str_t errstr; +#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0) + if (statcode >= PJSIP_SIMPLE_ERRNO_START && statcode < PJSIP_SIMPLE_ERRNO_START + PJ_ERRNO_SPACE_SIZE) { @@ -93,10 +100,13 @@ PJ_DEF(pj_str_t) pjsipsimple_strerror( pj_status_t statcode, } } +#endif /* PJ_HAS_ERROR_STRING */ + + /* Error not found. */ errstr.ptr = buf; errstr.slen = pj_ansi_snprintf(buf, bufsize, - "Unknown error %d", + "Unknown pjsip-simple error %d", statcode); return errstr; diff --git a/pjsip/src/pjsip/sip_errno.c b/pjsip/src/pjsip/sip_errno.c index ab4d72da..6bac6f96 100644 --- a/pjsip/src/pjsip/sip_errno.c +++ b/pjsip/src/pjsip/sip_errno.c @@ -24,6 +24,9 @@ /* PJSIP's own error codes/messages * MUST KEEP THIS ARRAY SORTED!! */ + +#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0) + static const struct { int code; @@ -91,6 +94,9 @@ static const struct }; +#endif /* PJ_HAS_ERROR_STRING */ + + /* * pjsip_strerror() */ @@ -99,6 +105,8 @@ PJ_DEF(pj_str_t) pjsip_strerror( pj_status_t statcode, { pj_str_t errstr; +#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0) + if (statcode >= PJSIP_ERRNO_START && statcode < PJSIP_ERRNO_START+800) { /* Status code. */ @@ -144,20 +152,18 @@ PJ_DEF(pj_str_t) pjsip_strerror( pj_status_t statcode, pj_strncpy_with_null(&errstr, &msg, bufsize); return errstr; - } else { - /* Error not found. */ - errstr.ptr = buf; - errstr.slen = pj_ansi_snprintf(buf, bufsize, - "Unknown error %d", - statcode); - - return errstr; - } - } - else { - /* Not our code. Give it to PJLIB. */ - return pj_strerror(statcode, buf, bufsize); + } } +#endif /* PJ_HAS_ERROR_STRING */ + + /* Error not found. */ + errstr.ptr = buf; + errstr.slen = pj_ansi_snprintf(buf, bufsize, + "Unknown pjsip error %d", + statcode); + + return errstr; + } |