From 84bf19bec42e2c53114727df2e239aa3fecb1071 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 16 Oct 2006 17:53:56 -0500 Subject: [svn-r12767] Description: Code cleanup to improve formatting & reduce compiler warnings. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2) --- src/H5FDstream.c | 10 +++++----- src/H5Ocont.c | 14 ++++++++------ src/H5S.c | 2 +- src/H5T.c | 4 ++-- test/tattr.c | 6 +++--- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/H5FDstream.c b/src/H5FDstream.c index 7c53b0a..70ce836 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -486,18 +486,18 @@ H5FD_stream_open_socket (const char *filename, int o_flags, fprintf (stderr, "Stream VFD: connecting to host '%s' port %d\n", hostname, fapl->port); #endif - if (connect (sock, (struct sockaddr *) &server, sizeof (server)) < 0) + if (connect (sock, (struct sockaddr *) &server, (socklen_t)sizeof (server)) < 0) HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to connect") } else { server.sin_addr.s_addr = INADDR_ANY; - if (H5FD_STREAM_IOCTL_SOCKET (sock, FIONBIO, &on) < 0) { + if (H5FD_STREAM_IOCTL_SOCKET (sock, (int)FIONBIO, &on) < 0) { HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set non-blocking mode for socket") } else if (setsockopt (sock, IPPROTO_TCP, TCP_NODELAY, (const char *) &on, - sizeof(on)) < 0) { + (socklen_t)sizeof(on)) < 0) { HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set socket option TCP_NODELAY") } else if (setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, - sizeof(on)) < 0) { + (socklen_t)sizeof(on)) < 0) { HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set socket option SO_REUSEADDR") } else { /* Try to bind the socket to the given port. @@ -775,7 +775,7 @@ H5FD_stream_flush (H5FD_t *_stream, hid_t UNUSED dxpl_id, unsigned UNUSED closin fromlen = sizeof (from); while (! H5FD_STREAM_ERROR_CHECK (sock = accept (stream->socket, &from, &fromlen))) { - if (H5FD_STREAM_IOCTL_SOCKET (sock, FIONBIO, &on) < 0) { + if (H5FD_STREAM_IOCTL_SOCKET (sock, (int)FIONBIO, &on) < 0) { H5FD_STREAM_CLOSE_SOCKET (sock); continue; /* continue the loop for other clients to connect */ } diff --git a/src/H5Ocont.c b/src/H5Ocont.c index 13a9d47..4d84b1c 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -135,19 +135,21 @@ H5O_cont_encode(H5F_t *f, uint8_t *p, const void *_mesg) { const H5O_cont_t *cont = (const H5O_cont_t *) _mesg; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_cont_encode); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_cont_encode) /* check args */ - assert(f); - assert(p); - assert(cont); + HDassert(f); + HDassert(p); + HDassert(cont); + HDassert(H5F_addr_defined(cont->addr)); + HDassert(cont->size > 0); /* encode */ H5F_addr_encode(f, &p, cont->addr); H5F_ENCODE_LENGTH(f, p, cont->size); - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5O_cont_encode() */ /*------------------------------------------------------------------------- diff --git a/src/H5S.c b/src/H5S.c index 6c52b9e..1ea2f21 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -1720,7 +1720,7 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc) FUNC_ENTER_NOAPI(H5S_encode, FAIL) /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc(0))) + if(NULL == (f = H5F_fake_alloc((size_t)0))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed for extent */ diff --git a/src/H5T.c b/src/H5T.c index aebeb57..4782b37 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -2854,7 +2854,7 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc) FUNC_ENTER_NOAPI(H5T_encode, FAIL) /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc(0))) + if(NULL == (f = H5F_fake_alloc((size_t)0))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed */ @@ -2910,7 +2910,7 @@ H5T_decode(const unsigned char *buf) FUNC_ENTER_NOAPI(H5T_decode, NULL) /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc(0))) + if(NULL == (f = H5F_fake_alloc((size_t)0))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") /* Decode the type of the information */ diff --git a/test/tattr.c b/test/tattr.c index a6e56a9..ed60126 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -1643,7 +1643,7 @@ test_attr_dtype_shared(hid_t fapl) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.nlink, 3, "H5Aopen_name"); + VERIFY(statbuf.nlink, 3, "H5Gget_objinfo"); /* Unlink the dataset */ ret=H5Gunlink(file_id,DSET1_NAME); @@ -1652,7 +1652,7 @@ test_attr_dtype_shared(hid_t fapl) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.nlink, 1, "H5Gunlink"); + VERIFY(statbuf.nlink, 1, "H5Gget_objinfo"); /* Unlink the named datatype */ ret=H5Gunlink(file_id,TYPE1_NAME); @@ -1664,7 +1664,7 @@ test_attr_dtype_shared(hid_t fapl) /* Check size of file */ filesize=h5_get_file_size(FILENAME); - VERIFY(filesize, empty_filesize, "H5Fclose"); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dtype_shared() */ /**************************************************************** -- cgit v0.12