Skip to content

Commit

Permalink
Explicit cast to unsigned char.
Browse files Browse the repository at this point in the history
  • Loading branch information
WardF committed Feb 24, 2023
1 parent 0c45c39 commit 1d908e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nc_test/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ put_atts(int ncid)
for (j = 0; j < NATTS(i); j++) {
if (ATT_TYPE(i,j) == NC_CHAR) {
for (k = 0; k < ATT_LEN(i,j); k++) {
catt[k] = (char) hash(ATT_TYPE(i,j), -1, &k);
catt[k] = (unsigned char) hash(ATT_TYPE(i,j), -1, &k);
}
err = nc_put_att_text(ncid, i, ATT_NAME(i,j),
ATT_LEN(i,j), catt);
Expand Down Expand Up @@ -1074,7 +1074,8 @@ check_atts(int ncid)
for (k = 0; k < ATT_LEN(i,j); k++) {
expect = hash(xtype, -1, &k);
IF ((unsigned char)text[k] != (unsigned char)expect) {
error("nc_get_att_text: unexpected value");
error("Var %s [%lu] value read %hhd not that expected %g ",
var_name[i], j, text, expect);
} else {
nok++;
}
Expand Down

0 comments on commit 1d908e2

Please sign in to comment.