Skip to content

Commit

Permalink
Merge pull request #1309 from Unidata/pr-aggregation.wif
Browse files Browse the repository at this point in the history
Rinse and Repeat: PR Edition
  • Loading branch information
WardF authored Feb 7, 2019
2 parents 69c4ed6 + 6511599 commit a260bbb
Show file tree
Hide file tree
Showing 24 changed files with 377 additions and 117 deletions.
9 changes: 5 additions & 4 deletions CMakeInstallation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ SET(CPACK_SOURCE_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}"
"/obsolete/"
"/unknown/"
".*~"
".git/"
)

###
Expand All @@ -56,9 +57,9 @@ IF(WIN32)
SET(CPACK_NSIS_CONTACT "[email protected]")
SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
SET(CPACK_NSIS_MENU_LINKS
"http://www.unidata.ucar.edu/netcdf" "Unidata Website"
"http://www.unidata.ucar.edu/netcdf/docs" "NetCDF Stable Documentation"
"http://www.unidata.ucar.edu/netcdf/docs_rc" "NetCDF Unstable Documentation")
"http://www.unidata.ucar.edu/software/netcdf" "Unidata Website"
"http://www.unidata.ucar.edu/software/netcdf/docs" "NetCDF Stable Documentation"
"http://www.unidata.ucar.edu/software/netcdf/docs_rc" "NetCDF Unstable Documentation")

ENDIF()

Expand Down Expand Up @@ -103,7 +104,7 @@ ENDIF()

IF(APPLE)
SET(CPACK_SOURCE_GENERATOR "TGZ")
SET(CPACK_GENERATOR "PackageMaker" "STGZ" "TBZ2" "TGZ" "ZIP")
SET(CPACK_GENERATOR "productbuild" "STGZ" "TBZ2" "TGZ" "ZIP")
ENDIF()

##
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ IF(MSVC)
ENDIF()

#Add custom CMake Module
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/"
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/"
CACHE INTERNAL "Location of our custom CMake modules.")

