mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
Fix returning wrong type
This commit is contained in:
parent
472b30f313
commit
b94199874d
@ -24,6 +24,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <netcdf.h>
|
#include <netcdf.h>
|
||||||
|
#include "nctime.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "nccomps.h"
|
#include "nccomps.h"
|
||||||
#include "dumplib.h" /* for sbuf_... prototypes */
|
#include "dumplib.h" /* for sbuf_... prototypes */
|
||||||
@ -55,12 +56,11 @@ bounds_add(char *bounds_name, int ncid, int varid) {
|
|||||||
* calendar type, if present. */
|
* calendar type, if present. */
|
||||||
cdCalenType
|
cdCalenType
|
||||||
calendar_type(int ncid, int varid) {
|
calendar_type(int ncid, int varid) {
|
||||||
int ctype;
|
|
||||||
int stat;
|
int stat;
|
||||||
ncatt_t catt;
|
ncatt_t catt;
|
||||||
static struct {
|
static struct {
|
||||||
char* attname;
|
char* attname;
|
||||||
int type;
|
cdCalenType type;
|
||||||
} calmap[] = {
|
} calmap[] = {
|
||||||
{"gregorian", cdMixed},
|
{"gregorian", cdMixed},
|
||||||
{"standard", cdMixed}, /* synonym */
|
{"standard", cdMixed}, /* synonym */
|
||||||
@ -77,7 +77,7 @@ calendar_type(int ncid, int varid) {
|
|||||||
};
|
};
|
||||||
#define CF_CAL_ATT_NAME "calendar"
|
#define CF_CAL_ATT_NAME "calendar"
|
||||||
int ncals = (sizeof calmap)/(sizeof calmap[0]);
|
int ncals = (sizeof calmap)/(sizeof calmap[0]);
|
||||||
ctype = cdMixed; /* default mixed Gregorian/Julian ala udunits */
|
cdCalenType ctype = cdMixed; /* default mixed Gregorian/Julian ala udunits */
|
||||||
stat = nc_inq_att(ncid, varid, CF_CAL_ATT_NAME, &catt.type, &catt.len);
|
stat = nc_inq_att(ncid, varid, CF_CAL_ATT_NAME, &catt.type, &catt.len);
|
||||||
if(stat == NC_NOERR && (catt.type == NC_CHAR || catt.type == NC_STRING) && catt.len > 0) {
|
if(stat == NC_NOERR && (catt.type == NC_CHAR || catt.type == NC_STRING) && catt.len > 0) {
|
||||||
char *calstr;
|
char *calstr;
|
||||||
|
Loading…
Reference in New Issue
Block a user