if(!CORBA::is_nil(cont) && pid != cont->getPID())
lstCont.push_back((*iter));
}
- catch(const CORBA::Exception& e)
+ catch(const CORBA::Exception&)
{
// ignore this entry and continue
}
else
return Engines::Container::_narrow(obj);
}
- catch(const CORBA::Exception& e)
+ catch(const CORBA::Exception&)
{
return Engines::Container::_nil();
}
{
return false; // VSR 02/08/2013: Python containers are no more supported
bool ret = false;
- int len = strlen(ContainerName);
+ size_t len = strlen(ContainerName);
if (len >= 2)
if (strcmp(ContainerName + len - 2, "Py") == 0)
void SALOME_ContainerManager::RmTmpFile(std::string& tmpFileName)
{
- int length = tmpFileName.size();
+ size_t length = tmpFileName.size();
if ( length > 0)
{
#ifdef WIN32
HDFfile *hdf_file;
HDFgroup *hdf_group;
HDFdataset *hdf_dataset;
- int size;
+ size_t size;
int fd;
char * value;
char * buffer;
throw SALOME::SALOME_Exception(es);
};
hdf_dataset->ReadFromDisk(buffer);
- if ( write(fd,buffer,size) <0) {
+ if ( write(fd,buffer, static_cast<unsigned int>(size)) <0) {
SALOME::ExceptionStruct es;
es.type = SALOME::INTERNAL_ERROR;
std::string text = "write failed";
Salome_file_i::getFilesInfos() {
Engines::files * infos = new Engines::files();
- infos->length(_fileManaged.size());
+ infos->length(static_cast<unsigned long>(_fileManaged.size()));
_t_fileManaged::iterator begin = _fileManaged.begin();
_t_fileManaged::iterator end = _fileManaged.end();
// see Advanced CORBA Programming with C++ pp 187-194
CORBA::Octet *buf;
buf = Engines::fileBlock::allocbuf(FILEBLOCK_SIZE);
- int nbRed = fread(buf, sizeof(CORBA::Octet), FILEBLOCK_SIZE, fp);
+ size_t nbRed = fread(buf, sizeof(CORBA::Octet), FILEBLOCK_SIZE, fp);
aBlock->replace(nbRed, nbRed, buf, 1); // 1 means give ownership
return aBlock;
}
//Returns a number of existent documents
int DF_Application::NbDocuments()
{
- return _documents.size();
+ //TODO: return <size_t> ot <int>?
+ return static_cast<int>(_documents.size());
}
if(node) vn.push_back(node);
}
- for(int i = 0, len = vn.size(); i<len; i++)
+ for(size_t i = 0, len = vn.size(); i<len; i++)
delete vn[i];
_root._node->Reset();
std::vector<DF_Attribute*> va = GetAttributes();
_node->_attributes.clear();
- for(int i = 0, len = va.size(); i<len; i++) {
+ for(size_t i = 0, len = va.size(); i<len; i++) {
va[i]->BeforeForget();
delete va[i];
}
sorted.push_back(p->first);
sort(sorted.begin(), sorted.end());
- int len = sorted.size();
+ size_t len = sorted.size();
for(int i = 0; i<len; i++)
attributes.push_back(_node->_attributes[sorted[i]]);
for(AI p = _attributes.begin(); p!=_attributes.end(); p++)
va.push_back(p->second);
- for(int i = 0, len = va.size(); i<len; i++)
+ for(size_t i = 0, len = va.size(); i<len; i++)
delete va[i];
_attributes.clear();
for(AI p = _attributes.begin(); p!=_attributes.end(); p++)
va.push_back(p->second);
- for(int i = 0, len = va.size(); i<len; i++)
+ for(size_t i = 0, len = va.size(); i<len; i++)
delete va[i];
_attributes.clear();
return NULL;
}
- int length = strlen(aPath.c_str());
+ size_t length = strlen(aPath.c_str());
char *new_str = new char[ 1+length ];
strcpy(new_str , aPath.c_str()) ;
fprintf(fp, " %i\n", ndim);
for(int i = 0;i < ndim;i++) {
- fprintf(fp, " %i", dim[i]);
+ fprintf(fp, " %Ii", dim[i]);
}
fprintf(fp, "\n");
array->GetDim(arr_dim);
for( int i = 0;i < arr_ndim; i++ ) {
- fprintf(fp, " %i", arr_dim[i]);
+ fprintf(fp, " %Ii", arr_dim[i]);
}
//And write the data array
hdf_type type = hdf_attribute->GetType();
char* name = makeName(hdf_attribute->GetName());
- int size = hdf_attribute->GetSize();
+ size_t size = hdf_attribute->GetSize();
fprintf(fp, "%s\n", ATTRIBUTE_ID);
- fprintf(fp, "%s %i %i\n", name, type, size);
+ fprintf(fp, "%s %i %Ii\n", name, type, size);
delete [] name;
return NULL;
}
- int length = strlen(aTmpDir.c_str());
+ size_t length = strlen(aTmpDir.c_str());
char *new_str = new char[ 1+length ];
strcpy(new_str , aTmpDir.c_str()) ;
} else if(type == HDF_CHAR) {
hdf_char* val = new hdf_char[size];
for(i=0; i<size; i++) {
- fscanf(fp, " %i", &(val[i]));
+ fscanf(fp, " %hhi", &(val[i]));
}
hdf_dataset->WriteOnDisk(val);
delete [] val;
char* makeName(char* name)
{
std::string aName(name), aNewName;
- int i, length = aName.size();
+ size_t i, length = aName.size();
char replace = (char)19;
for(i=0; i<length; i++) {
char* restoreName(char* name)
{
std::string aName(name), aNewName;
- int i, length = aName.size();
+ size_t i, length = aName.size();
char replace = (char)19;
for(i=0; i<length; i++) {
return -1;
};
-
- return length;
+ // TODO: return <int> or <size_t>?
+ return static_cast<int>(length);
};
std::ostream & operator<< (std::ostream & f,
const ParserService & S)
{
- int i, n;
+ size_t i, n;
f << " name : " << S.name << std::endl;
f << " default : " << (S.byDefault ? "yes" : "no")
<< std::endl;
std::ostream & operator<< (std::ostream & f,
const ParserInterface & I)
{
- int j, n;
+ size_t j, n;
f << " name : " << I.name << std::endl;
n = I.services.size();
std::ostream & operator<< (std::ostream & f,
const ParserComponent & C)
{
- int j, n;
+ size_t j, n;
f << std::endl
<< " name : " << C.name << std::endl;
f << " user name : " << C.username << std::endl;
{
std::list<std::string> aList;
- int sepLen = theSeparator.length();
- int startPos = 0, sepPos = theString.find(theSeparator, startPos);
+ size_t sepLen = theSeparator.length();
+ size_t startPos = 0, sepPos = theString.find(theSeparator, startPos);
while (1)
{
SALOME_ModuleCatalog::ListOfTypeDefinition* SALOME_ModuleCatalogImpl::GetTypes()
{
SALOME_ModuleCatalog::ListOfTypeDefinition_var type_list = new SALOME_ModuleCatalog::ListOfTypeDefinition();
- type_list->length(myPrivate->_typeList.size());
+ type_list->length(static_cast<unsigned long>(myPrivate->_typeList.size()));
for (unsigned int ind = 0 ; ind < myPrivate->_typeList.size() ; ind++)
{
type_list[ind].kind=SALOME_ModuleCatalog::Objref;
type_list[ind].id=CORBA::string_dup(myPrivate->_typeList[ind].id.c_str());
//bases
- type_list[ind].bases.length(myPrivate->_typeList[ind].bases.size());
+ type_list[ind].bases.length(static_cast<unsigned long>(myPrivate->_typeList[ind].bases.size()));
std::vector<std::string>::const_iterator miter;
miter=myPrivate->_typeList[ind].bases.begin();
int n_memb=0;
{
type_list[ind].kind=SALOME_ModuleCatalog::Struc;
//members
- type_list[ind].members.length(myPrivate->_typeList[ind].members.size());
+ type_list[ind].members.length(static_cast<unsigned long>(myPrivate->_typeList[ind].members.size()));
std::vector< std::pair<std::string,std::string> >::const_iterator miter;
miter=myPrivate->_typeList[ind].members.begin();
SALOME_ModuleCatalog::ListOfComponents_var _list_components =
new SALOME_ModuleCatalog::ListOfComponents;
- _list_components->length(myPrivate->_personal_module_list.size());
+ _list_components->length(static_cast<unsigned long>(myPrivate->_personal_module_list.size()));
// All the components defined in the personal catalog are taken
for(unsigned int ind=0; ind < myPrivate->_personal_module_list.size();ind++){
if(MYDEBUG) SCRUTE(_list_components[ind]) ;
}
- int indice = myPrivate->_personal_module_list.size() ;
+ size_t indice = static_cast<size_t>(myPrivate->_personal_module_list.size()) ;
bool _find = false;
// The components in the general catalog are taken only if they're
if(!_find){
if(MYDEBUG) MESSAGE("A new component " << myPrivate->_general_module_list[ind].name
<< " has to be to added in the list");
- _list_components->length(indice+1);
+ _list_components->length(static_cast<unsigned long>(indice+1));
// The component is not already defined => has to be taken
- _list_components[indice]=(myPrivate->_general_module_list[ind].name).c_str();
+ _list_components[static_cast<unsigned long>(indice)]=(myPrivate->_general_module_list[ind].name).c_str();
if(MYDEBUG) SCRUTE(_list_components[indice]) ;
indice++;
SALOME_ModuleCatalog::ListOfIAPP_Affich_var _list_components_icone =
new SALOME_ModuleCatalog::ListOfIAPP_Affich;
- _list_components_icone->length(myPrivate->_personal_module_list.size());
+ _list_components_icone->length(static_cast<unsigned long>(myPrivate->_personal_module_list.size()));
// All the components defined in the personal catalog are taken
for(unsigned int ind=0; ind < myPrivate->_personal_module_list.size();ind++){
//if(MYDEBUG) SCRUTE(_list_components_icone[ind].moduleicone);
}
- int indice = myPrivate->_personal_module_list.size() ;
+ size_t indice = myPrivate->_personal_module_list.size() ;
bool _find = false;
// The components in the general catalog are taken only if they're
}
if(!_find){
// if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
- _list_components_icone->length(indice+1);
+ _list_components_icone->length(static_cast<unsigned long>(indice+1));
// The component is not already defined => has to be taken
- _list_components_icone[indice].modulename=myPrivate->_general_module_list[ind].name.c_str();
- _list_components_icone[indice].moduleusername=myPrivate->_general_module_list[ind].username.c_str();
- _list_components_icone[indice].moduleicone=myPrivate->_general_module_list[ind].icon.c_str();
- _list_components_icone[indice].moduleversion=myPrivate->_general_module_list[ind].version.c_str();
- _list_components_icone[indice].modulecomment=myPrivate->_general_module_list[ind].comment.c_str();
+ _list_components_icone[static_cast<unsigned long>(indice)].modulename=myPrivate->_general_module_list[ind].name.c_str();
+ _list_components_icone[static_cast<unsigned long>(indice)].moduleusername=myPrivate->_general_module_list[ind].username.c_str();
+ _list_components_icone[static_cast<unsigned long>(indice)].moduleicone=myPrivate->_general_module_list[ind].icon.c_str();
+ _list_components_icone[static_cast<unsigned long>(indice)].moduleversion=myPrivate->_general_module_list[ind].version.c_str();
+ _list_components_icone[static_cast<unsigned long>(indice)].modulecomment=myPrivate->_general_module_list[ind].comment.c_str();
//if(MYDEBUG) SCRUTE(_list_components_icone[indice].modulename) ;
//if(MYDEBUG) SCRUTE(_list_components_icone[indice].moduleicone);
C_corba.implementationType=SALOME_ModuleCatalog::SO;
C_corba.implname = CORBA::string_dup(C_parser.implementationName.c_str());
- unsigned int _length = C_parser.interfaces.size();
- C_corba.interfaces.length(_length);
+ size_t _length = C_parser.interfaces.size();
+ C_corba.interfaces.length(static_cast<unsigned long>(_length));
for (unsigned int ind = 0; ind < _length; ind++)
duplicate(C_corba.interfaces[ind], C_parser.interfaces[ind]);
I_corba.interfacename = CORBA::string_dup(I_parser.name.c_str());
// duplicate service list
- unsigned int _length = I_parser.services.size();
+ size_t _length = I_parser.services.size();
// if(MYDEBUG) SCRUTE(_length);
// I_corba.interfaceservicelist
// = new SALOME_ModuleCatalog::ListOfInterfaceService;
- I_corba.interfaceservicelist.length(_length);
+ I_corba.interfaceservicelist.length(static_cast<unsigned long>(_length));
for (unsigned int ind1 = 0; ind1 < _length ; ind1 ++)
duplicate(I_corba.interfaceservicelist[ind1],
S_corba.TypeOfNode = S_parser.typeOfNode;
- unsigned int _length;
+ size_t _length;
// duplicate in Parameters
_length = S_parser.inParameters.size();
- S_corba.ServiceinParameter.length(_length);
+ S_corba.ServiceinParameter.length(static_cast<unsigned long>(_length));
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
duplicate(S_corba.ServiceinParameter[ind2],
// duplicate out Parameters
_length = S_parser.outParameters.size();
- S_corba.ServiceoutParameter.length(_length);
+ S_corba.ServiceoutParameter.length(static_cast<unsigned long>(_length));
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
duplicate(S_corba.ServiceoutParameter[ind2],
// duplicate in DataStreamParameters
_length = S_parser.inDataStreamParameters.size();
- S_corba.ServiceinDataStreamParameter.length(_length);
+ S_corba.ServiceinDataStreamParameter.length(static_cast<unsigned long>(_length));
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
duplicate(S_corba.ServiceinDataStreamParameter[ind2],
// duplicate out DataStreamParameters
_length = S_parser.outDataStreamParameters.size();
// if(MYDEBUG) SCRUTE(_length);
- S_corba.ServiceoutDataStreamParameter.length(_length);
+ S_corba.ServiceoutDataStreamParameter.length(static_cast<unsigned long>(_length));
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
duplicate(S_corba.ServiceoutDataStreamParameter[ind2],
// --- The current directory is now the directory where the object should
// be recorded
- int sizePath = splitPath.size();
+ size_t sizePath = splitPath.size();
if (sizePath > dimension_resultat){
ASSERT(sizePath == dimension_resultat+1);
context_name.length(1);
// --- The current directory is now the directory where the object should
// be destroyed
- int sizePath = splitPath.size();
+ size_t sizePath = splitPath.size();
if (sizePath > dimension_resultat)
{
ASSERT(sizePath == dimension_resultat+1);
endWithDelim = true;
if (endIdx == std::string::npos)
endIdx = path.length();
- int lsub = endIdx - begIdx;
+ size_t lsub = endIdx - begIdx;
if (lsub >= 1)
splitPath.push_back(path.substr(begIdx, lsub));
begIdx = path.find_first_not_of(delims, endIdx);
}
- int dim;
+ size_t dim;
if (onlyDir) // only directory part
{
dim = splitPath.size()-1; // omit final object
else
dim = splitPath.size(); // directories and final object
- context_name.length(dim);
+ context_name.length(static_cast<unsigned long>(dim));
for (int i=0; i<dim; i++)
{
// SCRUTE(splitPath[i]);
// MESSAGE("--- " <<splitPath[i] <<".dir");
}
}
- return dim;
+ return static_cast<int>(dim); //TODO: return <int> or <size_t>?
}
// ============================================================================
Registry::AllInfos *all = new Registry::AllInfos ;
ASSERT(all) ;
- const int RegLength = mymap.size();
+ const size_t RegLength = mymap.size();
all->length(RegLength);
std::map<int,client_infos *>::iterator im;
{
resource.setAccessProtocolTypeStr((const char *)protocol);
}
- catch (const ResourcesException & e)
+ catch (const ResourcesException & )
{
std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
{
resource.setClusterInternalProtocolStr((const char *)iprotocol);
}
- catch (const ResourcesException & e)
+ catch (const ResourcesException &)
{
std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
{
resource.setResourceTypeStr((const char*)type);
}
- catch (const ResourcesException & e)
+ catch (const ResourcesException &)
{
cerr << "Warning, invalid type \"" << (const char*)type << "\" for resource \"" <<
resource.Name << "\", using default value \"" << resource.getResourceTypeStr() <<
{
resource.setAccessProtocolTypeStr((const char *)protocol);
}
- catch (const ResourcesException & e)
+ catch (const ResourcesException &)
{
cerr << "Warning, invalid protocol \"" << (const char*)protocol << "\" for resource \"" <<
resource.Name << "\", using default value \"" <<
{
resource.setClusterInternalProtocolStr((const char *)iprotocol);
}
- catch (const ResourcesException & e)
+ catch (const ResourcesException &)
{
cerr << "Warning, invalid internal protocol \"" << (const char*)iprotocol <<
"\" for resource \"" << resource.Name << "\", using default value \"" <<
{
resource.setBatchTypeStr((const char *)batch);
}
- catch (const ResourcesException & e)
+ catch (const ResourcesException &)
{
cerr << "Warning, invalid batch manager \"" << (const char*)batch <<
"\" for resource \"" << resource.Name << "\", using default value \"" <<
{
resource.setMpiImplTypeStr((const char *)mpi);
}
- catch (const ResourcesException & e)
+ catch (const ResourcesException &)
{
cerr << "Warning, invalid MPI implementation \"" << (const char*)mpi <<
"\" for resource \"" << resource.Name << "\", using default value \"" <<
{
resource.setCanLaunchBatchJobsStr((const char *)can_launch_batch_jobs);
}
- catch (const ResourcesException & e)
+ catch (const ResourcesException &)
{
cerr << "Warning, invalid can_launch_batch_jobs parameter value \"" <<
(const char*)can_launch_batch_jobs << "\" for resource \"" << resource.Name <<
{
resource.setCanRunContainersStr((const char *)can_run_containers);
}
- catch (const ResourcesException & e)
+ catch (const ResourcesException &)
{
cerr << "Warning, invalid can_run_containers parameter value \"" <<
(const char*)can_run_containers << "\" for resource \"" << resource.Name <<
machines=new Engines::ResourceList;
nbProcsOfMachines=new Engines::IntegerList;
std::size_t sz(ret0.size());
- machines->length(sz); nbProcsOfMachines->length(sz);
+ machines->length(static_cast<unsigned long>(sz)); nbProcsOfMachines->length(static_cast<unsigned long>(sz));
for(std::size_t j=0;j<sz;j++)
{
- (*machines)[j]=CORBA::string_dup(ret0[j].c_str());
- (*nbProcsOfMachines)[j]=ret1[j];
+ (*machines)[static_cast<unsigned long>(j)]=CORBA::string_dup(ret0[j].c_str());
+ (*nbProcsOfMachines)[static_cast<unsigned long>(j)]=ret1[j];
}
}
//CCRT
assert(Destructeurs) ;
Destructeurs->push_back( &objet ) ;
- return Destructeurs->size() ;
+ return static_cast<const int>(Destructeurs->size()) ; //TODO: return <const int> or <size_t>?
}