diff --git a/regtest/basic/rt-make-exceptions/main.cpp b/regtest/basic/rt-make-exceptions/main.cpp index baae4ae446..9d42429286 100644 --- a/regtest/basic/rt-make-exceptions/main.cpp +++ b/regtest/basic/rt-make-exceptions/main.cpp @@ -58,7 +58,7 @@ int main(){ int natoms=10; std::vector positions(3*natoms,0.0); - for(unsigned i=0;i<3*natoms;i++) positions[i]=i; + for(int i=0;i<3*natoms;i++) positions[i]=i; std::vector masses(natoms,1.0); std::vector forces(3*natoms,0.0); std::vector box(9,0.0); @@ -145,7 +145,7 @@ int main(){ plumed.cmd("setVirial",&virial[0]); plumed.cmd("setMasses",&masses[0]); // set positions after having passed the pointer. They should be accessed here (at "calc"). - for(unsigned i=0;i<3*natoms;i++) positions[i]=i*step; + for(int i=0;i<3*natoms;i++) positions[i]=i*step; plumed.cmd("calc"); // this should fail diff --git a/src/wrapper/Plumed.h b/src/wrapper/Plumed.h index 3ea2bc9c75..5094a301ad 100644 --- a/src/wrapper/Plumed.h +++ b/src/wrapper/Plumed.h @@ -2346,7 +2346,7 @@ class Plumed { char msg[__PLUMED_WRAPPER_CXX_EXCEPTION_BUFFER]; void init(const char* msg) __PLUMED_WRAPPER_CXX_NOEXCEPT { this->msg[0]='\0'; - __PLUMED_WRAPPER_STD strncat(this->msg,msg,__PLUMED_WRAPPER_CXX_EXCEPTION_BUFFER-1); + __PLUMED_WRAPPER_STD strncpy(this->msg,msg,__PLUMED_WRAPPER_CXX_EXCEPTION_BUFFER); this->msg[__PLUMED_WRAPPER_CXX_EXCEPTION_BUFFER-1]='\0'; if(PlumedGetenvExceptionsDebug() && __PLUMED_WRAPPER_STD strlen(msg) > __PLUMED_WRAPPER_CXX_EXCEPTION_BUFFER-1) __PLUMED_WRAPPER_STD fprintf(stderr,"+++ WARNING: message will be truncated\n"); } @@ -3831,7 +3831,7 @@ void* plumed_attempt_dlopen(const char*path,int mode) { __PLUMED_FPRINTF(stderr,"+++ Allocation error +++\n"); __PLUMED_WRAPPER_STD abort(); } - __PLUMED_WRAPPER_STD strncpy(pathcopy,path,strlenpath+1); + __PLUMED_WRAPPER_STD memcpy(pathcopy,path,strlenpath+1); pc=pathcopy+strlenpath-6; while(pc>=pathcopy && __PLUMED_WRAPPER_STD memcmp(pc,"Kernel",6)) pc--; if(pc>=pathcopy) {