summaryrefslogtreecommitdiffstats
path: root/src/H5FDsec2.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-01-09 21:22:30 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-01-09 21:22:30 (GMT)
commit35bc545296209684a5c46db0cde11beb9403a4dc (patch)
tree98b5a037ed928085b98abc1fee71fc62f81073c1 /src/H5FDsec2.c
parent1290c4808d3e9890c765b1445f66b823c9026734 (diff)
downloadhdf5-35bc545296209684a5c46db0cde11beb9403a4dc.zip
hdf5-35bc545296209684a5c46db0cde11beb9403a4dc.tar.gz
hdf5-35bc545296209684a5c46db0cde11beb9403a4dc.tar.bz2
[svn-r3252] Purpose:
Code cleanup. Description: Fixed _lots_ (I mean _tons_) of warnings spit out by the gcc with the extra warnings. Including a few show-stoppers for compression on IRIX machines. Solution: Changed lots of variables' types to more sensible and consistent types, more range-checking, more variable typecasts, etc. Platforms tested: FreeBSD 4.2 (hawkwind), IRIX64-64 (modi4)
Diffstat (limited to 'src/H5FDsec2.c')
-rw-r--r--src/H5FDsec2.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index bc21fd4..2d29c0c 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -264,7 +264,7 @@ static H5FD_t *
H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
haddr_t maxaddr)
{
- unsigned o_flags;
+ int o_flags;
int fd;
struct stat sb;
H5FD_sec2_t *file=NULL;
@@ -579,9 +579,10 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
* and the end of the file.
*/
while (size>0) {
- do
- nbytes = read(file->fd, buf, size);
- while (-1==nbytes && EINTR==errno);
+ do {
+ assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
+ nbytes = HDread(file->fd, buf, (size_t)size);
+ } while (-1==nbytes && EINTR==errno);
if (-1==nbytes) {
/* error */
file->pos = HADDR_UNDEF;
@@ -590,7 +591,8 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
}
if (0==nbytes) {
/* end of file but not end of format address space */
- memset(buf, 0, size);
+ assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
+ HDmemset(buf, 0, (size_t)size);
size = 0;
}
assert(nbytes>=0);
@@ -659,9 +661,10 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
* results
*/
while (size>0) {
- do
- nbytes = write(file->fd, buf, size);
- while (-1==nbytes && EINTR==errno);
+ do {
+ assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
+ nbytes = HDwrite(file->fd, buf, (size_t)size);
+ } while (-1==nbytes && EINTR==errno);
if (-1==nbytes) {
/* error */
file->pos = HADDR_UNDEF;