From 77389f72e236461ab2017f84cf9dd0a019bc2c2c Mon Sep 17 00:00:00 2001 From: Viktor Uzlov Date: Wed, 12 Aug 2020 17:41:49 +0300 Subject: [PATCH] fix warning "unused variable" and "possible loss of data" --- src/Container/Component_i.cxx | 2 +- src/Container/SALOME_ContainerManager.cxx | 2 +- src/Launcher/Launcher_XML_Persistence.cxx | 2 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx | 20 +++++++------- src/Logger/SALOME_Logger_Server.hxx | 5 ++-- src/SALOMEDS/SALOMEDS_Study_i.cxx | 4 +-- ...ALOMEDSImpl_AttributeSequenceOfInteger.cxx | 4 +-- .../SALOMEDSImpl_AttributeSequenceOfReal.cxx | 4 +-- .../SALOMEDSImpl_AttributeStudyProperties.cxx | 6 ++--- .../SALOMEDSImpl_AttributeTableOfInteger.cxx | 24 ++++++++--------- .../SALOMEDSImpl_AttributeTableOfReal.cxx | 24 ++++++++--------- .../SALOMEDSImpl_AttributeTableOfString.cxx | 26 +++++++++---------- .../SALOMEDSImpl_StudyBuilder.cxx | 4 +-- src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx | 14 +++++----- src/SALOMESDS/SALOMESDS_AutoRefCountPtr.hxx | 2 +- src/SALOMESDS/SALOMESDS_DataScopeServer.cxx | 10 +++---- src/SALOMESDS/SALOMESDS_DataServerManager.cxx | 8 +++--- .../SALOMESDS_PickelizedPyObjServer.cxx | 6 ++--- src/SALOMESDS/SALOMESDS_Transaction.cxx | 6 ++--- 19 files changed, 86 insertions(+), 87 deletions(-) diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 9290062fc..8895fb58c 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -665,7 +665,7 @@ void Engines_Component_i::endService(const char *serviceName) if ( !_CanceledThread ) _ThreadCpuUsed = CpuUsed_impl() ; - float cpus=_ThreadCpuUsed/1000.; + float cpus=_ThreadCpuUsed/1000.f; std::cerr << "endService for " << serviceName << " Component instance : " << _instanceName ; std::cerr << " Cpu Used: " << cpus << " (s) " << std::endl; MESSAGE("Send EndService notification for " << serviceName diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 7d7932651..9696a0b71 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -368,7 +368,7 @@ Engines::Container_ptr SALOME_ContainerManager::GiveContainer(const Engines::Con break; } } - catch(const SALOME_Exception &ex) + catch(const SALOME_Exception & /*ex*/) //!< TODO: unused variable { MESSAGE("[GiveContainer] Exception in ResourceManager find !: " << ex.what()); return ret; diff --git a/src/Launcher/Launcher_XML_Persistence.cxx b/src/Launcher/Launcher_XML_Persistence.cxx index 63a3cb0a5..3da17b9f4 100644 --- a/src/Launcher/Launcher_XML_Persistence.cxx +++ b/src/Launcher/Launcher_XML_Persistence.cxx @@ -519,7 +519,7 @@ Job* XML_Persistence::createJobFromString(const std::string& jobDump) { xmlDocPtr doc; - doc = xmlReadMemory(jobDump.c_str(), jobDump.length(), "noname.xml", NULL, 0); + doc = xmlReadMemory(jobDump.c_str(), (int)jobDump.length(), "noname.xml", NULL, 0); //TODO: conversion from size_t to int, possible loss of data if (doc == NULL) { std::string error = "Error in xmlReadMemory in XML_Persistence::createJobFromString, could not parse string: " + jobDump; diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index ca62c0a07..4a5fbf688 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -152,7 +152,7 @@ SALOME_LifeCycleCORBA::FindComponent(const Engines::ContainerParameters& params, { listOfResources = _ResManager->GetFittingResources(new_params.resource_params); } - catch( const SALOME::SALOME_Exception& ex ) + catch( const SALOME::SALOME_Exception& /*ex*/ ) //!< TODO: unused variable { return Engines::EngineComponent::_nil(); } @@ -192,7 +192,7 @@ SALOME_LifeCycleCORBA::LoadComponent(const Engines::ContainerParameters& params, { listOfResources = _ResManager->GetFittingResources(new_params.resource_params); } - catch( const SALOME::SALOME_Exception& ex ) + catch( const SALOME::SALOME_Exception& /*ex*/ ) //!< TODO: unused variable { return Engines::EngineComponent::_nil(); } @@ -234,7 +234,7 @@ FindOrLoad_Component(const Engines::ContainerParameters& params, { listOfResources = _ResManager->GetFittingResources(new_params.resource_params); } - catch( const SALOME::SALOME_Exception& ex ) + catch( const SALOME::SALOME_Exception& /*ex*/ ) //!< TODO: unused variable { return Engines::EngineComponent::_nil(); } @@ -449,7 +449,7 @@ void SALOME_LifeCycleCORBA::shutdownServers(bool shutdownLauncher) if ( !CORBA::is_nil(connMan) && ( pid != connMan->getPID() ) ) connMan->ShutdownWithExit(); } - catch(const CORBA::Exception& e) + catch(const CORBA::Exception& /*e*/) //!< TODO: unused variable { // ignore and continue } @@ -472,7 +472,7 @@ void SALOME_LifeCycleCORBA::shutdownServers(bool shutdownLauncher) study->Shutdown(); _NS->Destroy_Name("/Study"); } - catch(const CORBA::Exception& e) + catch(const CORBA::Exception& /*e*/) //!< TODO: unused variable { // ignore and continue } @@ -491,7 +491,7 @@ void SALOME_LifeCycleCORBA::shutdownServers(bool shutdownLauncher) catalog->shutdown(); _NS->Destroy_Name("/Kernel/ModulCatalog"); } - catch(const CORBA::Exception& e) + catch(const CORBA::Exception& /*e*/) //!< TODO: unused variable { // ignore and continue } @@ -508,7 +508,7 @@ void SALOME_LifeCycleCORBA::shutdownServers(bool shutdownLauncher) if ( !CORBA::is_nil(dsm) ) dsm->shutdownScopes(); } - catch(const CORBA::Exception& e) + catch(const CORBA::Exception& /*e*/) //!< TODO: unused variable { // ignore and continue } @@ -520,7 +520,7 @@ void SALOME_LifeCycleCORBA::shutdownServers(bool shutdownLauncher) if ( !CORBA::is_nil(dsm) ) dsm->shutdownServers(); } - catch(const CORBA::Exception& e) + catch(const CORBA::Exception& /*e*/) //!< TODO: unused variable { // ignore and continue } @@ -534,7 +534,7 @@ void SALOME_LifeCycleCORBA::shutdownServers(bool shutdownLauncher) launcher->Shutdown(); } } - catch(const CORBA::Exception& e) + catch(const CORBA::Exception& /*e*/) //!< TODO: unused variable { // ignore and continue } @@ -553,7 +553,7 @@ void SALOME_LifeCycleCORBA::shutdownServers(bool shutdownLauncher) registry->Shutdown(); _NS->Destroy_Name("/Registry"); } - catch(const CORBA::Exception& e) + catch(const CORBA::Exception& /*e*/) //!< TODO: unused variable { // ignore and continue } diff --git a/src/Logger/SALOME_Logger_Server.hxx b/src/Logger/SALOME_Logger_Server.hxx index 75323215a..c4a5182a2 100644 --- a/src/Logger/SALOME_Logger_Server.hxx +++ b/src/Logger/SALOME_Logger_Server.hxx @@ -57,11 +57,11 @@ class LOGGER_EXPORT Logger : public: //constructor w/o parameters //all messages will be put into terminal via cout - Logger(); + Logger(); //constructor with parameter, filename is output file //all messages will be put into special file passed as parameter Logger(const char *filename); - virtual ~Logger(); + virtual ~Logger(); //put message into one special place for all servers void putMessage(const char* message); void ping(); @@ -73,7 +73,6 @@ private: bool m_putIntoFile; //ofstream class specialized for disk file output std::ofstream m_outputFile; - //synchronisation object static omni_mutex myLock; diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 397c9c427..bc2f0785b 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -200,7 +200,7 @@ namespace SALOMEDS gobj->Register(); } } - catch(const CORBA::Exception& e) + catch(const CORBA::Exception& /*e*/) //!< TODO: unused variable { } } @@ -216,7 +216,7 @@ namespace SALOMEDS gobj->UnRegister(); } } - catch(const CORBA::Exception& e) + catch(const CORBA::Exception& /*e*/) //!< TODO: unused variable { } } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx index fd06e9f99..c59b5537a 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx @@ -158,7 +158,7 @@ void SALOMEDSImpl_AttributeSequenceOfInteger::Remove(const int Index) int SALOMEDSImpl_AttributeSequenceOfInteger::Length() { - return myValue.size(); + return (int)myValue.size(); //!< TODO: conversion from size_t to int, possible loss of data } int SALOMEDSImpl_AttributeSequenceOfInteger::Value(const int Index) { @@ -174,7 +174,7 @@ std::string SALOMEDSImpl_AttributeSequenceOfInteger::Save() int aLength = Length(); char* aResult = new char[aLength * 25]; aResult[0] = 0; - int aPosition = 0; + size_t aPosition = 0; for (int i = 1; i <= aLength; i++) { sprintf(aResult + aPosition , "%d ", Value(i)); aPosition += strlen(aResult + aPosition); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx index 6bc3d0dff..263d72845 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx @@ -160,7 +160,7 @@ void SALOMEDSImpl_AttributeSequenceOfReal::Remove(const int Index) int SALOMEDSImpl_AttributeSequenceOfReal::Length() { - return myValue.size(); + return (int)myValue.size(); //!< TODO: conversion from size_t to int, possible loss of data } double SALOMEDSImpl_AttributeSequenceOfReal::Value(const int Index) @@ -175,7 +175,7 @@ std::string SALOMEDSImpl_AttributeSequenceOfReal::Save() int aLength = Length(); char* aResult = new char[aLength * 127]; aResult[0] = 0; - int aPosition = 0; + size_t aPosition = 0; for (int i = 1; i <= aLength; i++) { sprintf(aResult + aPosition , "%.64e ", Value(i)); aPosition += strlen(aResult + aPosition); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx index 67b3777c2..3d8467802 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx @@ -198,7 +198,7 @@ void SALOMEDSImpl_AttributeStudyProperties::Restore(DF_Attribute* with) std::vector aNames; std::vector aMinutes, aHours, aDays, aMonths, aYears; aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); - for (int i = 0, len = aNames.size(); i < len; i++) { + for (size_t i = 0, len = aNames.size(); i < len; i++) { myUserName.push_back(aNames[i]); myMinute.push_back(aMinutes[i]); myHour.push_back(aHours[i]); @@ -243,14 +243,14 @@ std::string SALOMEDSImpl_AttributeStudyProperties::Save() std::vector aMinutes, aHours, aDays, aMonths, aYears; GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); - int aLength, anIndex, unitsSize = 0, commentSize = 0;; + size_t aLength, anIndex, unitsSize = 0, commentSize = 0;; for (aLength = 0, anIndex = aNames.size()-1; anIndex >= 0; anIndex--) aLength += aNames[anIndex].size() + 1; std::string units = GetUnits(); std::string comment = GetComment(); - int aLength1 = 0; + size_t aLength1 = 0; std::map versions; versionMap::const_iterator it; for (aLength1 = 0, it = myComponentVersions.begin(); it != myComponentVersions.end(); ++it ) { diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx index d1799c639..4792c0a82 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx @@ -35,7 +35,7 @@ typedef std::map::const_iterator MI; static std::string getUnit(std::string theString) { std::string aString(theString); - int aPos = aString.find(SEPARATOR); + size_t aPos = aString.find(SEPARATOR); if(aPos <= 0 || aPos == aString.size() ) return std::string(); return aString.substr(aPos+1, aString.size()); } @@ -43,7 +43,7 @@ static std::string getUnit(std::string theString) static std::string getTitle(std::string theString) { std::string aString(theString); - int aPos = aString.find(SEPARATOR); + size_t aPos = aString.find(SEPARATOR); if(aPos < 1) return aString; if(aPos == 0) return std::string(); return aString.substr(0, aPos); @@ -117,7 +117,7 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const int theRow, const std::vector& theData) { CheckLocked(); - if(theData.size() > myNbColumns) SetNbColumns(theData.size()); + if(theData.size() > myNbColumns) SetNbColumns((int)theData.size()); //!< TODO: conversion from size_t to const int, possible loss of data Backup(); @@ -125,7 +125,7 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const int theRow, myRows.push_back(std::string("")); } - int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); + size_t i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); for(i = 1; i <= aLength; i++) { myTable[aShift + i] = theData[i-1]; } @@ -181,7 +181,7 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnit(const int theRow, void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const std::vector& theUnits) { if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows"); - int aLength = theUnits.size(), i; + size_t aLength = theUnits.size(), i; for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -190,7 +190,7 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const std::vector SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits() { std::vector aSeq; - int aLength = myRows.size(), i; + size_t aLength = myRows.size(), i; for(i=0; i SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits() void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitles(const std::vector& theTitles) { if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows"); - int aLength = theTitles.size(), i; + size_t aLength = theTitles.size(), i; for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -207,7 +207,7 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitles(const std::vector SALOMEDSImpl_AttributeTableOfInteger::GetRowTitles() { std::vector aSeq; - int aLength = myRows.size(), i; + size_t aLength = myRows.size(), i; for(i=0; i& theTitles) { if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns"); - int aLength = theTitles.size(), i; + size_t aLength = theTitles.size(), i; for(i = 0; i < aLength; i++) myCols[i] = theTitles[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -291,7 +291,7 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const std::vector SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitles() { std::vector aSeq; - int aLength = myCols.size(), i; + size_t aLength = myCols.size(), i; for(i=0; i::const_iterator MI; static std::string getUnit(const std::string& theString) { std::string aString(theString); - int aPos = aString.find(SEPARATOR); + size_t aPos = aString.find(SEPARATOR); return aPos < 0 || aPos == aString.size()-1 ? std::string() : aString.substr(aPos+1, aString.size()); } static std::string getTitle(const std::string& theString) { std::string aString(theString); - int aPos = aString.find(SEPARATOR); + size_t aPos = aString.find(SEPARATOR); return aPos < 0 ? aString :aString.substr(0, aPos); } @@ -114,7 +114,7 @@ void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const int theRow, const std::vector& theData) { CheckLocked(); - if(theData.size() > myNbColumns) SetNbColumns(theData.size()); + if(theData.size() > myNbColumns) SetNbColumns((int)theData.size()); //!< TODO: conversion from size_t to const int, possible loss of data Backup(); @@ -122,7 +122,7 @@ void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const int theRow, myRows.push_back(std::string("")); } - int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); + size_t i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); for(i = 1; i <= aLength; i++) { myTable[aShift + i] = theData[i-1]; } @@ -178,7 +178,7 @@ void SALOMEDSImpl_AttributeTableOfReal::SetRowUnit(const int theRow, void SALOMEDSImpl_AttributeTableOfReal::SetRowUnits(const std::vector& theUnits) { if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows"); - int aLength = theUnits.size(), i; + size_t aLength = theUnits.size(), i; for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -187,7 +187,7 @@ void SALOMEDSImpl_AttributeTableOfReal::SetRowUnits(const std::vector SALOMEDSImpl_AttributeTableOfReal::GetRowUnits() { std::vector aSeq; - int aLength = myRows.size(), i; + size_t aLength = myRows.size(), i; for(i=0; i SALOMEDSImpl_AttributeTableOfReal::GetRowUnits() void SALOMEDSImpl_AttributeTableOfReal::SetRowTitles(const std::vector& theTitles) { if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows"); - int aLength = theTitles.size(), i; + size_t aLength = theTitles.size(), i; for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -204,7 +204,7 @@ void SALOMEDSImpl_AttributeTableOfReal::SetRowTitles(const std::vector SALOMEDSImpl_AttributeTableOfReal::GetRowTitles() { std::vector aSeq; - int aLength = myRows.size(), i; + size_t aLength = myRows.size(), i; for(i=0; i& theTitles) { if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns"); - int aLength = theTitles.size(), i; + size_t aLength = theTitles.size(), i; for(i = 0; i < aLength; i++) myCols[i] = theTitles[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -289,7 +289,7 @@ void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitles(const std::vector SALOMEDSImpl_AttributeTableOfReal::GetColumnTitles() { std::vector aSeq; - int aLength = myCols.size(), i; + size_t aLength = myCols.size(), i; for(i=0; i::const_iterator MI; static std::string getUnit(std::string theString) { std::string aString(theString); - int aPos = aString.find(SEPARATOR); + size_t aPos = aString.find(SEPARATOR); if(aPos <= 0 || aPos == aString.size() ) return std::string(); return aString.substr(aPos+1, aString.size()); } @@ -43,7 +43,7 @@ static std::string getUnit(std::string theString) static std::string getTitle(std::string theString) { std::string aString(theString); - int aPos = aString.find(SEPARATOR); + size_t aPos = aString.find(SEPARATOR); if(aPos < 1) return aString; if(aPos == 0) return std::string(); return aString.substr(0, aPos); @@ -131,14 +131,14 @@ void SALOMEDSImpl_AttributeTableOfString::SetRowUnit(const int theRow, void SALOMEDSImpl_AttributeTableOfString::SetRowUnits(const std::vector& theUnits) { if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows"); - int aLength = theUnits.size(), i; + size_t aLength = theUnits.size(), i; for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]); } std::vector SALOMEDSImpl_AttributeTableOfString::GetRowUnits() { std::vector aSeq; - int aLength = myRows.size(), i; + size_t aLength = myRows.size(), i; for(i=0; i SALOMEDSImpl_AttributeTableOfString::GetRowUnits() void SALOMEDSImpl_AttributeTableOfString::SetRowTitles(const std::vector& theTitles) { if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows"); - int aLength = theTitles.size(), i; + size_t aLength = theTitles.size(), i; for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -155,7 +155,7 @@ void SALOMEDSImpl_AttributeTableOfString::SetRowTitles(const std::vector SALOMEDSImpl_AttributeTableOfString::GetRowTitles() { std::vector aSeq; - int aLength = myRows.size(), i; + size_t aLength = myRows.size(), i; for(i=0; i& theData) { CheckLocked(); - if(theData.size() > myNbColumns) SetNbColumns(theData.size()); + if(theData.size() > myNbColumns) SetNbColumns((int)theData.size()); //!< TODO: conversion from size_t to const int, possible loss of data Backup(); @@ -182,7 +182,7 @@ void SALOMEDSImpl_AttributeTableOfString::SetRowData(const int theRow, myRows.push_back(std::string("")); } - int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); + size_t i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); for(i = 1; i <= aLength; i++) { myTable[aShift + i] = theData[i-1]; } @@ -228,7 +228,7 @@ void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const int theColumn, Backup(); - int i, aLength = theData.size(); + size_t i, aLength = theData.size(); for(i = 1; i <= aLength; i++) { myTable[myNbColumns*(i-1)+theColumn] = theData[i-1]; } @@ -280,7 +280,7 @@ std::string SALOMEDSImpl_AttributeTableOfString::GetColumnTitle(const int theCol void SALOMEDSImpl_AttributeTableOfString::SetColumnTitles(const std::vector& theTitles) { if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns"); - int aLength = theTitles.size(), i; + size_t aLength = theTitles.size(), i; for(i = 0; i < aLength; i++) myCols[i] = theTitles[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -289,7 +289,7 @@ void SALOMEDSImpl_AttributeTableOfString::SetColumnTitles(const std::vector SALOMEDSImpl_AttributeTableOfString::GetColumnTitles() { std::vector aSeq; - int aLength = myCols.size(), i; + size_t aLength = myCols.size(), i; for(i=0; isecond.size()) { // check empty string in the value table sprintf(buffer, "%d\n", p->first); aString += buffer; - unsigned long aValueSize = p->second.size(); + unsigned long aValueSize = (unsigned long)p->second.size(); //!< TODO conversion from size_t to unsigned long, possible loss of data sprintf(buffer, "%ld\n", aValueSize); aString +=buffer; aString += p->second; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index d57c511ad..bcd63d021 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -336,12 +336,12 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const SALOMEDSImpl_SComponent& anSCO, hasModuleData = true; unsigned char* aStreamFile = NULL; - int aStreamSize = 0; + size_t aStreamSize = 0; if (hdf_sco_group->ExistInternalObject("FILE_STREAM")) { HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group); hdf_dataset->OpenOnDisk(); - aStreamSize = hdf_dataset->GetSize(); + aStreamSize = (size_t)hdf_dataset->GetSize(); aStreamFile = new unsigned char[aStreamSize]; if(aStreamFile == NULL) throw HDFexception("Unable to open dataset FILE_STREAM"); hdf_dataset->ReadFromDisk(aStreamFile); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx index c524e3d69..c1d030588 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx @@ -77,7 +77,7 @@ void SALOMEDSImpl_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]; @@ -118,7 +118,7 @@ void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const std::string& theDirectory, //============================================================================ std::string SALOMEDSImpl_Tool::GetNameFromPath(const std::string& thePath) { if (thePath.empty()) return ""; - int pos = thePath.rfind('/'); + size_t pos = thePath.rfind('/'); if(pos >= 0) return thePath.substr(pos+1, thePath.size()); pos = thePath.rfind('\\'); if(pos >= 0) return thePath.substr(pos+1, thePath.size()); @@ -140,7 +140,7 @@ std::string SALOMEDSImpl_Tool::GetDirFromPath(const std::string& thePath) { std::string path; if (!thePath.empty()) { - int pos = thePath.rfind('/'); + size_t pos = thePath.rfind('/'); if (pos < 0) pos = thePath.rfind('\\'); if (pos < 0) pos = thePath.rfind('|'); @@ -169,7 +169,7 @@ std::vector SALOMEDSImpl_Tool::splitString(const std::string& theVa { std::vector vs; if(theValue[0] == separator && theValue.size() == 1) return vs; - int pos = theValue.find(separator); + size_t pos = theValue.find(separator); if(pos < 0) { vs.push_back(theValue); return vs; @@ -197,7 +197,7 @@ std::vector treatRepetation(const std::string& theValue); std::vector treatRepetation(const std::string& theValue) { std::vector aResult; - int pos = theValue.find(";*="); + size_t pos = theValue.find(";*="); if(pos < 0 ) { aResult.push_back(theValue); @@ -217,7 +217,7 @@ std::vector SALOMEDSImpl_Tool::splitStringWithEmpty(const std::stri { std::vector aResult; if(theValue[0] == sep ) aResult.push_back(std::string()); - int pos = theValue.find(sep); + size_t pos = theValue.find(sep); if(pos < 0 ) { if(sep == '|') { @@ -266,7 +266,7 @@ std::vector< std::vector > SALOMEDSImpl_Tool::splitStringWithEmpty( std::vector< std::vector > aResult; if(theValue.size() > 0) { std::vector aSections = splitStringWithEmpty( theValue, sep1 ); - for( int i = 0, n = aSections.size(); i < n; i++ ) + for( size_t i = 0, n = aSections.size(); i < n; i++ ) aResult.push_back( splitStringWithEmpty( aSections[i], sep2 ) ); } return aResult; diff --git a/src/SALOMESDS/SALOMESDS_AutoRefCountPtr.hxx b/src/SALOMESDS/SALOMESDS_AutoRefCountPtr.hxx index c03f76f2d..e4046eae6 100644 --- a/src/SALOMESDS/SALOMESDS_AutoRefCountPtr.hxx +++ b/src/SALOMESDS/SALOMESDS_AutoRefCountPtr.hxx @@ -39,7 +39,7 @@ namespace SALOMESDS { id=poa->activate_object(this); } - catch(PortableServer::POA::ServantAlreadyActive& e) + catch(PortableServer::POA::ServantAlreadyActive& /*e*/) //!< TODO: unused variables { id=poa->servant_to_id(this); } diff --git a/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx b/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx index 7cf02f68e..fa24f9f2e 100644 --- a/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx +++ b/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx @@ -113,13 +113,13 @@ SALOME::StringVec *DataScopeServerBase::listVars() { SALOME::StringVec *ret(new SALOME::StringVec); std::size_t sz(_vars.size()); - ret->length(sz); + ret->length((_CORBA_ULong)sz); //!< TODO: size_t to _CORBA_ULong std::list< std::pair< SALOME::BasicDataServer_var, BasicDataServer * > >::iterator it(_vars.begin()); for(std::size_t i=0;igetVarNameCpp()); - (*ret)[i]=CORBA::string_dup(name.c_str()); + (*ret)[(_CORBA_ULong)i]=CORBA::string_dup(name.c_str()); //!< TODO: size_t to _CORBA_ULong } return ret; } @@ -230,13 +230,13 @@ SALOME::SeqOfByteVec *DataScopeServerBase::getAllKeysOfVarWithTypeDict(const cha } Py_ssize_t sz(PyList_Size(keys)); SALOME::SeqOfByteVec *ret(new SALOME::SeqOfByteVec); - ret->length(sz); + ret->length((_CORBA_ULong)sz); //!< TODO: convert Py_ssize_t in _CORBA_ULong for(Py_ssize_t i=0;ipickelize(item));//item consumed - PickelizedPyObjServer::FromCppToByteSeq(pickel,(*ret)[i]); + PickelizedPyObjServer::FromCppToByteSeq(pickel,(*ret)[(_CORBA_ULong)i]); //!< TODO: convert Py_ssize_t in _CORBA_ULong } Py_XDECREF(keys); return ret; @@ -893,7 +893,7 @@ void DataScopeServerTransaction::atomicApply(const SALOME::ListOfTransaction& tr Transaction *elt(0); try { - eltBase=_poa->reference_to_servant(transactions[i]); + eltBase=_poa->reference_to_servant(transactions[(_CORBA_ULong)i]); //!< TODO: size_t to _CORBA_ULong elt=dynamic_cast(eltBase); } catch(...) diff --git a/src/SALOMESDS/SALOMESDS_DataServerManager.cxx b/src/SALOMESDS/SALOMESDS_DataServerManager.cxx index 428cdc684..5f0098fa1 100644 --- a/src/SALOMESDS/SALOMESDS_DataServerManager.cxx +++ b/src/SALOMESDS/SALOMESDS_DataServerManager.cxx @@ -72,9 +72,9 @@ SALOME::StringVec *DataServerManager::listScopes() std::vector scopes(listOfScopesCpp()); SALOME::StringVec *ret(new SALOME::StringVec); std::size_t sz(scopes.size()); - ret->length(sz); + ret->length((_CORBA_ULong)sz); //!< TODO: size_t to _CORBA_ULong for(std::size_t i=0;ilength(sz); + ret->length((_CORBA_ULong)sz); //!< TODO: size_t to _CORBA_ULong for(std::size_t i=0;i(ret.c_str())); for(std::size_t i=0;i(&ret[0])); for(std::size_t i=0;i& bsToBeConv, SALOME::ByteVec& ret) { std::size_t sz(bsToBeConv.size()); - ret.length(sz); + ret.length((_CORBA_ULong)sz); //!< TODO: size_t to _CORBA_ULong for(std::size_t i=0;i