Commit d22a1915 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

use size of CDI_MAX_NAME to allocate CDI names

parent 33a258a4
......@@ -4,7 +4,7 @@
Name: cdo
#BuildRequires:
Version: 1.5.1rc4
Version: 1.5.1rc5
Release: 1
Summary: Climate Data Operators
License: GNU GENERAL PUBLIC LICENSE Version 2, June 1991
......
......@@ -773,6 +773,7 @@ enable_fast_install
enable_dependency_tracking
with_gnu_ld
enable_libtool_lock
with_gnu_ld
enable_largefile
with_threads
with_zlib
......@@ -799,8 +800,12 @@ LDFLAGS
LIBS
CPPFLAGS
CPP
CPPFLAGS
CXX
CXXFLAGS
LDFLAGS
LIBS
CPPFLAGS
CCC
CXXCPP'
ac_subdirs_all='libcdi'
......
......@@ -44,7 +44,7 @@ void *Arithlat(void *argument)
int taxisID1, taxisID2;
int nmiss;
long gridsize, i;
char units[128];
char units[CDI_MAX_NAME];
double *scale = NULL;
double *array = NULL;
......
......@@ -48,7 +48,7 @@ void *Change(void *argument)
int taxisID1, taxisID2;
int chints[MAXARG], nch = 0;
char *chnames[MAXARG];
char varname[128];
char varname[CDI_MAX_NAME];
char *chname = NULL;
int chcode = 0;
int param;
......
......@@ -49,7 +49,7 @@ void *Change_e5slm(void *argument)
{
int streamIDslm, streamID1, streamID2;
const char *fn_slm;
char name[256];
char name[CDI_MAX_NAME];
int nrecs, code;
int tsID, recID, varID, levelID;
int gridsize;
......
......@@ -139,7 +139,7 @@ void *Cloudlayer(void *argument)
int aclcacID = -1;
int nvars2 = 0;
int kmin[NVARS], kmax[NVARS];
char varname[128];
char varname[CDI_MAX_NAME];
double sfclevel = 0;
double *plevs = NULL;
double *aclcac = NULL;
......
......@@ -30,9 +30,9 @@
typedef struct
{
int param;
char name[128];
char longname[128];
char units[128];
char name[CDI_MAX_NAME];
char longname[CDI_MAX_NAME];
char units[CDI_MAX_NAME];
} vars_t;
vars_t *all_vars = NULL;
......
......@@ -48,7 +48,7 @@ void *Diff(void *argument)
int nmiss1, nmiss2;
int ndrec = 0, nd2rec = 0, ngrec = 0;
int cmpflag;
char varname[128];
char varname[CDI_MAX_NAME];
char paramstr[32];
char vdatestr[32], vtimestr[32];
double *array1, *array2;
......
......@@ -700,7 +700,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
int nvdims, nvatts;
int dimidsp[9];
int max_vars = 4096;
char name[256];
char name[CDI_MAX_NAME];
int lon_dimid, lat_dimid, nhgl_dimid, nlevp1_dimid, spc_dimid, nvclev_dimid;
int complex_dimid, nmp1_dimid, belowsurface_dimid, lev_dimid, ilev_dimid;
int /* surface_dimid, height2m_dimid, height10m_dimid,*/ n2_dimid;
......@@ -712,7 +712,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
double attflt;
size_t attlen, dimlen;
nc_type xtype;
char attname[256];
char attname[CDI_MAX_NAME];
const int attstringlen = 8192; char attstring[8192];
/* open file and check file type */
......@@ -1516,7 +1516,7 @@ void *Echam5ini(void *argument)
{
VAR *vars = NULL;
int code, gridID, zaxisID, gridtype, zaxistype, gridsize, nlev;
char name[256], longname[256], units[256];
char name[CDI_MAX_NAME], longname[CDI_MAX_NAME], units[CDI_MAX_NAME];
int taxisID, vdate, vtime;
int ntr = 0;
......
......@@ -83,7 +83,7 @@ void gen_index(int gridID1, int gridID2, int *index)
/* Convert lat/lon units if required */
{
char units[128];
char units[CDI_MAX_NAME];
gridInqXunits(gridID1, units);
gridToDegree(units, "grid1 center lon", nlon1, xvals1);
gridInqYunits(gridID1, units);
......@@ -95,7 +95,7 @@ void gen_index(int gridID1, int gridID2, int *index)
/* Convert lat/lon units if required */
{
char units[128];
char units[CDI_MAX_NAME];
gridInqXunits(gridID2, units);
gridToDegree(units, "grid2 center lon", nlon2, xvals2);
gridInqYunits(gridID2, units);
......
......@@ -179,7 +179,7 @@ void *Filedes(void *argument)
else if ( operatorID == PARDES )
{
int varID, code;
char varname[128], varlongname[128], varunits[128];
char varname[CDI_MAX_NAME], varlongname[CDI_MAX_NAME], varunits[CDI_MAX_NAME];
for ( varID = 0; varID < nvars; varID++ )
{
......@@ -204,7 +204,7 @@ void *Filedes(void *argument)
{
int varID, code, tabnum, tableID, prec;
char pstr[4];
char varname[128], varlongname[128], varstdname[128], varunits[128];
char varname[CDI_MAX_NAME], varlongname[CDI_MAX_NAME], varstdname[CDI_MAX_NAME], varunits[CDI_MAX_NAME];
int natts;
if ( operatorID == PARTAB2 )
......
......@@ -387,7 +387,7 @@ void *Gradsdes(void *argument)
const char *datfile;
char ctlfile[1024], *pctlfile;
int len;
char varname[256], varlongname[256], varunits[256];
char varname[CDI_MAX_NAME], varlongname[CDI_MAX_NAME], varunits[CDI_MAX_NAME];
FILE *gdp;
int yrev = FALSE;
int zrev = FALSE;
......
......@@ -186,7 +186,7 @@ int genBoxGrid(int gridID1, int xinc, int yinc)
/* Convert lat/lon units if required */
{
char units[128];
char units[CDI_MAX_NAME];
gridInqXunits(gridID1, units);
gridToDegree(units, "grid center lon", nlon1*nlat1, xvals1);
gridInqYunits(gridID1, units);
......@@ -204,7 +204,7 @@ int genBoxGrid(int gridID1, int xinc, int yinc)
/* Convert lat/lon units if required */
{
char units[128];
char units[CDI_MAX_NAME];
gridInqXunits(gridID1, units);
gridToDegree(units, "grid corner lon", 4*nlon1*nlat1, grid1_corner_lon);
gridInqYunits(gridID1, units);
......
......@@ -218,7 +218,7 @@ void *Gridcell(void *argument)
long i, j, xsize, ysize;
double *xv, *yv;
double len1 = 0, len2 = 0;
char units[128];
char units[CDI_MAX_NAME];
if ( gridtype != GRID_CURVILINEAR )
gridID = gridToCurvilinear(gridID);
......
......@@ -142,8 +142,8 @@ void read_param(const char *paramfile, param_t *param, int maxparam, int *nparam
int codenum, tabnum, levtype;
int numparam = 0;
char *datatype = NULL;
char *name = NULL, *itype = NULL, *stdname = NULL, longname[256] = "", units[256] = "";
char varname[256];
char *name = NULL, *itype = NULL, *stdname = NULL, longname[CDI_MAX_NAME] = "", units[CDI_MAX_NAME] = "";
char varname[CDI_MAX_NAME];
fp = fopen(paramfile, "r");
if ( fp == NULL ) cdoAbort("Open failed on %s!", paramfile);
......
......@@ -774,7 +774,7 @@ void read_dataset(hid_t loc_id, const char *name, void *opdata)
int iattr;
float fattr;
double dattr;
char attname[256];
char attname[CDI_MAX_NAME];
H5T_class_t type_class;
H5T_class_t atype_class;
size_t atype_size;
......@@ -790,7 +790,7 @@ void read_dataset(hid_t loc_id, const char *name, void *opdata)
int len;
int dtype = DATATYPE_FLT32;
char attstring[4096]; /* Buffer to read string attribute back */
char varname[256];
char varname[CDI_MAX_NAME];
short *mask = NULL;
double minval, maxval;
int nmiss;
......@@ -1321,7 +1321,7 @@ static
void get_global_att(hid_t file_id, const char *obj_path, int vlistID)
{
hid_t attr, atype, atype_mem, obj_id, grp_id = -1;
char attname[256];
char attname[CDI_MAX_NAME];
H5T_class_t type_class;
int attint;
double attflt;
......@@ -1378,8 +1378,8 @@ int get_vdate(int vlistID)
int vdate = 0;
int natts;
int i, len, type;
char name[256];
char attstr[256];
char name[CDI_MAX_NAME];
char attstr[CDI_MAX_NAME];
vlistInqNatts(vlistID, CDI_GLOBAL, &natts);
......@@ -1391,7 +1391,7 @@ int get_vdate(int vlistID)
if ( strcmp(name, "DateAndTime") == 0 ||
strcmp(name, "Date_Time") == 0 )
{
vlistInqAttTxt(vlistID, CDI_GLOBAL, name, 256, attstr);
vlistInqAttTxt(vlistID, CDI_GLOBAL, name, CDI_MAX_NAME, attstr);
if ( len > 8 ) len = 8;
attstr[len] = 0;
vdate = atoi(attstr);
......
......@@ -155,7 +155,7 @@ void *Importobs(void *argument)
/* Convert lat/lon units if required */
{
char units[128];
char units[CDI_MAX_NAME];
gridInqXunits(gridID, units);
gridToDegree(units, "grid center lon", gridsize, xvals);
gridInqYunits(gridID, units);
......
......@@ -237,7 +237,7 @@ void *Info(void *argument)
int number;
int ivals = 0, nvals = 0;
int imiss = 0;
char varname[128];
char varname[CDI_MAX_NAME];
char paramstr[32];
char vdatestr[32], vtimestr[32];
double missval;
......
......@@ -138,7 +138,7 @@ void genlonlatgrid(int gridID1, int *lat1, int *lat2, int *lon11, int *lon12, in
/* Convert lat/lon units if required */
{
char units[128];
char units[CDI_MAX_NAME];
gridInqXunits(gridID1, units);
gridToDegree(units, "grid center lon", nlon1, xvals1);
gridInqYunits(gridID1, units);
......@@ -266,7 +266,7 @@ void maskregion(int *mask, int gridID, double *xcoords, double *ycoords, int nof
/* Convert lat/lon units if required */
{
char units[128];
char units[CDI_MAX_NAME];
gridInqXunits(gridID, units);
gridToDegree(units, "grid center lon", nlon, xvals);
gridInqYunits(gridID, units);
......
......@@ -113,7 +113,7 @@ void *Mastrfu(void *argument)
if ( zaxisInqType(zaxisID) != ZAXIS_PRESSURE &&
zaxisInqType(zaxisID) != ZAXIS_GENERIC )
{
char longname[128];
char longname[CDI_MAX_NAME];
zaxisInqLongname(zaxisID, longname);
cdoWarning("Unexpected vertical grid %s!", longname);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment