mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-25 17:00:45 +08:00
[svn-r12735] Description:
Clean up some compiler warnings and resolve some inconsistenceis between hsize_t and size_t in the interface. Tested on: FreeBSD/32 4.11 (sleipnir) w/threadsafe Linux/32 2.4 (heping) w/FORTRAN & C++ Linux/64 2.4 (mir) w/enable-1.6-compat
This commit is contained in:
parent
25d1056dbf
commit
20720af231
@ -81,7 +81,7 @@
|
||||
* Sets the index to point to the packet specified by index.
|
||||
* Returns 0 on success, negative on failure (if index is out of bounds)
|
||||
*/
|
||||
int PacketTable::SetIndex(unsigned int index)
|
||||
int PacketTable::SetIndex(hsize_t index)
|
||||
{
|
||||
return H5PTset_index(table_id, index);
|
||||
}
|
||||
@ -90,7 +90,7 @@
|
||||
* Sets the index to point to the packet specified by index.
|
||||
* Returns 0 on success, negative on failure (if index is out of bounds)
|
||||
*/
|
||||
int PacketTable::GetIndex(int &error)
|
||||
hsize_t PacketTable::GetIndex(int &error)
|
||||
{
|
||||
hsize_t index;
|
||||
|
||||
@ -157,7 +157,7 @@
|
||||
* to be added and a pointer to their location in memory.
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int FL_PacketTable::AppendPackets(unsigned int numPackets, void * data)
|
||||
int FL_PacketTable::AppendPackets(size_t numPackets, void * data)
|
||||
{
|
||||
return H5PTappend(table_id, numPackets, data);
|
||||
}
|
||||
@ -168,7 +168,7 @@
|
||||
* to memory where the data should be stored.
|
||||
* Returns 0 on success, negative on failure
|
||||
*/
|
||||
int FL_PacketTable::GetPacket(unsigned int index, void * data)
|
||||
int FL_PacketTable::GetPacket(hsize_t index, void * data)
|
||||
{
|
||||
return H5PTread_packets(table_id, index, 1, data);
|
||||
}
|
||||
@ -179,7 +179,7 @@
|
||||
* the memory where these packets should be stored.
|
||||
* Returns 0 on success, negative on failure.
|
||||
*/
|
||||
int FL_PacketTable::GetPackets(unsigned int startIndex, unsigned int endIndex, void * data)
|
||||
int FL_PacketTable::GetPackets(hsize_t startIndex, hsize_t endIndex, void * data)
|
||||
{
|
||||
// Make sure the range of indexes is valid
|
||||
if (startIndex > endIndex)
|
||||
@ -205,7 +205,7 @@
|
||||
* Returns 0 on success, negative on failure. Index
|
||||
* is not advanced on failure.
|
||||
*/
|
||||
int FL_PacketTable::GetNextPackets(unsigned int numPackets, void * data)
|
||||
int FL_PacketTable::GetNextPackets(size_t numPackets, void * data)
|
||||
{
|
||||
return H5PTget_next(table_id, numPackets, data);
|
||||
}
|
||||
@ -244,7 +244,7 @@
|
||||
* in bytes.
|
||||
* Returns 0 on success, negative on failure.
|
||||
*/
|
||||
int VL_PacketTable::AppendPacket(void * data, unsigned int length)
|
||||
int VL_PacketTable::AppendPacket(void * data, size_t length)
|
||||
{
|
||||
hvl_t packet;
|
||||
|
||||
@ -260,7 +260,7 @@
|
||||
* packets to be added and a pointer to an array of hvl_t structs in memory.
|
||||
* Returns 0 on success, negative on failure.
|
||||
*/
|
||||
int VL_PacketTable::AppendPackets(unsigned int numPackets, hvl_t * data)
|
||||
int VL_PacketTable::AppendPackets(size_t numPackets, hvl_t * data)
|
||||
{
|
||||
return H5PTappend(table_id, numPackets, data);
|
||||
}
|
||||
@ -271,7 +271,7 @@
|
||||
* to a hvl_t struct in which to store the packet's size and location.
|
||||
* Returns 0 on success, negative on failure.
|
||||
*/
|
||||
int VL_PacketTable::GetPacket(unsigned int index, hvl_t * data)
|
||||
int VL_PacketTable::GetPacket(hsize_t index, hvl_t * data)
|
||||
{
|
||||
return H5PTread_packets(table_id, index, 1, data);
|
||||
}
|
||||
@ -282,7 +282,7 @@
|
||||
* of hvl_t structs in memory in which to store pointers to the packets.
|
||||
* Returns 0 on success, negative on failure.
|
||||
*/
|
||||
int VL_PacketTable::GetPackets(unsigned int startIndex, unsigned int endIndex, hvl_t * data)
|
||||
int VL_PacketTable::GetPackets(hsize_t startIndex, hsize_t endIndex, hvl_t * data)
|
||||
{
|
||||
// Make sure the range of indexes is valid
|
||||
if (startIndex > endIndex)
|
||||
@ -309,7 +309,7 @@
|
||||
* Returns 0 on success, negative on failure. Index
|
||||
* is not advanced on failure.
|
||||
*/
|
||||
int VL_PacketTable::GetNextPackets(unsigned int numPackets, hvl_t * data)
|
||||
int VL_PacketTable::GetNextPackets(size_t numPackets, hvl_t * data)
|
||||
{
|
||||
return H5PTget_next(table_id, numPackets, data);
|
||||
}
|
||||
@ -320,7 +320,7 @@
|
||||
* location in memory.
|
||||
* Returns 0 on success, negative on error.
|
||||
*/
|
||||
int VL_PacketTable::FreeReadbuff(unsigned int numStructs, hvl_t * buffer)
|
||||
int VL_PacketTable::FreeReadbuff(size_t numStructs, hvl_t * buffer)
|
||||
{
|
||||
return H5PTfree_vlen_readbuff( table_id, numStructs, buffer);
|
||||
}
|
||||
|
@ -72,13 +72,13 @@ public:
|
||||
* Sets the current packet to point to the packet specified by index.
|
||||
* Returns 0 on success, negative on failure (if index is out of bounds)
|
||||
*/
|
||||
int SetIndex(unsigned int index);
|
||||
int SetIndex(hsize_t index);
|
||||
|
||||
/* GetIndex
|
||||
* Returns the position of the current packet.
|
||||
* On failure, returns 0 and error is set to negative.
|
||||
*/
|
||||
int GetIndex(int& error);
|
||||
hsize_t GetIndex(int& error);
|
||||
|
||||
/* GetPacketCount
|
||||
* Returns the number of packets in the packet table. Error
|
||||
@ -87,7 +87,7 @@ public:
|
||||
*/
|
||||
hsize_t GetPacketCount(int& error);
|
||||
|
||||
unsigned int GetPacketCount()
|
||||
hsize_t GetPacketCount()
|
||||
{
|
||||
int ignoreError;
|
||||
return GetPacketCount(ignoreError);
|
||||
@ -127,7 +127,7 @@ public:
|
||||
* to be added and a pointer to their location in memory.
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int AppendPackets(unsigned int numPackets, void * data);
|
||||
int AppendPackets(size_t numPackets, void * data);
|
||||
|
||||
/* GetPacket (indexed)
|
||||
* Gets a single packet from the packet table. Takes the index
|
||||
@ -135,7 +135,7 @@ public:
|
||||
* to memory where the data should be stored.
|
||||
* Returns 0 on success, negative on failure
|
||||
*/
|
||||
int GetPacket(unsigned int index, void * data);
|
||||
int GetPacket(hsize_t index, void * data);
|
||||
|
||||
/* GetPackets (multiple packets)
|
||||
* Gets multiple packets at once, all packets between
|
||||
@ -143,7 +143,7 @@ public:
|
||||
* the memory where these packets should be stored.
|
||||
* Returns 0 on success, negative on failure.
|
||||
*/
|
||||
int GetPackets(unsigned int startIndex, unsigned int endIndex, void * data);
|
||||
int GetPackets(hsize_t startIndex, hsize_t endIndex, void * data);
|
||||
|
||||
/* GetNextPacket (single packet)
|
||||
* Gets the next packet in the packet table. Takes a pointer to
|
||||
@ -159,7 +159,7 @@ public:
|
||||
* Returns 0 on success, negative on failure. Index
|
||||
* is not advanced on failure.
|
||||
*/
|
||||
int GetNextPackets(unsigned int numPackets, void * data);
|
||||
int GetNextPackets(size_t numPackets, void * data);
|
||||
};
|
||||
|
||||
class H5_HLCPPDLL VL_PacketTable : virtual public PacketTable
|
||||
@ -184,7 +184,7 @@ public:
|
||||
* in bytes.
|
||||
* Returns 0 on success, negative on failure.
|
||||
*/
|
||||
int AppendPacket(void * data, unsigned int length);
|
||||
int AppendPacket(void * data, size_t length);
|
||||
|
||||
/* AppendPackets (multiple packets)
|
||||
* Adds multiple variable-length packets to the packet table. Takes the
|
||||
@ -192,7 +192,7 @@ public:
|
||||
* hvl_t structs in memory.
|
||||
* Returns 0 on success, negative on failure.
|
||||
*/
|
||||
int AppendPackets(unsigned int numPackets, hvl_t * data);
|
||||
int AppendPackets(size_t numPackets, hvl_t * data);
|
||||
|
||||
/* GetPacket (indexed)
|
||||
* Gets a single variable-length packet from the packet table. Takes
|
||||
@ -200,7 +200,7 @@ public:
|
||||
* to a hvl_t struct in which to store the packet's size and location.
|
||||
* Returns 0 on success, negative on failure.
|
||||
*/
|
||||
int GetPacket(unsigned int index, hvl_t * data);
|
||||
int GetPacket(hsize_t index, hvl_t * data);
|
||||
|
||||
/* GetPackets (multiple packets)
|
||||
* Gets multiple variable-length packets at once, all packets between
|
||||
@ -208,7 +208,7 @@ public:
|
||||
* of hvl_t structs in memory in which to store pointers to the packets.
|
||||
* Returns 0 on success, negative on failure.
|
||||
*/
|
||||
int GetPackets(unsigned int startIndex, unsigned int endIndex, hvl_t * data);
|
||||
int GetPackets(hsize_t startIndex, hsize_t endIndex, hvl_t * data);
|
||||
|
||||
/* GetNextPacket (single packet)
|
||||
* Gets the next packet in the packet table. Takes a pointer to
|
||||
@ -225,7 +225,7 @@ public:
|
||||
* Returns 0 on success, negative on failure. Index
|
||||
* is not advanced on failure.
|
||||
*/
|
||||
int GetNextPackets(unsigned int numPackets, hvl_t * data);
|
||||
int GetNextPackets(size_t numPackets, hvl_t * data);
|
||||
|
||||
/* FreeReadbuff
|
||||
* Frees the buffers created when variable-length packets are read.
|
||||
@ -233,7 +233,7 @@ public:
|
||||
* location in memory.
|
||||
* Returns 0 on success, negative on error.
|
||||
*/
|
||||
int FreeReadbuff(unsigned int numStructs, hvl_t * buffer);
|
||||
int FreeReadbuff(size_t numStructs, hvl_t * buffer);
|
||||
};
|
||||
|
||||
#endif /* H5PTWRAP_H */
|
||||
|
@ -102,7 +102,7 @@ hid_t H5PTcreate_fl ( hid_t loc_id,
|
||||
goto out;
|
||||
if(compression >= 0 && compression <= 9)
|
||||
{
|
||||
if( H5Pset_deflate(plist_id, compression) < 0)
|
||||
if( H5Pset_deflate(plist_id, (unsigned)compression) < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -403,7 +403,7 @@ out:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t H5PTappend( hid_t table_id,
|
||||
hsize_t nrecords,
|
||||
size_t nrecords,
|
||||
const void * data )
|
||||
{
|
||||
htbl_t * table;
|
||||
@ -457,7 +457,7 @@ out:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t H5PTget_next( hid_t table_id,
|
||||
hsize_t nrecords,
|
||||
size_t nrecords,
|
||||
void * data)
|
||||
{
|
||||
htbl_t * table;
|
||||
@ -503,7 +503,7 @@ out:
|
||||
*/
|
||||
herr_t H5PTread_packets( hid_t table_id,
|
||||
hsize_t start,
|
||||
hsize_t nrecords,
|
||||
size_t nrecords,
|
||||
void *data)
|
||||
{
|
||||
htbl_t * table;
|
||||
@ -780,11 +780,12 @@ out:
|
||||
*/
|
||||
|
||||
herr_t H5PTfree_vlen_readbuff( hid_t table_id,
|
||||
hsize_t bufflen,
|
||||
size_t _bufflen,
|
||||
void * buff )
|
||||
{
|
||||
hid_t space_id = H5I_BADID;
|
||||
htbl_t * table;
|
||||
hsize_t bufflen = _bufflen;
|
||||
herr_t ret_value;
|
||||
|
||||
/* find the table struct from its ID */
|
||||
|
@ -51,7 +51,7 @@ H5_HLDLL herr_t H5PTclose( hid_t table_id );
|
||||
*/
|
||||
|
||||
H5_HLDLL herr_t H5PTappend( hid_t table_id,
|
||||
hsize_t nrecords,
|
||||
size_t nrecords,
|
||||
const void * data );
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -63,12 +63,12 @@ H5_HLDLL herr_t H5PTappend( hid_t table_id,
|
||||
|
||||
|
||||
H5_HLDLL herr_t H5PTget_next( hid_t table_id,
|
||||
hsize_t nrecords,
|
||||
size_t nrecords,
|
||||
void * data );
|
||||
|
||||
H5_HLDLL herr_t H5PTread_packets( hid_t table_id,
|
||||
hsize_t start,
|
||||
hsize_t nrecords,
|
||||
size_t nrecords,
|
||||
void *data );
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -109,7 +109,7 @@ H5_HLDLL herr_t H5PTget_index( hid_t table_id,
|
||||
*/
|
||||
|
||||
H5_HLDLL herr_t H5PTfree_vlen_readbuff( hid_t table_id,
|
||||
hsize_t bufflen,
|
||||
size_t bufflen,
|
||||
void * buff );
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -324,7 +324,7 @@ herr_t H5TBappend_records( hid_t loc_id,
|
||||
goto out;
|
||||
|
||||
/* Append the records */
|
||||
if ((H5TB_common_append_records(did, mem_type_id, nrecords, nrecords_orig, data))<0)
|
||||
if ((H5TB_common_append_records(did, mem_type_id, (size_t)nrecords, nrecords_orig, data))<0)
|
||||
goto out;
|
||||
|
||||
/* Release the datatype. */
|
||||
@ -934,7 +934,7 @@ herr_t H5TBread_records( hid_t loc_id,
|
||||
goto out;
|
||||
|
||||
/* Read the records */
|
||||
if ((H5TB_common_read_records(did, mem_type_id, start, nrecords, nrecords_orig, data)) < 0)
|
||||
if ((H5TB_common_read_records(did, mem_type_id, start, (size_t)nrecords, nrecords_orig, data)) < 0)
|
||||
goto out;
|
||||
|
||||
/* get the dataspace handle */
|
||||
@ -3671,7 +3671,7 @@ out:
|
||||
*/
|
||||
herr_t H5TB_common_append_records( hid_t dataset_id,
|
||||
hid_t mem_type_id,
|
||||
hsize_t nrecords,
|
||||
size_t nrecords,
|
||||
hsize_t orig_table_size,
|
||||
const void * data)
|
||||
{
|
||||
@ -3746,7 +3746,7 @@ out:
|
||||
herr_t H5TB_common_read_records( hid_t dataset_id,
|
||||
hid_t mem_type_id,
|
||||
hsize_t start,
|
||||
hsize_t nrecords,
|
||||
size_t nrecords,
|
||||
hsize_t table_size,
|
||||
void *data)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
herr_t H5TB_common_append_records( hid_t dataset_id,
|
||||
hid_t mem_type_id,
|
||||
hsize_t nrecords,
|
||||
size_t nrecords,
|
||||
hsize_t orig_table_size,
|
||||
const void * data);
|
||||
|
||||
@ -49,7 +49,7 @@ herr_t H5TB_common_append_records( hid_t dataset_id,
|
||||
herr_t H5TB_common_read_records( hid_t dataset_id,
|
||||
hid_t mem_type_id,
|
||||
hsize_t start,
|
||||
hsize_t nrecords,
|
||||
size_t nrecords,
|
||||
hsize_t table_size,
|
||||
void *data);
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "h5hltest.h"
|
||||
#include "H5PTpublic.h"
|
||||
@ -67,7 +66,7 @@ static particle_t testPart[NRECORDS] = {
|
||||
* function that compares one particle
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf )
|
||||
static int cmp_par(size_t i, size_t j, particle_t *rbuf, particle_t *wbuf )
|
||||
{
|
||||
if ( ( strcmp( rbuf[i].name, wbuf[j].name ) != 0 ) ||
|
||||
rbuf[i].lati != wbuf[j].lati ||
|
||||
@ -147,7 +146,7 @@ static int create_hl_table(hid_t fid)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
status=H5TBmake_table( "Table Title", fid, H5TB_TABLE_NAME, (hsize_t) NFIELDS,
|
||||
status=H5TBmake_table( "Table Title", fid, H5TB_TABLE_NAME, (hsize_t)NFIELDS,
|
||||
(hsize_t)NRECORDS, sizeof(particle_t),
|
||||
field_names, part_offset, field_type,
|
||||
chunk_size, fill_data, compress, testPart );
|
||||
@ -182,7 +181,7 @@ static int test_create_close(hid_t fid)
|
||||
assert(part_t != -1);
|
||||
|
||||
/* Create the table */
|
||||
table = H5PTcreate_fl(fid, PT_NAME, part_t, 100, -1);
|
||||
table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1);
|
||||
H5Tclose(part_t);
|
||||
if( H5PTis_valid(table) < 0)
|
||||
goto out;
|
||||
@ -265,17 +264,17 @@ static int test_append(hid_t fid)
|
||||
goto out;
|
||||
|
||||
/* Append one particle */
|
||||
err = H5PTappend(table, 1, &(testPart[0]));
|
||||
err = H5PTappend(table, (size_t)1, &(testPart[0]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
|
||||
/* Append several particles */
|
||||
err = H5PTappend(table, 6, &(testPart[1]));
|
||||
err = H5PTappend(table, (size_t)6, &(testPart[1]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
|
||||
/* Append one more particle */
|
||||
err = H5PTappend(table, 1, &(testPart[7]));
|
||||
err = H5PTappend(table, (size_t)1, &(testPart[7]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
|
||||
@ -314,7 +313,7 @@ static int test_read(hid_t fid)
|
||||
herr_t err;
|
||||
hid_t table;
|
||||
particle_t readBuf[NRECORDS];
|
||||
hsize_t c;
|
||||
size_t c;
|
||||
|
||||
TESTING("H5PTread_packets");
|
||||
|
||||
@ -324,17 +323,17 @@ static int test_read(hid_t fid)
|
||||
goto out;
|
||||
|
||||
/* Read several particles */
|
||||
err = H5PTread_packets(table, 0, 3, &(readBuf[0]));
|
||||
err = H5PTread_packets(table, (hsize_t)0, 3, &(readBuf[0]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
|
||||
/* Read one particle */
|
||||
err = H5PTread_packets(table, 3, 1, &(readBuf[3]));
|
||||
err = H5PTread_packets(table, (hsize_t)3, 1, &(readBuf[3]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
|
||||
/* Read several particles */
|
||||
err = H5PTread_packets(table, 4, (NRECORDS - 4 ), &(readBuf[4]));
|
||||
err = H5PTread_packets(table, (hsize_t)4, (NRECORDS - 4 ), &(readBuf[4]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
|
||||
@ -375,7 +374,7 @@ static int test_get_next(hid_t fid)
|
||||
hid_t table;
|
||||
particle_t readBuf[NRECORDS];
|
||||
particle_t readBuf2[NRECORDS];
|
||||
hsize_t c;
|
||||
size_t c;
|
||||
|
||||
TESTING("H5PTget_next");
|
||||
|
||||
@ -444,7 +443,7 @@ static int test_big_table(hid_t fid)
|
||||
herr_t err;
|
||||
hid_t table;
|
||||
hid_t part_t;
|
||||
hsize_t c;
|
||||
size_t c;
|
||||
particle_t readPart;
|
||||
hsize_t count;
|
||||
|
||||
@ -456,7 +455,7 @@ static int test_big_table(hid_t fid)
|
||||
assert(part_t != -1);
|
||||
|
||||
/* Create a new table */
|
||||
table = H5PTcreate_fl(fid, "Packet Test Dataset2", part_t, 33, -1);
|
||||
table = H5PTcreate_fl(fid, "Packet Test Dataset2", part_t, (hsize_t)33, -1);
|
||||
H5Tclose(part_t);
|
||||
if( H5PTis_valid(table) < 0)
|
||||
goto out;
|
||||
@ -465,7 +464,7 @@ static int test_big_table(hid_t fid)
|
||||
for(c = 0; c < BIG_TABLE_SIZE ; c+=8)
|
||||
{
|
||||
/* Append eight particles at once*/
|
||||
err = H5PTappend(table, 8, &(testPart[0]));
|
||||
err = H5PTappend(table, (size_t)8, &(testPart[0]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
}
|
||||
@ -552,7 +551,7 @@ static int test_varlen(hid_t fid)
|
||||
}
|
||||
|
||||
/* Create the table */
|
||||
table = H5PTcreate_vl(fid, VL_TABLE_NAME, 1001);
|
||||
table = H5PTcreate_vl(fid, VL_TABLE_NAME, (hsize_t)1001);
|
||||
if( H5PTis_valid(table) < 0)
|
||||
goto out;
|
||||
if( H5PTis_varlen(table) != 1)
|
||||
@ -585,18 +584,18 @@ static int test_varlen(hid_t fid)
|
||||
goto out;
|
||||
|
||||
/* Add several variable-length packets */
|
||||
err = H5PTappend(table, 8, writeBuffer );
|
||||
err = H5PTappend(table, (size_t)8, writeBuffer );
|
||||
if(err < 0)
|
||||
goto out;
|
||||
|
||||
/* Read them back */
|
||||
err = H5PTread_packets(table, 0, 4, &(readBuffer[0]));
|
||||
err = H5PTread_packets(table, (hsize_t)0, 4, &(readBuffer[0]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
err = H5PTread_packets(table, 4, 1, &(readBuffer[4]));
|
||||
err = H5PTread_packets(table, (hsize_t)4, 1, &(readBuffer[4]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
err = H5PTread_packets(table, 5, (NRECORDS - 5 ), &(readBuffer[5]));
|
||||
err = H5PTread_packets(table, (hsize_t)5, (NRECORDS - 5 ), &(readBuffer[5]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
|
||||
@ -693,7 +692,7 @@ static int test_opaque(hid_t fid)
|
||||
herr_t err;
|
||||
hid_t table;
|
||||
hid_t part_t;
|
||||
hsize_t c;
|
||||
size_t c;
|
||||
particle_t readBuf[NRECORDS];
|
||||
|
||||
TESTING("opaque data");
|
||||
@ -709,18 +708,18 @@ static int test_opaque(hid_t fid)
|
||||
return -1;
|
||||
|
||||
/* Create a new table */
|
||||
table = H5PTcreate_fl(fid, "Packet Test Dataset3", part_t, 100, -1);
|
||||
table = H5PTcreate_fl(fid, "Packet Test Dataset3", part_t, (hsize_t)100, -1);
|
||||
H5Tclose(part_t);
|
||||
if( H5PTis_valid(table) < 0)
|
||||
goto out;
|
||||
|
||||
/* Append several particles, starting at particle 1 */
|
||||
err = H5PTappend(table, (NRECORDS - 1), &(testPart[1]));
|
||||
err = H5PTappend(table, (size_t)(NRECORDS - 1), &(testPart[1]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
|
||||
/* Read the particles back */
|
||||
err = H5PTread_packets(table, 0, 7, &(readBuf[0]));
|
||||
err = H5PTread_packets(table, (hsize_t)0, 7, &(readBuf[0]));
|
||||
if( err < 0)
|
||||
goto out;
|
||||
|
||||
@ -754,7 +753,8 @@ static int test_opaque(hid_t fid)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int test_compress()
|
||||
static int
|
||||
test_compress(void)
|
||||
{
|
||||
hid_t fid1 = -1;
|
||||
hid_t fid2 = -1;
|
||||
@ -762,10 +762,9 @@ static int test_compress()
|
||||
herr_t err;
|
||||
hid_t table = -1;
|
||||
hid_t part_t = -1;
|
||||
hsize_t c;
|
||||
size_t c;
|
||||
particle_t readPart;
|
||||
hsize_t count;
|
||||
hid_t plist_id = -1;
|
||||
|
||||
TESTING("packet table compression");
|
||||
|
||||
@ -791,7 +790,7 @@ static int test_compress()
|
||||
assert(part_t != -1);
|
||||
|
||||
/* Create a new table with compression level 1 */
|
||||
table = H5PTcreate_fl(fid1, "Packet Compress Test Dataset", part_t, 80, 1);
|
||||
table = H5PTcreate_fl(fid1, "Packet Compress Test Dataset", part_t, (hsize_t)80, 1);
|
||||
if( H5PTis_valid(table) < 0) TEST_ERROR;
|
||||
|
||||
/* We can now use this table exactly the same way we use a normal uncompressed
|
||||
@ -800,7 +799,7 @@ static int test_compress()
|
||||
for(c = 0; c < BIG_TABLE_SIZE ; c+=8)
|
||||
{
|
||||
/* Append eight particles at once*/
|
||||
err = H5PTappend(table, 8, &(testPart[0]));
|
||||
err = H5PTappend(table, (size_t)8, &(testPart[0]));
|
||||
if( err < 0) TEST_ERROR;
|
||||
}
|
||||
|
||||
@ -827,13 +826,13 @@ static int test_compress()
|
||||
|
||||
/* Open the second file and create a new table with compression level 9. */
|
||||
if((fid2 = H5Fopen(TEST_COMPRESS_FILE2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR;
|
||||
table = H5PTcreate_fl(fid2, "Packet Compress Test Dataset", part_t, 80, 9);
|
||||
table = H5PTcreate_fl(fid2, "Packet Compress Test Dataset", part_t, (hsize_t)80, 9);
|
||||
if(table < 0) TEST_ERROR;
|
||||
|
||||
for(c = 0; c < BIG_TABLE_SIZE ; c+=8)
|
||||
{
|
||||
/* Append eight particles at once*/
|
||||
err = H5PTappend(table, 8, &(testPart[0]));
|
||||
err = H5PTappend(table, (size_t)8, &(testPart[0]));
|
||||
if( err < 0) TEST_ERROR;
|
||||
}
|
||||
/* Read particles to ensure that all of them were written correctly */
|
||||
@ -911,13 +910,13 @@ static int test_error(hid_t fid)
|
||||
goto out;
|
||||
if(H5PTclose(id) >= 0)
|
||||
goto out;
|
||||
if(H5PTappend(id, 1, testPart) >= 0)
|
||||
if(H5PTappend(id, (size_t)1, testPart) >= 0)
|
||||
goto out;
|
||||
if(H5PTread_packets(id, 0, 1, readBuf) >= 0)
|
||||
if(H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0)
|
||||
goto out;
|
||||
if(H5PTcreate_index(id) >= 0)
|
||||
goto out;
|
||||
if(H5PTset_index(id, 1) >= 0)
|
||||
if(H5PTset_index(id, (hsize_t)1) >= 0)
|
||||
goto out;
|
||||
if(H5PTget_index(id, NULL) >= 0)
|
||||
goto out;
|
||||
@ -936,13 +935,13 @@ static int test_error(hid_t fid)
|
||||
goto out;
|
||||
if(H5PTclose(id) >= 0)
|
||||
goto out;
|
||||
if(H5PTappend(id, 1, testPart) >= 0)
|
||||
if(H5PTappend(id, (size_t)1, testPart) >= 0)
|
||||
goto out;
|
||||
if(H5PTread_packets(id, 0, 1, readBuf) >= 0)
|
||||
if(H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0)
|
||||
goto out;
|
||||
if(H5PTcreate_index(id) >= 0)
|
||||
goto out;
|
||||
if(H5PTset_index(id, 1) >= 0)
|
||||
if(H5PTset_index(id, (hsize_t)1) >= 0)
|
||||
goto out;
|
||||
if(H5PTget_index(id, NULL) >= 0)
|
||||
goto out;
|
||||
@ -966,13 +965,13 @@ static int test_error(hid_t fid)
|
||||
goto out;
|
||||
if(H5PTclose(id) >= 0)
|
||||
goto out;
|
||||
if(H5PTappend(id, 1, testPart) >= 0)
|
||||
if(H5PTappend(id, (size_t)1, testPart) >= 0)
|
||||
goto out;
|
||||
if(H5PTread_packets(id, 0, 1, readBuf) >= 0)
|
||||
if(H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0)
|
||||
goto out;
|
||||
if(H5PTcreate_index(id) >= 0)
|
||||
goto out;
|
||||
if(H5PTset_index(id, 1) >= 0)
|
||||
if(H5PTset_index(id, (hsize_t)1) >= 0)
|
||||
goto out;
|
||||
if(H5PTget_index(id, NULL) >= 0)
|
||||
goto out;
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "h5hltest.h"
|
||||
#include "H5TBpublic.h"
|
||||
|
||||
@ -126,7 +125,8 @@ static int compare_deleted(hsize_t rrecords, hsize_t dstart, hsize_t drecords,
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int test_table(hid_t fid, int write)
|
||||
static int
|
||||
test_table(hid_t fid, int do_write)
|
||||
{
|
||||
/* identifiers */
|
||||
hid_t fid1;
|
||||
@ -341,7 +341,7 @@ static int test_table(hid_t fid, int write)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
TESTING2("making table");
|
||||
|
||||
@ -381,7 +381,7 @@ static int test_table(hid_t fid, int write)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
TESTING2("writing records");
|
||||
|
||||
@ -439,7 +439,7 @@ static int test_table(hid_t fid, int write)
|
||||
* we use the original "table1" instead
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if(write)
|
||||
if(do_write)
|
||||
strcpy(tname,"table2");
|
||||
else
|
||||
strcpy(tname,"table1");
|
||||
@ -466,7 +466,7 @@ static int test_table(hid_t fid, int write)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
TESTING2("appending records");
|
||||
|
||||
@ -512,7 +512,7 @@ static int test_table(hid_t fid, int write)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
TESTING2("inserting records");
|
||||
|
||||
@ -572,7 +572,7 @@ static int test_table(hid_t fid, int write)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
TESTING2("deleting records");
|
||||
|
||||
@ -739,7 +739,7 @@ static int test_table(hid_t fid, int write)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
TESTING2("adding records");
|
||||
|
||||
@ -799,7 +799,7 @@ static int test_table(hid_t fid, int write)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
TESTING2("combining tables");
|
||||
|
||||
@ -894,7 +894,7 @@ static int test_table(hid_t fid, int write)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
TESTING2("writing fields by name");
|
||||
|
||||
@ -959,7 +959,7 @@ static int test_table(hid_t fid, int write)
|
||||
* write and read the "Pressure" field
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
if (H5TBmake_table(TITLE,fid,"table10",NFIELDS,NRECORDS,type_size_mem,
|
||||
field_names,field_offset,field_type,
|
||||
@ -993,7 +993,7 @@ static int test_table(hid_t fid, int write)
|
||||
* Write and read the "Latitude,Longitude" fields
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
/* Write the new longitude and latitude information to all the records */
|
||||
start = 0;
|
||||
@ -1023,7 +1023,7 @@ static int test_table(hid_t fid, int write)
|
||||
* Write and read the "Name,Pressure" fields
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
/* Write the new name and pressure information to all the records */
|
||||
start = 0;
|
||||
@ -1085,7 +1085,7 @@ static int test_table(hid_t fid, int write)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
TESTING2("writing fields by index");
|
||||
|
||||
@ -1147,7 +1147,7 @@ static int test_table(hid_t fid, int write)
|
||||
|
||||
TESTING2("reading fields by index");
|
||||
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
/* make an empty table */
|
||||
if (H5TBmake_table(TITLE,fid,"table12",NFIELDS,NRECORDS,type_size_mem,
|
||||
@ -1189,7 +1189,7 @@ static int test_table(hid_t fid, int write)
|
||||
* write and read the "Latitude,Longitude" fields
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
/* write the new longitude and latitude information to all the records */
|
||||
nfields = 2;
|
||||
@ -1222,7 +1222,7 @@ static int test_table(hid_t fid, int write)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
/* write the new name and pressure information to all the records */
|
||||
nfields = 2;
|
||||
@ -1293,7 +1293,7 @@ static int test_table(hid_t fid, int write)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
TESTING2("inserting fields");
|
||||
|
||||
@ -1337,7 +1337,7 @@ static int test_table(hid_t fid, int write)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (write)
|
||||
if (do_write)
|
||||
{
|
||||
TESTING2("deleting fields");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user