Ignore:
Timestamp:
May 11, 2007 3:14:34 PM (17 years ago)
Author:
bennylp
Message:

HUGE changeset to make the rest of the libraries compile with C++ mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pjlib-test/string.c

    r1235 r1266  
    9797#define STRTEST(res,S1,S2,code) \ 
    9898            do { \ 
    99                 s1.ptr=S1; s1.slen=S1?len:0; \ 
    100                 s2.ptr=S2; s2.slen=S2?len:0; \ 
     99                s1.ptr=S1; s1.slen=(S1)?len:0; \ 
     100                s2.ptr=S2; s2.slen=(S2)?len:0; \ 
    101101                pj_get_timestamp(&t1); \ 
    102102                if (C(pj_stricmp(&s1,&s2),res)) return code; \ 
     
    124124    pj_thread_sleep(0); 
    125125 
     126#define SNULL 0 
     127 
    126128    /* Compare empty strings. */ 
    127129    len=0; 
    128130    STRTEST( 0, "","",-500); 
    129     STRTEST( 0, NULL,"",-502); 
    130     STRTEST( 0, "",NULL,-504); 
    131     STRTEST( 0, NULL,NULL,-506); 
     131    STRTEST( 0, SNULL,"",-502); 
     132    STRTEST( 0, "",SNULL,-504); 
     133    STRTEST( 0, SNULL,SNULL,-506); 
    132134    STRTEST( 0, "hello","world",-508); 
    133135 
     
    140142    STRTEST( 0, "a",buf+1,-512); 
    141143    STRTEST( -1, "O", "P", -514); 
    142     STRTEST(-1, NULL, "a", -516); 
    143     STRTEST(1, "a", NULL, -518); 
     144    STRTEST(-1, SNULL, "a", -516); 
     145    STRTEST(1, "a", SNULL, -518); 
    144146 
    145147    /* equal, length=2  
     
    267269    len=0; 
    268270    STR_TEST(0, "", "", -400); 
    269     STR_TEST(0, NULL, "", -405); 
    270     STR_TEST(0, "", NULL, -410); 
    271     STR_TEST(0, NULL, NULL, -415); 
     271    STR_TEST(0, SNULL, "", -405); 
     272    STR_TEST(0, "", SNULL, -410); 
     273    STR_TEST(0, SNULL, SNULL, -415); 
    272274    STR_TEST(0, "hello", "", -420); 
    273     STR_TEST(0, "hello", NULL, -425); 
     275    STR_TEST(0, "hello", SNULL, -425); 
    274276 
    275277    /* Test with length != 0 */ 
     
    278280    STR_TEST(1, "12", "1", -435); 
    279281    STR_TEST(-1, "1", "12", -440); 
    280     STR_TEST(-1, NULL, "12", -445); 
    281     STR_TEST(1, "12", NULL, -450); 
     282    STR_TEST(-1, SNULL, "12", -445); 
     283    STR_TEST(1, "12", SNULL, -450); 
    282284 
    283285    return 0; 
     
    296298    int i; 
    297299 
    298     pool = pj_pool_create(mem, NULL, 4096, 0, NULL); 
     300    pool = pj_pool_create(mem, SNULL, 4096, 0, SNULL); 
    299301    if (!pool) return -5; 
    300302     
     
    368370    s5 = pj_str("123456"); 
    369371 
    370     pj_strtoul2(&s5, NULL, 10); /* Crash test */ 
     372    pj_strtoul2(&s5, SNULL, 10);        /* Crash test */ 
    371373 
    372374    if (pj_strtoul2(&s5, &s4, 10) != 123456UL) 
     
    382384    if (s4.slen != 4) 
    383385        return -294; 
    384     if (s4.ptr == NULL || *s4.ptr != 'A') 
     386    if (s4.ptr == SNULL || *s4.ptr != 'A') 
    385387        return -295; 
    386388    if (pj_strtoul2(&s5, &s4, 16) != 0x123ABCDUL) 
Note: See TracChangeset for help on using the changeset viewer.