X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTOOLSDS%2FSALOMEDS_Tool.cxx;h=2b61d3fddcb726106b06b87a1c5049cdbd34e6a6;hb=d8edd4804d9e6513a17c497c1a30326d4ba0d677;hp=d83e243b246d6fa1d92dcd8ff01a568f2df136b9;hpb=2c3b0cf16d5069414bb63f3829a8ab0a2b7072db;p=modules%2Fkernel.git diff --git a/src/TOOLSDS/SALOMEDS_Tool.cxx b/src/TOOLSDS/SALOMEDS_Tool.cxx index d83e243b2..2b61d3fdd 100644 --- a/src/TOOLSDS/SALOMEDS_Tool.cxx +++ b/src/TOOLSDS/SALOMEDS_Tool.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -127,7 +127,7 @@ void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory, { std::string aDirName = theDirectory; - int i, aLength = theFiles.size(); + size_t i, aLength = theFiles.size(); for(i=1; i<=aLength; i++) { std::string aFile(aDirName); aFile += theFiles[i-1]; @@ -174,7 +174,7 @@ namespace const std::vector& theFileNames, const int theNamesOnly) { - int i, aLength = theFiles.size(); + int i, aLength = (int)theFiles.size(); //!< TODO: conversion from size_t to int if(aLength == 0) return (new SALOMEDS::TMPFile); @@ -207,10 +207,10 @@ namespace std::ifstream aFile(aFullPath.c_str()); #endif aFile.seekg(0, std::ios::end); - aFileSize[i] = aFile.tellg(); + aFileSize[i] = (long)aFile.tellg(); //!< TODO: conversion from std::streamoff to long aBufferSize += aFileSize[i]; //Add a space to store the file } - aFileNameSize[i] = theFileNames[i].length()+1; + aFileNameSize[i] = (int)theFileNames[i].length()+1; //!< TODO: conversion from size_t to int aBufferSize += aFileNameSize[i]; //Add a space to store the file name aBufferSize += (theNamesOnly)?4:12; //Add 4 bytes: a length of the file name, // 8 bytes: length of the file itself @@ -340,10 +340,10 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream, //Put a file name to aFileName memcpy(aFileName, (aBuffer + aCurrentPos), aFileNameSize); #ifdef WIN32 - for (int i = 0; i < strlen(aFileName); i++) + for (int j = 0; j < strlen(aFileName); j++) { - if (aFileName[i] == ':') - aFileName[i] = '_'; + if (aFileName[j] == ':') + aFileName[j] = '_'; } #endif aCurrentPos += aFileNameSize; @@ -382,25 +382,25 @@ std::string SALOMEDS_Tool::GetNameFromPath(const std::string& thePath) { if (thePath.empty()) return ""; std::string aPath = thePath; bool isFound = false; - int pos = aPath.rfind('/'); - if(pos > 0) { + size_t pos = aPath.rfind('/'); + if(pos != std::string::npos) { aPath = aPath.substr(pos+1, aPath.size()); isFound = true; } if(!isFound) { pos = aPath.rfind('\\'); - if(pos > 0) { + if(pos != std::string::npos) { aPath = aPath.substr(pos+1, aPath.size()); isFound = true; } } if(!isFound) { pos = aPath.rfind('|'); - if(pos > 0) aPath = aPath.substr(pos+1, aPath.size()); + if(pos != std::string::npos) aPath = aPath.substr(pos+1, aPath.size()); } pos = aPath.rfind('.'); - if(pos > 0) aPath = aPath.substr(0, pos); //Remove extension + if(pos != std::string::npos) aPath = aPath.substr(0, pos); //Remove extension return aPath; } @@ -412,18 +412,18 @@ std::string SALOMEDS_Tool::GetNameFromPath(const std::string& thePath) { std::string SALOMEDS_Tool::GetDirFromPath(const std::string& thePath) { if (thePath.empty()) return ""; - int pos = thePath.rfind('/'); + size_t pos = thePath.rfind('/'); std::string path; - if(pos > 0) { + if(pos != std::string::npos) { path = thePath.substr(0, pos+1); } if(path.empty()) { pos = thePath.rfind('\\'); - if(pos > 0) path = thePath.substr(0, pos+1); + if(pos != std::string::npos) path = thePath.substr(0, pos+1); } if(path.empty()) { pos = thePath.rfind('|'); - if(pos > 0) path = thePath.substr(0, pos+1); + if(pos != std::string::npos) path = thePath.substr(0, pos+1); } if(path.empty()) { path = thePath+"/"; @@ -433,7 +433,7 @@ std::string SALOMEDS_Tool::GetDirFromPath(const std::string& thePath) { if(path.size() == 2 && path[1] == ':') path +='\\'; #endif - for(int i = 0, len = path.size(); i