Skip to content

Commit c190804

Browse files
authored
fix: resolve char/u_char pointer-sign warnings in libopendmarc test suite (#427)
make check surfaces the same -Wpointer-sign warnings as the main build once libmilter/libspf2 are on the include path. Also corrects test_dmarc_fetch.c, which declared opendmarc_policy_fetch_ruf/rua's return value as u_char * instead of the actual u_char ** (caught as -Wincompatible-pointer-types).
1 parent 087d44e commit c190804

6 files changed

Lines changed: 13 additions & 13 deletions

File tree

libopendmarc/tests/test_alignment.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ main(int argc, char **argv)
4747
for (alignp = alignm_test; alignp != NULL && alignp->subdomain != NULL; ++alignp)
4848
{
4949
count += 1;
50-
outcome = opendmarc_policy_check_alignment(alignp->subdomain, alignp->tld, alignp->mode);
50+
outcome = opendmarc_policy_check_alignment((u_char *)alignp->subdomain, (u_char *)alignp->tld, alignp->mode);
5151
if (outcome == alignp->outcome)
5252
{
5353
//printf("\tALIGNMENT No TLD file: find test: %d: PASS\n", count);
@@ -71,7 +71,7 @@ main(int argc, char **argv)
7171
for (alignp = alignm_test; alignp != NULL && alignp->subdomain != NULL; ++alignp)
7272
{
7373
count += 1;
74-
outcome = opendmarc_policy_check_alignment(alignp->subdomain, alignp->tld, alignp->mode);
74+
outcome = opendmarc_policy_check_alignment((u_char *)alignp->subdomain, (u_char *)alignp->tld, alignp->mode);
7575
if (outcome == alignp->outcome)
7676
{
7777
//printf("\tALIGNMENT With TLD file: find test: %d: PASS\n", count);

libopendmarc/tests/test_dmarc_fetch.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ main(int argc, char **argv)
1515
int aspf;
1616

1717
pass = fails = count = 0;
18-
pctx = opendmarc_policy_connect_init("1.2.3.4", 0);
18+
pctx = opendmarc_policy_connect_init((u_char *)"1.2.3.4", 0);
1919
if (pctx == NULL)
2020
{
2121
(void) fprintf(stderr, "opendmarc_policy_connect_init: %s\n", strerror(errno));
2222
return 1;
2323
}
24-
status = opendmarc_policy_parse_dmarc(pctx, "abuse.net", record);
24+
status = opendmarc_policy_parse_dmarc(pctx, (u_char *)"abuse.net", (u_char *)record);
2525
if (status != DMARC_PARSE_OKAY)
2626
{
2727
printf("\t%s(%d): opendmarc_policy_parse_dmarc: %s: FAIL\n", __FILE__, __LINE__, opendmarc_policy_status_to_str(status));
@@ -85,7 +85,7 @@ main(int argc, char **argv)
8585
count++;
8686
{
8787
u_char buf[256];
88-
u_char *ret = opendmarc_policy_fetch_ruf(pctx, buf, sizeof buf, 1);
88+
u_char **ret = opendmarc_policy_fetch_ruf(pctx, buf, sizeof buf, 1);
8989
if (ret == NULL)
9090
{
9191
printf("\t%s(%d): fetch_ruf with valid buf returned NULL: FAIL\n", __FILE__, __LINE__);
@@ -107,7 +107,7 @@ main(int argc, char **argv)
107107
count++;
108108
{
109109
u_char buf[256];
110-
u_char *ret = opendmarc_policy_fetch_rua(pctx, buf, sizeof buf, 1);
110+
u_char **ret = opendmarc_policy_fetch_rua(pctx, buf, sizeof buf, 1);
111111
if (ret == NULL)
112112
{
113113
printf("\t%s(%d): fetch_rua with valid buf returned NULL: FAIL\n", __FILE__, __LINE__);

libopendmarc/tests/test_dmarc_parse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ main(int argc, char **argv)
4545
for (dpp = dpp_test; dpp != NULL && dpp->dmarc != NULL; ++dpp)
4646
{
4747
count += 1;
48-
pctx = opendmarc_policy_connect_init("1.2.3.4", 0);
48+
pctx = opendmarc_policy_connect_init((u_char *)"1.2.3.4", 0);
4949
if (pctx == NULL)
5050
{
5151
(void) fprintf(stderr, "opendmarc_policy_connect_init: %s\n", strerror(errno));
5252
return 1;
5353
}
54-
status = opendmarc_policy_parse_dmarc(pctx, "abuse.net", dpp->dmarc);
54+
status = opendmarc_policy_parse_dmarc(pctx, (u_char *)"abuse.net", (u_char *)dpp->dmarc);
5555
if (status == dpp->outcome)
5656
{
5757
//printf("\tDMARC Policy Parse: %d: PASS\n", count);

libopendmarc/tests/test_finddomain.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ main(int argc, char **argv)
3535
for (domp = domain_test; domp != NULL && domp->raw != NULL; ++domp)
3636
{
3737
count += 1;
38-
dp = opendmarc_util_finddomain(domp->raw, dbuf, sizeof dbuf);
38+
dp = opendmarc_util_finddomain((u_char *)domp->raw, dbuf, sizeof dbuf);
3939
if (dp == NULL)
4040
{
4141
(void) printf("\t%s: %s\n", domp->raw, strerror(errno));
4242
++fails;
4343
continue;
4444
}
45-
if (strcmp(dbuf, domp->should_get) == 0)
45+
if (strcmp((char *)dbuf, domp->should_get) == 0)
4646
{
4747
//printf("\tFinddomain test: %d: PASS\n", count);
4848
pass += 1;

libopendmarc/tests/test_parse_to_buf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ main(int argc, char **argv)
1515
char big_buf[BUFSIZ * 4];
1616

1717
pass = fails = count = 0;
18-
pctx = opendmarc_policy_connect_init("1.2.3.4", 0);
18+
pctx = opendmarc_policy_connect_init((u_char *)"1.2.3.4", 0);
1919
if (pctx == NULL)
2020
{
2121
(void) fprintf(stderr, "opendmarc_policy_connect_init: %s\n", strerror(errno));
2222
return 1;
2323
}
24-
status = opendmarc_policy_parse_dmarc(pctx, "abuse.net", record);
24+
status = opendmarc_policy_parse_dmarc(pctx, (u_char *)"abuse.net", (u_char *)record);
2525
if (status == DMARC_PARSE_OKAY)
2626
{
2727
pass += 1;

libopendmarc/tests/test_tld.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ main(int argc, char **argv)
3030
for (tldp = tld_test; tldp != NULL && tldp->domain != NULL; ++tldp)
3131
{
3232
count += 1;
33-
(void) opendmarc_get_tld(tldp->domain, tldbuf, sizeof tldbuf);
33+
(void) opendmarc_get_tld((u_char *)tldp->domain, tldbuf, sizeof tldbuf);
3434
if (memcmp(tldp->tld, tldbuf, strlen(tldp->tld)) == 0)
3535
{
3636
//printf("\tTLD find test: %d: PASS\n", count);

0 commit comments

Comments
 (0)