Type correctness fixes 04/248204/1 accepted/tizen/unified/20201127.130445 submit/tizen/20201126.152656
authorMichal Bloch <m.bloch@partner.samsung.com>
Mon, 23 Nov 2020 13:22:33 +0000 (14:22 +0100)
committerMichal Bloch <m.bloch@partner.samsung.com>
Mon, 23 Nov 2020 19:44:44 +0000 (20:44 +0100)
Change-Id: I60385a605ac92461da1c438ca0037672954abf0a
Signed-off-by: Michal Bloch <m.bloch@partner.samsung.com>
tests/test-common.c

index 95844ae..5d57fe4 100644 (file)
@@ -177,24 +177,24 @@ void test_split_positive()
        char c[] = "::Lorem::ipsum";
        size_t l;
        char st[] = "Some::other:::text:";
-       char *state = &st;
+       char *state = st;
 
-       assert(strcmp("Some::other:::text:", split(&c, &l, ":", &state)) == 0);
+       assert(strcmp("Some::other:::text:", split(c, &l, ":", &state)) == 0);
        assert(strcmp(c, "::Lorem::ipsum") == 0);
        assert(l == 4);
        assert(strcmp(state, "::other:::text:") == 0);
 
-       assert(strcmp("other:::text:", split(&c, &l, ":", &state)) == 0);
+       assert(strcmp("other:::text:", split(c, &l, ":", &state)) == 0);
        assert(strcmp(c, "::Lorem::ipsum") == 0);
        assert(l == 5);
        assert(strcmp(state, ":::text:") == 0);
 
-       assert(strcmp("text:", split(&c, &l, ":", &state)) == 0);
+       assert(strcmp("text:", split(c, &l, ":", &state)) == 0);
        assert(strcmp(c, "::Lorem::ipsum") == 0);
        assert(l == 4);
        assert(strcmp(state, ":") == 0);
 
-       assert(strcmp("", split(&c, &l, ":", &state)) == 0);
+       assert(strcmp("", split(c, &l, ":", &state)) == 0);
        assert(strcmp(c, "::Lorem::ipsum") == 0);
        assert(l == 0);
        assert(strcmp(state, "") == 0);
@@ -202,20 +202,20 @@ void test_split_positive()
        /* the state is a null pointer */
        state = NULL;
 
-       assert(strcmp("Lorem::ipsum", split(&c, &l, ":", &state)) == 0);
+       assert(strcmp("Lorem::ipsum", split(c, &l, ":", &state)) == 0);
        assert(strcmp(c, "::Lorem::ipsum") == 0);
        assert(l == 5);
        assert(strcmp(state, "::ipsum") == 0);
 
-       assert(strcmp("ipsum", split(&c, &l, ":", &state)) == 0);
+       assert(strcmp("ipsum", split(c, &l, ":", &state)) == 0);
        assert(strcmp(c, "::Lorem::ipsum") == 0);
        assert(l == 5);
        assert(strcmp(state, "") == 0);
 
        /* the separator is empty */
-       state = &st;
+       state = st;
 
-       assert(strcmp("Some::other:::text:", split(&c, &l, "", &state)) == 0);
+       assert(strcmp("Some::other:::text:", split(c, &l, "", &state)) == 0);
        assert(strcmp(c, "::Lorem::ipsum") == 0);
        assert(l == 19);
        assert(strcmp(state, "") == 0);
@@ -223,10 +223,10 @@ void test_split_positive()
        /* the string is empty */
        char cc[] = "";
        char str[] = "";
-       state = &str;
+       state = str;
        l = 12345;
 
-       char *tmp = split(&cc, &l, ":", &state);
+       char *tmp = split(cc, &l, ":", &state);
        assert(tmp == NULL);
        assert(strcmp(cc, "") == 0);
        assert(l == 12345);
