Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
replace useless strncpy by a memcpy
[simgrid.git] / src / smpi / bindings / smpi_pmpi.cpp
index cbddb4d..a20a5ff 100644 (file)
@@ -142,7 +142,7 @@ double PMPI_Wtick()
   return sg_maxmin_precision;
 }
 
-int PMPI_Address(void *location, MPI_Aint * address)
+int PMPI_Address(const void* location, MPI_Aint* address)
 {
   if (address==nullptr) {
     return MPI_ERR_ARG;
@@ -154,7 +154,7 @@ int PMPI_Address(void *location, MPI_Aint * address)
 
 int PMPI_Get_address(const void *location, MPI_Aint * address)
 {
-  return PMPI_Address(const_cast<void*>(location), address);
+  return PMPI_Address(location, address);
 }
 
 int PMPI_Get_processor_name(char *name, int *resultlen)
@@ -222,7 +222,7 @@ int PMPI_Error_string(int errorcode, char* string, int* resultlen){
       FOREACH_ERROR(GENERATE_STRING)
     };
     *resultlen = strlen(smpi_error_string[errorcode]);
-    strncpy(string, smpi_error_string[errorcode], *resultlen);
+    memcpy(string, smpi_error_string[errorcode], *resultlen*sizeof(char));
     return MPI_SUCCESS;  
   }
 }