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
|
define(`NCX_GETN_Byte_Body',dnl
|
||||||
`dnl
|
`dnl
|
||||||
(void) memcpy(tp, *xpp, (size_t)nelems);
|
(void) memcpy(tp, *xpp, (size_t)nelems);
|
||||||
*xpp = (void *)((char *)(*xpp) + nelems);
|
*xpp = (void *)((schar *)(*xpp) + nelems);
|
||||||
return NC_NOERR;
|
return NC_NOERR;
|
||||||
')dnl
|
')dnl
|
||||||
dnl dnl dnl
|
dnl dnl dnl
|
||||||
@ -2441,7 +2441,7 @@ define(`NCX_PAD_GETN_Byte_Body',dnl
|
|||||||
rndup = X_ALIGN - rndup;
|
rndup = X_ALIGN - rndup;
|
||||||
|
|
||||||
(void) memcpy(tp, *xpp, (size_t)nelems);
|
(void) memcpy(tp, *xpp, (size_t)nelems);
|
||||||
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
|
*xpp = (void *)((schar *)(*xpp) + nelems + rndup);
|
||||||
|
|
||||||
return NC_NOERR;
|
return NC_NOERR;
|
||||||
')dnl
|
')dnl
|
||||||
|
@ -979,7 +979,7 @@ void
|
|||||||
check_vars(int ncid)
|
check_vars(int ncid)
|
||||||
{
|
{
|
||||||
size_t index[MAX_RANK];
|
size_t index[MAX_RANK];
|
||||||
char text, name[NC_MAX_NAME];
|
signed char text, name[NC_MAX_NAME];
|
||||||
int i, err; /* status */
|
int i, err; /* status */
|
||||||
size_t j;
|
size_t j;
|
||||||
int nok = 0; /* count of valid comparisons */
|
int nok = 0; /* count of valid comparisons */
|
||||||
@ -987,6 +987,7 @@ check_vars(int ncid)
|
|||||||
double value, expect;
|
double value, expect;
|
||||||
nc_type xtype;
|
nc_type xtype;
|
||||||
size_t length;
|
size_t length;
|
||||||
|
signed char tmp_char;
|
||||||
|
|
||||||
for (i = 0; i < numVars; i++) {
|
for (i = 0; i < numVars; i++) {
|
||||||
isChar = var_type[i] == NC_CHAR;
|
isChar = var_type[i] == NC_CHAR;
|
||||||
@ -1013,11 +1014,11 @@ check_vars(int ncid)
|
|||||||
expect = hash( var_type[i], var_rank[i], index );
|
expect = hash( var_type[i], var_rank[i], index );
|
||||||
if (isChar) {
|
if (isChar) {
|
||||||
err = nc_get_var1_text(ncid, i, index, &text);
|
err = nc_get_var1_text(ncid, i, index, &text);
|
||||||
IF (err)
|
IF (err)
|
||||||
error("nc_get_var1_text: %s", nc_strerror(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 ",
|
error("Var %s [%lu] value read %hhd not that expected %g ",
|
||||||
var_name[i], j, text, expect);
|
var_name[i], j, text, expect);
|
||||||
print_n_size_t(var_rank[i], index);
|
print_n_size_t(var_rank[i], index);
|
||||||
} else {
|
} else {
|
||||||
nok++;
|
nok++;
|
||||||
|
Loading…
Reference in New Issue
Block a user