summaryrefslogtreecommitdiffstats
path: root/c++/examples
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2023-06-19 05:13:38 (GMT)
committerGitHub <noreply@github.com>2023-06-19 05:13:38 (GMT)
commit65d8c9347010771473b53c91adcec2f281772213 (patch)
tree487567dae0dc005de896f616b90e67744239a5e2 /c++/examples
parent1f20354ee6cdfa9fd157ac9cdfff9acdf320a32d (diff)
downloadhdf5-65d8c9347010771473b53c91adcec2f281772213.zip
hdf5-65d8c9347010771473b53c91adcec2f281772213.tar.gz
hdf5-65d8c9347010771473b53c91adcec2f281772213.tar.bz2
Many fixes to various compiler warnings (#3124)
* Fixed various -Wmissing-variable-declarations by adding static keyword * In a few cases, renamed the variable suffix from _g to _s. * Fixed some -Wmissing-variable-declarations by using different declaration macros * Fixed various -Wconditional-uninitialized warnings by just initializing variable to zero * Fixed various -Wcomma warnings * Fixed clang -Wstrict-prototypes warnings * Fixed various -Wunused-variable warnings * Updated some casts to fix the only 3 -Wcast-qual warnings * Fixed the only -Wsometimes-uninitialized warning
Diffstat (limited to 'c++/examples')
-rw-r--r--c++/examples/h5tutr_extend.cpp13
-rw-r--r--c++/examples/readdata.cpp4
2 files changed, 9 insertions, 8 deletions
diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp
index ff5ddab..3916f9a 100644
--- a/c++/examples/h5tutr_extend.cpp
+++ b/c++/examples/h5tutr_extend.cpp
@@ -99,7 +99,7 @@ main(void)
// ---------------------------------------
int rdata[10][3];
- int i, j, rank, rank_chunk;
+ int i, j, rank;
hsize_t chunk_dimsr[2], dimsr[2];
// Open the file and dataset.
@@ -111,12 +111,13 @@ main(void)
prop = dataset->getCreatePlist();
// Get information to obtain memory dataspace.
- rank = filespace->getSimpleExtentNdims();
- herr_t status_n = filespace->getSimpleExtentDims(dimsr);
+ rank = filespace->getSimpleExtentNdims();
+ (void)filespace->getSimpleExtentDims(dimsr);
- if (H5D_CHUNKED == prop.getLayout())
- rank_chunk = prop.getChunk(rank, chunk_dimsr);
- cout << "rank chunk = " << rank_chunk << endl;
+ if (H5D_CHUNKED == prop.getLayout()) {
+ int rank_chunk = prop.getChunk(rank, chunk_dimsr);
+ cout << "rank chunk = " << rank_chunk << endl;
+ }
memspace = new DataSpace(rank, dimsr, NULL);
dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace);
diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp
index 1deed36..bfc03ee 100644
--- a/c++/examples/readdata.cpp
+++ b/c++/examples/readdata.cpp
@@ -84,7 +84,7 @@ main(void)
* Get order of datatype and print message if it's a little endian.
*/
H5std_string order_string;
- H5T_order_t order = intype.getOrder(order_string);
+ (void)intype.getOrder(order_string);
cout << order_string << endl;
/*
@@ -109,7 +109,7 @@ main(void)
* display them.
*/
hsize_t dims_out[2];
- int ndims = dataspace.getSimpleExtentDims(dims_out, NULL);
+ (void)dataspace.getSimpleExtentDims(dims_out, NULL);
cout << "rank " << rank << ", dimensions " << (unsigned long)(dims_out[0]) << " x "
<< (unsigned long)(dims_out[1]) << endl;