summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2002-05-18 07:24:49 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2002-05-18 07:24:49 (GMT)
commite12beea6244555171693821481db5c31e1090e0e (patch)
tree064f594deee24044cb75835b9f2195d40583b1c7
parent79dcc353099b4b599470729e11eb775109aa6b7d (diff)
downloadhdf5-e12beea6244555171693821481db5c31e1090e0e.zip
hdf5-e12beea6244555171693821481db5c31e1090e0e.tar.gz
hdf5-e12beea6244555171693821481db5c31e1090e0e.tar.bz2
[svn-r5437]
Purpose: eliminate warnings on win32 Description: some conversion warnings were being issued Solution: added some type casts Platforms tested: w2000, linux changed the HDmemset to include a cast in win32; this was just to eliminate a compiler warning. probably the macro can also be used in unix #ifdef WIN32 #define HDmemset(X,C,Z) memset((void*)(X),C,Z) #else /* WIN32 */ #define HDmemset(X,C,Z) memset(X,C,Z) #endif /* WIN32 */ the list of previous warnings was D:\disk_w\hdf5\src\H5FDstdio.c(659) : warning C4244: 'initializing' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Fcontig.c(435) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Fcontig.c(497) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Fcontig.c(915) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Fcontig.c(982) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Shyper.c(912) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Shyper.c(995) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Shyper.c(1936) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Shyper.c(2019) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Shyper.c(2862) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Shyper.c(2864) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Shyper.c(2948) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Shyper.c(3690) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Shyper.c(3692) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Shyper.c(3776) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Shyper.c(5167) : warning C4244: '+=' : conversion from '__int64 ' to 'unsigned int ', possible loss of data D:\disk_w\hdf5\src\H5Tvlen.c(371) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned int ', possible loss of data
-rw-r--r--src/H5.c2
-rw-r--r--src/H5Dcontig.c8
-rw-r--r--src/H5FDstdio.c2
-rw-r--r--src/H5Fcontig.c8
-rw-r--r--src/H5Shyper.c26
-rw-r--r--src/H5Tvlen.c2
-rw-r--r--src/H5private.h7
7 files changed, 33 insertions, 22 deletions
diff --git a/src/H5.c b/src/H5.c
index 1fefa4f..47dd553 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -907,7 +907,7 @@ HDfprintf (FILE *stream, const char *fmt, ...)
case 'g':
case 'G':
if (!HDstrcmp (modifier, "h")) {
- float x = va_arg (ap, double);
+ float x = (float) va_arg (ap, double);
n = fprintf (stream, format_templ, x);
} else if (!*modifier || !HDstrcmp (modifier, "l")) {
double x = va_arg (ap, double);
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index b879c78..301aae9 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -432,7 +432,7 @@ H5F_contig_readv(H5F_t *f, hsize_t _max_data, H5FD_mem_t type, haddr_t _addr,
/* Compute the size of the sieve buffer */
/* Don't read off the end of the file, don't read past the end of the data element and don't read more than the buffer size */
- f->shared->sieve_size=MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
+ f->shared->sieve_size=(size_t)MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
/* Update local copies of sieve information */
sieve_start=f->shared->sieve_loc;
@@ -494,7 +494,7 @@ H5F_contig_readv(H5F_t *f, hsize_t _max_data, H5FD_mem_t type, haddr_t _addr,
rel_eoa=abs_eoa-f->shared->base_addr;
/* Compute the size of the sieve buffer */
- f->shared->sieve_size=MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
+ f->shared->sieve_size=(size_t)MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
/* Read the new sieve buffer */
if (H5F_block_read(f, type, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
@@ -912,7 +912,7 @@ H5F_contig_writev(H5F_t *f, hsize_t _max_data, H5FD_mem_t type, haddr_t _addr,
/* Compute the size of the sieve buffer */
/* Don't read off the end of the file, don't read past the end of the data element and don't read more than the buffer size */
- f->shared->sieve_size=MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
+ f->shared->sieve_size=(size_t)MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
/* Update local copies of sieve information */
sieve_start=f->shared->sieve_loc;
@@ -979,7 +979,7 @@ H5F_contig_writev(H5F_t *f, hsize_t _max_data, H5FD_mem_t type, haddr_t _addr,
rel_eoa=abs_eoa-f->shared->base_addr;
/* Compute the size of the sieve buffer */
- f->shared->sieve_size=MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
+ f->shared->sieve_size=(size_t)MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
/* Check if there is any point in reading the data from the file */
if(f->shared->sieve_size>size) {
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 4085de7..1689b4f 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -656,7 +656,7 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
* Read zeros past the logical end of file (physical is handled below)
*/
if ((size_t) addr + size > file->eof) {
- size_t nbytes = (size_t) addr + size - file->eof;
+ size_t nbytes = (size_t) (addr + size - file->eof);
memset((unsigned char *)buf + size - nbytes, 0, nbytes);
size -= nbytes;
}
diff --git a/src/H5Fcontig.c b/src/H5Fcontig.c
index b879c78..301aae9 100644
--- a/src/H5Fcontig.c
+++ b/src/H5Fcontig.c
@@ -432,7 +432,7 @@ H5F_contig_readv(H5F_t *f, hsize_t _max_data, H5FD_mem_t type, haddr_t _addr,
/* Compute the size of the sieve buffer */
/* Don't read off the end of the file, don't read past the end of the data element and don't read more than the buffer size */
- f->shared->sieve_size=MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
+ f->shared->sieve_size=(size_t)MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
/* Update local copies of sieve information */
sieve_start=f->shared->sieve_loc;
@@ -494,7 +494,7 @@ H5F_contig_readv(H5F_t *f, hsize_t _max_data, H5FD_mem_t type, haddr_t _addr,
rel_eoa=abs_eoa-f->shared->base_addr;
/* Compute the size of the sieve buffer */
- f->shared->sieve_size=MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
+ f->shared->sieve_size=(size_t)MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
/* Read the new sieve buffer */
if (H5F_block_read(f, type, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
@@ -912,7 +912,7 @@ H5F_contig_writev(H5F_t *f, hsize_t _max_data, H5FD_mem_t type, haddr_t _addr,
/* Compute the size of the sieve buffer */
/* Don't read off the end of the file, don't read past the end of the data element and don't read more than the buffer size */
- f->shared->sieve_size=MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
+ f->shared->sieve_size=(size_t)MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
/* Update local copies of sieve information */
sieve_start=f->shared->sieve_loc;
@@ -979,7 +979,7 @@ H5F_contig_writev(H5F_t *f, hsize_t _max_data, H5FD_mem_t type, haddr_t _addr,
rel_eoa=abs_eoa-f->shared->base_addr;
/* Compute the size of the sieve buffer */
- f->shared->sieve_size=MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
+ f->shared->sieve_size=(size_t)MIN(rel_eoa-f->shared->sieve_loc,MIN(max_data,f->shared->sieve_buf_size));
/* Check if there is any point in reading the data from the file */
if(f->shared->sieve_size>size) {
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 915764d..663817e 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -909,7 +909,7 @@ H5S_hyper_fread_opt (H5F_t *f, const struct H5O_layout_t *layout,
leftover=file_space->select.sel_info.hslab.diminfo[fast_dim].block-((file_iter->hyp.off[fast_dim]-file_space->select.sel_info.hslab.diminfo[fast_dim].start)%file_space->select.sel_info.hslab.diminfo[fast_dim].stride);
/* Make certain that we don't read too many */
- actual_read=MIN(leftover,io_left);
+ actual_read=(size_t)MIN(leftover,io_left);
actual_bytes=actual_read*elmt_size;
/* Copy the location of the point to get */
@@ -992,7 +992,7 @@ H5S_hyper_fread_opt (H5F_t *f, const struct H5O_layout_t *layout,
fast_dim_offset=fast_dim_start+file_space->select.offset[fast_dim];
/* Compute the number of blocks which would fit into the buffer */
- tot_blk_count=io_left/fast_dim_block;
+ tot_blk_count=(size_t)io_left/(size_t)fast_dim_block;
/* Compute the amount to wrap at the end of each row */
for(i=0; i<ndims; i++)
@@ -1933,7 +1933,7 @@ H5S_hyper_fwrite_opt (H5F_t *f, const struct H5O_layout_t *layout,
leftover=file_space->select.sel_info.hslab.diminfo[fast_dim].block-((file_iter->hyp.off[fast_dim]-file_space->select.sel_info.hslab.diminfo[fast_dim].start)%file_space->select.sel_info.hslab.diminfo[fast_dim].stride);
/* Make certain that we don't write too many */
- actual_write=MIN(leftover,io_left);
+ actual_write=(size_t)MIN(leftover,io_left);
actual_bytes=actual_write*elmt_size;
/* Copy the location of the point to get */
@@ -2016,7 +2016,7 @@ H5S_hyper_fwrite_opt (H5F_t *f, const struct H5O_layout_t *layout,
fast_dim_offset=fast_dim_start+file_space->select.offset[fast_dim];
/* Compute the number of blocks which would fit into the buffer */
- tot_blk_count=io_left/fast_dim_block;
+ tot_blk_count=(size_t)io_left/(size_t)fast_dim_block;
/* Compute the amount to wrap at the end of each row */
for(i=0; i<ndims; i++)
@@ -2859,9 +2859,11 @@ H5S_hyper_mread_opt (const void *_buf, size_t elmt_size,
/* Calculate the number of elements left in the sequence */
if(mem_space->select.sel_info.hslab.diminfo[fast_dim].stride==1)
- leftover=mem_space->select.sel_info.hslab.diminfo[fast_dim].block-(mem_iter->hyp.off[fast_dim]-mem_space->select.sel_info.hslab.diminfo[fast_dim].start);
+ leftover=(size_t)mem_space->select.sel_info.hslab.diminfo[fast_dim].block
+ -(size_t)(mem_iter->hyp.off[fast_dim]-mem_space->select.sel_info.hslab.diminfo[fast_dim].start);
else
- leftover=mem_space->select.sel_info.hslab.diminfo[fast_dim].block-((mem_iter->hyp.off[fast_dim]-mem_space->select.sel_info.hslab.diminfo[fast_dim].start)%mem_space->select.sel_info.hslab.diminfo[fast_dim].stride);
+ leftover=(size_t)mem_space->select.sel_info.hslab.diminfo[fast_dim].block
+ -(size_t)((mem_iter->hyp.off[fast_dim]-mem_space->select.sel_info.hslab.diminfo[fast_dim].start)%mem_space->select.sel_info.hslab.diminfo[fast_dim].stride);
/* Make certain that we don't write too many */
actual_read=MIN(leftover,io_left);
@@ -2945,7 +2947,7 @@ H5S_hyper_mread_opt (const void *_buf, size_t elmt_size,
fast_dim_offset=fast_dim_start+mem_space->select.offset[fast_dim];
/* Compute the number of blocks which would fit into the buffer */
- tot_blk_count=io_left/fast_dim_block;
+ tot_blk_count=(size_t)io_left/(size_t)fast_dim_block;
/* Compute the amount to wrap at the end of each row */
for(i=0; i<ndims; i++)
@@ -3687,9 +3689,11 @@ H5S_hyper_mwrite_opt (const void *_tconv_buf, size_t elmt_size,
/* Calculate the number of elements left in the sequence */
if(mem_space->select.sel_info.hslab.diminfo[fast_dim].stride==1)
- leftover=mem_space->select.sel_info.hslab.diminfo[fast_dim].block-(mem_iter->hyp.off[fast_dim]-mem_space->select.sel_info.hslab.diminfo[fast_dim].start);
+ leftover=(size_t)mem_space->select.sel_info.hslab.diminfo[fast_dim].block
+ -(size_t)(mem_iter->hyp.off[fast_dim]-mem_space->select.sel_info.hslab.diminfo[fast_dim].start);
else
- leftover=mem_space->select.sel_info.hslab.diminfo[fast_dim].block-((mem_iter->hyp.off[fast_dim]-mem_space->select.sel_info.hslab.diminfo[fast_dim].start)%mem_space->select.sel_info.hslab.diminfo[fast_dim].stride);
+ leftover=(size_t)mem_space->select.sel_info.hslab.diminfo[fast_dim].block
+ -(size_t)((mem_iter->hyp.off[fast_dim]-mem_space->select.sel_info.hslab.diminfo[fast_dim].start)%mem_space->select.sel_info.hslab.diminfo[fast_dim].stride);
/* Make certain that we don't write too many */
actual_write=MIN(leftover,io_left);
@@ -3773,7 +3777,7 @@ H5S_hyper_mwrite_opt (const void *_tconv_buf, size_t elmt_size,
fast_dim_offset=fast_dim_start+mem_space->select.offset[fast_dim];
/* Compute the number of blocks which would fit into the buffer */
- tot_blk_count=io_left/fast_dim_block;
+ tot_blk_count=(size_t)io_left/(size_t)fast_dim_block;
/* Compute the amount to wrap at the end of each row */
for(i=0; i<ndims; i++)
@@ -5164,7 +5168,7 @@ H5S_hyper_select_serialize (const H5S_t *space, uint8_t *buf)
len+=4;
/* Add 8 bytes times the rank for each hyperslab selected */
- len+=8*space->extent.u.simple.rank*block_count;
+ len+=(size_t)8*space->extent.u.simple.rank*(size_t)block_count;
/* Encode each hyperslab in selection */
H5S_hyper_select_serialize_helper(space->select.sel_info.hslab.span_lst,start,end,(hsize_t)0,&buf);
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index fc898c5..042c6c1 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -368,7 +368,7 @@ herr_t H5T_vlen_str_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, vo
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data");
} /* end else */
- len=(size_t)seq_len*base_size;
+ len=(size_t)seq_len*(size_t)base_size;
HDmemcpy(*s,buf,len);
(*s)[len]='\0';
diff --git a/src/H5private.h b/src/H5private.h
index 3399c28..425fd32 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -607,7 +607,14 @@ typedef struct stat h5_stat_t;
*/
#define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z)
#define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z)
+/*
+ * The (void*) cast just avoids a compiler warning in WIN32
+ */
+#ifdef WIN32
+#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
+#else /* WIN32 */
#define HDmemset(X,C,Z) memset(X,C,Z)
+#endif /* WIN32 */
#ifdef WIN32
#define HDmkdir(S,M) _mkdir(S)
#else /* WIN32 */