NULL
);
if ( msgLen > 0 ) {
-#if defined( WIN32 ) && defined( UNICODE )
- error = Kernel_Utils::encode((wchar_t*)cstr);
-#else
+# if defined( UNICODE )
+ error = Kernel_Utils::encode_s((wchar_t*)cstr);
+# else
error = (char*)cstr;
-#endif
+# endif
LocalFree(cstr);
}
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;
}
SMESH_File resultFile( outFile, /*open=*/false );
bool ok = ( resultFile.exists() && resultFile.size() > 0 );
- if (ok)
+ if ( ok )
libraryFile._name = outFile;
else
error = "Can't download file " + url;
bool ok = false;
typedef bool (*SignFun)(void* );
- SignFun signFun = (SignFun) GetProc( theLibraryHandle, "SignCAD" );
+ SignFun signFun = (SignFun) GetProc( theLibraryHandle, "SignCAD" );
if ( !signFun )
{
if ( ! getLastError( error ))
error = SMESH_Comment( "Can't find symbol 'SignCAD' in '") << getenv( theEnvVar ) << "'";
}
- else
+ else
{
-
SMESH_TRY;
ok = signFun( meshgems_cad );
if ( !loadLibrary( error, libraryFile ))
return false;
+ bool ok = false;
typedef bool (*SignFun)(void* );
SignFun signFun = (SignFun) GetProc( theLibraryHandle, "SignMesh" );
if ( !signFun )
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;
}
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 + "')";