summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST48
-rw-r--r--hl/c++/src/H5PacketTable.cpp4
-rw-r--r--hl/c++/src/H5PacketTable.h4
-rw-r--r--hl/fortran/src/H5IMcc.c3
-rwxr-xr-xhl/fortran/src/H5IMfc.c6
-rwxr-xr-xhl/fortran/src/H5TBfc.c8
-rw-r--r--hl/src/H5DS.c82
-rw-r--r--hl/src/H5DSprivate.h19
-rw-r--r--hl/src/H5DSpublic.h4
-rw-r--r--hl/src/H5HLprivate2.h64
-rw-r--r--hl/src/H5IMprivate.h13
-rw-r--r--hl/src/H5LT.c35
-rw-r--r--hl/src/H5LTparse.y13
-rw-r--r--hl/src/H5LTprivate.h25
-rw-r--r--hl/src/H5LTpublic.h10
-rw-r--r--hl/src/H5PT.c15
-rw-r--r--hl/src/H5PTprivate.h5
-rw-r--r--hl/src/H5PTpublic.h14
-rw-r--r--hl/src/H5TB.c31
-rw-r--r--hl/src/H5TBprivate.h8
-rw-r--r--hl/test/h5hltest.h41
-rw-r--r--hl/test/pal_rgb.h6
-rw-r--r--hl/test/test_ds.c107
-rw-r--r--hl/test/test_image.c18
-rw-r--r--hl/test/test_lite.c32
-rw-r--r--hl/test/test_packet.c101
-rw-r--r--hl/test/test_table.c8
-rw-r--r--hl/tools/gif2h5/gif.h2
-rw-r--r--hl/tools/gif2h5/gif2hdf.c8
-rw-r--r--hl/tools/gif2h5/gifread.c2
-rw-r--r--hl/tools/gif2h5/hdf2gif.c10
-rw-r--r--hl/tools/gif2h5/hdfgifwr.c2
-rw-r--r--hl/tools/gif2h5/writehdf.c12
33 files changed, 405 insertions, 355 deletions
diff --git a/MANIFEST b/MANIFEST
index 924e7fd..c65e647 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1254,14 +1254,12 @@
# high level libraries
./hl/Makefile.am
./hl/Makefile.in
-./hl/examples/ex_lite1.c
-./hl/examples/ex_lite2.c
-./hl/examples/ex_lite3.c
./hl/examples/Makefile.am
./hl/examples/Makefile.in
-./hl/examples/ptExampleFL.c
-./hl/examples/ptExampleVL.c
./hl/examples/ex_ds1.c
+./hl/examples/ex_lite1.c
+./hl/examples/ex_lite2.c
+./hl/examples/ex_lite3.c
./hl/examples/ex_image1.c
./hl/examples/ex_image2.c
./hl/examples/ex_table_01.c
@@ -1279,49 +1277,53 @@
./hl/examples/image24pixel.txt
./hl/examples/image8.txt
./hl/examples/pal_rgb.h
+./hl/examples/ptExampleFL.c
+./hl/examples/ptExampleVL.c
./hl/src/Makefile.am
./hl/src/Makefile.in
+./hl/src/H5DS.c
+./hl/src/H5DSprivate.h
+./hl/src/H5DSpublic.h
+./hl/src/H5HLprivate2.h
./hl/src/H5IM.c
+./hl/src/H5IMprivate.h
+./hl/src/H5IMpublic.h
./hl/src/H5LT.c
-./hl/src/H5TB.c
-./hl/src/H5DS.c
-./hl/src/H5PT.c
./hl/src/H5LTanalyze.l
./hl/src/H5LTanalyze.c
./hl/src/H5LTparse.y
./hl/src/H5LTparse.c
./hl/src/H5LTparse.h
-./hl/src/H5DSprivate.h
-./hl/src/H5DSpublic.h
-./hl/src/H5IMprivate.h
-./hl/src/H5IMpublic.h
./hl/src/H5LTprivate.h
./hl/src/H5LTpublic.h
+./hl/src/H5PT.c
./hl/src/H5PTprivate.h
./hl/src/H5PTpublic.h
+./hl/src/H5TB.c
./hl/src/H5TBprivate.h
./hl/src/H5TBpublic.h
./hl/src/hdf5_hl.h
./hl/test/Makefile.am
./hl/test/Makefile.in
+./hl/test/dsdata.txt
+./hl/test/dslat.txt
+./hl/test/dslon.txt
+./hl/test/earth.pal
+./hl/test/h5hltest.h
+./hl/test/image8.txt
+./hl/test/image24pixel.txt
+./hl/test/image24plane.txt
+./hl/test/pal_rgb.h
+./hl/test/sepia.pal
+./hl/test/test_ds.c
./hl/test/test_image.c
./hl/test/test_lite.c
-./hl/test/test_table.c
./hl/test/test_packet.c
-./hl/test/test_ds.c
-./hl/test/pal_rgb.h
+./hl/test/test_table.c
./hl/test/test_table_le.hdf5
./hl/test/test_table_be.hdf5
./hl/test/test_table_cray.hdf5
-./hl/test/image8.txt
-./hl/test/image24pixel.txt
-./hl/test/image24plane.txt
./hl/test/usa.wri
-./hl/test/dsdata.txt
-./hl/test/dslat.txt
-./hl/test/dslon.txt
-./hl/test/sepia.pal
-./hl/test/earth.pal
./hl/tools/Makefile.am
./hl/tools/Makefile.in
./hl/tools/gif2h5/Makefile.am
diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp
index 59730e0..0cfdb59 100644
--- a/hl/c++/src/H5PacketTable.cpp
+++ b/hl/c++/src/H5PacketTable.cpp
@@ -120,7 +120,7 @@
if( H5PTis_varlen(table_id) != 0 ) // If this is not a fixed-length table
{
H5PTclose(table_id);
- table_id = NULL;
+ table_id = -1;
}
}
@@ -216,7 +216,7 @@
if( H5PTis_varlen(table_id) != 1 ) // If this is not a variable-length table
{
H5PTclose(table_id);
- table_id = NULL;
+ table_id = -1;
}
}
diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h
index 71c9de5..bd3d166 100644
--- a/hl/c++/src/H5PacketTable.h
+++ b/hl/c++/src/H5PacketTable.h
@@ -23,7 +23,11 @@
#ifndef H5PTWRAP_H
#define H5PTWRAP_H
+/* High-level library internal header file */
+#include "H5HLprivate2.h"
+
#include "H5PTpublic.h"
+#include "H5api_adpt.h"
class H5_HLCPPDLL PacketTable
{
diff --git a/hl/fortran/src/H5IMcc.c b/hl/fortran/src/H5IMcc.c
index 19a99ba..b2e487c 100644
--- a/hl/fortran/src/H5IMcc.c
+++ b/hl/fortran/src/H5IMcc.c
@@ -12,10 +12,7 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "H5IMprivate.h"
#include "H5IMcc.h"
-#include "H5f90i_gen.h"
-
#include <string.h>
#include <stdlib.h>
diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c
index 0062d60..a680e17 100755
--- a/hl/fortran/src/H5IMfc.c
+++ b/hl/fortran/src/H5IMfc.c
@@ -14,10 +14,8 @@
/* This files contains C stubs for H5D Fortran APIs */
-#include "H5IMprivate.h"
#include "H5IMcc.h"
#include "H5LTf90proto.h"
-#include "../../../fortran/src/H5f90i_gen.h"
/*-------------------------------------------------------------------------
@@ -64,7 +62,7 @@ nh5immake_image_8bit_c (hid_t_f *loc_id,
* Call H5IMmake_image_8bitf function.
*/
c_loc_id = (hid_t)*loc_id;
- ret = H5IMmake_image_8bitf(c_loc_id,c_name,*width,*height,buf);
+ ret = H5IMmake_image_8bitf(c_loc_id,c_name,(hsize_t)*width,(hsize_t)*height,buf);
if (ret < 0) return ret_value;
ret_value = 0;
@@ -175,7 +173,7 @@ nh5immake_image_24bit_c (hid_t_f *loc_id,
*/
c_loc_id = (hid_t)*loc_id;
- ret = H5IMmake_image_24bitf(c_loc_id,c_name,*width,*height,c_il,buf);
+ ret = H5IMmake_image_24bitf(c_loc_id,c_name,(hsize_t)*width,(hsize_t)*height,c_il,buf);
if (ret < 0) return ret_value;
ret_value = 0;
diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c
index 2bce973..656a393 100755
--- a/hl/fortran/src/H5TBfc.c
+++ b/hl/fortran/src/H5TBfc.c
@@ -58,7 +58,7 @@ nh5tbmake_table_c(int_f *namelen1,
char *c_name1;
int c_namelen1;
hsize_t num_elem;
- int i;
+ hsize_t i;
int max_len=1;
hid_t c_loc_id = *loc_id;
hsize_t c_nfields = *nfields;
@@ -340,7 +340,7 @@ nh5tbwrite_field_index_c(hid_t_f *loc_id,
* Call H5TBwrite_fields_name function.
*/
- ret = H5TBwrite_fields_index(c_loc_id,c_name,1,c_field_index,c_start,c_nrecords,c_type_size,
+ ret = H5TBwrite_fields_index(c_loc_id,c_name,(hsize_t)1,c_field_index,c_start,c_nrecords,c_type_size,
0,c_type_sizes,buf);
if (ret < 0) return ret_value;
@@ -404,7 +404,7 @@ nh5tbread_field_index_c(hid_t_f *loc_id,
* Call H5TBread_fields_index function.
*/
- ret = H5TBread_fields_index(c_loc_id,c_name,1,c_field_index,c_start,c_nrecords,c_type_size,
+ ret = H5TBread_fields_index(c_loc_id,c_name,(hsize_t)1,c_field_index,c_start,c_nrecords,c_type_size,
0,c_type_sizes,buf);
if (ret < 0) return ret_value;
@@ -625,7 +625,7 @@ nh5tbget_field_info_c(hid_t_f *loc_id,
char *c_name;
int c_namelen;
hsize_t num_elem;
- int i;
+ hsize_t i;
int max_len=1;
hid_t c_loc_id = *loc_id;
hsize_t c_nfields = *nfields;
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index c3e1dc3..254f7df 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -12,7 +12,9 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <assert.h>
#include <stdlib.h>
+#include <string.h>
#include "H5DSprivate.h"
#include "H5LTprivate.h"
#include "H5IMprivate.h"
@@ -43,7 +45,7 @@
*/
herr_t H5DSset_scale(hid_t dsid,
- char *dimname)
+ const char *dimname)
{
int has_dimlist;
H5I_type_t it;
@@ -125,8 +127,8 @@ herr_t H5DSattach_scale(hid_t did,
int is_ds;
hssize_t nelmts;
hid_t sid; /* space ID */
- hid_t tid; /* attribute type ID */
- hid_t aid; /* attribute ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
hsize_t *dims; /* dimension of the "REFERENCE_LIST" array */
ds_list_t dsl; /* attribute data in the DS pointing to the dataset */
@@ -157,7 +159,7 @@ herr_t H5DSattach_scale(hid_t did,
return FAIL;
/* same object, not valid */
- if (!HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
+ if (!memcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !memcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
return FAIL;
/* get ID type */
@@ -334,7 +336,7 @@ herr_t H5DSattach_scale(hid_t did,
goto out;
/* same object, so this DS scale is already in this DIM IDX */
- if (!HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
+ if (!memcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !memcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
{
found_ds = 1;
}
@@ -590,8 +592,8 @@ herr_t H5DSdetach_scale(hid_t did,
hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */
hid_t did_i; /* dataset ID in REFERENCE_LIST */
hid_t sid; /* space ID */
- hid_t tid; /* attribute type ID */
- hid_t aid; /* attribute ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
ds_list_t *dsbuf=NULL; /* array of attribute data in the DS pointing to the dataset */
ds_list_t *dsbufn=NULL; /* array of attribute data in the DS pointing to the dataset */
@@ -620,7 +622,7 @@ herr_t H5DSdetach_scale(hid_t did,
return FAIL;
/* same object, not valid */
- if (!HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
+ if (!memcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !memcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
return FAIL;
/* get ID type */
@@ -714,7 +716,7 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* same object, reset */
- if (!HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
+ if (!memcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !memcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
{
for(jj=j; jj<buf[idx].len-1; jj++)
{
@@ -799,7 +801,7 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* same object, reset. we want to detach only for this DIM */
- if (!HDmemcmp(&sb3.fileno, &sb4.fileno, sizeof(sb3.fileno)) && !HDmemcmp(&sb3.objno, &sb4.objno, sizeof(sb3.objno))
+ if (!memcmp(&sb3.fileno, &sb4.fileno, sizeof(sb3.fileno)) && !memcmp(&sb3.objno, &sb4.objno, sizeof(sb3.objno))
&& (int)idx==dsbuf[i].dim_idx)
{
for(jj=i; jj<nelmts-1; jj++)
@@ -955,8 +957,8 @@ htri_t H5DSis_attached(hid_t did,
int has_reflist;
hssize_t nelmts;
hid_t sid; /* space ID */
- hid_t tid; /* attribute type ID */
- hid_t aid; /* attribute ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
ds_list_t *dsbuf; /* array of attribute data in the DS pointing to the dataset */
hobj_ref_t ref; /* reference to the DS */
@@ -985,7 +987,7 @@ htri_t H5DSis_attached(hid_t did,
return FAIL;
/* same object, not valid */
- if (!HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
+ if (!memcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !memcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
return FAIL;
/* get ID type */
@@ -1067,7 +1069,7 @@ htri_t H5DSis_attached(hid_t did,
goto out;
/* same object */
- if (!HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
+ if (!memcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !memcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)))
{
found_ds = 1;
}
@@ -1155,7 +1157,7 @@ htri_t H5DSis_attached(hid_t did,
goto out;
/* same object */
- if (!HDmemcmp(&sb3.fileno, &sb4.fileno, sizeof(sb3.fileno)) && !HDmemcmp(&sb3.objno, &sb4.objno, sizeof(sb3.objno))
+ if (!memcmp(&sb3.fileno, &sb4.fileno, sizeof(sb3.fileno)) && !memcmp(&sb3.objno, &sb4.objno, sizeof(sb3.objno))
&& (int)idx==dsbuf[i].dim_idx) {
found_dset=1;
} /* if */
@@ -1246,8 +1248,8 @@ herr_t H5DSiterate_scales(hid_t did,
int rank;
hobj_ref_t ref; /* reference to the DS */
hid_t sid; /* space ID */
- hid_t tid; /* attribute type ID */
- hid_t aid; /* attribute ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
hvl_t *buf=NULL; /* VL buffer to store in the attribute */
H5I_type_t it; /* ID type */
herr_t ret_value=0;
@@ -1401,15 +1403,15 @@ out:
herr_t H5DSset_label(hid_t did,
unsigned int idx,
- char *label)
+ const char *label)
{
int has_labels;
hid_t sid; /* space ID */
- hid_t tid; /* attribute type ID */
- hid_t aid; /* attribute ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
hsize_t dims[1]; /* dimensions of dataset */
- char **buf=NULL; /* buffer to store in the attribute */
+ const char **buf=NULL; /* buffer to store in the attribute */
H5I_type_t it; /* ID type */
unsigned int i;
@@ -1469,7 +1471,7 @@ herr_t H5DSset_label(hid_t did,
goto out;
/* allocate and initialize */
- buf = (char **)malloc((size_t)rank * sizeof(char *));
+ buf = (const char **)malloc((size_t)rank * sizeof(char *));
if (buf == NULL)
goto out;
@@ -1509,7 +1511,7 @@ herr_t H5DSset_label(hid_t did,
goto out;
/* allocate and initialize */
- buf = (char **)malloc((size_t)rank * sizeof(char *));
+ buf = (const char **)malloc((size_t)rank * sizeof(char *));
if (buf == NULL)
goto out;
@@ -1574,8 +1576,8 @@ ssize_t H5DSget_label(hid_t did,
{
int has_labels;
hid_t sid; /* space ID */
- hid_t tid; /* attribute type ID */
- hid_t aid; /* attribute ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
char **buf=NULL; /* buffer to store in the attribute */
H5I_type_t it; /* ID type */
@@ -1627,8 +1629,7 @@ ssize_t H5DSget_label(hid_t did,
*-------------------------------------------------------------------------
*/
- if (has_labels == 1)
- {
+ assert (has_labels == 1);
if ((aid = H5Aopen_name(did,DIMENSION_LABELS))<0)
goto out;
@@ -1646,18 +1647,17 @@ ssize_t H5DSget_label(hid_t did,
goto out;
/* get the real string length */
- nbytes = HDstrlen(buf[idx]);
+ nbytes = strlen(buf[idx]);
/* compute the string length which will fit into the user's buffer */
copy_len = MIN(size-1, nbytes);
/* copy all/some of the name */
if( label ) {
- HDmemcpy(label, buf[idx], copy_len);
+ memcpy(label, buf[idx], copy_len);
/* terminate the string */
label[copy_len]='\0';
- }
/* close */
if (H5Tclose(tid)<0)
@@ -1707,7 +1707,7 @@ ssize_t H5DSget_scale_name(hid_t did,
size_t size)
{
hid_t aid; /* attribute ID */
- hid_t tid; /* attribute type ID */
+ hid_t tid = -1; /* attribute type ID */
hid_t sid; /* space ID */
H5I_type_t it; /* ID type */
size_t nbytes;
@@ -1775,7 +1775,7 @@ ssize_t H5DSget_scale_name(hid_t did,
/* copy all/some of the name */
if (name) {
- HDmemcpy(name, buf, copy_len);
+ memcpy(name, buf, copy_len);
/* terminate the string */
name[copy_len]='\0';
@@ -1828,7 +1828,7 @@ out:
htri_t H5DSis_scale(hid_t did)
{
- hid_t tid; /* attribute type ID */
+ hid_t tid = -1; /* attribute type ID */
hid_t aid; /* attribute ID */
herr_t has_class; /* has the "CLASS" attribute */
htri_t is_ds; /* boolean return value */
@@ -1853,7 +1853,7 @@ htri_t H5DSis_scale(hid_t did)
if (has_class == 0)
is_ds = 0;
- else if (has_class == 1 )
+ else
{
if ((aid = H5Aopen_name(did,"CLASS"))<0)
goto out;
@@ -1913,8 +1913,8 @@ int H5DSget_num_scales(hid_t did,
{
int has_dimlist;
hid_t sid; /* space ID */
- hid_t tid; /* attribute type ID */
- hid_t aid; /* attribute ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
hvl_t *buf; /* VL buffer to store in the attribute */
H5I_type_t it; /* ID type */
@@ -1964,7 +1964,7 @@ int H5DSget_num_scales(hid_t did,
*-------------------------------------------------------------------------
*/
- else if ( has_dimlist == 1 )
+ else
{
if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0)
goto out;
@@ -2032,8 +2032,8 @@ out:
herr_t H5DS_is_reserved(hid_t did)
{
int has_class;
- hid_t tid;
- hid_t aid;
+ hid_t tid = -1;
+ hid_t aid = -1;
char buf[40];
herr_t ret;
@@ -2044,8 +2044,7 @@ herr_t H5DS_is_reserved(hid_t did)
if ( has_class == 0 )
return 0;
- else if ( has_class == 1 )
- {
+ assert( has_class == 1 );
if ((aid = H5Aopen_name(did,"CLASS"))<0)
goto out;
@@ -2068,7 +2067,6 @@ herr_t H5DS_is_reserved(hid_t did)
if (H5Aclose(aid)<0)
goto out;
- }
return ret;
diff --git a/hl/src/H5DSprivate.h b/hl/src/H5DSprivate.h
index 1d922be..7356bcd 100644
--- a/hl/src/H5DSprivate.h
+++ b/hl/src/H5DSprivate.h
@@ -15,19 +15,10 @@
#ifndef _H5DSprivate_H
#define _H5DSprivate_H
-/* public hdf5 prototypes */
-#include "H5Ipublic.h"
-#include "H5Tpublic.h"
-#include "H5Spublic.h"
-#include "H5Dpublic.h"
-#include "H5Ppublic.h"
-#include "H5Gpublic.h"
-#include "H5Apublic.h"
-#include "H5Epublic.h"
-#include "H5Rpublic.h"
-
+/* High-level library internal header file */
+#include "H5HLprivate2.h"
+
/* public LT prototypes */
-#include "H5LTpublic.h"
#include "H5DSpublic.h"
@@ -50,9 +41,7 @@ typedef struct ds_list_t {
*-------------------------------------------------------------------------
*/
-
H5_HLDLL herr_t H5DS_is_reserved( hid_t did);
-
-
#endif
+
diff --git a/hl/src/H5DSpublic.h b/hl/src/H5DSpublic.h
index cfec471..7d2afff 100644
--- a/hl/src/H5DSpublic.h
+++ b/hl/src/H5DSpublic.h
@@ -31,14 +31,14 @@ H5_HLDLL herr_t H5DSdetach_scale( hid_t did,
unsigned int idx);
H5_HLDLL herr_t H5DSset_scale( hid_t dsid,
- char *dimname);
+ const char *dimname);
H5_HLDLL int H5DSget_num_scales( hid_t did,
unsigned int dim);
H5_HLDLL herr_t H5DSset_label( hid_t did,
unsigned int idx,
- char *label);
+ const char *label);
H5_HLDLL ssize_t H5DSget_label( hid_t did,
unsigned int idx,
diff --git a/hl/src/H5HLprivate2.h b/hl/src/H5HLprivate2.h
new file mode 100644
index 0000000..534c7f9
--- /dev/null
+++ b/hl/src/H5HLprivate2.h
@@ -0,0 +1,64 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _H5HLprivate2_H
+#define _H5HLprivate2_H
+
+/* Public HDF5 header */
+#include "hdf5.h"
+
+/* Public High-Level header */
+#include "hdf5_hl.h"
+
+/* The following is copied from src/H5private.h */
+
+/*
+ * Status return values for the `herr_t' type.
+ * Since some unix/c routines use 0 and -1 (or more precisely, non-negative
+ * vs. negative) as their return code, and some assumption had been made in
+ * the code about that, it is important to keep these constants the same
+ * values. When checking the success or failure of an integer-valued
+ * function, remember to compare against zero and not one of these two
+ * values.
+ */
+#define SUCCEED 0
+#define FAIL (-1)
+#define UFAIL (unsigned)(-1)
+
+/* minimum of two, three, or four values */
+#undef MIN
+#define MIN(a,b) (((a)<(b)) ? (a) : (b))
+#define MIN2(a,b) MIN(a,b)
+#define MIN3(a,b,c) MIN(a,MIN(b,c))
+#define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d))
+
+/* maximum of two, three, or four values */
+#undef MAX
+#define MAX(a,b) (((a)>(b)) ? (a) : (b))
+#define MAX2(a,b) MAX(a,b)
+#define MAX3(a,b,c) MAX(a,MAX(b,c))
+#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
+
+/*
+ * HDF Boolean type.
+ */
+#ifndef FALSE
+# define FALSE 0
+#endif
+#ifndef TRUE
+# define TRUE 1
+#endif
+
+#endif /* _H5HLprivate2_H */
+
diff --git a/hl/src/H5IMprivate.h b/hl/src/H5IMprivate.h
index bca5a84..86093ca 100644
--- a/hl/src/H5IMprivate.h
+++ b/hl/src/H5IMprivate.h
@@ -15,14 +15,10 @@
#ifndef _H5IMprivate_H
#define _H5IMprivate_H
-/* public hdf5 prototypes */
-#include "H5Rpublic.h"
-#include "H5Apublic.h"
-#include "H5Spublic.h"
-#include "H5Dpublic.h"
-
-/* public LT prototypes */
-#include "H5LTpublic.h"
+/* High-level library internal header file */
+#include "H5HLprivate2.h"
+
+/* public IM prototypes */
#include "H5IMpublic.h"
@@ -41,3 +37,4 @@ H5_HLDLL herr_t H5IM_find_palette(hid_t loc_id );
#endif
+
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 5d281a7..c779ef0 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -12,11 +12,11 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "H5LTprivate.h"
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
+#include "H5LTprivate.h"
/* For Lex and Yacc */
@@ -2120,15 +2120,15 @@ print_enum(hid_t type, char* str, int indt)
value = (unsigned char*)calloc((size_t)nmembs, MAX(dst_size, super_size));
for (i = 0; i < nmembs; i++) {
- if((name[i] = H5Tget_member_name(type, i))==NULL)
+ if((name[i] = H5Tget_member_name(type, (unsigned)i))==NULL)
goto out;
- if(H5Tget_member_value(type, i, value + i * super_size)<0)
+ if(H5Tget_member_value(type, (unsigned)i, value + i * super_size)<0)
goto out;
}
/* Convert values to native data type */
if (native > 0) {
- if(H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT)<0)
+ if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT)<0)
goto out;
}
@@ -2202,7 +2202,7 @@ herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *
{
size_t str_len = INCREMENT;
char *text_str;
- herr_t ret;
+ herr_t ret = -1;
if(lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG)
goto out;
@@ -2502,7 +2502,7 @@ next:
indent += COL;
indentation(indent + COL, *dt_str);
- sprintf(tmp_str, "OPQ_SIZE %d;\n", H5Tget_size(dtype));
+ sprintf(tmp_str, "OPQ_SIZE %lu;\n", (unsigned long)H5Tget_size(dtype));
strcat(*dt_str, tmp_str);
indentation(indent + COL, *dt_str);
@@ -2640,11 +2640,11 @@ next:
indent += COL;
for (i = 0; i < nmembs; i++) {
- if((mname = H5Tget_member_name(dtype, i))==NULL)
+ if((mname = H5Tget_member_name(dtype, (unsigned)i))==NULL)
goto out;
- if((mtype = H5Tget_member_type(dtype, i))<0)
+ if((mtype = H5Tget_member_type(dtype, (unsigned)i))<0)
goto out;
- moffset = H5Tget_member_offset(dtype, i);
+ moffset = H5Tget_member_offset(dtype, (unsigned)i);
indentation(indent + COL, *dt_str);
if((mclass = H5Tget_class(mtype))<0)
@@ -2667,7 +2667,7 @@ next:
strcat(*dt_str, tmp_str);
free(mname);
- sprintf(tmp_str, " : %d;\n", moffset);
+ sprintf(tmp_str, " : %lu;\n", (unsigned long)moffset);
strcat(*dt_str, tmp_str);
}
@@ -3509,10 +3509,7 @@ out:
return -1;
}
-
-
-
-
+
/*-------------------------------------------------------------------------
* Function: H5LT_set_attribute_string
*
@@ -3530,15 +3527,13 @@ out:
*
*-------------------------------------------------------------------------
*/
-
-
herr_t H5LT_set_attribute_string(hid_t dset_id,
- char *name,
- char *buf )
+ const char *name,
+ const char *buf )
{
hid_t tid;
- hid_t sid;
- hid_t aid;
+ hid_t sid = -1;
+ hid_t aid = -1;
int has_attr;
size_t size;
diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y
index f5da780..50e8f6d 100644
--- a/hl/src/H5LTparse.y
+++ b/hl/src/H5LTparse.y
@@ -28,11 +28,14 @@ struct cmpd_info {
hbool_t is_field; /*flag to lexer for compound member*/
hbool_t first_memb; /*flag for first compound member*/
};
+
/*stack for nested compound type*/
-struct cmpd_info cmpd_stack[STACK_SIZE] = { 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
- 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
- 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
- 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1 };
+struct cmpd_info cmpd_stack[STACK_SIZE] = {
+ {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1},
+ {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1},
+ {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1},
+ {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1} };
+
int csindex = -1; /*pointer to the top of compound stack*/
/*structure for array type information*/
@@ -161,7 +164,7 @@ memb_list :
memb_def : ddl_type { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ }
'"' field_name '"' field_offset ';'
{
- int origin_size, new_size;
+ size_t origin_size, new_size;
hid_t dtype_id = cmpd_stack[csindex].id;
/*Adjust size and insert member, consider both member size and offset.*/
diff --git a/hl/src/H5LTprivate.h b/hl/src/H5LTprivate.h
index 22d753c..441c00c 100644
--- a/hl/src/H5LTprivate.h
+++ b/hl/src/H5LTprivate.h
@@ -15,27 +15,12 @@
#ifndef _H5LTprivate_H
#define _H5LTprivate_H
-#include "H5private.h"
-/* public hdf5 prototypes */
-#include "H5Ipublic.h"
-#include "H5Tpublic.h"
-#include "H5Spublic.h"
-#include "H5Dpublic.h"
-#include "H5Ppublic.h"
-#include "H5Gpublic.h"
-#include "H5Apublic.h"
-#include "H5Epublic.h"
+/* High-level library internal header file */
+#include "H5HLprivate2.h"
+
/* public LT prototypes */
#include "H5LTpublic.h"
-#define TESTING(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);}
-#define TESTING2(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);}
-#define TESTING3(WHAT) {printf("%-70s", "" WHAT); fflush(stdout);}
-#define PASSED() {puts(" PASSED");fflush(stdout);}
-#define H5_FAILED() {puts("*FAILED*");fflush(stdout);}
-#define SKIPPED() {puts(" -SKIP-");fflush(stdout);}
-#define EXAMPLE(WHAT) {printf("%-70s", "Example " WHAT); fflush(stdout);}
-
/*-------------------------------------------------------------------------
* Private functions
*-------------------------------------------------------------------------
@@ -60,8 +45,8 @@ H5_HLDLL herr_t H5LT_set_attribute_numerical( hid_t loc_id,
const void *data );
H5_HLDLL herr_t H5LT_set_attribute_string( hid_t dset_id,
- char *name,
- char *buf );
+ const char *name,
+ const char *buf );
H5_HLDLL herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang,
size_t *slen, hbool_t no_user_buf);
diff --git a/hl/src/H5LTpublic.h b/hl/src/H5LTpublic.h
index cfccb08..32ae8de 100644
--- a/hl/src/H5LTpublic.h
+++ b/hl/src/H5LTpublic.h
@@ -15,10 +15,6 @@
#ifndef _H5LTpublic_H
#define _H5LTpublic_H
-
-/* Public headers needed by this file */
-#include "H5public.h"
-
typedef enum H5LT_lang_t {
H5LT_LANG_ERR = -1, /*this is the first*/
H5LT_DDL = 0, /*for DDL*/
@@ -27,8 +23,6 @@ typedef enum H5LT_lang_t {
H5LT_NO_LANG = 3 /*this is the last*/
} H5LT_lang_t;
-
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -352,11 +346,9 @@ H5_HLDLL herr_t H5LTrepack( hsize_t nfields,
unsigned char *src_buf,
unsigned char *dst_buf );
-
-
-
#ifdef __cplusplus
}
#endif
#endif
+
diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c
index 09c9074..94b8f08 100644
--- a/hl/src/H5PT.c
+++ b/hl/src/H5PT.c
@@ -81,7 +81,7 @@ hid_t H5PTcreate_fl ( hid_t loc_id,
/* Register the packet table ID type if this is the first table created */
if( H5PT_ptable_id_type < 0)
- if((H5PT_ptable_id_type = H5Iregister_type(H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free)) <0)
+ if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free)) <0)
goto out;
/* Get memory for the table identifier */
@@ -209,7 +209,7 @@ out:
*-------------------------------------------------------------------------
*/
hid_t H5PTopen( hid_t loc_id,
- char *dset_name )
+ const char *dset_name )
{
hid_t type_id=H5I_BADID;
hid_t space_id=H5I_BADID;
@@ -219,13 +219,14 @@ hid_t H5PTopen( hid_t loc_id,
/* Register the packet table ID type if this is the first table created */
if( H5PT_ptable_id_type < 0)
- if((H5PT_ptable_id_type = H5Iregister_type(H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free))<0)
+ if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free))<0)
goto out;
table = (htbl_t *) malloc(sizeof(htbl_t));
/* Open the dataset */
- if(( table->dset_id = H5Dopen(loc_id, dset_name)) <0);
+ if(( table->dset_id = H5Dopen(loc_id, dset_name)) <0)
+ goto out;
if (table->dset_id < 0)
goto out;
@@ -408,7 +409,7 @@ herr_t H5PTappend( hid_t table_id,
if (nrecords == 0)
return 0;
- if((H5TBcommon_append_records(table->dset_id, table->type_id,
+ if((H5TB_common_append_records(table->dset_id, table->type_id,
nrecords, table->size, data)) <0)
goto out;
@@ -462,7 +463,7 @@ herr_t H5PTget_next( hid_t table_id,
if (nrecords == 0)
return 0;
- if((H5TBcommon_read_records(table->dset_id, table->type_id,
+ if((H5TB_common_read_records(table->dset_id, table->type_id,
table->current_index, nrecords, table->size, data)) < 0)
goto out;
@@ -509,7 +510,7 @@ herr_t H5PTread_packets( hid_t table_id,
if (nrecords == 0)
return 0;
- if( H5TBcommon_read_records(table->dset_id, table->type_id,
+ if( H5TB_common_read_records(table->dset_id, table->type_id,
start, nrecords, table->size, data) < 0)
goto out;
diff --git a/hl/src/H5PTprivate.h b/hl/src/H5PTprivate.h
index bf6a00b..3bba9d2 100644
--- a/hl/src/H5PTprivate.h
+++ b/hl/src/H5PTprivate.h
@@ -15,8 +15,11 @@
#ifndef _H5PTprivate_H
#define _H5PTprivate_H
-
+/* High-level library internal header file */
+#include "H5HLprivate2.h"
+
/* public LT prototypes */
#include "H5PTpublic.h"
#endif
+
diff --git a/hl/src/H5PTpublic.h b/hl/src/H5PTpublic.h
index 5bcb203..d1d635b 100644
--- a/hl/src/H5PTpublic.h
+++ b/hl/src/H5PTpublic.h
@@ -16,17 +16,6 @@
#define _H5PTpublic_H
-/* public hdf5 prototypes */
-#include "H5Ipublic.h"
-#include "H5Tpublic.h"
-#include "H5Spublic.h"
-#include "H5Dpublic.h"
-#include "H5Ppublic.h"
-#include "H5Gpublic.h"
-#include "H5Apublic.h"
-#include "H5Epublic.h"
-#include "H5Rpublic.h"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -48,7 +37,7 @@ H5_HLDLL hid_t H5PTcreate_vl ( hid_t loc_id,
hsize_t chunk_size );
H5_HLDLL hid_t H5PTopen( hid_t loc_id,
- char *dset_name );
+ const char *dset_name );
H5_HLDLL herr_t H5PTclose( hid_t table_id );
@@ -124,3 +113,4 @@ H5_HLDLL herr_t H5PTfree_vlen_readbuff( hid_t table_id,
#endif
#endif
+
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c
index 2ed4693..d9579c3 100644
--- a/hl/src/H5TB.c
+++ b/hl/src/H5TB.c
@@ -12,9 +12,10 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "H5TBprivate.h"
#include <stdlib.h>
#include <string.h>
+#include "H5LTprivate.h"
+#include "H5TBprivate.h"
/*-------------------------------------------------------------------------
@@ -323,7 +324,7 @@ herr_t H5TBappend_records( hid_t loc_id,
goto out;
/* Append the records */
- if ((H5TBcommon_append_records(did, mem_type_id, nrecords, nrecords_orig, data))<0)
+ if ((H5TB_common_append_records(did, mem_type_id, nrecords, nrecords_orig, data))<0)
goto out;
/* Release the datatype. */
@@ -568,7 +569,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id,
/* Only one field */
else
{
- if ( H5Tinsert( write_type_id, member_name, 0, nmtype_id ) < 0 )
+ if ( H5Tinsert( write_type_id, member_name, (size_t)0, nmtype_id ) < 0 )
goto out;
}
@@ -735,7 +736,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id,
/* Only one field */
else
{
- if ( H5Tinsert( write_type_id, member_name, 0, nmtype_id ) < 0 )
+ if ( H5Tinsert( write_type_id, member_name, (size_t)0, nmtype_id ) < 0 )
goto out;
}
/* Close */
@@ -938,7 +939,7 @@ herr_t H5TBread_records( hid_t loc_id,
goto out;
/* Read the records */
- if ((H5TBcommon_read_records(did, mem_type_id, start, nrecords, nrecords_orig, data)) < 0)
+ if ((H5TB_common_read_records(did, mem_type_id, start, nrecords, nrecords_orig, data)) < 0)
goto out;
/* get the dataspace handle */
@@ -1089,7 +1090,7 @@ herr_t H5TBread_fields_name( hid_t loc_id,
}
else
{
- if ( H5Tinsert( mem_type_id, member_name, 0, nmtype_id ) < 0 )
+ if ( H5Tinsert( mem_type_id, member_name, (size_t)0, nmtype_id ) < 0 )
goto out;
}
@@ -1245,7 +1246,7 @@ herr_t H5TBread_fields_index( hid_t loc_id,
}
else
{
- if ( H5Tinsert( read_type_id, member_name, 0, nmtype_id ) < 0 )
+ if ( H5Tinsert( read_type_id, member_name, (size_t)0, nmtype_id ) < 0 )
goto out;
}
@@ -1471,7 +1472,7 @@ herr_t H5TBdelete_record( hid_t loc_id,
nrows = ntotal_records - nrecords;
/* Set the attribute */
- if (H5LT_set_attribute_numerical(loc_id,dset_name,"NROWS",1,
+ if (H5LT_set_attribute_numerical(loc_id,dset_name,"NROWS",(size_t)1,
H5T_NATIVE_LLONG,&nrows)<0)
return -1;
@@ -2426,7 +2427,7 @@ herr_t H5TBinsert_field( hid_t loc_id,
goto out;
/* The field in the file is found by its name */
- if ( H5Tinsert( write_type_id, field_name, 0, field_type ) < 0 )
+ if ( H5Tinsert( write_type_id, field_name, (size_t)0, field_type ) < 0 )
goto out;
/* Create xfer properties to preserve initialized data */
@@ -2896,7 +2897,7 @@ herr_t H5TBdelete_field( hid_t loc_id,
goto out;
/* Insert it into the new type */
- if ( H5Tinsert( read_type_id, member_name, 0, member_type_id ) < 0 )
+ if ( H5Tinsert( read_type_id, member_name, (size_t)0, member_type_id ) < 0 )
goto out;
tmp_buf = (unsigned char *)calloc((size_t) nrecords, member_size );
@@ -2910,7 +2911,7 @@ herr_t H5TBdelete_field( hid_t loc_id,
goto out;
/* The field in the file is found by its name */
- if ( H5Tinsert( write_type_id, member_name, 0, member_type_id ) < 0 )
+ if ( H5Tinsert( write_type_id, member_name, (size_t)0, member_type_id ) < 0 )
goto out;
/* Create xfer properties to preserve initialized data */
@@ -3656,7 +3657,7 @@ out:
*/
/*-------------------------------------------------------------------------
- * Function: H5TBcommon_append_records
+ * Function: H5TB_common_append_records
*
* Purpose: Common code for reading records shared between H5PT and H5TB
*
@@ -3673,7 +3674,7 @@ out:
*
*-------------------------------------------------------------------------
*/
-herr_t H5TBcommon_append_records( hid_t dataset_id,
+herr_t H5TB_common_append_records( hid_t dataset_id,
hid_t mem_type_id,
hsize_t nrecords,
hsize_t orig_table_size,
@@ -3729,7 +3730,7 @@ out:
/*-------------------------------------------------------------------------
- * Function: H5TBcommon_read_records
+ * Function: H5TB_common_read_records
*
* Purpose: Common code for reading records shared between H5PT and H5TB
*
@@ -3747,7 +3748,7 @@ out:
*
*-------------------------------------------------------------------------
*/
-herr_t H5TBcommon_read_records( hid_t dataset_id,
+herr_t H5TB_common_read_records( hid_t dataset_id,
hid_t mem_type_id,
hsize_t start,
hsize_t nrecords,
diff --git a/hl/src/H5TBprivate.h b/hl/src/H5TBprivate.h
index 68fe303..46dcf15 100644
--- a/hl/src/H5TBprivate.h
+++ b/hl/src/H5TBprivate.h
@@ -15,8 +15,10 @@
#ifndef _H5TBprivate_H
#define _H5TBprivate_H
+/* High-level library internal header file */
+#include "H5HLprivate2.h"
-#include "H5LTprivate.h"
+/* public TB prototypes */
#include "H5TBpublic.h"
@@ -30,7 +32,7 @@
*-------------------------------------------------------------------------
*/
-herr_t H5TBcommon_append_records( hid_t dataset_id,
+herr_t H5TB_common_append_records( hid_t dataset_id,
hid_t mem_type_id,
hsize_t nrecords,
hsize_t orig_table_size,
@@ -44,7 +46,7 @@ herr_t H5TBcommon_append_records( hid_t dataset_id,
*/
-herr_t H5TBcommon_read_records( hid_t dataset_id,
+herr_t H5TB_common_read_records( hid_t dataset_id,
hid_t mem_type_id,
hsize_t start,
hsize_t nrecords,
diff --git a/hl/test/h5hltest.h b/hl/test/h5hltest.h
new file mode 100644
index 0000000..2776204
--- /dev/null
+++ b/hl/test/h5hltest.h
@@ -0,0 +1,41 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Friday, April 28, 2006
+ *
+ * Purpose: Test support stuff.
+ */
+
+#ifndef _H5HLTEST_H
+#define _H5HLTEST_H
+
+/* Get the HDF5 public header */
+#include "hdf5.h"
+
+/* Include the High-Level private header */
+#include "H5HLprivate2.h"
+
+/* These are copied from the test/h5test.h header */
+#define TESTING(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);}
+#define TESTING2(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);}
+#define TESTING3(WHAT) {printf("%-70s", "" WHAT); fflush(stdout);}
+#define PASSED() {puts(" PASSED");fflush(stdout);}
+#define H5_FAILED() {puts("*FAILED*");fflush(stdout);}
+#define SKIPPED() {puts(" -SKIP-");fflush(stdout);}
+#define EXAMPLE(WHAT) {printf("%-70s", "Example " WHAT); fflush(stdout);}
+
+#endif /* _H5HLTEST_H */
+
diff --git a/hl/test/pal_rgb.h b/hl/test/pal_rgb.h
index 8fba910..0bc3905 100644
--- a/hl/test/pal_rgb.h
+++ b/hl/test/pal_rgb.h
@@ -270,9 +270,3 @@ const unsigned char pal_rgb[256*3] = {255,255,255,
127,0,0
};
-
-
-
-
-
-
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index 3e72766..e8caf10 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -14,9 +14,10 @@
#include <stdlib.h>
#include <string.h>
-#include "H5DSprivate.h"
-#include "H5LTprivate.h"
-#include "H5IMprivate.h"
+#include "h5hltest.h"
+#include "H5DSpublic.h"
+#include "H5LTpublic.h"
+#include "H5IMpublic.h"
/* operator functions */
static herr_t verifiy_scale(hid_t dset, unsigned dim, hid_t scale, void *visitor_data);
@@ -115,7 +116,7 @@ error:
static int test_simple(void)
{
hid_t fid; /* file ID */
- hid_t did; /* dataset ID */
+ hid_t did = -1; /* dataset ID */
hid_t dsid; /* DS dataset ID */
hid_t sid; /* space ID */
hid_t gid; /* group ID */
@@ -852,7 +853,7 @@ static int test_simple(void)
*/
/* create a group */
- if ((gid=H5Gcreate(fid,"grp",0))<0)
+ if ((gid=H5Gcreate(fid,"grp",(size_t)0))<0)
goto out;
/* create the data space for the dataset */
@@ -989,12 +990,12 @@ static int test_simple(void)
{
if ( i==1 )
{
- if(H5DSdetach_scale(did,dsid,i)<0)
+ if(H5DSdetach_scale(did,dsid,(unsigned)i)<0)
goto out;
}
else
{
- if(H5DSdetach_scale(did,dsid,i)!=FAIL)
+ if(H5DSdetach_scale(did,dsid,(unsigned)i)!=FAIL)
goto out;
}
}
@@ -1047,9 +1048,9 @@ static int test_simple(void)
*-------------------------------------------------------------------------
*/
- if ((dim0_label_size=H5DSget_label(did,DIM0,NULL,0))<0)
+ if ((dim0_label_size=H5DSget_label(did,DIM0,NULL,(size_t)0))<0)
goto out;
- if ((dim1_label_size=H5DSget_label(did,DIM1,NULL,0))<0)
+ if ((dim1_label_size=H5DSget_label(did,DIM1,NULL,(size_t)0))<0)
goto out;
/* allocate */
@@ -1058,14 +1059,14 @@ static int test_simple(void)
if ( dim0_labeld==NULL || dim1_labeld==NULL)
goto out;
- if (H5DSget_label(did,DIM0,dim0_labeld,dim0_label_size)<0)
+ if (H5DSget_label(did,DIM0,dim0_labeld,(size_t)dim0_label_size)<0)
goto out;
- if (H5DSget_label(did,DIM1,dim1_labeld,dim1_label_size)<0)
+ if (H5DSget_label(did,DIM1,dim1_labeld,(size_t)dim1_label_size)<0)
goto out;
- if (strncmp(DIM0_LABEL,dim0_labeld,dim0_label_size-1)!=0)
+ if (strncmp(DIM0_LABEL,dim0_labeld,(size_t)(dim0_label_size-1))!=0)
goto out;
- if (strncmp(DIM1_LABEL,dim1_labeld,dim1_label_size-1)!=0)
+ if (strncmp(DIM1_LABEL,dim1_labeld,(size_t)(dim1_label_size-1))!=0)
goto out;
if (dim0_labeld)
@@ -1124,7 +1125,7 @@ static int test_simple(void)
*/
/* get the lenght of the scale name (pass NULL in name) */
- if ((name_len=H5DSget_scale_name(dsid,NULL,0))<0)
+ if ((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0))<0)
goto out;
/* allocate a buffer */
@@ -1133,7 +1134,7 @@ static int test_simple(void)
goto out;
/* get the scale name using this buffer */
- if (H5DSget_scale_name(dsid,name_out,name_len)<0)
+ if (H5DSget_scale_name(dsid,name_out,(size_t)name_len)<0)
goto out;
if (strcmp(SCALE_1_NAME,name_out)!=0)
@@ -1512,8 +1513,8 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor
{
int ret = 0; /* define a default zero value for return. This will cause the iterator to continue */
hid_t sid; /* space ID */
- hid_t tid; /* file type ID */
- hid_t mtid; /* memory type ID */
+ hid_t tid = -1; /* file type ID */
+ hid_t mtid = -1; /* memory type ID */
hssize_t nelmts; /* number of data elements */
char *buf=NULL; /* data buffer */
size_t size;
@@ -1542,7 +1543,7 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor
if (nelmts)
{
- buf=(char *) malloc((unsigned)(nelmts*size));
+ buf=(char *) malloc((size_t)(nelmts*size));
if ( buf==NULL)
goto out;
if (H5Dread(scale_id,mtid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
@@ -1610,6 +1611,9 @@ static herr_t match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor
hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
hsize_t storage_size;
+ /* Stop compiler from whining about "unused parameters" */
+ visitor_data = visitor_data;
+
/*-------------------------------------------------------------------------
* get DID (dataset) space info
*-------------------------------------------------------------------------
@@ -1682,15 +1686,14 @@ out:
static herr_t op_bogus(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
{
- /* define a default zero value for return. This will cause the iterator to continue */
- int ret = 0;
-
- /* unused */
- dset=dset;
- dim=dim;
- visitor_data=visitor_data;
+ /* Stop compiler from whining about "unused parameters" */
+ dset = dset;
+ dim = dim;
+ scale_id = scale_id;
+ visitor_data = visitor_data;
- return ret;
+ /* define a default zero value for return. This will cause the iterator to continue */
+ return 0;
}
@@ -1711,11 +1714,11 @@ static int test_errors(void)
int rankds = 1; /* rank of DS dataset */
hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE}; /* size of data dataset */
hsize_t s1_dim[1] = {DIM1_SIZE}; /* size of DS 1 dataset */
- hid_t did; /* dataset ID */
- hid_t dsid; /* scale ID */
- hid_t gid; /* group ID */
- hid_t sid; /* space ID */
- hid_t sidds; /* space ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t dsid = -1; /* scale ID */
+ hid_t gid = -1; /* group ID */
+ hid_t sid = -1; /* space ID */
+ hid_t sidds = -1; /* space ID */
hsize_t pal_dims[] = {9,3};
printf("Testing error conditions\n");
@@ -1729,7 +1732,7 @@ static int test_errors(void)
if ((fid=H5Fcreate(FILE2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
goto out;
/* create a group */
- if ((gid=H5Gcreate(fid,"grp",0))<0)
+ if ((gid=H5Gcreate(fid,"grp",(size_t)0))<0)
goto out;
/* create the data space for the dataset */
if ((sid=H5Screate_simple(rank,dims,NULL))<0)
@@ -1911,7 +1914,7 @@ static int test_errors(void)
TESTING2("attach to a dataset that is a reserved class dataset");
/* make an image */
- if (H5IMmake_image_8bit(fid,"image",100,50,NULL)<0)
+ if (H5IMmake_image_8bit(fid,"image",(hsize_t)100,(hsize_t)50,NULL)<0)
goto out;
/* make a palette */
@@ -2090,7 +2093,7 @@ static int test_iterators(void)
int rankds = 1; /* rank of DS dataset */
hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE}; /* size of data dataset */
hsize_t s1_dim[1] = {DIM1_SIZE}; /* size of DS 1 dataset */
- hid_t gid; /* group ID */
+ hid_t gid = -1; /* group ID */
hid_t did; /* dataset ID */
hid_t dsid; /* scale ID */
char dname[30]; /* dataset name */
@@ -2107,7 +2110,7 @@ static int test_iterators(void)
if ((fid=H5Fcreate(FILE3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
goto out;
/* create a group */
- if ((gid=H5Gcreate(fid,"grp",0))<0)
+ if ((gid=H5Gcreate(fid,"grp",(size_t)0))<0)
goto out;
/* close */
if (H5Gclose(gid)<0)
@@ -2272,8 +2275,8 @@ out:
static int test_rank(void)
{
hid_t fid; /* file ID */
- hid_t did; /* dataset ID */
- hid_t dsid; /* scale ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t dsid = -1; /* scale ID */
hid_t sid; /* space ID */
hid_t sidds; /* space ID */
hsize_t dims1[1] = {DIM1_SIZE}; /* size of data dataset */
@@ -2329,9 +2332,9 @@ static int test_rank(void)
sprintf(name,"ds_a_%d",i);
if((dsid = H5Dopen(fid,name))<0)
goto out;
- if(H5DSattach_scale(did,dsid,i)<0)
+ if(H5DSattach_scale(did,dsid,(unsigned)i)<0)
goto out;
- if (H5DSis_attached(did,dsid,i)<=0)
+ if (H5DSis_attached(did,dsid,(unsigned)i)<=0)
goto out;
if (H5Dclose(dsid)<0)
goto out;
@@ -2358,9 +2361,9 @@ static int test_rank(void)
sprintf(name,"ds_a_%d",i);
if((dsid = H5Dopen(fid,name))<0)
goto out;
- if(H5DSdetach_scale(did,dsid,i)<0)
+ if(H5DSdetach_scale(did,dsid,(unsigned)i)<0)
goto out;
- if (H5DSis_attached(did,dsid,i)!=0)
+ if (H5DSis_attached(did,dsid,(unsigned)i)!=0)
goto out;
if (H5Dclose(dsid)<0)
goto out;
@@ -2387,17 +2390,17 @@ static int test_rank(void)
goto out;
if (H5DSset_scale(dsid,name)<0)
goto out;
- if(H5DSattach_scale(did,dsid,i)<0)
+ if(H5DSattach_scale(did,dsid,(unsigned)i)<0)
goto out;
- if (H5DSis_attached(did,dsid,i)<=0)
+ if (H5DSis_attached(did,dsid,(unsigned)i)<=0)
goto out;
if (H5DSget_scale_name(dsid,names,sizeof(names))<0)
goto out;
if (H5Dclose(dsid)<0)
goto out;
- if (H5DSset_label(did,i,name)<0)
+ if (H5DSset_label(did,(unsigned)i,name)<0)
goto out;
- if (H5DSget_label(did,i,namel,sizeof(namel))<0)
+ if (H5DSget_label(did,(unsigned)i,namel,sizeof(namel))<0)
goto out;
if (strcmp(name,names)!=0)
goto out;
@@ -2480,8 +2483,8 @@ out:
static int test_types(void)
{
hid_t fid; /* file ID */
- hid_t did; /* dataset ID */
- hid_t dsid; /* DS dataset ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t dsid = -1; /* DS dataset ID */
int rank = RANK; /* rank of data dataset */
int rankds = 1; /* rank of DS dataset */
hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE}; /* size of data dataset */
@@ -2490,8 +2493,8 @@ static int test_types(void)
hsize_t s2_dim[1] = {DIM2_SIZE}; /* size of DS 2 dataset */
float s1_float[DIM1_SIZE] = {10,20,30}; /* data of DS 1 dataset */
unsigned short s2_ushort[DIM2_SIZE] = {10,20,30,40}; /* data of DS 2 dataset */
- char *s1_str = "ABC";
- char *s2_str = "ABCD";
+ const char *s1_str = "ABC";
+ const char *s2_str = "ABCD";
printf("Testing scales with several datatypes\n");
@@ -2656,8 +2659,8 @@ out:
static int test_data(void)
{
hid_t fid; /* file ID */
- hid_t did; /* dataset ID */
- hid_t dsid; /* DS dataset ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t dsid = -1; /* DS dataset ID */
hid_t dcpl; /* dataset creation property list */
hid_t sid; /* dataspace ID */
float *vals=NULL; /* array to hold data values */
@@ -2845,7 +2848,7 @@ static int read_data( const char* fname, int ndims, hsize_t *dims, float **buf )
for (i=0, nelms=1; i < ndims; i++)
{
- fscanf( f, "%s %d", str, &j);
+ fscanf( f, "%s %u", str, &j);
fscanf( f, "%d",&n );
dims[i] = n;
nelms *= n;
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index 6d1f445..630b9c5 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -12,11 +12,12 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "H5LTprivate.h"
-#include "H5IMprivate.h"
-#include "pal_rgb.h"
#include <stdlib.h>
#include <string.h>
+#include "h5hltest.h"
+#include "H5LTpublic.h"
+#include "H5IMpublic.h"
+#include "pal_rgb.h"
#define FILE1 "test_image1.h5"
#define FILE2 "test_image2.h5"
@@ -52,7 +53,7 @@ static int test_simple(void);
static int test_data(void);
static int test_generate(void);
static int read_data(const char* file_name, hsize_t *width, hsize_t *height );
-static int read_palette(const char* file_name, rgb_t *palette, int palette_size);
+static int read_palette(const char* file_name, rgb_t *palette, size_t palette_size);
/* globals */
unsigned char *image_data = NULL;
@@ -103,7 +104,7 @@ static int test_simple(void)
unsigned char image_out2[ WIDTH*HEIGHT*3 ];
unsigned char pal_data_out[PAL_ENTRIES*3];
unsigned char n;
- int space;
+ hsize_t space;
/* create a PAL_ENTRIES entry palette */
unsigned char pal_data_in[PAL_ENTRIES*3] = {
0,0,168, /* dark blue */
@@ -137,7 +138,6 @@ static int test_simple(void)
n++;
j=0;
}
- if (n>255) n=0;
}
/* create a file using default properties */
@@ -829,7 +829,7 @@ static int read_data( const char* fname, /*IN*/
static int read_palette(const char* fname,
rgb_t *palette,
- int palette_size)
+ size_t palette_size)
{
FILE *file;
char buffer[80];
@@ -837,7 +837,7 @@ static int read_palette(const char* fname,
unsigned int red;
unsigned int green;
unsigned int blue;
- int nentries;
+ unsigned nentries;
char *srcdir = getenv("srcdir"); /* the source directory */
char data_file[512]; /* buffer to hold name of existing data file */
@@ -912,7 +912,7 @@ static int read_palette(const char* fname,
return -1;
}
- if (sscanf(buffer, "%d", &nentries) != 1)
+ if (sscanf(buffer, "%u", &nentries) != 1)
{
fclose(file);
return -1;
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c
index 1816f7f..705cf3a 100644
--- a/hl/test/test_lite.c
+++ b/hl/test/test_lite.c
@@ -14,8 +14,8 @@
#include <stdlib.h>
#include <string.h>
-
-#include "H5LTprivate.h"
+#include "h5hltest.h"
+#include "H5LTpublic.h"
#define FILE_NAME "test_lite1.h5"
#define FILE_NAME2 "test_lite2.h5"
@@ -70,8 +70,8 @@ static int test_dsets( void )
float data_float_out[DIM];
double data_double_in[DIM] = {1,2,3,4,5,6};
double data_double_out[DIM];
- char *data_string_in = "This is a string";
- char data_string_out[20];
+ const char *data_string_in = "This is a string";
+ char data_string_out[20];
int i;
@@ -426,7 +426,7 @@ static int test_attr( void )
*/
/* Create a group. */
- if ((group_id = H5Gcreate( file_id, "grp", 0 ))<0)
+ if ((group_id = H5Gcreate( file_id, "grp", (size_t)0 ))<0)
goto out;
/* Close */
@@ -554,7 +554,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
TESTING("H5LTset_attribute_char");
/* Set the attribute */
- if ( H5LTset_attribute_char( loc_id, obj_name, ATTR2_NAME, attr_char_in, 5 ) < 0 )
+ if ( H5LTset_attribute_char( loc_id, obj_name, ATTR2_NAME, attr_char_in, (size_t)5 ) < 0 )
return -1;
PASSED();
@@ -598,7 +598,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
TESTING("H5LTset_attribute_short");
/* Set the attribute */
- if ( H5LTset_attribute_short( loc_id, obj_name, ATTR3_NAME, attr_short_in, 5 ) < 0 )
+ if ( H5LTset_attribute_short( loc_id, obj_name, ATTR3_NAME, attr_short_in, (size_t)5 ) < 0 )
return -1;
PASSED();
@@ -644,7 +644,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
TESTING("H5LTset_attribute_int");
/* Set the attribute */
- if ( H5LTset_attribute_int( loc_id, obj_name, ATTR4_NAME, attr_int_in, 5 ) < 0 )
+ if ( H5LTset_attribute_int( loc_id, obj_name, ATTR4_NAME, attr_int_in, (size_t)5 ) < 0 )
return -1;
PASSED();
@@ -688,7 +688,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
TESTING("H5LTset_attribute_long");
/* Set the attribute */
- if ( H5LTset_attribute_long( loc_id, obj_name, ATTR5_NAME, attr_long_in, 5 ) < 0 )
+ if ( H5LTset_attribute_long( loc_id, obj_name, ATTR5_NAME, attr_long_in, (size_t)5 ) < 0 )
return -1;
PASSED();
@@ -732,7 +732,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
TESTING("H5LTset_attribute_uchar");
/* Set the attribute */
- if ( H5LTset_attribute_uchar( loc_id, obj_name, ATTR6_NAME, attr_uchar_in, 5 ) < 0 )
+ if ( H5LTset_attribute_uchar( loc_id, obj_name, ATTR6_NAME, attr_uchar_in, (size_t)5 ) < 0 )
return -1;
PASSED();
@@ -776,7 +776,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
TESTING("H5LTset_attribute_ushort");
/* Set the attribute */
- if ( H5LTset_attribute_ushort( loc_id, obj_name, ATTR7_NAME, attr_ushort_in, 5 ) < 0 )
+ if ( H5LTset_attribute_ushort( loc_id, obj_name, ATTR7_NAME, attr_ushort_in, (size_t)5 ) < 0 )
return -1;
PASSED();
@@ -822,7 +822,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
TESTING("H5LTset_attribute_uint");
/* Set the attribute */
- if ( H5LTset_attribute_uint( loc_id, obj_name, ATTR8_NAME, attr_uint_in, 5 ) < 0 )
+ if ( H5LTset_attribute_uint( loc_id, obj_name, ATTR8_NAME, attr_uint_in, (size_t)5 ) < 0 )
return -1;
PASSED();
@@ -866,7 +866,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
TESTING("H5LTset_attribute_ulong");
/* Set the attribute */
- if ( H5LTset_attribute_ulong( loc_id, obj_name, ATTR9_NAME, attr_ulong_in, 5 ) < 0 )
+ if ( H5LTset_attribute_ulong( loc_id, obj_name, ATTR9_NAME, attr_ulong_in, (size_t)5 ) < 0 )
return -1;
PASSED();
@@ -911,7 +911,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
TESTING("H5LTset_attribute_float");
/* Set the attribute */
- if ( H5LTset_attribute_float( loc_id, obj_name, ATTR10_NAME, attr_float_in, 5 ) < 0 )
+ if ( H5LTset_attribute_float( loc_id, obj_name, ATTR10_NAME, attr_float_in, (size_t)5 ) < 0 )
return -1;
PASSED();
@@ -956,7 +956,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
TESTING("H5LTset_attribute_double");
/* Set the attribute */
- if ( H5LTset_attribute_double( loc_id, obj_name, ATTR11_NAME, attr_double_in, 5 ) < 0 )
+ if ( H5LTset_attribute_double( loc_id, obj_name, ATTR11_NAME, attr_double_in, (size_t)5 ) < 0 )
return -1;
PASSED();
@@ -1289,7 +1289,7 @@ static int test_enums(void)
size_t size = 16;
char name1[16];
int value1 = 7;
- char *name2 = "WHITE";
+ const char *name2 = "WHITE";
int value2;
H5T_class_t type_class;
char* dt_str;
diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c
index 739b0f7..7c7ab2c 100644
--- a/hl/test/test_packet.c
+++ b/hl/test/test_packet.c
@@ -12,11 +12,12 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "H5PTprivate.h"
-#include "H5TBprivate.h"
#include <stdlib.h>
#include <assert.h>
#include <string.h>
+#include "h5hltest.h"
+#include "H5PTpublic.h"
+#include "H5TBpublic.h"
/*-------------------------------------------------------------------------
* Packet Table API test
@@ -96,7 +97,7 @@ make_particle_type(void)
/* Insert fields. */
string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
+ H5Tset_size( string_type, (size_t)16 );
if ( H5Tinsert(type_id, "Name", HOFFSET(particle_t, name) , string_type ) < 0 )
return -1;
@@ -134,7 +135,7 @@ static int create_hl_table(hid_t fid)
/* Initialize the field field_type */
string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
+ H5Tset_size( string_type, (size_t)16 );
field_type[0] = string_type;
field_type[1] = H5T_NATIVE_INT;
field_type[2] = H5T_NATIVE_INT;
@@ -168,7 +169,7 @@ else
*-------------------------------------------------------------------------
*/
-int test_create_close(hid_t fid)
+static int test_create_close(hid_t fid)
{
herr_t err;
hid_t table;
@@ -182,7 +183,7 @@ int test_create_close(hid_t fid)
assert(part_t != -1);
/* Create the table */
- table = H5PTcreate_fl(fid, PT_NAME, part_t, 100);
+ table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100);
H5Tclose(part_t);
if( H5PTis_valid(table) < 0)
goto out;
@@ -209,7 +210,7 @@ int test_create_close(hid_t fid)
*
*-------------------------------------------------------------------------
*/
-int test_open(hid_t fid)
+static int test_open(hid_t fid)
{
herr_t err;
hid_t table;
@@ -243,7 +244,7 @@ int test_open(hid_t fid)
*
*-------------------------------------------------------------------------
*/
-int test_append(hid_t fid)
+static int test_append(hid_t fid)
{
herr_t err;
hid_t table;
@@ -265,17 +266,17 @@ int test_append(hid_t fid)
goto out;
/* Append one particle */
- err = H5PTappend(table, 1, &(testPart[0]));
+ err = H5PTappend(table, (hsize_t)1, &(testPart[0]));
if( err < 0)
goto out;
/* Append several particles */
- err = H5PTappend(table, 6, &(testPart[1]));
+ err = H5PTappend(table, (hsize_t)6, &(testPart[1]));
if( err < 0)
goto out;
/* Append one more particle */
- err = H5PTappend(table, 1, &(testPart[7]));
+ err = H5PTappend(table, (hsize_t)1, &(testPart[7]));
if( err < 0)
goto out;
@@ -309,12 +310,12 @@ int test_append(hid_t fid)
*
*-------------------------------------------------------------------------
*/
-int test_read(hid_t fid)
+static int test_read(hid_t fid)
{
herr_t err;
hid_t table;
particle_t readBuf[NRECORDS];
- int c;
+ hsize_t c;
TESTING("H5PTread_packets");
@@ -324,17 +325,17 @@ int test_read(hid_t fid)
goto out;
/* Read several particles */
- err = H5PTread_packets(table, 0, 3, &(readBuf[0]));
+ err = H5PTread_packets(table, (hsize_t)0, (hsize_t)3, &(readBuf[0]));
if( err < 0)
goto out;
/* Read one particle */
- err = H5PTread_packets(table, 3, 1, &(readBuf[3]));
+ err = H5PTread_packets(table, (hsize_t)3, (hsize_t)1, &(readBuf[3]));
if( err < 0)
goto out;
/* Read several particles */
- err = H5PTread_packets(table, 4, (NRECORDS - 4 ), &(readBuf[4]));
+ err = H5PTread_packets(table, (hsize_t)4, (hsize_t)(NRECORDS - 4 ), &(readBuf[4]));
if( err < 0)
goto out;
@@ -369,13 +370,13 @@ int test_read(hid_t fid)
*
*-------------------------------------------------------------------------
*/
-int test_get_next(hid_t fid)
+static int test_get_next(hid_t fid)
{
herr_t err;
hid_t table;
particle_t readBuf[NRECORDS];
particle_t readBuf2[NRECORDS];
- int c;
+ hsize_t c;
TESTING("H5PTget_next");
@@ -387,7 +388,7 @@ int test_get_next(hid_t fid)
/* Read several particles consecutively */
for(c=0; c < NRECORDS; c++)
{
- err = H5PTget_next(table, 1, &readBuf[c]);
+ err = H5PTget_next(table, (hsize_t)1, &readBuf[c]);
if(err < 0)
goto out;
}
@@ -404,7 +405,7 @@ int test_get_next(hid_t fid)
/* Read particles two by two */
for(c=0; c < NRECORDS / 2; c++)
{
- err = H5PTget_next(table, 2, &readBuf2[c * 2]);
+ err = H5PTget_next(table, (hsize_t)2, &readBuf2[c * 2]);
if(err < 0)
goto out;
}
@@ -439,12 +440,12 @@ int test_get_next(hid_t fid)
*
*-------------------------------------------------------------------------
*/
-int test_big_table(hid_t fid)
+static int test_big_table(hid_t fid)
{
herr_t err;
hid_t table;
hid_t part_t;
- int c;
+ hsize_t c;
particle_t readPart;
hsize_t count;
@@ -456,7 +457,7 @@ int test_big_table(hid_t fid)
assert(part_t != -1);
/* Create a new table */
- table = H5PTcreate_fl(fid, "Packet Test Dataset2", part_t, 33);
+ table = H5PTcreate_fl(fid, "Packet Test Dataset2", part_t, (hsize_t)33);
H5Tclose(part_t);
if( H5PTis_valid(table) < 0)
goto out;
@@ -465,7 +466,7 @@ int test_big_table(hid_t fid)
for(c = 0; c < BIG_TABLE_SIZE ; c+=8)
{
/* Append eight particles at once*/
- err = H5PTappend(table, 8, &(testPart[0]));
+ err = H5PTappend(table, (hsize_t)8, &(testPart[0]));
if( err < 0)
goto out;
}
@@ -482,12 +483,12 @@ int test_big_table(hid_t fid)
/* the first packet in the table */
for(c = 0; c < BIG_TABLE_SIZE; c++)
{
- err = H5PTget_next(table, 1, &readPart);
+ err = H5PTget_next(table, (hsize_t)1, &readPart);
if(err < 0)
goto out;
/* Ensure that particles were read correctly */
- if( cmp_par(c % 8, 0, testPart, &readPart) != 0)
+ if( cmp_par(c % 8, (hsize_t)0, testPart, &readPart) != 0)
goto out;
}
@@ -514,7 +515,7 @@ int test_big_table(hid_t fid)
*
*-------------------------------------------------------------------------
*/
-int test_varlen(hid_t fid)
+static int test_varlen(hid_t fid)
{
herr_t err;
hid_t table=H5I_BADID;
@@ -552,7 +553,7 @@ int test_varlen(hid_t fid)
}
/* Create the table */
- table = H5PTcreate_vl(fid, VL_TABLE_NAME, 1001);
+ table = H5PTcreate_vl(fid, VL_TABLE_NAME, (hsize_t)1001);
if( H5PTis_valid(table) < 0)
goto out;
if( H5PTis_varlen(table) != 1)
@@ -585,18 +586,18 @@ int test_varlen(hid_t fid)
goto out;
/* Add several variable-length packets */
- err = H5PTappend(table, 8, writeBuffer );
+ err = H5PTappend(table, (hsize_t)8, writeBuffer );
if(err < 0)
goto out;
/* Read them back */
- err = H5PTread_packets(table, 0, 4, &(readBuffer[0]));
+ err = H5PTread_packets(table, (hsize_t)0, (hsize_t)4, &(readBuffer[0]));
if( err < 0)
goto out;
- err = H5PTread_packets(table, 4, 1, &(readBuffer[4]));
+ err = H5PTread_packets(table, (hsize_t)4, (hsize_t)1, &(readBuffer[4]));
if( err < 0)
goto out;
- err = H5PTread_packets(table, 5, (NRECORDS - 5 ), &(readBuffer[5]));
+ err = H5PTread_packets(table, (hsize_t)5, (hsize_t)(NRECORDS - 5 ), &(readBuffer[5]));
if( err < 0)
goto out;
@@ -617,7 +618,7 @@ int test_varlen(hid_t fid)
goto out;
break;
case 3:
- if( cmp_par(0, 0, readBuffer[x].p, writeBuffer[x].p) < 0)
+ if( cmp_par((hsize_t)0, (hsize_t)0, readBuffer[x].p, writeBuffer[x].p) < 0)
goto out;
break;
default:
@@ -626,13 +627,13 @@ int test_varlen(hid_t fid)
}
/* Free memory used by read buffer */
- if(H5PTfree_vlen_readbuff(table, NRECORDS, readBuffer) <0)
+ if(H5PTfree_vlen_readbuff(table, (hsize_t)NRECORDS, readBuffer) <0)
goto out;
/* Read packets back using get_next */
for(x=0; x < NRECORDS; x++)
{
- err = H5PTget_next(table, 1, &readBuffer[x]);
+ err = H5PTget_next(table, (hsize_t)1, &readBuffer[x]);
if(err < 0)
goto out;
}
@@ -654,7 +655,7 @@ int test_varlen(hid_t fid)
goto out;
break;
case 3:
- if( cmp_par(0, 0, readBuffer[x].p, writeBuffer[x].p) < 0)
+ if( cmp_par((hsize_t)0, (hsize_t)0, readBuffer[x].p, writeBuffer[x].p) < 0)
goto out;
break;
default:
@@ -663,7 +664,7 @@ int test_varlen(hid_t fid)
}
/* Free memory used by read buffer */
- if(H5PTfree_vlen_readbuff(table, NRECORDS, readBuffer) <0)
+ if(H5PTfree_vlen_readbuff(table, (hsize_t)NRECORDS, readBuffer) <0)
goto out;
/* Close the table */
@@ -688,12 +689,12 @@ int test_varlen(hid_t fid)
*
*-------------------------------------------------------------------------
*/
-int test_opaque(hid_t fid)
+static int test_opaque(hid_t fid)
{
herr_t err;
hid_t table;
hid_t part_t;
- int c;
+ hsize_t c;
particle_t readBuf[NRECORDS];
TESTING("opaque data");
@@ -709,18 +710,18 @@ int test_opaque(hid_t fid)
return -1;
/* Create a new table */
- table = H5PTcreate_fl(fid, "Packet Test Dataset3", part_t, 1);
+ table = H5PTcreate_fl(fid, "Packet Test Dataset3", part_t, (hsize_t)1);
H5Tclose(part_t);
if( H5PTis_valid(table) < 0)
goto out;
/* Append several particles, starting at particle 1 */
- err = H5PTappend(table, NRECORDS - 1, &(testPart[1]));
+ err = H5PTappend(table, (hsize_t)(NRECORDS - 1), &(testPart[1]));
if( err < 0)
goto out;
/* Read the particles back */
- err = H5PTread_packets(table, 0, 7, &(readBuf[0]));
+ err = H5PTread_packets(table, (hsize_t)0, (hsize_t)7, &(readBuf[0]));
if( err < 0)
goto out;
@@ -754,7 +755,7 @@ int test_opaque(hid_t fid)
*
*-------------------------------------------------------------------------
*/
-int test_error(hid_t fid)
+static int test_error(hid_t fid)
{
hid_t id = H5I_BADID;
int id_open=0;
@@ -782,9 +783,9 @@ int test_error(hid_t fid)
goto out;
if(H5PTclose(id) >= 0)
goto out;
- if(H5PTappend(id, 1, testPart) >= 0)
+ if(H5PTappend(id, (hsize_t)1, testPart) >= 0)
goto out;
- if(H5PTread_packets(id, 0, 1, readBuf) >= 0)
+ if(H5PTread_packets(id, (hsize_t)0, (hsize_t)1, readBuf) >= 0)
goto out;
if(H5PTcreate_index(id) >= 0)
goto out;
@@ -803,9 +804,9 @@ int test_error(hid_t fid)
goto out;
if(H5PTclose(id) >= 0)
goto out;
- if(H5PTappend(id, 1, testPart) >= 0)
+ if(H5PTappend(id, (hsize_t)1, testPart) >= 0)
goto out;
- if(H5PTread_packets(id, 0, 1, readBuf) >= 0)
+ if(H5PTread_packets(id, (hsize_t)0, (hsize_t)1, readBuf) >= 0)
goto out;
if(H5PTcreate_index(id) >= 0)
goto out;
@@ -829,9 +830,9 @@ int test_error(hid_t fid)
goto out;
if(H5PTclose(id) >= 0)
goto out;
- if(H5PTappend(id, 1, testPart) >= 0)
+ if(H5PTappend(id, (hsize_t)1, testPart) >= 0)
goto out;
- if(H5PTread_packets(id, 0, 1, readBuf) >= 0)
+ if(H5PTread_packets(id, (hsize_t)0, (hsize_t)1, readBuf) >= 0)
goto out;
if(H5PTcreate_index(id) >= 0)
goto out;
@@ -848,7 +849,7 @@ out:
}
-int test_packet_table(hid_t fid)
+static int test_packet_table(hid_t fid)
{
if( test_create_close(fid) < 0 )
diff --git a/hl/test/test_table.c b/hl/test/test_table.c
index e3d248a..95d6a60 100644
--- a/hl/test/test_table.c
+++ b/hl/test/test_table.c
@@ -12,11 +12,11 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "H5TBprivate.h"
-
#include <stdlib.h>
#include <string.h>
#include <assert.h>
+#include "h5hltest.h"
+#include "H5TBpublic.h"
#define TEST_FILE_BE "test_table_be.hdf5"
#define TEST_FILE_LE "test_table_le.hdf5"
@@ -126,7 +126,7 @@ static int compare_deleted(hsize_t rrecords, hsize_t dstart, hsize_t drecords,
*-------------------------------------------------------------------------
*/
-int test_table(hid_t fid, int write)
+static int test_table(hid_t fid, int write)
{
/* identifiers */
hid_t fid1;
@@ -325,7 +325,7 @@ int test_table(hid_t fid, int write)
{ "Name","Longitude","Pressure","Temperature","Latitude" };
hid_t field_type[NFIELDS];
hid_t string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
+ H5Tset_size( string_type, (size_t)16 );
field_type[0] = string_type;
field_type[1] = H5T_NATIVE_LONG;
field_type[2] = H5T_NATIVE_FLOAT;
diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h
index ad60968..535126d 100644
--- a/hl/tools/gif2h5/gif.h
+++ b/hl/tools/gif2h5/gif.h
@@ -161,7 +161,7 @@ int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, BYTE *rmap,
int colorstyle, int BitsPerPixel);
/* WRITEHDF.C */
-int WriteHDF(GIFTOMEM , CHAR * , CHAR *);
+int WriteHDF(GIFTOMEM , CHAR *);
/* Function: ReadHDF
** Return: 0 on completion without error, -1 on error
diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c
index 2863b4b..8627548 100644
--- a/hl/tools/gif2h5/gif2hdf.c
+++ b/hl/tools/gif2h5/gif2hdf.c
@@ -52,8 +52,8 @@ main(int argv , char *argc[])
return(-1);
}
- strncpy(GIFFileName , argc[1] , VSNAMELENMAX - 1);
- strncpy(HDFFileName , argc[2] , VSNAMELENMAX - 1);
+ strncpy(GIFFileName , argc[1] , (size_t)(VSNAMELENMAX - 1));
+ strncpy(HDFFileName , argc[2] , (size_t)(VSNAMELENMAX - 1));
GIFFileName[VSNAMELENMAX - 1] = '\0';
HDFFileName[VSNAMELENMAX - 1] = '\0';
@@ -77,7 +77,7 @@ main(int argv , char *argc[])
exit (-1);
}
- if (fread(MemGif,(size_t)filesize,1,fpGif) != 1) {
+ if (fread(MemGif,(size_t)filesize,(size_t)1,fpGif) != 1) {
printf("Corrupted Input File");
exit(-1);
}
@@ -101,7 +101,7 @@ main(int argv , char *argc[])
* Call WriteHDF from here. Go ahead and change WriteHDF to write whatever
* format you want
*/
- if (WriteHDF(GifMemoryStruct , argc[2] , argc[1]))
+ if (WriteHDF(GifMemoryStruct , argc[2]))
printf("HDF Write Error\n\n");
/* Free all buffers */
diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c
index 5f4aba0..d0ac695 100644
--- a/hl/tools/gif2h5/gifread.c
+++ b/hl/tools/gif2h5/gifread.c
@@ -65,7 +65,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
GifHead->HeaderDump[i] = *(*MemGif2)++;
}
- if (strncmp((const char *)GifHead->HeaderDump , "GIF" , 3)) {
+ if (strncmp((const char *)GifHead->HeaderDump , "GIF" , (size_t)3)) {
printf("The file does not appear to be a valid GIF file.\n");
exit(-1);
}
diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c
index 52e57f7..b3489b6 100644
--- a/hl/tools/gif2h5/hdf2gif.c
+++ b/hl/tools/gif2h5/hdf2gif.c
@@ -113,8 +113,8 @@ int main(int argc , char **argv)
return 0;
}
- memset(image_name_arr , 0 , MAX_NUMBER_IMAGES);
- memset(pal_name_arr , 0 , MAX_NUMBER_IMAGES);
+ memset(image_name_arr , 0 , (size_t)MAX_NUMBER_IMAGES);
+ memset(pal_name_arr , 0 , (size_t)MAX_NUMBER_IMAGES);
HDFName = (CHAR *)malloc (strlen(argv[1]) + 1);
GIFName = (CHAR *)malloc (strlen(argv[2]) + 1);
@@ -310,9 +310,9 @@ int main(int argc , char **argv)
if (idx == 0) {
/* Write out the GIF header and logical screen descriptor */
if (n_images > 1) {
- fwrite("GIF89a", sizeof( char ), 6, fpGif); /* the GIF magic number */
+ fwrite("GIF89a", sizeof( char ), (size_t)6, fpGif); /* the GIF magic number */
} else {
- fwrite("GIF87a", sizeof( char ), 6, fpGif); /* the GIF magic number */
+ fwrite("GIF87a", sizeof( char ), (size_t)6, fpGif); /* the GIF magic number */
}
putword(RWidth, fpGif); /* screen descriptor */
@@ -334,7 +334,7 @@ int main(int argc , char **argv)
fputc(0x21 , fpGif);
fputc(0xFF , fpGif);
fputc(11 , fpGif);
- fwrite("NETSCAPE2.0" , 1 , 11 , fpGif);
+ fwrite("NETSCAPE2.0" , (size_t)1 , (size_t)11 , fpGif);
fputc(3 , fpGif);
fputc(1 , fpGif);
fputc(0 , fpGif);
diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c
index b1b5be5..d4ed991 100644
--- a/hl/tools/gif2h5/hdfgifwr.c
+++ b/hl/tools/gif2h5/hdfgifwr.c
@@ -515,7 +515,7 @@ flush_char(void)
{
if (a_count > 0) {
fputc( a_count, g_outfile );
- fwrite( accum, 1, (size_t)a_count, g_outfile);
+ fwrite( accum, (size_t)1, (size_t)a_count, g_outfile);
a_count = 0;
}
}
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c
index bbd74eb..8d02d7d 100644
--- a/hl/tools/gif2h5/writehdf.c
+++ b/hl/tools/gif2h5/writehdf.c
@@ -34,17 +34,12 @@
*/
int
-WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
+WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
{
GIFHEAD gifHead; /* GIF Header structure */
GIFIMAGEDESC *gifImageDesc; /* Logical Image Descriptor struct */
long ImageCount; /* number of images */
-#ifdef UNUSED
- long CommentCount, /* number of comments */
- ApplicationCount, /* number of application extensions */
- PlainTextCount; /* number of plain text extensions */
-#endif /* UNUSED */
char ImageName[256]; /* Image name for the Image */
@@ -59,11 +54,6 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
/* get some data from gifHead */
ImageCount = gifHead.ImageCount;
-#ifdef UNUSED
- CommentCount = (WORD)gifHead.CommentCount;
- ApplicationCount = (WORD)gifHead.ApplicationCount;
- PlainTextCount = (WORD)gifHead.PlainTextCount;
-#endif /* UNUSED */
if ((file_id = H5Fcreate(HDFName , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT)) < 0) {
/* error occured opening the HDF File for write */