summaryrefslogtreecommitdiffstats
path: root/src/H5FDcore.c
diff options
context:
space:
mode:
authorMuQun Yang <ymuqun@hdfgroup.org>2002-05-02 18:56:32 (GMT)
committerMuQun Yang <ymuqun@hdfgroup.org>2002-05-02 18:56:32 (GMT)
commit84d5daad4faa490f541aa87aa2b8ce8dd047cfce (patch)
treecf90fe5db2f277c54503554281d43240621c89ae /src/H5FDcore.c
parent5979d5776fe92998fe07768aa070c76f75459324 (diff)
downloadhdf5-84d5daad4faa490f541aa87aa2b8ce8dd047cfce.zip
hdf5-84d5daad4faa490f541aa87aa2b8ce8dd047cfce.tar.gz
hdf5-84d5daad4faa490f541aa87aa2b8ce8dd047cfce.tar.bz2
[svn-r5326]
Purpose: code clean-up Description: Many warnings are generated on windows due to seemingly large-size data type converting to small-size data type, 1.5 branch has been cleaned up, make 1.4 catch up with 1.5. Solution: If meeting with the break-up of the current tests on other platforms, will resume the previous one Platforms tested: windows 2000, linux 2.2.18
Diffstat (limited to 'src/H5FDcore.c')
-rw-r--r--src/H5FDcore.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 909275c..15bb866 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -365,7 +365,7 @@ H5FD_core_flush(H5FD_t *_file)
while (size) {
ssize_t n;
- assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
+ H5_CHECK_OVERFLOW(size,hsize_t,size_t);/*check for overflow*/
n = HDwrite(file->fd, ptr, (size_t)size);
if (n<0 && EINTR==errno) continue;
if (n<0)
@@ -596,10 +596,19 @@ H5FD_core_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
/* Read the part which is before the EOF marker */
if (addr < file->eof) {
- hsize_t nbytes = MIN(size, file->eof-addr);
-
- assert(nbytes==(hsize_t)((size_t)nbytes)); /*check for overflow*/
- HDmemcpy(buf, file->mem + addr, (size_t)nbytes);
+ size_t nbytes;
+#ifndef NDEBUG
+ hsize_t temp_nbytes;
+
+ temp_nbytes = file->eof-addr;
+ H5_CHECK_OVERFLOW(temp_nbytes,hsize_t,size_t);
+ nbytes = MIN(size,(size_t)temp_nbytes);
+#else /* NDEBUG */
+ nbytes = MIN(size,(size_t)(file->eof-addr));
+#endif /* NDEBUG */
+
+
+ HDmemcpy(buf, file->mem + addr, nbytes);
size -= nbytes;
addr += nbytes;
buf = (char *)buf + nbytes;
@@ -658,8 +667,10 @@ H5FD_core_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
*/
if (addr+size>file->eof) {
unsigned char *x;
- size_t new_eof = file->increment * ((addr+size)/file->increment);
+ size_t new_eof;
+ H5_ASSIGN_OVERFLOW(new_eof,file->increment*((addr+size)/file->increment),hsize_t,size_t);
+
if ((addr+size) % file->increment) new_eof += file->increment;
if (NULL==file->mem) x = H5MM_malloc(new_eof);
else x = H5MM_realloc(file->mem, new_eof);