summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2000-11-28 16:18:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2000-11-28 16:18:42 (GMT)
commit51f5bbc54fae647682f4d6723c5c956053e6195a (patch)
tree0401dd21d85ca75986d222012908ac379a35d15b
parent923c2ecb780c709a210f74d679fc4cdde08fa0d3 (diff)
downloadhdf5-51f5bbc54fae647682f4d6723c5c956053e6195a.zip
hdf5-51f5bbc54fae647682f4d6723c5c956053e6195a.tar.gz
hdf5-51f5bbc54fae647682f4d6723c5c956053e6195a.tar.bz2
[svn-r3008] Purpose:
Code cleanup Description: Several places in the code were using -2 as a default value for various features. However, when a default value is returned from a function that is supposed to return negative on failure, it was causing confusion and extra work for users to check for the special value. Solution: Replaced hard-coded -2 values in the code with symbolic names, then changed symbolic names to 0 instead of -2. Platforms tested: FreeBSD 4.2 (hawkwind)
-rw-r--r--src/H5.c2
-rw-r--r--src/H5D.c2
-rw-r--r--src/H5FDfamily.c4
-rw-r--r--src/H5FDlog.c2
-rw-r--r--src/H5FDpublic.h1
-rw-r--r--src/H5FDsec2.c2
-rw-r--r--src/H5P.c4
-rw-r--r--src/H5Ppublic.h2
-rw-r--r--src/H5Spublic.h2
9 files changed, 11 insertions, 10 deletions
diff --git a/src/H5.c b/src/H5.c
index a74c41c..ad27399 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -1689,7 +1689,7 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
}
} else {
hid_t obj = va_arg (ap, hid_t);
- if (-2 == obj) {
+ if (H5P_DEFAULT == obj) {
fprintf (out, "H5P_DEFAULT");
} else if (obj<0) {
fprintf (out, "FAIL");
diff --git a/src/H5D.c b/src/H5D.c
index 657d0df..719e064 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -94,7 +94,7 @@ H5D_xfer_t H5D_xfer_dflt = {
NULL, /*No information needed for malloc() calls */
NULL, /*Use free() for VL data frees */
NULL, /*No information needed for free() calls */
- -2, /*See H5Pget_driver() */
+ H5FD_VFD_DEFAULT, /*See H5Pget_driver() */
NULL, /*No file driver-specific information yet */
#ifdef COALESCE_READS
0, /*coalesce single reads into a read */
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 5266336..6b6881d 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -597,9 +597,9 @@ H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
{
const H5FD_family_t *f1 = (const H5FD_family_t*)_f1;
const H5FD_family_t *f2 = (const H5FD_family_t*)_f2;
- int ret_value=(-2);
+ int ret_value=(H5FD_VFD_DEFAULT);
- FUNC_ENTER(H5FD_family_cmp, -2);
+ FUNC_ENTER(H5FD_family_cmp, H5FD_VFD_DEFAULT);
assert(f1->nmembs>=1 && f1->memb[0]);
assert(f2->nmembs>=1 && f2->memb[0]);
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 949ae18..8913cf9 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -595,7 +595,7 @@ H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
const H5FD_log_t *f2 = (const H5FD_log_t*)_f2;
int ret_value=0;
- FUNC_ENTER(H5FD_log_cmp, -2);
+ FUNC_ENTER(H5FD_log_cmp, H5FD_VFD_DEFAULT);
#ifdef WIN32
if (f1->fileindexhi < f2->fileindexhi) ret_value= -1;
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index 80c7291..6a0fb59 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -10,6 +10,7 @@
#include <H5public.h>
#define H5_HAVE_VFL 1 /*define a convenient app feature test*/
+#define H5FD_VFD_DEFAULT 0 /* Default VFL driver value */
/*
* Types of allocation requests. The values larger than H5FD_MEM_DEFAULT
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index e53eb16..7674e6d 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -368,7 +368,7 @@ H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
const H5FD_sec2_t *f2 = (const H5FD_sec2_t*)_f2;
int ret_value=0;
- FUNC_ENTER(H5FD_sec2_cmp, -2);
+ FUNC_ENTER(H5FD_sec2_cmp, H5FD_VFD_DEFAULT);
#ifdef WIN32
if (f1->fileindexhi < f2->fileindexhi) ret_value= -1;
diff --git a/src/H5P.c b/src/H5P.c
index 63537f0..f88ec60 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -1847,7 +1847,7 @@ H5Pget_driver(hid_t plist_id)
* Rewritten to use the virtual file layer.
*
* Robb Matzke, 1999-08-05
- * If the driver ID is -2 then substitute the current value of
+ * If the driver ID is H5FD_VFD_DEFAULT then substitute the current value of
* H5FD_SEC2.
*-------------------------------------------------------------------------
*/
@@ -1874,7 +1874,7 @@ H5Pget_driver(hid_t plist_id)
"not a file access or data transfer property list");
}
- if (H5P_DEFAULT==ret_value)
+ if (H5FD_VFD_DEFAULT==ret_value)
ret_value = H5FD_SEC2;
FUNC_LEAVE(ret_value);
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 46e74a6..072be5e 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -18,7 +18,7 @@
#define _H5Ppublic_H
/* Default Template for creation, access, etc. templates */
-#define H5P_DEFAULT (-2)
+#define H5P_DEFAULT 0
/* Public headers needed by this file */
#include <H5public.h>
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index f7aa805..2f2b740 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -21,7 +21,7 @@
#include <H5Ipublic.h>
/* Define atomic datatypes */
-#define H5S_ALL (-2)
+#define H5S_ALL 0
#define H5S_UNLIMITED ((hsize_t)(hssize_t)(-1))
/* Define user-level maximum number of dimensions */