diff --git a/config/gnu-warnings/no-developer-general b/config/gnu-warnings/no-developer-general index fafa1214f3..45f84dba72 100644 --- a/config/gnu-warnings/no-developer-general +++ b/config/gnu-warnings/no-developer-general @@ -6,3 +6,4 @@ # regarding the library settings string (H4libhdf4_settings). We'll turn # it off here but leave it on in the developer flags. -Wno-overlength-strings +-Wno-format-nonliteral diff --git a/hdf/src/mfan.c b/hdf/src/mfan.c index a506742812..5901599470 100644 --- a/hdf/src/mfan.c +++ b/hdf/src/mfan.c @@ -569,73 +569,6 @@ ANIcreate_ann_tree(int32 an_id,/* IN: annotation interface id */ return ret_value; } /* ANIcreate_ann_tree */ -#if NOT_USED_YET -/*-------------------------------------------------------------------------- - NAME - ANIfind -- find annotation id for given annotation type and ref number - - DESCRIPTION - Find annotation id for the given annotation type and ref number - - RETURNS - Annotation id if successful and FAIL (-1) otherwise - - AUTHOR - GeorgeV. - - -------------------------------------------------------------------------*/ -static int32 -ANIfind(int32 an_id, /* IN: annotation interface id */ - ann_type type, /* IN: AN_DATA_LABEL for data labels, - AN_DATA_DESC for data descriptions, - AN_FILE_LABEL for file labels, - AN_FILE_DESC for file descriptions.*/ - uint16 ann_ref /* IN: ref of annotation */) -{ - filerec_t *file_rec = NULL; /* file record pointer */ - TBBT_NODE *entry = NULL; - ANentry *ann_entry = NULL; - int32 ann_key; - int32 ret_value = SUCCEED; - - /* Clear error stack */ - HEclear(); - - /* convert an_id i.e. file_id to file rec and check for validity */ - file_rec = HAatom_object(an_id); - if (BADFREC(file_rec)) - HGOTO_ERROR(DFE_ARGS, FAIL); - - /* Check for empty annotation tree of 'type'? */ - if (file_rec->an_num[type] == -1) { - if ((file_rec->an_tree[type] = (TBBT_TREE *)tbbtdmake(ANIanncmp, sizeof(int32), 0)) == NULL) { - HE_REPORT_GOTO("failed to create annotation tree", FAIL); - } - - file_rec->an_num[type] = 0; /* initialize after allocation */ - } - - /* Create key from type/ref pair - * ---------------------------- - * | type(16bits) | ref(16bits) | - * -----------------------------*/ - ann_key = AN_CREATE_KEY(type, ann_ref); - - /* See if annotation of 'type' with ref exits */ - if ((entry = tbbtdfind(file_rec->an_tree[type], &ann_key, NULL)) == NULL) - HE_REPORT_GOTO("failed to find annotation of 'type'", FAIL); - - /* get annotation entry from node */ - ann_entry = (ANentry *)entry->data; - - /* return annotation id */ - ret_value = ann_entry->ann_id; - -done: - return ret_value; -} /* ANIfind */ -#endif /* NOT_USED_YET */ - /*-------------------------------------------------------------------------- NAME ANInumann -- find number of annotation of 'type' that diff --git a/hdf/test/mgr.c b/hdf/test/mgr.c index 253a2a8734..5916f5b9d8 100644 --- a/hdf/test/mgr.c +++ b/hdf/test/mgr.c @@ -4431,12 +4431,13 @@ test_mgr_chunkwr_pixel(int flag) data_type, /* data type of the image data */ comp_flag, /* compression flag */ index, i; - int32 start[2], stride[2], edge[2]; - intn is_mappedable; /* TRUE if the image is mapped-able (hmap project)*/ - intn name_generated; /* TRUE if the image has name generated by lib */ - int16 data_out[3 * Y_LENGTH * X_LENGTH]; - char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; - char *file_name[] = {"ChunkedGR_NO.hdf", "ChunkedGR_RL.hdf", "ChunkedGR_SK.hdf", "ChunkedGR_DF.hdf"}; + int32 start[2], stride[2], edge[2]; + intn is_mappedable; /* TRUE if the image is mapped-able (hmap project)*/ + intn name_generated; /* TRUE if the image has name generated by lib */ + int16 data_out[3 * Y_LENGTH * X_LENGTH]; + const char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; + const char *file_name[] = {"ChunkedGR_NO.hdf", "ChunkedGR_RL.hdf", "ChunkedGR_SK.hdf", + "ChunkedGR_DF.hdf"}; HDF_CHUNK_DEF chunk_def; int16 chunk_buf[18]; diff --git a/hdf/test/tattdatainfo.c b/hdf/test/tattdatainfo.c index fd20eefe87..1686c32554 100644 --- a/hdf/test/tattdatainfo.c +++ b/hdf/test/tattdatainfo.c @@ -406,18 +406,18 @@ test_vgmixedattrs() /* Test Vattrinfo2 and Vgetattr2 on each attribute */ for (ii = 0; ii < n_attrs; ii++) { - char aname[20]; - int32 atype, acount, asize, n_fields; - uint16 refnum; - int jj; - char cvalues[20]; - int32 ivalues[10]; - char *check_attr_names[5] = {"Attribute 6", "Attribute 7", "Attribute 1", "Attribute 2", - "Attribute 5"}; - char *check_attr_values[5] = {"VG0 oldattr0", "VG0 oldattr1", - "", /* int values, added by test_vvsattrs with attr1 */ - "Vgroup0", /* added by test_vvsattrs with attr2 */ - "VG0 newattr"}; + char aname[20]; + int32 atype, acount, asize, n_fields; + uint16 refnum; + int jj; + char cvalues[20]; + int32 ivalues[10]; + const char *check_attr_names[5] = {"Attribute 6", "Attribute 7", "Attribute 1", "Attribute 2", + "Attribute 5"}; + const char *check_attr_values[5] = {"VG0 oldattr0", "VG0 oldattr1", + "", /* int values, added by test_vvsattrs with attr1 */ + "Vgroup0", /* added by test_vvsattrs with attr2 */ + "VG0 newattr"}; /* Get attribute information and verify its name and number of fields, which should be 1 */ diff --git a/hdf/test/tmgrcomp.c b/hdf/test/tmgrcomp.c index 1ed731d243..f8a88fe60a 100644 --- a/hdf/test/tmgrcomp.c +++ b/hdf/test/tmgrcomp.c @@ -60,11 +60,10 @@ test_mgr_compress_a() int32 start[2]; /* start of image data to grab */ int32 stride[2]; /* stride of image data to grab */ int32 count[2]; /* Size of image data to operate on */ - intn i, j; /* indices */ /* Initialize data we are going to write out */ - for (i = 0; i < 10; i++) - for (j = 0; j < 10; j++) + for (int i = 0; i < 10; i++) + for (int j = 0; j < 10; j++) image0[i][j] = (uint8)(i + j); /* Get the first image in this file */ @@ -103,7 +102,7 @@ test_mgr_compress_a() if (memcmp(image, image0, 10 * 10) != 0) { MESSAGE(3, printf("Error reading data for gzip compressed image\n");); num_errs++; - } /* end if */ + } /* Close the empty image */ ret = GRendaccess(riid); @@ -159,7 +158,7 @@ test_mgr_compress_a() if (memcmp(image, image0, 10 * 10) != 0) { MESSAGE(3, printf("Error reading 2nd data for gzip compressed image\n");); num_errs++; - } /* end if */ + } /* Close the empty image */ ret = GRendaccess(riid); @@ -210,11 +209,10 @@ test_mgr_compress_b() int32 interlace_mode, n_comps, n_attrs, datatype; /* Image information */ char name[30]; /* Buffer for retrieving image name */ uint8 attr; /* Attribute data */ - intn i, j; /* indices */ /* Initialize data we are going to write out */ - for (i = 0; i < 10; i++) - for (j = 0; j < 10; j++) + for (int i = 0; i < 10; i++) + for (int j = 0; j < 10; j++) image0[i][j] = (uint8)(i + j); /* Get the first image in this file */ @@ -286,7 +284,7 @@ test_mgr_compress_b() if (memcmp(image, image0, 10 * 10) != 0) { MESSAGE(3, printf("Error reading data for gzip compressed image\n");); num_errs++; - } /* end if */ + } /* Close the image */ ret = GRendaccess(riid); @@ -309,16 +307,15 @@ test_mgr_compress_b() static int test_mgr_compress_c() { - intn status; /* status for functions returning an intn */ - int32 file_id, /* HDF file identifier */ - gr_id, /* GR interface identifier */ - ri_id, /* raster image identifier */ - start[2], /* start position to write for each dimension */ - edges[2], /* number of elements to be written along each dimension */ - dim_sizes[2], /* dimension sizes of the image array */ - interlace_mode, /* interlace mode of the image */ - data_type, /* data type of the image data */ - i, j; + int status; /* status for functions returning an int */ + int32 file_id; /* HDF file identifier */ + int32 gr_id; /* GR interface identifier */ + int32 ri_id; /* raster image identifier */ + int32 start[2]; /* start position to write for each dimension */ + int32 edges[2]; /* number of elements to be written along each dimension */ + int32 dim_sizes[2]; /* dimension sizes of the image array */ + int32 interlace_mode; /* interlace mode of the image */ + int32 data_type; /* data type of the image data */ uint8 image_buf[128][128][3]; uint8 read_buf[128][128][3]; comp_info c_info; @@ -351,11 +348,11 @@ test_mgr_compress_c() CHECK(status, FAIL, "GRsetcompress"); /* Fill the image data buffer with values */ - for (i = 0; i < 128; i++) - for (j = 0; j < 128; j++) { - image_buf[i][j][0] = (i + j) + 1; - image_buf[i][j][1] = (i + j) + 1; - image_buf[i][j][2] = (i + j) + 1; + for (uint8 i = 0; i < 128; i++) + for (uint8 j = 0; j < 128; j++) { + image_buf[i][j][0] = (uint8)(i + j + 1); + image_buf[i][j][1] = (uint8)(i + j + 1); + image_buf[i][j][2] = (uint8)(i + j + 1); } /* Write data in the buffer into the image array */ @@ -399,7 +396,7 @@ test_mgr_compress_c() if (fuzzy_memcmp(image_buf, read_buf, 128 * 128 * 3, JPEG_FUZZ) != 0) { MESSAGE(3, printf("tmgrcomp: Error reading data for 24-bit JPEG compressed image\n");); num_errs++; - } /* end if */ + } /* Terminate access to raster image and to GR */ /* interface and, close the HDF file. */ @@ -443,21 +440,20 @@ test_mgr_compress_c() #define DEFLATE_LEVEL 7 /* arbitrary */ #define SKPHUFF_SKIPSIZE 28 /* arbitrary */ -static intn -make_comp_image(int32 grid, char *img_name, comp_coder_t comp_type, /* Compression method */ - comp_info *cinfo, char *message) /* Compression parameters */ +static int +make_comp_image(int32 grid, const char *img_name, comp_coder_t comp_type, /* Compression method */ + comp_info *cinfo, char *message) /* Compression parameters */ { int32 riid; /* RI ID of the working image */ int32 dims[2] = {10, 10}; /* dimensions for the empty image */ uint8 image_data[10][10]; /* space for the image data */ int32 start[2]; /* start of image data to grab */ int32 stride[2]; /* stride of image data to grab */ - intn i, j; /* indices */ - intn ret_value; /* generic return value */ + int ret_value; /* generic return value */ /* Initialize data we are going to write out */ - for (i = 0; i < 10; i++) - for (j = 0; j < 10; j++) + for (int i = 0; i < 10; i++) + for (int j = 0; j < 10; j++) image_data[i][j] = (uint8)(i + j + 10); /* Create the image */ @@ -502,7 +498,7 @@ test_get_compress() comp_coder_t comp_type; /* Compression method */ comp_info cinfo; /* Compression parameters - union */ char err_func[80]; /* name of the functions where failure occurs */ - intn status; /* generic return value */ + int status; /* generic return value */ /* D - Retrieve compression information of compressed images */ MESSAGE(8, printf("Verify the compression information of compressed images\n");); @@ -689,7 +685,7 @@ test_mgr_chunk_compress() /************************* Variable declaration **************************/ - intn status; /* status for functions returning an intn */ + int status; /* status for functions returning an int */ int32 file_id, /* HDF file identifier */ gr_id, /* GR interface identifier */ ri_id[N_IMAGES], /* raster image identifier */ @@ -704,7 +700,7 @@ test_mgr_chunk_compress() comp_coder_t comp_type; int16 data_out[3 * Y_LENGTH * X_LENGTH]; - char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; + const char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; HDF_CHUNK_DEF chunk_def[N_IMAGES]; int16 chunk_buf[18]; @@ -879,7 +875,7 @@ test_mgr_chunk_compress() MESSAGE(3, printf("Error in reading chunk at line %d\n", __LINE__);); MESSAGE(3, printf("Image #%d\n", (int)img_num);); num_errs++; - } /* end if */ + } /* Read the whole image. */ start[0] = start[1] = 0; @@ -892,7 +888,7 @@ test_mgr_chunk_compress() MESSAGE(3, printf("%d: Error reading data for the whole image\n", __LINE__);); MESSAGE(3, printf("%d: Compression method\n", (int)img_num);); num_errs++; - } /* end if */ + } status = GRendaccess(ri_id[img_num]); CHECK(status, FAIL, "GRendaccess"); diff --git a/hdf/test/tszip.c b/hdf/test/tszip.c index 1caeeb5ff7..bc2a03f1ed 100644 --- a/hdf/test/tszip.c +++ b/hdf/test/tszip.c @@ -134,7 +134,7 @@ test_szip_RI8bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -347,7 +347,7 @@ test_szip_RI16bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -560,7 +560,7 @@ test_szip_RI32bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -773,7 +773,7 @@ test_szip_RIfl32bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -987,7 +987,7 @@ test_szip_RIfl64bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -1144,7 +1144,7 @@ test_szip_chunk() uint32 comp_config; comp_coder_t comp_type; int8 data_out[N_COMPS * LENGTH_CH * WIDTH_CH]; - char *image_name = "Image_chunked_sziped"; + const char *image_name = "Image_chunked_sziped"; HDF_CHUNK_DEF chunk_def; int8 chunk_buf[18]; @@ -1169,7 +1169,7 @@ test_szip_chunk() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for chunked and sziped data. */ diff --git a/hdf/util/he_file.c b/hdf/util/he_file.c index 2e734c5e3f..5bf8b55dc7 100644 --- a/hdf/util/he_file.c +++ b/hdf/util/he_file.c @@ -486,10 +486,10 @@ put(char *template, int verbose) int HEputR8(HE_CMD *cmd) { - int i; - int verbose = NO; - char *image = "img#.@.%"; - char *pal = "pal#"; + int i; + int verbose = NO; + const char *image = "img#.@.%"; + const char *pal = "pal#"; for (i = 1; i < cmd->argc; i++) if (cmd->argv[i][0] == '-') diff --git a/mfhdf/dumper/hdp_list.c b/mfhdf/dumper/hdp_list.c index b0a5e2f15c..6735b71e3b 100644 --- a/mfhdf/dumper/hdp_list.c +++ b/mfhdf/dumper/hdp_list.c @@ -202,16 +202,16 @@ print_list_header(list_info_t *list_opts) intn print_annots_by_object(const char *fname, int32 an_id, ann_type annot_type, uint16 tag, uint16 ref) { - intn i; - char *buf = NULL; - int32 ann_num; - int32 ann_length; - int32 ann_id = FAIL; - int32 *ann_list = NULL; - char *annot_type_text = "invalid"; /* "label" or "description" */ - char *func_name = "print_annots_by_object"; /* used to print error msg */ - char error_item[256]; /* holds tag, ref, and fname for error msg */ - intn ret_value = SUCCEED; + intn i; + char *buf = NULL; + int32 ann_num; + int32 ann_length; + int32 ann_id = FAIL; + int32 *ann_list = NULL; + const char *annot_type_text = "invalid"; /* "label" or "description" */ + const char *func_name = "print_annots_by_object"; /* used to print error msg */ + char error_item[256]; /* holds tag, ref, and fname for error msg */ + intn ret_value = SUCCEED; /* stores the current values tag, ref, and file name in error_item, just to simplify the error printing statement */ @@ -327,13 +327,13 @@ print_all_file_labels, and print_all_file_descs for the common code. */ intn print_annots_in_file(int32 an_id, const char *fname, int32 n_annotations, ann_type annot_type) { - intn i; - int32 len; - char *annotation = NULL; - char *func_name = "print_annots_in_file"; - int32 ann_id = FAIL; - char *annot_type_text = "invalid"; /* "label" or "description" */ - intn ret_value = SUCCEED; + intn i; + int32 len; + char *annotation = NULL; + const char *func_name = "print_annots_in_file"; + int32 ann_id = FAIL; + const char *annot_type_text = "invalid"; /* "label" or "description" */ + intn ret_value = SUCCEED; /* validate annotation type before processing */ if (annot_type == AN_DATA_LABEL) diff --git a/mfhdf/hdiff/hdiff_misc.c b/mfhdf/hdiff/hdiff_misc.c index c419872e4f..dd48d1ddf9 100644 --- a/mfhdf/hdiff/hdiff_misc.c +++ b/mfhdf/hdiff/hdiff_misc.c @@ -123,8 +123,8 @@ pr_att_vals(nc_type type, int len, void *vals) char *sp; unsigned char uc; char gps[30]; /* for ascii of a float or double precision */ - char *f_fmt = "%#.8g"; - char *d_fmt = "%#.16g"; + const char *f_fmt = "%#.8g"; + const char *d_fmt = "%#.16g"; switch (type) { case DFNT_INT8: diff --git a/mfhdf/hrepack/hrepack_gr.c b/mfhdf/hrepack/hrepack_gr.c index 321e729f8d..11579f2b48 100644 --- a/mfhdf/hrepack/hrepack_gr.c +++ b/mfhdf/hrepack/hrepack_gr.c @@ -82,10 +82,10 @@ copy_gr(int32 infile_id, int32 outfile_id, int32 gr_in, int32 gr_out, int32 tag, eltsz, /* element size */ nelms, /* number of elements */ data_size; - void *buf = NULL; - uint8 pal_data[256 * 3]; - int can_compress = 1; /* flag to tell if a compression is supported */ - char *pal_path = "palette"; + void *buf = NULL; + uint8 pal_data[256 * 3]; + int can_compress = 1; /* flag to tell if a compression is supported */ + const char *pal_path = "palette"; ri_index = GRreftoindex(gr_in, (uint16)ref); ri_id = GRselect(gr_in, ri_index); diff --git a/mfhdf/libsrc/mfsd.c b/mfhdf/libsrc/mfsd.c index efa7cc5be1..033abd0b5e 100644 --- a/mfhdf/libsrc/mfsd.c +++ b/mfhdf/libsrc/mfsd.c @@ -2959,9 +2959,8 @@ SDgetdimstrs(int32 id, /* IN: dataset ID */ NC_dim *dim = NULL; NC_attr **attr = NULL; char *name = NULL; - int32 ii; int32 namelen; - intn ret_value = SUCCEED; + int ret_value = SUCCEED; /* clear error stack */ HEclear(); @@ -2990,10 +2989,10 @@ SDgetdimstrs(int32 id, /* IN: dataset ID */ name = dim->name->values; namelen = strlen(name); dp = (NC_var **)handle->vars->values; - for (ii = 0; ii < handle->vars->count; ii++, dp++) { + for (int i = 0; i < handle->vars->count; i++, dp++) { /* eliminate vars with rank > 1, coord vars only have rank 1 */ - if ((*dp)->assoc->count == 1) - if (namelen == (*dp)->name->len && strncmp(name, (*dp)->name->values, strlen(name)) == 0) + if ((*dp)->assoc->count == 1) { + if (namelen == (*dp)->name->len && strncmp(name, (*dp)->name->values, strlen(name)) == 0) { /* because a dim was given, make sure that this is a coord var */ /* if it is an SDS, the function will fail */ if ((*dp)->var_type == IS_SDSVAR) { @@ -3008,6 +3007,8 @@ SDgetdimstrs(int32 id, /* IN: dataset ID */ { var = (*dp); } + } + } } } @@ -3555,14 +3556,13 @@ SDsetnbitdataset(int32 id, /* IN: dataset ID */ intn SDsetup_szip_parms(int32 id, NC *handle, comp_info *c_info, int32 *cdims) { - NC_dim *dim; /* to check if the dimension is unlimited */ - int32 dimindex; /* to obtain the NC_dim record */ + NC_dim *dim = NULL; /* to check if the dimension is unlimited */ + int32 dimindex; /* to obtain the NC_dim record */ NC_var *var = NULL; int32 ndims; - int i; int32 xdims[H4_MAX_VAR_DIMS]; int32 nt; - intn ret_value = SUCCEED; + int ret_value = SUCCEED; /* clear error stack */ HEclear(); @@ -3577,9 +3577,11 @@ SDsetup_szip_parms(int32 id, NC *handle, comp_info *c_info, int32 *cdims) } ndims = var->assoc->count; - for (i = 0; i < ndims; i++) { + for (int i = 0; i < ndims; i++) { dimindex = var->assoc->values[i]; dim = SDIget_dim(handle, dimindex); + if (dim == NULL) + HGOTO_ERROR(DFE_ARGS, FAIL); xdims[i] = dim->size; } @@ -3588,7 +3590,7 @@ SDsetup_szip_parms(int32 id, NC *handle, comp_info *c_info, int32 *cdims) ret_value = HCPsetup_szip_parms(c_info, nt, 1, ndims, xdims, cdims); done: - return (ret_value); + return ret_value; } #endif /****************************************************************************** diff --git a/mfhdf/libsrc/putget.c b/mfhdf/libsrc/putget.c index d2db533d65..992bddbccd 100644 --- a/mfhdf/libsrc/putget.c +++ b/mfhdf/libsrc/putget.c @@ -1824,7 +1824,7 @@ NC_fill_buffer(NC *handle, int varid, const long *edges, void *values) /* Find user-defined fill-value and fill the buffer with it */ attr = NC_findattr(&vp->attrs, _FillValue); - if (attr != NULL) + if (attr != NULL) { if (HDmemfill(values, (*attr)->data->values, vp->szof, buf_size) == NULL) { return -1; } @@ -1832,6 +1832,8 @@ NC_fill_buffer(NC *handle, int varid, const long *edges, void *values) else { NC_arrayfill(values, buf_size * vp->szof, vp->type); } + } + return 0; } diff --git a/mfhdf/ncdump/vardata.c b/mfhdf/ncdump/vardata.c index c620a00408..6bb157be4d 100644 --- a/mfhdf/ncdump/vardata.c +++ b/mfhdf/ncdump/vardata.c @@ -262,6 +262,10 @@ annotate(struct ncvar *vp, struct fspec *fsp, long cor[], long iel) printf(",%d", (int)(1 + cor[id])); } break; + case LANG_NONE: + default: + /* Might want to make this an error */ + break; } printf(")\n "); } @@ -565,6 +569,10 @@ vardata(struct ncvar *vp, long vdims[], int ncid, int varid, struct fspec *fsp) printf(",%d", (int)(1 + cor[id])); } break; + case LANG_NONE: + default: + /* Might want to make this an error */ + break; } printf(")\n "); set_indent(4); diff --git a/mfhdf/test/tncunlim.c b/mfhdf/test/tncunlim.c index 206f661dbc..627cf225d7 100644 --- a/mfhdf/test/tncunlim.c +++ b/mfhdf/test/tncunlim.c @@ -141,7 +141,7 @@ test_1dim_singlevar() long start[] = {0}; long edges[1]; edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -174,7 +174,7 @@ test_1dim_singlevar() long start[] = {0}; long edges[1]; edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -404,7 +404,7 @@ test_1dim_multivars() long start[] = {0}; long edges[1]; edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); /* Read and verify data of Variable 1 */ status = ncvarget(ncid, varid1, start, edges, outdata); @@ -421,7 +421,7 @@ test_1dim_multivars() /* Read and verify data of Variable 2 */ edges[0] = 2; /* only reading what written to this variable so far */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -437,7 +437,7 @@ test_1dim_multivars() /* Try to read again but up to the max number of records, 4 in this case because the other variable in the file has 4 elements written */ edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -482,7 +482,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1 */ /* read data should be: 300 301 302 303 400 401 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid1, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -497,7 +497,7 @@ test_1dim_multivars() /* Read and verify data of Variable 2 */ /* read data should be: 102 104 -2 -2 -2 -2 */ edges[0] = 2; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -534,7 +534,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1 */ /* read data should be: 300 301 302 303 400 401 -1 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid1, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -548,7 +548,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1 */ /* read data should be: 102 104 -2 -2 200 201 202 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -588,7 +588,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1; read data should be: */ /* 300 301 302 303 400 401 -1 -1 -1 -1 -1 -1 500 501 502 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid1, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -602,7 +602,7 @@ test_1dim_multivars() /* Read and verify data of Variable 2; read data should be: */ /* 102 104 -2 -2 200 201 202 -2 -2 -2 -2 -2 -2 -2 -2 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -615,7 +615,7 @@ test_1dim_multivars() } } /* end read data */ -#if NOTRUN +#if 0 /* The following test is to verify that attempting to read pass the maximum number of records in the file will fail. However, because ncvarget leads to the internal function NCcoordck which uses NCadvise to display the