summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1999-02-15 17:38:04 (GMT)
committerRobb Matzke <matzke@llnl.gov>1999-02-15 17:38:04 (GMT)
commitc22bac0d207abbdd81123c35681f0558f75de488 (patch)
tree98db51d9303724a07f13558a7490881e89c6e6ad /src/H5T.c
parentf6272d42929093a81aa2da79f150333793de49e0 (diff)
downloadhdf5-c22bac0d207abbdd81123c35681f0558f75de488.zip
hdf5-c22bac0d207abbdd81123c35681f0558f75de488.tar.gz
hdf5-c22bac0d207abbdd81123c35681f0558f75de488.tar.bz2
[svn-r1065] Changes since 19990121
---------------------- ./configure.in ./acconfig.h ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5public.h ./src/H5Omtime.c Check for <stddef.h> Checks for `__tm_gmtoff' in `struct tm' because old versions of GNU libc are different than recent versions. This fixes the failing mtime test. ./bin/config.guess ./config/freebsd2.2.7 [REMOVED] ./config/freebsd [ADDED] Changed the name so it works with all versions of FreeBSD. ./src/H5.c Moved H5F after H5T and H5G in H5_term_library() to satisfy dependencies. ./src/H5G.c Fixed a bug that caused H5Gcreate() to fail if the group name had trailing slashes. ./src/H5Gpublic.h Changed `group_name' to `name' in a prototype. ./src/Makefile.in Dynamic library on Linux, but needs for work to be generally useful. ./src/H5HG.c ./src/H5HGprivate.h Fixed alignment problems when using old GCC compilers (like the one shipped with RedHad Linux). ./tools/h5ls.c Fixed a bug where the contents of the root group could be listed twice if there was a link back to the root group. Similarly for groups that are mentioned on the command line. Fixed a bug where unknown types were printed with a random type class number. ./src/H5T.c ./src/H5Tconv.c ./src/H5Tprivate.h Fixed O(log N) conversion bugs.
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/H5T.c b/src/H5T.c
index c1d518a..097e33c 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -5075,7 +5075,7 @@ H5T_pack(H5T_t *dt)
}
/* Remove padding between members */
- H5T_sort_value(dt);
+ H5T_sort_value(dt, NULL);
for (i=0, offset=0; i<dt->u.compnd.nmembs; i++) {
dt->u.compnd.memb[i].offset = offset;
offset += dt->u.compnd.memb[i].size;
@@ -5095,7 +5095,8 @@ H5T_pack(H5T_t *dt)
* Purpose: Sorts the members of a compound data type by their offsets;
* sorts the members of an enum type by their values. This even
* works for locked data types since it doesn't change the value
- * of the type.
+ * of the type. MAP is an optional parallel integer array which
+ * is also swapped along with members of DT.
*
* Return: Non-negative on success/Negative on failure
*
@@ -5107,7 +5108,7 @@ H5T_pack(H5T_t *dt)
*-------------------------------------------------------------------------
*/
herr_t
-H5T_sort_value(H5T_t *dt)
+H5T_sort_value(H5T_t *dt, int *map)
{
int i, j, nmembs;
size_t size;
@@ -5132,6 +5133,11 @@ H5T_sort_value(H5T_t *dt)
H5T_cmemb_t tmp = dt->u.compnd.memb[j];
dt->u.compnd.memb[j] = dt->u.compnd.memb[j+1];
dt->u.compnd.memb[j+1] = tmp;
+ if (map) {
+ int x = map[j];
+ map[j] = map[j+1];
+ map[j+1] = x;
+ }
swapped = TRUE;
}
}
@@ -5166,6 +5172,13 @@ H5T_sort_value(H5T_t *dt)
dt->u.enumer.value+(j+1)*size, size);
HDmemcpy(dt->u.enumer.value+(j+1)*size, tbuf, size);
+ /* Swap map */
+ if (map) {
+ int x = map[j];
+ map[j] = map[j+1];
+ map[j+1] = x;
+ }
+
swapped = TRUE;
}
}
@@ -5204,7 +5217,7 @@ H5T_sort_value(H5T_t *dt)
*-------------------------------------------------------------------------
*/
herr_t
-H5T_sort_name(H5T_t *dt)
+H5T_sort_name(H5T_t *dt, int *map)
{
int i, j, nmembs;
size_t size;
@@ -5230,6 +5243,11 @@ H5T_sort_name(H5T_t *dt)
dt->u.compnd.memb[j] = dt->u.compnd.memb[j+1];
dt->u.compnd.memb[j+1] = tmp;
swapped = TRUE;
+ if (map) {
+ int x = map[j];
+ map[j] = map[j+1];
+ map[j+1] = x;
+ }
}
}
}
@@ -5261,7 +5279,14 @@ H5T_sort_name(H5T_t *dt)
HDmemcpy(dt->u.enumer.value+j*size,
dt->u.enumer.value+(j+1)*size, size);
HDmemcpy(dt->u.enumer.value+(j+1)*size, tbuf, size);
-
+
+ /* Swap map */
+ if (map) {
+ int x = map[j];
+ map[j] = map[j+1];
+ map[j+1] = x;
+ }
+
swapped = TRUE;
}
}
@@ -5390,7 +5415,7 @@ H5T_enum_nameof(H5T_t *dt, void *value, char *name/*out*/, size_t size)
if (name && size>0) *name = '\0';
/* Do a binary search over the values to find the correct one */
- H5T_sort_value(dt);
+ H5T_sort_value(dt, NULL);
lt = 0;
rt = dt->u.enumer.nmembs;
md = -1;
@@ -5458,7 +5483,7 @@ H5T_enum_valueof(H5T_t *dt, const char *name, void *value/*out*/)
assert(value);
/* Do a binary search over the names to find the correct one */
- H5T_sort_name(dt);
+ H5T_sort_name(dt, NULL);
lt = 0;
rt = dt->u.enumer.nmembs;
md = -1;