Skip to content

Commit

Permalink
change error code from NC_EINVAL to NC_EGLOBAL when trying to set glo…
Browse files Browse the repository at this point in the history
…bal _FillValue
  • Loading branch information
Wei-keng Liao committed Mar 25, 2017
1 parent 0ff3616 commit f7f8a0f
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions libdispatch/dattput.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ apply.
\param value Pointer to one or more values.
\returns ::NC_NOERR No error.
\returns ::NC_EINVAL More than one value for _FillValue or trying to set global _FillValue.
\returns ::NC_EINVAL More than one value for _FillValue.
\returns ::NC_EGLOBAL Trying to set global _FillValue.
\returns ::NC_ENOTVAR Couldn't find varid.
\returns ::NC_EBADTYPE Fill value and var must be same type.
\returns ::NC_ENOMEM Out of memory
Expand All @@ -55,7 +56,7 @@ nc_put_att_string(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, NC_STRING,
len, (void*)value, NC_STRING);
}
Expand Down Expand Up @@ -90,7 +91,8 @@ apply.
\param value Pointer to one or more values.
\returns ::NC_NOERR No error.
\returns ::NC_EINVAL More than one value for _FillValue or trying to set global _FillValue.
\returns ::NC_EINVAL More than one value for _FillValue.
\returns ::NC_EGLOBAL Trying to set global _FillValue.
\returns ::NC_ENOTVAR Couldn't find varid.
\returns ::NC_EBADTYPE Fill value and var must be same type.
\returns ::NC_ENOMEM Out of memory
Expand Down Expand Up @@ -146,7 +148,7 @@ int nc_put_att_text(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, NC_CHAR, len,
(void *)value, NC_CHAR);
}
Expand Down Expand Up @@ -188,7 +190,8 @@ apply.
\param value Pointer to one or more values.
\returns ::NC_NOERR No error.
\returns ::NC_EINVAL More than one value for _FillValue or trying to set global _FillValue.
\returns ::NC_EINVAL More than one value for _FillValue.
\returns ::NC_EGLOBAL Trying to set global _FillValue.
\returns ::NC_ENOTVAR Couldn't find varid.
\returns ::NC_EBADTYPE Fill value and var must be same type.
\returns ::NC_ENOMEM Out of memory
Expand Down Expand Up @@ -240,7 +243,7 @@ nc_put_att(int ncid, int varid, const char *name, nc_type xtype,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
value, xtype);
}
Expand All @@ -254,7 +257,7 @@ nc_put_att_schar(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, NC_BYTE);
}
Expand All @@ -268,7 +271,7 @@ nc_put_att_uchar(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, NC_UBYTE);
}
Expand All @@ -282,7 +285,7 @@ nc_put_att_short(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, NC_SHORT);
}
Expand All @@ -296,7 +299,7 @@ nc_put_att_int(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, NC_INT);
}
Expand All @@ -310,7 +313,7 @@ nc_put_att_long(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, longtype);
}
Expand All @@ -324,7 +327,7 @@ nc_put_att_float(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, NC_FLOAT);
}
Expand All @@ -338,7 +341,7 @@ nc_put_att_double(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, NC_DOUBLE);
}
Expand All @@ -352,7 +355,7 @@ nc_put_att_ubyte(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, NC_UBYTE);
}
Expand All @@ -366,7 +369,7 @@ nc_put_att_ushort(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, NC_USHORT);
}
Expand All @@ -380,7 +383,7 @@ nc_put_att_uint(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, NC_UINT);
}
Expand All @@ -395,7 +398,7 @@ nc_put_att_longlong(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, NC_INT64);
}
Expand All @@ -410,7 +413,7 @@ nc_put_att_ulonglong(int ncid, int varid, const char *name,
if(stat != NC_NOERR) return stat;
/* set global _FillValue is not allowed */
if (varid == NC_GLOBAL && name != NULL && !strcmp(name, _FillValue))
return NC_EINVAL;
return NC_EGLOBAL;
return ncp->dispatch->put_att(ncid, varid, name, xtype, len,
(void *)value, NC_UINT64);
}

0 comments on commit f7f8a0f

Please sign in to comment.