@@ -291,9 +291,9 @@ void test_str_to_strv_positive()
 {
        char str[] = ":very::long:::string::::";
        char **strv;
-       str_to_strv(&str, &strv, ":");
+       str_to_strv(str, &strv, ":");
 
-       assert(sizeof_strv(strv) == 4);
+       assert(sizeof_strv((const char **) strv) == 4);
        assert(strcmp(strv[0], "very") == 0);
        assert(strcmp(strv[1], "long") == 0);
        assert(strcmp(strv[2], "string") == 0);
@@ -305,9 +305,9 @@ void test_str_to_strv_positive()
 
        /* two separators */
        char **wstrv;
-       str_to_strv(&str, &wstrv, ":r");
+       str_to_strv(str, &wstrv, ":r");
 
-       assert(sizeof_strv(wstrv) == 6);
+       assert(sizeof_strv((const char **) wstrv) == 6);
        assert(strcmp(wstrv[0], "ve") == 0);
        assert(strcmp(wstrv[1], "y") == 0);
        assert(strcmp(wstrv[2], "long") == 0);
@@ -321,9 +321,9 @@ void test_str_to_strv_positive()
 
        /* there is no 'p', but there is ':' */
        char **xstrv;
-       str_to_strv(&str, &xstrv, ":p");
+       str_to_strv(str, &xstrv, ":p");
 
-       assert(sizeof_strv(xstrv) == 4);
+       assert(sizeof_strv((const char **) xstrv) == 4);
        assert(strcmp(xstrv[0], "very") == 0);
        assert(strcmp(xstrv[1], "long") == 0);
        assert(strcmp(xstrv[2], "string") == 0);
@@ -337,9 +337,9 @@ void test_str_to_strv_positive()
        char st[] = ":not:so::long";
        char **astrv;
 
-       str_to_strv(&st, &astrv, ":");
+       str_to_strv(st, &astrv, ":");
 
-       assert(sizeof_strv(astrv) == 3);
+       assert(sizeof_strv((const char **) astrv) == 3);
        assert(strcmp(astrv[0], "not") == 0);
        assert(strcmp(astrv[1], "so") == 0);
        assert(strcmp(astrv[2], "long") == 0);
@@ -350,9 +350,9 @@ void test_str_to_strv_positive()
 
        /* with empty separator */
        char **bstrv;
-       str_to_strv(&st, &bstrv, "");
+       str_to_strv(st, &bstrv, "");
 
-       assert(sizeof_strv(bstrv) == 1);
+       assert(sizeof_strv((const char **) bstrv) == 1);
        assert(strcmp(bstrv[0], ":not:so::long") == 0);
        assert(bstrv[1] == NULL);
 
@@ -363,9 +363,9 @@ void test_str_to_strv_positive()
        char ptr[] = ":very::long:::string::::";
        char **zstrv;
 
-       str_to_strv(&ptr, &zstrv, "k");
+       str_to_strv(ptr, &zstrv, "k");
 
-       assert(sizeof_strv(zstrv) == 1);
+       assert(sizeof_strv((const char **) zstrv) == 1);
        assert(strcmp(zstrv[0], ":very::long:::string::::") == 0);
        assert(zstrv[1] == NULL);
 
@@ -378,7 +378,7 @@ void test_strv_attach_positive()
        char str[] = "c:d:";
        char **strv;
        char **swsk;
-       str_to_strv(&str, &strv, ":");
+       str_to_strv(str, &strv, ":");
 
        char **d = malloc(3 * sizeof(char *));
        assert(d);
@@ -388,7 +388,7 @@ void test_strv_attach_positive()
        assert(d[0]);
        assert(d[1]);
 
-       assert(sizeof_strv(strv) == 3);
+       assert(sizeof_strv((const char **) strv) == 3);
        assert(strcmp(strv[0], "c") == 0);
        assert(strcmp(strv[1], "d") == 0);
        assert(strcmp(strv[2], "") == 0);
@@ -396,7 +396,7 @@ void test_strv_attach_positive()
 
        strv_attach(strv, d, &swsk, true);
 
-       assert(sizeof_strv(swsk) == 5);
+       assert(sizeof_strv((const char **) swsk) == 5);
        assert(strcmp(swsk[0], "c") == 0);
        assert(strcmp(swsk[1], "d") == 0);
        assert(strcmp(swsk[2], "") == 0);
@@ -404,18 +404,18 @@ void test_strv_attach_positive()
        assert(strcmp(swsk[4], "b") == 0);
        assert(swsk[5] == NULL);
 
-       str_to_strv(&str, &strv, ":");
+       str_to_strv(str, &strv, ":");
        char *dr[3] = {"a", "b", NULL};
 
-       assert(sizeof_strv(strv) == 3);
+       assert(sizeof_strv((const char **) strv) == 3);
        assert(strcmp(strv[0], "c") == 0);
        assert(strcmp(strv[1], "d") == 0);
        assert(strcmp(strv[2], "") == 0);
        assert(strv[3] == NULL);
 
-       strv_attach(strv, &dr, &swsk, false);
+       strv_attach(strv, dr, &swsk, false);
 
-       assert(sizeof_strv(swsk) == 5);
+       assert(sizeof_strv((const char **) swsk) == 5);
        assert(strcmp(swsk[0], "c") == 0);
        assert(strcmp(swsk[1], "d") == 0);
        assert(strcmp(swsk[2], "") == 0);
@@ -427,23 +427,23 @@ void test_strv_attach_positive()
        char str2[] = "e:f";
        char **rtrv;
 
-       str_to_strv(&str, &strv, ":");
-       str_to_strv(&str2, &rtrv, ":");
+       str_to_strv(str, &strv, ":");
+       str_to_strv(str2, &rtrv, ":");
 
-       assert(sizeof_strv(strv) == 3);
+       assert(sizeof_strv((const char **) strv) == 3);
        assert(strcmp(strv[0], "c") == 0);
        assert(strcmp(strv[1], "d") == 0);
        assert(strcmp(strv[2], "") == 0);
        assert(strv[3] == NULL);
 
-       assert(sizeof_strv(rtrv) == 2);
+       assert(sizeof_strv((const char **) rtrv) == 2);
        assert(strcmp(rtrv[0], "e") == 0);
        assert(strcmp(rtrv[1], "f") == 0);
        assert(rtrv[2] == NULL);
 
        strv_attach(strv, rtrv, &swsk, false);
 
-       assert(sizeof_strv(swsk) == 5);
+       assert(sizeof_strv((const char **) swsk) == 5);
        assert(strcmp(swsk[0], "c") == 0);
        assert(strcmp(swsk[1], "d") == 0);
        assert(strcmp(swsk[2], "") == 0);
@@ -462,8 +462,8 @@ void test_strv_attach_positive()
        char **ptrv;
        char **fwsk;
 
-       str_to_strv(&str3, &ftrv, "");
-       str_to_strv(&str4, &ptrv, "");
+       str_to_strv(str3, &ftrv, "");
+       str_to_strv(str4, &ptrv, "");
        assert(ftrv == NULL);
        assert(ptrv == NULL);