mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
We cannot assume char is signed or unsigned.
This commit is contained in:
parent
7a0e61f97c
commit
e100aaf6b0
@ -2426,7 +2426,7 @@ dnl
|
||||
define(`NCX_GETN_Byte_Body',dnl
|
||||
`dnl
|
||||
(void) memcpy(tp, *xpp, (size_t)nelems);
|
||||
*xpp = (void *)((char *)(*xpp) + nelems);
|
||||
*xpp = (void *)((schar *)(*xpp) + nelems);
|
||||
return NC_NOERR;
|
||||
')dnl
|
||||
dnl dnl dnl
|
||||
@ -2441,7 +2441,7 @@ define(`NCX_PAD_GETN_Byte_Body',dnl
|
||||
rndup = X_ALIGN - rndup;
|
||||
|
||||
(void) memcpy(tp, *xpp, (size_t)nelems);
|
||||
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
|
||||
*xpp = (void *)((schar *)(*xpp) + nelems + rndup);
|
||||
|
||||
return NC_NOERR;
|
||||
')dnl
|
||||
|
@ -979,7 +979,7 @@ void
|
||||
check_vars(int ncid)
|
||||
{
|
||||
size_t index[MAX_RANK];
|
||||
char text, name[NC_MAX_NAME];
|
||||
signed char text, name[NC_MAX_NAME];
|
||||
int i, err; /* status */
|
||||
size_t j;
|
||||
int nok = 0; /* count of valid comparisons */
|
||||
@ -987,6 +987,7 @@ check_vars(int ncid)
|
||||
double value, expect;
|
||||
nc_type xtype;
|
||||
size_t length;
|
||||
signed char tmp_char;
|
||||
|
||||
for (i = 0; i < numVars; i++) {
|
||||
isChar = var_type[i] == NC_CHAR;
|
||||
@ -1015,7 +1016,7 @@ check_vars(int ncid)
|
||||
err = nc_get_var1_text(ncid, i, index, &text);
|
||||
IF (err)
|
||||
error("nc_get_var1_text: %s", nc_strerror(err));
|
||||
IF (text != (char)expect) {
|
||||
IF (text != expect) {
|
||||
error("Var %s [%lu] value read %hhd not that expected %g ",
|
||||
var_name[i], j, text, expect);
|
||||
print_n_size_t(var_rank[i], index);
|
||||
|
Loading…
Reference in New Issue
Block a user