summaryrefslogtreecommitdiffstats
path: root/src/H5Tconv.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-08-20 17:26:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-08-20 17:26:13 (GMT)
commit0d18eda03f0986668261771c58c435f0c6488a28 (patch)
tree72b4dfa1a2b51eacb02772ef6b4184c769483c7b /src/H5Tconv.c
parent45d515096004c89043f2a3f0e500cb2db01a1796 (diff)
downloadhdf5-0d18eda03f0986668261771c58c435f0c6488a28.zip
hdf5-0d18eda03f0986668261771c58c435f0c6488a28.tar.gz
hdf5-0d18eda03f0986668261771c58c435f0c6488a28.tar.bz2
[svn-r4394] Purpose:
Bug Fix Description: Byte swapping routine was failing when attempting to convert 0 elements. Solution: Don't try to swap when there are no elements... :-) Platforms tested: Solaris 2.7 (arabica)
Diffstat (limited to 'src/H5Tconv.c')
-rw-r--r--src/H5Tconv.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index f7cfc20..014f55f 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -538,9 +538,10 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
}
md = src->size / 2;
- buf_stride = buf_stride ? buf_stride : src->size;
+ buf_stride = buf_stride ? buf_stride : src->size;
- /* Optimize for popular sizes */
+ /* Optimize for popular sizes */
+ if(nelmts>0) {
switch(md) {
case 1: /* Swap 2-byte objects */
#ifdef NO_DUFFS_DEVICE
@@ -551,10 +552,10 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
buf[1] = tmp;
}
#else /* NO_DUFFS_DEVICE */
-{
+ {
size_t duff_count = (nelmts + 7) / 8;
- switch (nelmts % 8)
+ switch ((long)(nelmts % 8))
{
case 0:
do
@@ -609,7 +610,7 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
}
while (--duff_count > 0);
}
-}
+ }
#endif /* NO_DUFFS_DEVICE */
break;
@@ -627,10 +628,10 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
buf[2] = tmp;
}
#else /* NO_DUFFS_DEVICE */
-{
+ {
size_t duff_count = (nelmts + 7) / 8;
- switch (nelmts % 8)
+ switch ((long)(nelmts % 8))
{
case 0:
do
@@ -741,7 +742,7 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
}
while (--duff_count > 0);
}
-}
+ }
#endif /* NO_DUFFS_DEVICE */
break;
@@ -769,10 +770,10 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
buf[4] = tmp;
}
#else /* NO_DUFFS_DEVICE */
-{
+ {
size_t duff_count = (nelmts + 7) / 8;
- switch (nelmts % 8)
+ switch ((long)(nelmts % 8))
{
case 0:
do
@@ -963,7 +964,7 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
}
while (--duff_count > 0);
}
-}
+ }
#endif /* NO_DUFFS_DEVICE */
break;
@@ -977,10 +978,10 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
}
}
#else /* NO_DUFFS_DEVICE */
-{
+ {
size_t duff_count = (nelmts + 7) / 8;
- switch (nelmts % 8)
+ switch ((long)(nelmts % 8))
{
case 0:
do
@@ -1067,10 +1068,11 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
}
while (--duff_count > 0);
}
-}
+ }
#endif /* NO_DUFFS_DEVICE */
break;
} /* end switch */
+ } /* end if */
break;
case H5T_CONV_FREE: