X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHUtils%2FSMESH_MGLicenseKeyGen.cxx;h=ec06d988548ae0d1a1a1010a6e161dda1fc55e62;hb=c9deeb65356c923f6129f363982dd8da8d6e32a5;hp=a49e74bf8b777c90e481cf21b0b6ace83bdbfcc9;hpb=4a8f4b4c1c2545fe6a0bf9cfa771bd38779738e7;p=modules%2Fsmesh.git diff --git a/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx b/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx index a49e74bf8..ec06d9885 100644 --- a/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx +++ b/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx @@ -201,17 +201,32 @@ namespace bool isURL( LibraryFile & libraryFile ) { - enum { SCHEME = 2, AUTHORITY = 4, PATH = 5 }; // sub-strings - std::regex urlRegex ( R"(^(([^:\/?#]+):)?(//([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)", - std::regex::extended ); - std::smatch matchResult; - - libraryFile._isURL = false; - if ( std::regex_match( libraryFile._name, matchResult, urlRegex )) - libraryFile._isURL = ( !matchResult.str( SCHEME ).empty() && - !matchResult.str( AUTHORITY ).empty() && - !matchResult.str( PATH ).empty() ); - + {// round1 + enum { SCHEME = 2, AUTHORITY = 4, PATH = 5 }; // sub-strings + std::regex urlRegex ( R"(^(([^:\/?#]+):)?(//([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)", + std::regex::extended ); + std::smatch matchResult; + + libraryFile._isURL = false; + if ( std::regex_match( libraryFile._name, matchResult, urlRegex )) + libraryFile._isURL = ( !matchResult.str( SCHEME ).empty() && + !matchResult.str( AUTHORITY ).empty() && + !matchResult.str( PATH ).empty() ); + } + if(libraryFile._isURL) + return true; + {// round2 + enum { HOST = 2, PORT = 3, PATH = 4 }; // sub-strings + std::regex urlRegex ( R"(^(([^:\/?#]+):)?([^/]+)?(/[^#]*))", + std::regex::extended ); + std::smatch matchResult; + + libraryFile._isURL = false; + if ( std::regex_match( libraryFile._name, matchResult, urlRegex )) + libraryFile._isURL = ( !matchResult.str( HOST ).empty() && + !matchResult.str( PORT ).empty() && + !matchResult.str( PATH ).empty() ); + } return libraryFile._isURL; } @@ -373,7 +388,6 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation } else { - SMESH_TRY; ok = signFun( meshgems_cad ); @@ -403,6 +417,7 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation if ( !loadLibrary( error, libraryFile )) return false; + bool ok = false; typedef bool (*SignFun)(void* ); SignFun signFun = (SignFun) GetProc( theLibraryHandle, "SignMesh" ); if ( !signFun ) @@ -410,19 +425,19 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation if ( ! getLastError( error )) error = SMESH_Comment( "Can't find symbol 'SignMesh' in '") << getenv( theEnvVar ) << "'"; } - bool ok; - - SMESH_TRY; - - ok = signFun( meshgems_mesh ); + else + { + SMESH_TRY; - SMESH_CATCH( SMESH::returnError ); + ok = signFun( meshgems_mesh ); - if ( !error.empty() ) - ok = false; - else if ( !ok ) - error = "SignMesh() failed (located in '" + libraryFile._name + "')"; + SMESH_CATCH( SMESH::returnError ); + if ( !error.empty() ) + ok = false; + else if ( !ok ) + error = "SignMesh() failed (located in '" + libraryFile._name + "')"; + } return ok; } @@ -455,8 +470,10 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation if ( ! getLastError( error )) error = SMESH_Comment( "Can't find symbol 'GetKey' in '") << getenv( theEnvVar ) << "'"; } - key = keyFun( gmfFile, nbVertex, nbEdge, nbFace, nbVol ); - + else + { + key = keyFun( gmfFile, nbVertex, nbEdge, nbFace, nbVol ); + } if ( key.empty() ) error = "GetKey() failed (located in '" + libraryFile._name + "')";