Fixed all warnings from tests.

This commit is contained in:
Omer Katz 2014-05-21 10:50:37 +03:00
parent de5a308002
commit 0e627e33d5
3 changed files with 12 additions and 12 deletions

View file

@ -158,7 +158,7 @@ void r3_tree_compile_patterns(node * n) {
char * cpat; char * cpat;
char * p; char * p;
cpat = zcalloc(128); cpat = zcalloc(sizeof(char) * 128);
if (cpat==NULL) if (cpat==NULL)
return; return;
@ -190,7 +190,7 @@ void r3_tree_compile_patterns(node * n) {
info("pattern: %s\n",cpat); info("pattern: %s\n",cpat);
n->ov_cnt = (1 + n->edge_len) * 3; n->ov_cnt = (1 + n->edge_len) * 3;
n->ov = (int*) zcalloc(n->ov_cnt); n->ov = (int*) zcalloc(sizeof(int) * n->ov_cnt);
n->combined_pattern = cpat; n->combined_pattern = cpat;

View file

@ -63,7 +63,7 @@ START_TEST (test_inside_slug)
int slug_len = 0; int slug_len = 0;
char * pattern = "/user/{name:\\s+}/to/{id}"; char * pattern = "/user/{name:\\s+}/to/{id}";
char * offset = strchr(pattern, '{') + 2; char * offset = strchr(pattern, '{') + 2;
ck_assert( inside_slug(pattern, strlen(pattern), offset) ); ck_assert( (int)inside_slug(pattern, strlen(pattern), offset) );
ck_assert( *(inside_slug(pattern, strlen(pattern), offset)) == '{' ); ck_assert( *(inside_slug(pattern, strlen(pattern), offset)) == '{' );
ck_assert( ! inside_slug(pattern, strlen(pattern), pattern) ); ck_assert( ! inside_slug(pattern, strlen(pattern), pattern) );
} }

View file

@ -72,27 +72,27 @@ START_TEST (test_compile)
entry = match_entry_createl( "foo" , strlen("/foo") ); entry = match_entry_createl( "foo" , strlen("/foo") );
m = r3_tree_matchl( n , "/foo", strlen("/foo"), entry); m = r3_tree_matchl( n , "/foo", strlen("/foo"), entry);
ck_assert( m ); ck_assert( (int)m );
entry = match_entry_createl( "/zoo" , strlen("/zoo") ); entry = match_entry_createl( "/zoo" , strlen("/zoo") );
m = r3_tree_matchl( n , "/zoo", strlen("/zoo"), entry); m = r3_tree_matchl( n , "/zoo", strlen("/zoo"), entry);
ck_assert( m ); ck_assert( (int)m );
entry = match_entry_createl( "/bar" , strlen("/bar") ); entry = match_entry_createl( "/bar" , strlen("/bar") );
m = r3_tree_matchl( n , "/bar", strlen("/bar"), entry); m = r3_tree_matchl( n , "/bar", strlen("/bar"), entry);
ck_assert( m ); ck_assert( (int)m );
entry = match_entry_createl( "/xxx" , strlen("/xxx") ); entry = match_entry_createl( "/xxx" , strlen("/xxx") );
m = r3_tree_matchl( n , "/xxx", strlen("/xxx"), entry); m = r3_tree_matchl( n , "/xxx", strlen("/xxx"), entry);
ck_assert( m ); ck_assert( (int)m );
entry = match_entry_createl( "/foo/xxx" , strlen("/foo/xxx") ); entry = match_entry_createl( "/foo/xxx" , strlen("/foo/xxx") );
m = r3_tree_matchl( n , "/foo/xxx", strlen("/foo/xxx"), entry); m = r3_tree_matchl( n , "/foo/xxx", strlen("/foo/xxx"), entry);
ck_assert( m ); ck_assert( (int)m );
entry = match_entry_createl( "/some_id" , strlen("/some_id") ); entry = match_entry_createl( "/some_id" , strlen("/some_id") );
m = r3_tree_matchl( n , "/some_id", strlen("/some_id"), entry); m = r3_tree_matchl( n , "/some_id", strlen("/some_id"), entry);
ck_assert( m ); ck_assert( (int)m );
} }
END_TEST END_TEST
@ -107,7 +107,7 @@ START_TEST (test_pcre_patterns_insert)
node *matched; node *matched;
matched = r3_tree_matchl(n, "/post/111-222", strlen("/post/111-222"), NULL); matched = r3_tree_matchl(n, "/post/111-222", strlen("/post/111-222"), NULL);
ck_assert(matched); ck_assert((int)matched);
ck_assert(matched->endpoint > 0); ck_assert(matched->endpoint > 0);
// incomplete string shouldn't match // incomplete string shouldn't match
@ -133,7 +133,7 @@ START_TEST (test_pcre_patterns_insert_2)
r3_tree_dump(n, 0); r3_tree_dump(n, 0);
node *matched; node *matched;
matched = r3_tree_match(n, "/post/11/22", NULL); matched = r3_tree_match(n, "/post/11/22", NULL);
ck_assert(matched); ck_assert((int)matched);
ck_assert(matched->endpoint > 0); ck_assert(matched->endpoint > 0);
} }
END_TEST END_TEST
@ -160,7 +160,7 @@ START_TEST (test_pcre_patterns_insert_3)
matched = r3_tree_match(n, "/post/11/22", NULL); matched = r3_tree_match(n, "/post/11/22", NULL);
ck_assert(matched); ck_assert((int)matched);
matched = r3_tree_match(n, "/post/11", NULL); matched = r3_tree_match(n, "/post/11", NULL);
ck_assert(!matched); ck_assert(!matched);