# auto-configure style checks, other CMake modules.
Expand Down
9 changes: 8 additions & 1 deletion include/hdf5internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,14 @@ int nc4_reform_coord_var(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *coord_var, NC_DIM_IN
extern hid_t NC4_image_init(NC_FILE_INFO_T* h5);
extern void NC4_image_finalize(void*);

/* These functions are internal to the libhdf5 directory. */
/* Create HDF5 dataset for dim without a coord var. */
extern int nc4_create_dim_wo_var(NC_DIM_INFO_T *dim);

/* Give a var a secret HDF5 name, for use when there is a dim of this
* name, but the var is not a coord var of that dim. */
extern int nc4_give_var_secret_name(NC_VAR_INFO_T *var);

/* Get the fill value for a var. */
int nc4_get_fill_value(NC_FILE_INFO_T *h5, NC_VAR_INFO_T *var, void **fillp);


Expand Down
4 changes: 2 additions & 2 deletions include/nc4internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ typedef struct NC_VAR_INFO
nc_bool_t created; /* Variable has already been created (_not_ that it was just created) */
nc_bool_t written_to; /* True if variable has data written to it */
struct NC_TYPE_INFO *type_info;
int atts_not_read; /* If true, the atts have not yet been read. */
int atts_read; /* If true, the atts have been read. */
nc_bool_t meta_read; /* True if this vars metadata has been completely read. */
nc_bool_t coords_read; /* True if this var has hidden coordinates att, and it has been read. */
NCindex *att; /* NCindex<NC_ATT_INFO_T*> */
Expand Down Expand Up @@ -229,7 +229,7 @@ typedef struct NC_GRP_INFO
void *format_grp_info;
struct NC_FILE_INFO *nc4_info;
struct NC_GRP_INFO *parent;
int atts_not_read;
int atts_read; /* True if atts have been read for this group. */
NCindex* children; /* NCindex<struct NC_GRP_INFO*> */
NCindex* dim; /* NCindex<NC_DIM_INFO_T> * */
NCindex* att; /* NCindex<NC_ATT_INFO_T> * */
Expand Down
4 changes: 4 additions & 0 deletions include/ncconfigure.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,8 @@ typedef unsigned short ushort;
typedef unsigned int uint;
#endif

#ifndef NC_UNUSED
#define NC_UNUSED(var) (void)var
#endif

#endif /* NCCONFIGURE_H */
23 changes: 23 additions & 0 deletions libdispatch/dparallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ int nc_create_par(const char *path, int cmode, MPI_Comm comm,
MPI_Info info, int *ncidp)
{
#ifndef USE_PARALLEL
NC_UNUSED(path);
NC_UNUSED(cmode);
NC_UNUSED(comm);
NC_UNUSED(info);
NC_UNUSED(ncidp);
return NC_ENOPAR;
#else
NC_MPI_INFO data;
Expand Down Expand Up @@ -201,6 +206,11 @@ nc_open_par(const char *path, int omode, MPI_Comm comm,
MPI_Info info, int *ncidp)
{
#ifndef USE_PARALLEL
NC_UNUSED(path);
NC_UNUSED(omode);
NC_UNUSED(comm);
NC_UNUSED(info);
NC_UNUSED(ncidp);
return NC_ENOPAR;
#else
NC_MPI_INFO mpi_data;
Expand Down Expand Up @@ -249,6 +259,11 @@ nc_open_par_fortran(const char *path, int omode, int comm,
int info, int *ncidp)
{
#ifndef USE_PARALLEL
NC_UNUSED(path);
NC_UNUSED(omode);
NC_UNUSED(comm);
NC_UNUSED(info);
NC_UNUSED(ncidp);
return NC_ENOPAR;
#else
MPI_Comm comm_c;
Expand Down Expand Up @@ -348,6 +363,9 @@ int
nc_var_par_access(int ncid, int varid, int par_access)
{
#ifndef USE_PARALLEL
NC_UNUSED(ncid);
NC_UNUSED(varid);
NC_UNUSED(par_access);
return NC_ENOPAR;
#else
int stat = NC_NOERR;
Expand Down Expand Up @@ -403,6 +421,11 @@ nc_create_par_fortran(const char *path, int cmode, int comm,
int info, int *ncidp)
{
#ifndef USE_PARALLEL
NC_UNUSED(path);
NC_UNUSED(cmode);
NC_UNUSED(comm);
NC_UNUSED(info);
NC_UNUSED(ncidp);
return NC_ENOPAR;
#else
MPI_Comm comm_c;
Expand Down
4 changes: 2 additions & 2 deletions libdispatch/drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ rcsearch(const char* prefix, const char* rcname, char** pathp)
{
char* path = NULL;
FILE* f = NULL;
int plen = strlen(prefix);
int rclen = strlen(rcname);
size_t plen = strlen(prefix);
size_t rclen = strlen(rcname);
int ret = NC_NOERR;

size_t pathlen = plen+rclen+1; /*+1 for '/' */
Expand Down
2 changes: 1 addition & 1 deletion libdispatch/dutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ NC_mktmp(const char* base)
char spid[7];
if(rno < 0) rno = -rno;
snprintf(spid,sizeof(spid),"%06d",rno);
strncat(tmp,spid,sizeof(tmp));
strncat(tmp,spid,sizeof(tmp) - strlen(tmp) - 1);
}
#endif /* HAVE_MKTEMP */
#ifdef _MSC_VER
Expand Down
1 change: 1 addition & 0 deletions libdispatch/nclog.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ Each line will be sent using nclog with the specified tag.
void
nclogtextn(int tag, const char* text, size_t count)
{
NC_UNUSED(tag);
if(!nclogging || nclogstream == NULL) return;
fwrite(text,1,count,nclogstream);
fflush(nclogstream);
Expand Down
4 changes: 3 additions & 1 deletion libdispatch/nctime.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include "ncconfigure.h"
#include "nctime.h"

static int cuErrOpts; /* Error options */
Expand Down Expand Up @@ -309,7 +310,7 @@ cdParseRelunits(cdCalenType timetype, char* relunits, cdUnitTime* unit, cdCompTi
char charunits[CD_MAX_RELUNITS];
char basetime_1[CD_MAX_CHARTIME];
char basetime_2[CD_MAX_CHARTIME];
char basetime[CD_MAX_CHARTIME];
char basetime[2 * CD_MAX_CHARTIME + 1];
int nconv1, nconv2, nconv;

/* Parse the relunits */
Expand Down Expand Up @@ -659,6 +660,7 @@ Cdh2e(CdTime *htime, double *etime)
static int
cdValidateTime(cdCalenType timetype, cdCompTime comptime)
{
NC_UNUSED(timetype);
if(comptime.month<1 || comptime.month>12){
cdError("Error on time conversion: invalid month = %hd\n",comptime.month);
return 1;
Expand Down
4 changes: 2 additions & 2 deletions libdispatch/ncuri.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static char* queryallow =
static char* userpwdallow =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!$&'()*+,-.;=_~?#/";

#ifndef HAVE_STRNCMP
#ifndef HAVE_STRNDUP
#define strndup ncstrndup
/* Not all systems have strndup, so provide one*/
char*
Expand Down Expand Up @@ -258,7 +258,7 @@ ncuriparse(const char* uri0, NCURI** durip)

isfile = (strcmp(tmp.protocol,"file")==0);
if(isfile) {
int l = strlen(p); /* to test if we have enough characters */
size_t l = strlen(p); /* to test if we have enough characters */
hashost = 0; /* always */
if(l >= 2 && p[1] == ':' && strchr(DRIVELETTERS,p[0]) != NULL) { /* case 1 */
; /* p points to the start of the path */
Expand Down
2 changes: 2 additions & 0 deletions libhdf4/hdf4file.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ nc4_var_list_add_full(NC_GRP_INFO_T* grp, const char* name, int ndims, nc_type x
(*var)->created = NC_TRUE;
(*var)->written_to = NC_TRUE;
(*var)->format_var_info = format_var_info;
(*var)->atts_read = 1;

/* Fill special type_info struct for variable type information. */
if ((retval = nc4_set_var_type(xtype, endianness, type_size, type_name,
Expand Down Expand Up @@ -630,6 +631,7 @@ NC_HDF4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
assert(nc4_info && nc4_info->root_grp);
h5 = nc4_info;
h5->no_write = NC_TRUE;
h5->root_grp->atts_read = 1;

/* Allocate data to hold HDF4 specific file data. */
if (!(hdf4_file = malloc(sizeof(NC_HDF4_FILE_INFO_T))))
Expand Down
9 changes: 6 additions & 3 deletions libhdf5/hdf5attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ static int
getattlist(NC_GRP_INFO_T *grp, int varid, NC_VAR_INFO_T **varp,
NCindex **attlist)
{
NC_VAR_INFO_T* var;
int retval;

assert(grp && attlist);

if (varid == NC_GLOBAL)
{
/* Do we need to read the atts? */
if (grp->atts_not_read)
if (!grp->atts_read)
if ((retval = nc4_read_atts(grp, NULL)))
return retval;

Expand All @@ -43,12 +44,14 @@ getattlist(NC_GRP_INFO_T *grp, int varid, NC_VAR_INFO_T **varp,
}
else
{
NC_VAR_INFO_T *var;

if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, varid)))
return NC_ENOTVAR;
assert(var->hdr.id == varid);

/* Do we need to read the atts? */
if (var->atts_not_read)
if (!var->atts_read)
if ((retval = nc4_read_atts(grp, var)))
return retval;

Expand Down
1 change: 1 addition & 0 deletions libhdf5/hdf5create.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ nc4_create_file(const char *path, int cmode, size_t initialsz,
BAIL(retval);
nc4_info = NC4_DATA(nc);
assert(nc4_info && nc4_info->root_grp);
nc4_info->root_grp->atts_read = 1;

/* Add struct to hold HDF5-specific file metadata. */
if (!(nc4_info->format_file_info = calloc(1, sizeof(NC_HDF5_FILE_INFO_T))))
Expand Down
2 changes: 1 addition & 1 deletion libhdf5/hdf5file.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ NC4_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp)
if (nattsp)
{
/* Do we need to read the atts? */
if (grp->atts_not_read)
if (!grp->atts_read)
if ((retval = nc4_read_atts(grp, NULL)))
return retval;

Expand Down
5 changes: 5 additions & 0 deletions libhdf5/hdf5grp.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ NC4_def_grp(int parent_ncid, const char *name, int *new_ncid)
return retval;
if (!(g->format_grp_info = calloc(1, sizeof(NC_HDF5_GRP_INFO_T))))
return NC_ENOMEM;

/* For new groups, there are no atts to read from file. */
g->atts_read = 1;

/* Return the ncid to the user. */
if (new_ncid)
*new_ncid = grp->nc4_info->controller->ext_ncid | g->hdr.id;

Expand Down
Loading

0 comments on commit a260bbb

Please sign in to comment.