Changeset 330


Ignore:
Timestamp:
Mar 18, 2006 12:26:55 PM (18 years ago)
Author:
bennylp
Message:

Added option to disable error message altogether, to save space footprint

Location:
pjproject/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/src/pjlib-util/errno.c

    r315 r330  
    2626 * Message must be limited to 64 chars! 
    2727 */ 
     28#if defined(PJ_HAS_ERROR_STRING) && PJ_HAS_ERROR_STRING!=0 
    2829static const struct  
    2930{ 
     
    4849    { PJLIB_UTIL_EINXML,            "Invalid XML message" }, 
    4950}; 
    50  
     51#endif  /* PJ_HAS_ERROR_STRING */ 
    5152 
    5253 
     
    5859{ 
    5960    pj_str_t errstr; 
     61 
     62#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0) 
    6063 
    6164    if (statcode >= PJLIB_UTIL_ERRNO_START &&  
     
    97100    } 
    98101 
     102#endif  /* PJ_HAS_ERROR_STRING */ 
     103 
     104 
    99105    /* Error not found. */ 
    100106    errstr.ptr = buf; 
    101107    errstr.slen = pj_ansi_snprintf(buf, bufsize,  
    102                                    "Unknown error %d", 
     108                                   "Unknown pjlib-util error %d", 
    103109                                   statcode); 
    104110 
  • pjproject/trunk/pjlib/src/pj/errno.c

    r315 r330  
    4040 
    4141/* PJLIB's own error codes/messages */ 
     42#if defined(PJ_HAS_ERROR_STRING) && PJ_HAS_ERROR_STRING!=0 
    4243static const struct  
    4344{ 
     
    6364    { PJ_EEOF,          "End of file" }, 
    6465}; 
     66#endif  /* PJ_HAS_ERROR_STRING */ 
     67 
    6568 
    6669/* 
     
    7174static int pjlib_error(pj_status_t code, char *buf, pj_size_t size) 
    7275{ 
     76#if defined(PJ_HAS_ERROR_STRING) && PJ_HAS_ERROR_STRING!=0 
    7377    unsigned i; 
    7478 
     
    8286        } 
    8387    } 
     88#endif 
    8489 
    85     *buf++ = '?'; 
    86     *buf++ = '?'; 
    87     *buf++ = '?'; 
    88     *buf++ = '\0'; 
    89     return 3; 
     90    return pj_ansi_snprintf( buf, size, "Unknown pjlib error %d", code); 
    9091} 
    9192 
  • pjproject/trunk/pjlib/src/pj/os_error_win32.c

    r315 r330  
    3434 * From Apache's APR: 
    3535 */ 
     36#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING!=0) 
     37 
    3638static const struct { 
    3739    pj_os_err_type code; 
     
    8991    {0,                  NULL} 
    9092}; 
     93 
     94#endif  /* PJ_HAS_ERROR_STRING */ 
     95 
    9196 
    9297 
     
    156161 
    157162    if (!len) { 
     163 
     164#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING!=0) 
    158165        int i; 
    159166        for (i = 0; gaErrorList[i].msg; ++i) { 
     
    168175            } 
    169176        } 
     177#endif  /* PJ_HAS_ERROR_STRING */ 
    170178 
    171179    } else { 
  • pjproject/trunk/pjmedia/src/pjmedia/errno.c

    r321 r330  
    2727 * Message must be limited to 64 chars! 
    2828 */ 
     29 
     30#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0) 
     31 
    2932static const struct  
    3033{ 
     
    122125}; 
    123126 
     127#endif  /* PJ_HAS_ERROR_STRING */ 
     128 
    124129 
    125130 
     
    131136{ 
    132137    pj_str_t errstr; 
     138 
     139#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0) 
    133140 
    134141    /* See if the error comes from PortAudio. */ 
     
    185192    } 
    186193 
     194#endif  /* PJ_HAS_ERROR_STRING */ 
     195 
    187196    /* Error not found. */ 
    188197    errstr.ptr = buf; 
    189198    errstr.slen = pj_ansi_snprintf(buf, bufsize,  
    190                                    "Unknown error %d", 
     199                                   "Unknown pjmedia error %d", 
    191200                                   statcode); 
    192201 
  • pjproject/trunk/pjsip/src/pjsip-simple/errno.c

    r315 r330  
    2424 * Message must be limited to 64 chars! 
    2525 */ 
     26 
     27#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0) 
     28 
    2629static const struct  
    2730{ 
     
    4750 
    4851 
     52#endif  /* PJ_HAS_ERROR_STRING */ 
     53 
    4954 
    5055/* 
     
    5560{ 
    5661    pj_str_t errstr; 
     62 
     63#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0) 
    5764 
    5865    if (statcode >= PJSIP_SIMPLE_ERRNO_START &&  
     
    94101    } 
    95102 
     103#endif  /* PJ_HAS_ERROR_STRING */ 
     104 
     105 
    96106    /* Error not found. */ 
    97107    errstr.ptr = buf; 
    98108    errstr.slen = pj_ansi_snprintf(buf, bufsize,  
    99                                    "Unknown error %d", 
     109                                   "Unknown pjsip-simple error %d", 
    100110                                   statcode); 
    101111 
  • pjproject/trunk/pjsip/src/pjsip/sip_errno.c

    r315 r330  
    2525 * MUST KEEP THIS ARRAY SORTED!! 
    2626 */ 
     27 
     28#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0) 
     29 
    2730static const struct  
    2831{ 
     
    9295 
    9396 
     97#endif  /* PJ_HAS_ERROR_STRING */ 
     98 
     99 
    94100/* 
    95101 * pjsip_strerror() 
     
    99105{ 
    100106    pj_str_t errstr; 
     107 
     108#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0) 
    101109 
    102110    if (statcode >= PJSIP_ERRNO_START && statcode < PJSIP_ERRNO_START+800)  
     
    145153            return errstr; 
    146154 
    147         } else { 
    148             /* Error not found. */ 
    149             errstr.ptr = buf; 
    150             errstr.slen = pj_ansi_snprintf(buf, bufsize,  
    151                                            "Unknown error %d", 
    152                                            statcode); 
     155        }  
     156    } 
    153157 
    154             return errstr; 
    155         } 
    156     } 
    157     else { 
    158         /* Not our code. Give it to PJLIB. */ 
    159         return pj_strerror(statcode, buf, bufsize); 
    160     } 
     158#endif  /* PJ_HAS_ERROR_STRING */ 
     159 
     160    /* Error not found. */ 
     161    errstr.ptr = buf; 
     162    errstr.slen = pj_ansi_snprintf(buf, bufsize,  
     163                                   "Unknown pjsip error %d", 
     164                                   statcode); 
     165 
     166    return errstr; 
    161167 
    162168} 
Note: See TracChangeset for help on using the changeset viewer.