Skip to content

external data pack: switch to using size_t #13158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ompi/datatype/ompi_datatype.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* Copyright (c) 2021 IBM Corporation. All rights reserved.
* Copyright (c) 2025 Triad National Security, LLC. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -377,15 +378,15 @@ OMPI_DECLSPEC int ompi_datatype_safeguard_pointer_debug_breakpoint( const void*
int count );
#endif /* OPAL_ENABLE_DEBUG */

OMPI_DECLSPEC int ompi_datatype_pack_external( const char datarep[], const void *inbuf, int incount,
OMPI_DECLSPEC int ompi_datatype_pack_external( const char datarep[], const void *inbuf, size_t incount,
ompi_datatype_t *datatype, void *outbuf,
MPI_Aint outsize, MPI_Aint *position);

OMPI_DECLSPEC int ompi_datatype_unpack_external( const char datarep[], const void *inbuf, MPI_Aint insize,
MPI_Aint *position, void *outbuf, int outcount,
MPI_Aint *position, void *outbuf, size_t outcount,
ompi_datatype_t *datatype);

OMPI_DECLSPEC int ompi_datatype_pack_external_size( const char datarep[], int incount,
OMPI_DECLSPEC int ompi_datatype_pack_external_size( const char datarep[], size_t incount,
ompi_datatype_t *datatype, MPI_Aint *size);

#define OMPI_DATATYPE_RETAIN(ddt) \
Expand Down
9 changes: 5 additions & 4 deletions ompi/datatype/ompi_datatype_external.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* reserved.
* Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2025 Triad National Security, LLC. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -29,7 +30,7 @@
#include "ompi/datatype/ompi_datatype.h"
#include "opal/datatype/opal_convertor.h"

int ompi_datatype_pack_external(const char datarep[], const void *inbuf, int incount,
int ompi_datatype_pack_external(const char datarep[], const void *inbuf, size_t incount,
ompi_datatype_t *datatype, void *outbuf,
MPI_Aint outsize, MPI_Aint *position)
{
Expand Down Expand Up @@ -73,7 +74,7 @@ int ompi_datatype_pack_external(const char datarep[], const void *inbuf, int inc
}

int ompi_datatype_unpack_external (const char datarep[], const void *inbuf, MPI_Aint insize,
MPI_Aint *position, void *outbuf, int outcount,
MPI_Aint *position, void *outbuf, size_t outcount,
ompi_datatype_t *datatype)
{
int rc = MPI_SUCCESS;
Expand All @@ -92,7 +93,7 @@ int ompi_datatype_unpack_external (const char datarep[], const void *inbuf, MPI_

/* Check for truncation */
opal_convertor_get_packed_size( &local_convertor, &size );
if( (*position + size) > (unsigned int)insize ) {
if( (*position + (MPI_Aint)size) > insize ) {
OBJ_DESTRUCT( &local_convertor );
return MPI_ERR_TRUNCATE;
}
Expand All @@ -112,7 +113,7 @@ int ompi_datatype_unpack_external (const char datarep[], const void *inbuf, MPI_
return (rc == 1) ? OMPI_SUCCESS : MPI_ERR_UNKNOWN;
}

int ompi_datatype_pack_external_size(const char datarep[], int incount,
int ompi_datatype_pack_external_size(const char datarep[], size_t incount,
ompi_datatype_t *datatype, MPI_Aint *size)
{
opal_convertor_t local_convertor;
Expand Down