summaryrefslogtreecommitdiffstats
path: root/src/H5S.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-06-21 16:53:39 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-06-21 16:53:39 (GMT)
commit4402923400e705eac6d28f97518bf18c536f6c80 (patch)
treed6e4254a561072885795c0f7881ccddbbfd79895 /src/H5S.c
parent8263f168f703f8a680a49419a0053c384abec4c3 (diff)
downloadhdf5-4402923400e705eac6d28f97518bf18c536f6c80.zip
hdf5-4402923400e705eac6d28f97518bf18c536f6c80.tar.gz
hdf5-4402923400e705eac6d28f97518bf18c536f6c80.tar.bz2
[svn-r4038] Purpose:
Code clean/bug fix Description: H5FL (free-list manager) code currently is taking an hsize_t as the size of a memory block to allocate. On many machines, the size of an hsize_t is greater than the size of a size_t, potentially leading to incorrect memory allocations in rare circumstances. Solution: Changed hsize_t parameters and variables to size_t. Platforms tested: FreeBSD 4.3 (hawkwind)
Diffstat (limited to 'src/H5S.c')
-rw-r--r--src/H5S.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/H5S.c b/src/H5S.c
index 0caf845..3292c17 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -664,13 +664,13 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src)
case H5S_SIMPLE:
if (src->u.simple.size) {
- dst->u.simple.size = H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->u.simple.rank,0);
+ dst->u.simple.size = H5FL_ARR_ALLOC(hsize_t,src->u.simple.rank,0);
for (u = 0; u < src->u.simple.rank; u++) {
dst->u.simple.size[u] = src->u.simple.size[u];
}
}
if (src->u.simple.max) {
- dst->u.simple.max = H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->u.simple.rank,0);
+ dst->u.simple.max = H5FL_ARR_ALLOC(hsize_t,src->u.simple.rank,0);
for (u = 0; u < src->u.simple.rank; u++) {
dst->u.simple.max[u] = src->u.simple.max[u];
}
@@ -1160,7 +1160,7 @@ H5S_read(H5G_entry_t *ent)
ds->select.type=H5S_SEL_ALL;
/* Allocate space for the offset and set it to zeros */
- if (NULL==(ds->select.offset = H5FL_ARR_ALLOC(hssize_t,(hsize_t)ds->extent.u.simple.rank,1))) {
+ if (NULL==(ds->select.offset = H5FL_ARR_ALLOC(hssize_t,ds->extent.u.simple.rank,1))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
}
@@ -1411,7 +1411,7 @@ H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims,
space->select.offset=H5FL_ARR_FREE(hssize_t,space->select.offset);
/* Allocate space for the offset and set it to zeros */
- if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,(hsize_t)rank,1))) {
+ if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,rank,1))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@@ -1446,12 +1446,12 @@ H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims,
/* Set the rank and copy the dims */
space->extent.u.simple.rank = rank;
- space->extent.u.simple.size = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0);
+ space->extent.u.simple.size = H5FL_ARR_ALLOC(hsize_t,rank,0);
HDmemcpy(space->extent.u.simple.size, dims, sizeof(hsize_t) * rank);
/* Copy the maximum dimensions if specified */
if(max!=NULL) {
- space->extent.u.simple.max = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0);
+ space->extent.u.simple.max = H5FL_ARR_ALLOC(hsize_t,rank,0);
HDmemcpy(space->extent.u.simple.max, max, sizeof(hsize_t) * rank);
} /* end if */
}
@@ -1883,7 +1883,7 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset)
/* Allocate space for new offset */
if(space->select.offset==NULL) {
- if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,(hsize_t)space->extent.u.simple.rank,0))) {
+ if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,space->extent.u.simple.rank,0))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}