Commit d8eec549 authored by Dave Goodell's avatar Dave Goodell
Browse files

tt#1754: fix warnings in ROMIO external32 code

This doesn't fix any of the serious bugs or inefficiencies present in
the current external32 implementation.  But it at least fixes some very
valid warnings related to const-ness and passing incorrect pointer
types.

References ticket #1754

Reviewed-by: robl
parent 0b364068
......@@ -38,7 +38,7 @@ int ADIOI_Error(ADIO_File fd, int error_code, char *string)
/* Returns an MPI error code corresponding to "my_errno", for function "myname"
* and the given file, "filename". */
int ADIOI_Err_create_code(char *myname, char *filename, int my_errno)
int ADIOI_Err_create_code(const char *myname, const char *filename, int my_errno)
{
int error_code = MPI_SUCCESS;
if(!my_errno) return MPI_SUCCESS;
......
......@@ -561,7 +561,7 @@ int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void *extra_s
int MPIR_Status_set_bytes(MPI_Status *status, MPI_Datatype datatype, int nbytes);
int ADIOI_Uses_generic_read(ADIO_File fd);
int ADIOI_Uses_generic_write(ADIO_File fd);
int ADIOI_Err_create_code(char *myname, char *filename, int my_errno);
int ADIOI_Err_create_code(const char *myname, const char *filename, int my_errno);
int ADIOI_FAKE_IODone(ADIO_Request *request, ADIO_Status *status,
......
......@@ -8,7 +8,7 @@
#ifndef _MPIU_EXTERNAL32_H_
#define _MPIU_EXTERNAL32_H_
int MPIU_write_external32_conversion_fn (void *userbuf, MPI_Datatype datatype,
int MPIU_write_external32_conversion_fn (const void *userbuf, MPI_Datatype datatype,
int count, void *filebuf);
int MPIU_read_external32_conversion_fn(void *userbuf, MPI_Datatype datatype,
int count, void *filebuf);
......@@ -17,6 +17,6 @@ int MPIU_datatype_full_size(MPI_Datatype datatype, MPI_Aint *size);
/* given a buffer, count, and datatype, return an apropriately sized and
* * external32-formatted buffer, suitable for handing off to a subsequent write
* * routine */
int MPIU_external32_buffer_setup(void * buf, int count, MPI_Datatype type, void **newbuf);
int MPIU_external32_buffer_setup(const void * buf, int count, MPI_Datatype type, void **newbuf);
#endif
......@@ -12,7 +12,7 @@
#include "mpioprof.h"
#endif
int MPIU_write_external32_conversion_fn (void *userbuf, MPI_Datatype datatype,
int MPIU_write_external32_conversion_fn (const void *userbuf, MPI_Datatype datatype,
int count, void *filebuf)
{
int position_i = 0;
......@@ -136,7 +136,7 @@ fn_exit:
/* given a buffer, count, and datatype, return an apropriately allocated, sized
* and external32-formatted buffer, suitable for handing off to a subsequent
* write routine. Caller is responsible for freeing 'newbuf' */
int MPIU_external32_buffer_setup(void * buf, int count, MPI_Datatype type, void **newbuf)
int MPIU_external32_buffer_setup(const void * buf, int count, MPI_Datatype type, void **newbuf)
{
MPI_Aint datatype_size=0, bytes=0;
......
......@@ -124,11 +124,12 @@ int MPIOI_File_read(MPI_File fh,
xbuf = buf;
if (adio_fh->is_external32)
{
error_code = MPIU_datatype_full_size(datatype, &datatype_size);
MPI_Aint e32_size = 0;
error_code = MPIU_datatype_full_size(datatype, &e32_size);
if (error_code != MPI_SUCCESS)
goto fn_exit;
e32_buf = ADIOI_Malloc(datatype_size*count);
e32_buf = ADIOI_Malloc(e32_size*count);
xbuf = e32_buf;
}
......
......@@ -107,11 +107,12 @@ int MPIOI_File_read_all(MPI_File fh,
xbuf = buf;
if (adio_fh->is_external32)
{
error_code = MPIU_datatype_full_size(datatype, &datatype_size);
MPI_Aint e32_size = 0;
error_code = MPIU_datatype_full_size(datatype, &e32_size);
if (error_code != MPI_SUCCESS)
goto fn_exit;
e32_buf = ADIOI_Malloc(datatype_size*count);
e32_buf = ADIOI_Malloc(e32_size*count);
xbuf = e32_buf;
}
......
......@@ -104,11 +104,12 @@ int MPIOI_File_read_all_begin(MPI_File fh,
xbuf = buf;
if (adio_fh->is_external32)
{
error_code = MPIU_datatype_full_size(datatype, &datatype_size);
MPI_Aint e32_size = 0;
error_code = MPIU_datatype_full_size(datatype, &e32_size);
if (error_code != MPI_SUCCESS)
goto fn_exit;
e32_buf = ADIOI_Malloc(datatype_size*count);
e32_buf = ADIOI_Malloc(e32_size*count);
xbuf = e32_buf;
}
......
......@@ -102,11 +102,12 @@ int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count,
xbuf = buf;
if (adio_fh->is_external32)
{
error_code = MPIU_datatype_full_size(datatype, &datatype_size);
MPI_Aint e32_size = 0;
error_code = MPIU_datatype_full_size(datatype, &e32_size);
if (error_code != MPI_SUCCESS)
goto fn_exit;
e32_buf = ADIOI_Malloc(datatype_size*count);
e32_buf = ADIOI_Malloc(e32_size*count);
xbuf = e32_buf;
}
......
......@@ -99,11 +99,12 @@ int MPI_File_read_shared(MPI_File fh, void *buf, int count,
xbuf = buf;
if (adio_fh->is_external32)
{
error_code = MPIU_datatype_full_size(datatype, &datatype_size);
MPI_Aint e32_size = 0;
error_code = MPIU_datatype_full_size(datatype, &e32_size);
if (error_code != MPI_SUCCESS)
goto fn_exit;
e32_buf = ADIOI_Malloc(datatype_size*count);
e32_buf = ADIOI_Malloc(e32_size*count);
xbuf = e32_buf;
}
......
......@@ -74,7 +74,8 @@ int MPIOI_File_write(MPI_File fh,
int datatype_size;
ADIO_Offset off;
ADIO_File adio_fh;
void *e32buf=NULL, *xbuf=NULL;
void *e32buf=NULL;
const void *xbuf=NULL;
MPIU_THREAD_CS_ENTER(ALLFUNC,);
......@@ -121,7 +122,7 @@ int MPIOI_File_write(MPI_File fh,
ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code);
xbuf = (void *)buf;
xbuf = buf;
if (adio_fh->is_external32) {
error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf);
if (error_code != MPI_SUCCESS)
......
......@@ -74,7 +74,8 @@ int MPIOI_File_write_all(MPI_File fh,
{
int error_code, datatype_size;
ADIO_File adio_fh;
void *e32buf=NULL, *xbuf=NULL;
void *e32buf=NULL;
const void *xbuf=NULL;
MPIU_THREAD_CS_ENTER(ALLFUNC,);
......@@ -104,7 +105,7 @@ int MPIOI_File_write_all(MPI_File fh,
MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code);
/* --END ERROR HANDLING-- */
xbuf = (void *)buf;
xbuf = buf;
if (adio_fh->is_external32) {
error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf);
if (error_code != MPI_SUCCESS)
......
......@@ -60,7 +60,8 @@ int MPIOI_File_write_all_begin(MPI_File fh,
{
int error_code, datatype_size;
ADIO_File adio_fh;
void *e32buf=NULL, *xbuf=NULL;
void *e32buf=NULL;
const void *xbuf=NULL;
MPIU_THREAD_CS_ENTER(ALLFUNC,);
......@@ -100,7 +101,7 @@ int MPIOI_File_write_all_begin(MPI_File fh,
/* --END ERROR HANDLING-- */
xbuf = (void *)buf;
xbuf = buf;
if (adio_fh->is_external32) {
error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf);
if (error_code != MPI_SUCCESS)
......
......@@ -48,7 +48,8 @@ int MPI_File_write_ordered(MPI_File fh, const void *buf, int count,
static char myname[] = "MPI_FILE_WRITE_ORDERED";
ADIO_Offset shared_fp;
ADIO_File adio_fh;
void *e32buf=NULL, *xbuf;
void *e32buf=NULL;
const void *xbuf;
MPIU_THREAD_CS_ENTER(ALLFUNC,);
......
......@@ -44,7 +44,8 @@ int MPI_File_write_ordered_begin(MPI_File fh, const void *buf, int count,
static char myname[] = "MPI_FILE_WRITE_ORDERED_BEGIN";
ADIO_Offset shared_fp;
ADIO_File adio_fh;
void *e32buf = NULL, *xbuf=NULL;
void *e32buf = NULL;
const void *xbuf=NULL;
MPIU_THREAD_CS_ENTER(ALLFUNC,);
......
......@@ -47,7 +47,8 @@ int MPI_File_write_shared(MPI_File fh, const void *buf, int count,
int datatype_size, incr;
ADIO_Offset off, shared_fp;
ADIO_File adio_fh;
void *e32buf = NULL, *xbuf = NULL;
void *e32buf = NULL;
const void *xbuf = NULL;
MPIU_THREAD_CS_ENTER(ALLFUNC,);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment