summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2006-04-13 03:15:05 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2006-04-13 03:15:05 (GMT)
commit2aab15533868c86250deb62ffb9f93710532967e (patch)
tree627c2d219fffa9f6c43148a9f332cf3ced6884a4 /hl
parentea0c09cf0f2e609b7ef2fffd5e54d2f9ed2c2917 (diff)
downloadhdf5-2aab15533868c86250deb62ffb9f93710532967e.zip
hdf5-2aab15533868c86250deb62ffb9f93710532967e.tar.gz
hdf5-2aab15533868c86250deb62ffb9f93710532967e.tar.bz2
[svn-r12235] Purpose:
bug fixes Description: some function calls had integer constants in the argument list; these caused size mismatches on some platforms (hsize_t expected) Solution: declared hsize_t variables or added casts Platforms tested: linux (heping) solaris Misc. update:
Diffstat (limited to 'hl')
-rw-r--r--hl/examples/ptExampleFL.c15
-rw-r--r--hl/examples/ptExampleVL.c9
2 files changed, 16 insertions, 8 deletions
diff --git a/hl/examples/ptExampleFL.c b/hl/examples/ptExampleFL.c
index 1596f7a..e3eba74 100644
--- a/hl/examples/ptExampleFL.c
+++ b/hl/examples/ptExampleFL.c
@@ -37,6 +37,8 @@ int main(void)
/* Buffers to hold data */
int writeBuffer[5];
int readBuffer[5];
+ hsize_t nrecords;
+ hsize_t chunk_size=1;
/* Initialize buffers */
for(x=0; x<5; x++)
@@ -50,17 +52,21 @@ int main(void)
/* Create a fixed-length packet table within the file */
/* This table's "packets" will be simple integers. */
- ptable = H5PTcreate_fl(fid, "Packet Test Dataset", H5T_NATIVE_INT, 1);
+ ptable = H5PTcreate_fl(fid, "Packet Test Dataset", H5T_NATIVE_INT, chunk_size);
if(ptable == H5I_INVALID_HID)
goto out;
+ nrecords=1;
+
/* Write one packet to the packet table */
- err = H5PTappend(ptable, 1, &(writeBuffer[0]) );
+ err = H5PTappend(ptable, nrecords, &(writeBuffer[0]) );
if(err < 0)
goto out;
+ nrecords=4;
+
/* Write several packets to the packet table */
- err = H5PTappend(ptable, 4, &(writeBuffer[1]) );
+ err = H5PTappend(ptable, nrecords, &(writeBuffer[1]) );
if(err < 0)
goto out;
@@ -76,10 +82,11 @@ int main(void)
if(err < 0)
goto out;
+ nrecords=1;
/* Iterate through packets, read each one back */
for(x=0; x<5; x++)
{
- err = H5PTget_next(ptable, 1, &(readBuffer[x]) );
+ err = H5PTget_next(ptable, nrecords, &(readBuffer[x]) );
if(err < 0)
goto out;
diff --git a/hl/examples/ptExampleVL.c b/hl/examples/ptExampleVL.c
index eebb3c3..ad35f40 100644
--- a/hl/examples/ptExampleVL.c
+++ b/hl/examples/ptExampleVL.c
@@ -36,6 +36,7 @@ int main(void)
/* Buffers to hold data */
hvl_t writeBuffer[5];
hvl_t readBuffer[5];
+ hsize_t chunk_size=1;
/* This example has two different sizes of "record": longs and shorts */
long longBuffer[5];
@@ -66,12 +67,12 @@ int main(void)
fid=H5Fcreate("packet_table_VLexample.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);
/* Create a variable-length packet table within the file */
- ptable = H5PTcreate_vl(fid, "Packet Test Dataset", 1);
+ ptable = H5PTcreate_vl(fid, "Packet Test Dataset", chunk_size);
if(ptable == H5I_INVALID_HID)
goto out;
/* Write the entire buffer to the packet table */
- err = H5PTappend(ptable, 5, writeBuffer );
+ err = H5PTappend(ptable, (hsize_t)5, writeBuffer );
if(err < 0)
goto out;
@@ -83,7 +84,7 @@ int main(void)
printf("Number of packets in packet table after five appends: %d\n", count);
/* Read all five packets back */
- err = H5PTread_packets(ptable, 0, 5, readBuffer );
+ err = H5PTread_packets(ptable, (hsize_t)0, (hsize_t)5, readBuffer );
if(err < 0)
goto out;
@@ -98,7 +99,7 @@ int main(void)
/* Before we close the packet table, we must free the memory that */
/* the pointers in readBuffer point to. */
- err = H5PTfree_vlen_readbuff(ptable, 5, readBuffer);
+ err = H5PTfree_vlen_readbuff(ptable, (hsize_t)5, readBuffer);
if(err < 0)
goto out;