summaryrefslogtreecommitdiffstats
path: root/hl/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-04-29 06:20:50 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-04-29 06:20:50 (GMT)
commitcc5b2ff93bc5b81993c104e64f3669a4d8f0c0a5 (patch)
tree67198d5997628d5a6640a7862ec5c96794e97244 /hl/src
parent27496ae0c7b8b1be7165d3720711b15c3a2d1288 (diff)
downloadhdf5-cc5b2ff93bc5b81993c104e64f3669a4d8f0c0a5.zip
hdf5-cc5b2ff93bc5b81993c104e64f3669a4d8f0c0a5.tar.gz
hdf5-cc5b2ff93bc5b81993c104e64f3669a4d8f0c0a5.tar.bz2
[svn-r12314] Purpose:
Code cleanup Description: Big clean up on high-level library code, including: - Removing include of HDF5 private header file(!) - Reduce number of compiler warnings - Untangle header files, etc. Platforms tested: FreeBSD 4.11 (sleipnir) w/C++ Linux 2.4/64 (mir) w/C++ & FORTRAN
Diffstat (limited to 'hl/src')
-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
14 files changed, 179 insertions, 159 deletions
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,