Merge pull request #129 from iresty/make-warning

change: avoided compiling warning.
This commit is contained in:
Yo-An Lin 2019-07-20 18:00:48 +08:00 committed by GitHub
commit 41685d402d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View file

@ -286,7 +286,7 @@ R3Node * r3_tree_matchl(const R3Node * n, const char * path, unsigned int path_l
const char *pp_end; const char *pp_end;
info("n->compare_type: %d\n", n->compare_type); info("n->compare_type: %d\n", n->compare_type);
info("n->pcre_pattern: %s\n",n->pcre_pattern); info("n->pcre_pattern: %s\n", (char *)n->pcre_pattern);
if (n->compare_type == NODE_COMPARE_OPCODE) { if (n->compare_type == NODE_COMPARE_OPCODE) {
info("NODE_COMPARE_OPCODE\n"); info("NODE_COMPARE_OPCODE\n");

View file

@ -52,7 +52,7 @@ END_TEST
START_TEST (test_r3_slug_find_pattern) START_TEST (test_r3_slug_find_pattern)
{ {
int len; unsigned int len;
char *test_str = "{name:\\s+}"; char *test_str = "{name:\\s+}";
const char * namerex = r3_slug_find_pattern(test_str, strlen(test_str), &len); const char * namerex = r3_slug_find_pattern(test_str, strlen(test_str), &len);
ck_assert( strncmp(namerex, "\\s+", len) == 0 ); ck_assert( strncmp(namerex, "\\s+", len) == 0 );
@ -61,7 +61,7 @@ END_TEST
START_TEST (test_r3_slug_find_name) START_TEST (test_r3_slug_find_name)
{ {
int len; unsigned int len;
char *test_str = "{name:\\s+}"; char *test_str = "{name:\\s+}";
const char * namerex = r3_slug_find_name(test_str, strlen(test_str), &len); const char * namerex = r3_slug_find_name(test_str, strlen(test_str), &len);
ck_assert( strncmp(namerex, "name", len) == 0 ); ck_assert( strncmp(namerex, "name", len) == 0 );
@ -70,7 +70,7 @@ END_TEST
START_TEST (test_r3_slug_find_name_without_pattern) START_TEST (test_r3_slug_find_name_without_pattern)
{ {
int len; unsigned int len;
char *test_str = "{name}"; char *test_str = "{name}";
const char * namerex = r3_slug_find_name(test_str, strlen(test_str), &len); const char * namerex = r3_slug_find_name(test_str, strlen(test_str), &len);
ck_assert( strncmp(namerex, "name", len) == 0 ); ck_assert( strncmp(namerex, "name", len) == 0 );
@ -79,7 +79,7 @@ END_TEST
START_TEST (test_r3_slug_find_name_with_multiple_slug) START_TEST (test_r3_slug_find_name_with_multiple_slug)
{ {
int len; unsigned int len;
char *test_str = "{name}/{name2}"; char *test_str = "{name}/{name2}";
const char * namerex = r3_slug_find_name(test_str, strlen(test_str), &len); const char * namerex = r3_slug_find_name(test_str, strlen(test_str), &len);
ck_assert( strncmp(namerex, "name", len) == 0 ); ck_assert( strncmp(namerex, "name", len) == 0 );
@ -88,7 +88,7 @@ END_TEST
START_TEST (test_r3_slug_find_placeholder) START_TEST (test_r3_slug_find_placeholder)
{ {
int slug_len = 0; unsigned int slug_len = 0;
const char * slug; const char * slug;
char *test_str = "/user/{name:\\s+}/to/{id}"; char *test_str = "/user/{name:\\s+}/to/{id}";
slug = r3_slug_find_placeholder(test_str, strlen(test_str), &slug_len); slug = r3_slug_find_placeholder(test_str, strlen(test_str), &slug_len);
@ -118,7 +118,7 @@ START_TEST (test_incomplete_slug)
char * pattern = "/user/{name:\\d{3}}/to/{id"; char * pattern = "/user/{name:\\d{3}}/to/{id";
cnt = r3_slug_count(pattern, strlen(pattern), &errstr); cnt = r3_slug_count(pattern, strlen(pattern), &errstr);
ck_assert_int_eq(cnt, -1); ck_assert_int_eq(cnt, -1);
ck_assert(errstr); ck_assert(errstr != NULL);
printf("%s\n",errstr); printf("%s\n",errstr);
free(errstr); free(errstr);
} }
@ -190,7 +190,7 @@ END_TEST
START_TEST (test_r3_slug_find_placeholder_with_broken_slug) START_TEST (test_r3_slug_find_placeholder_with_broken_slug)
{ {
int slug_len = 0; unsigned int slug_len = 0;
char *sl_test = "/user/{name:\\s+/to/{id"; char *sl_test = "/user/{name:\\s+/to/{id";
const char * slug = r3_slug_find_placeholder(sl_test, strlen(sl_test), &slug_len); const char * slug = r3_slug_find_placeholder(sl_test, strlen(sl_test), &slug_len);
ck_assert(slug == 0); ck_assert(slug == 0);