summaryrefslogtreecommitdiffstats
path: root/src/H5Fprivate.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-07-26 19:33:59 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-07-26 19:33:59 (GMT)
commit7143164de9d7de52516697bbb6bfc7cd2cf749d6 (patch)
tree107977d9f4732e672d5690072a2e85d82e1ebf28 /src/H5Fprivate.h
parent74e00605264ffb2b782b4f28be15accc7784217c (diff)
downloadhdf5-7143164de9d7de52516697bbb6bfc7cd2cf749d6.zip
hdf5-7143164de9d7de52516697bbb6bfc7cd2cf749d6.tar.gz
hdf5-7143164de9d7de52516697bbb6bfc7cd2cf749d6.tar.bz2
[svn-r22608] Description:
Switch propert list/class iteration from internal to external form of iteration, cleaning up and simplifying the code a bit. Bring other general improvements from plist_encode_decode branch back to trunk. Clean up many warnings. Tested on: Mac OSX/64 10.7.4 (amazon) w/gcc 4.7, debug and C++ & FORTRAN (too minor to require h5committest)
Diffstat (limited to 'src/H5Fprivate.h')
-rw-r--r--src/H5Fprivate.h44
1 files changed, 15 insertions, 29 deletions
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 40e075b..7c6fae8 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -70,10 +70,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
*(p) = (uint8_t)(((i) >> 24) & 0xff); (p)++; \
}
-/* Encode a 32-bit unsigned integer into a variable-sized buffer */
+/* Encode an unsigned integer into a variable-sized buffer */
/* (Assumes that the high bits of the integer are zero) */
-# define UINT32ENCODE_VAR(p, n, l) { \
- uint32_t _n = (n); \
+# define ENCODE_VAR(p, typ, n, l) { \
+ typ _n = (n); \
size_t _i; \
uint8_t *_p = (uint8_t*)(p); \
\
@@ -82,6 +82,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
(p) = (uint8_t*)(p) + l; \
}
+/* Encode a 32-bit unsigned integer into a variable-sized buffer */
+/* (Assumes that the high bits of the integer are zero) */
+# define UINT32ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint32_t, n, l)
+
# define INT64ENCODE(p, n) { \
int64_t _n = (n); \
size_t _i; \
@@ -108,15 +112,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
/* Encode a 64-bit unsigned integer into a variable-sized buffer */
/* (Assumes that the high bits of the integer are zero) */
-# define UINT64ENCODE_VAR(p, n, l) { \
- uint64_t _n = (n); \
- size_t _i; \
- uint8_t *_p = (uint8_t*)(p); \
- \
- for(_i = 0; _i < l; _i++, _n >>= 8) \
- *_p++ = (uint8_t)(_n & 0xff); \
- (p) = (uint8_t*)(p) + l; \
-}
+# define UINT64ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint64_t, n, l)
/* DECODE converts little endian bytes pointed by p to integer values and store
* it in i. For signed values, need to do sign-extension when converting
@@ -152,12 +148,9 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
(i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \
}
-/* Decode a variable-sized buffer into a 32-bit unsigned integer */
+/* Decode a variable-sized buffer */
/* (Assumes that the high bits of the integer will be zero) */
-/* (Note: this is exactly the same code as the 64-bit variable-length decoder
- * and bugs/improvements should be make in both places - QAK)
- */
-# define UINT32DECODE_VAR(p, n, l) { \
+# define DECODE_VAR(p, n, l) { \
size_t _i; \
\
n = 0; \
@@ -167,6 +160,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
(p) += l; \
}
+/* Decode a variable-sized buffer into a 32-bit unsigned integer */
+/* (Assumes that the high bits of the integer will be zero) */
+# define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, n, l)
+
# define INT64DECODE(p, n) { \
/* WE DON'T CHECK FOR OVERFLOW! */ \
size_t _i; \
@@ -191,18 +188,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
/* Decode a variable-sized buffer into a 64-bit unsigned integer */
/* (Assumes that the high bits of the integer will be zero) */
-/* (Note: this is exactly the same code as the 32-bit variable-length decoder
- * and bugs/improvements should be make in both places - QAK)
- */
-# define UINT64DECODE_VAR(p, n, l) { \
- size_t _i; \
- \
- n = 0; \
- (p) += l; \
- for (_i = 0; _i < l; _i++) \
- n = (n << 8) | *(--p); \
- (p) += l; \
-}
+# define UINT64DECODE_VAR(p, n, l) DECODE_VAR(p, n, l)
/* Address-related macros */
#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \