From 5627fb562713c934520e76f82b16d9e8b60f9964 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Sat, 4 Mar 2006 13:16:04 +0000 Subject: [PATCH] - Get rid of compiler warning: init type to DT_MAX_PREDEFINED and assert it is below when accessing ompi_ddt_basicDatatypes - datatype in ompi_ddt_pack_description_length is and will not be changed. This commit was SVN r9193. --- ompi/datatype/datatype.h | 2 +- ompi/datatype/dt_args.c | 2 +- ompi/datatype/new_unpack.c | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ompi/datatype/datatype.h b/ompi/datatype/datatype.h index 56253a4dfa..9972f03ab7 100644 --- a/ompi/datatype/datatype.h +++ b/ompi/datatype/datatype.h @@ -224,7 +224,7 @@ OMPI_DECLSPEC int32_t ompi_ddt_release_args( ompi_datatype_t* pData ); /* * */ -OMPI_DECLSPEC size_t ompi_ddt_pack_description_length( ompi_datatype_t* datatype ); +OMPI_DECLSPEC size_t ompi_ddt_pack_description_length( const ompi_datatype_t* datatype ); /* * diff --git a/ompi/datatype/dt_args.c b/ompi/datatype/dt_args.c index fe9e069122..784836f6f7 100644 --- a/ompi/datatype/dt_args.c +++ b/ompi/datatype/dt_args.c @@ -332,7 +332,7 @@ int32_t ompi_ddt_release_args( ompi_datatype_t* pData ) return OMPI_SUCCESS; } -size_t ompi_ddt_pack_description_length( ompi_datatype_t* datatype ) +size_t ompi_ddt_pack_description_length( const ompi_datatype_t* datatype ) { if( datatype->flags & DT_FLAG_PREDEFINED ) { return sizeof(int) * 2; diff --git a/ompi/datatype/new_unpack.c b/ompi/datatype/new_unpack.c index 320841ca8e..16d0055431 100644 --- a/ompi/datatype/new_unpack.c +++ b/ompi/datatype/new_unpack.c @@ -137,11 +137,11 @@ int ompi_convertor_generic_simple_unpack( ompi_convertor_t* pConvertor, size_t* max_data, int32_t* freeAfter ) { - dt_stack_t* pStack; /* pointer to the position on the stack */ - uint32_t pos_desc; /* actual position in the description of the derived datatype */ - uint32_t count_desc; /* the number of items already done in the actual pos_desc */ - uint16_t type; /* type at current position */ - size_t total_unpacked = 0; /* total size unpacked this time */ + dt_stack_t* pStack; /* pointer to the position on the stack */ + uint32_t pos_desc; /* actual position in the description of the derived datatype */ + uint32_t count_desc; /* the number of items already done in the actual pos_desc */ + uint16_t type = DT_MAX_PREDEFINED; /* type at current position */ + size_t total_unpacked = 0; /* total size unpacked this time */ dt_elem_desc_t* description; dt_elem_desc_t* pElem; const ompi_datatype_t *pData = pConvertor->pDesc; @@ -256,6 +256,7 @@ int ompi_convertor_generic_simple_unpack( ompi_convertor_t* pConvertor, packed_buffer, user_memory_base, iov_len_local ); if( 0 != count_desc ) { /* completed */ type = pElem->elem.common.type; + assert (type < DT_MAX_PREDEFINED); required_space = ompi_ddt_basicDatatypes[type]->size; goto complete_loop; } @@ -269,6 +270,7 @@ int ompi_convertor_generic_simple_unpack( ompi_convertor_t* pConvertor, /* We have some partial data here. Let's copy it into the convertor * and keep it hot until the next round. */ + assert (type < DT_MAX_PREDEFINED); assert( iov_len_local < ompi_ddt_basicDatatypes[type]->size ); memcpy( pConvertor->pending, packed_buffer, iov_len_local ); DO_DEBUG( opal_output( 0, "Saving %d bytes for the next call\n", iov_len_local ); );