From 0a2050d0aae54cec7f3934d723709020b81a19e8 Mon Sep 17 00:00:00 2001 From: abd Date: Thu, 2 Nov 2006 10:37:24 +0000 Subject: [PATCH] Fix support of old format libraries for hypothezis --- src/SMESH_I/SMESH_Gen_i.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index e1222308b..0e7a76350 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -319,19 +319,22 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName { int libNameLen = strlen(theLibName); //check for old format "libXXXXXXX.so" - if( !strncmp( theLibName, "lib", 3 ) && !strcmp( theLibName+libNameLen-4, ".so" ) && libNameLen > 7 ) + if( libNameLen > 7 && !strncmp( theLibName, "lib", 3 ) && !strcmp( theLibName+libNameLen-3, ".so" ) ) { //the old format #ifdef WNT - aPlatformLibName = new char[libNameLen - 2]; + aPlatformLibName = new char[libNameLen - 1]; aPlatformLibName[0] = '\0'; aPlatformLibName = strncat( aPlatformLibName, theLibName+3, libNameLen-6 ); aPlatformLibName = strcat( aPlatformLibName, ".dll" ); + aPlatformLibName[libNameLen - 2] = '\0'; #else - aPlatformLibName = new char[ libNameLen ]; + aPlatformLibName = new char[ libNameLen + 1]; aPlatformLibName[0] = '\0'; aPlatformLibName = strcat( aPlatformLibName, theLibName ); + aPlatformLibName[libNameLen] = '\0'; #endif + } else { -- 2.39.2