X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FContainer%2FSalome_file_i.cxx;h=41ff72e14107065ee5ff36c8a18bc5123f89b98f;hb=3ce0546302001755828c8476425a60c6ab61ac92;hp=afcea4d3bb09c40b3d36006e7208edbb49de91da;hpb=288dc1c84630e521220d796b7c88c518f34856d5;p=modules%2Fkernel.git diff --git a/src/Container/Salome_file_i.cxx b/src/Container/Salome_file_i.cxx index afcea4d3b..41ff72e14 100644 --- a/src/Container/Salome_file_i.cxx +++ b/src/Container/Salome_file_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -91,7 +91,7 @@ Salome_file_i::load(const char* hdf5_file) { HDFfile *hdf_file; HDFgroup *hdf_group; HDFdataset *hdf_dataset; - int size; + size_t size; int fd; char * value; char * buffer; @@ -191,15 +191,15 @@ Salome_file_i::load(const char* hdf5_file) { std::string text = "open failed"; es.text = CORBA::string_dup(text.c_str()); throw SALOME::SALOME_Exception(es); - }; + } hdf_dataset->ReadFromDisk(buffer); - if ( write(fd,buffer,size) <0) { + if ( write(fd,buffer,(unsigned int)size) <0) { SALOME::ExceptionStruct es; es.type = SALOME::INTERNAL_ERROR; std::string text = "write failed"; es.text = CORBA::string_dup(text.c_str()); throw SALOME::SALOME_Exception(es); - }; + } // Close the target file ::close(fd); @@ -373,7 +373,7 @@ Salome_file_i::save_all(const char* hdf5_file) { } // For each file we create two groups - // First group contains file's informations + // First group contains file's information // Second group contains the file // At the end we create a group and a dataset containing the names // of all the files. @@ -501,7 +501,7 @@ Salome_file_i::setLocalFile(const char* comp_file_name) std::string cp_file_name(comp_file_name); std::size_t index = cp_file_name.rfind("/"); - if (index != -1) + if (index != std::string::npos) { file_name = cp_file_name.substr(index+1); path = cp_file_name.substr(0,index+1); @@ -527,7 +527,7 @@ Salome_file_i::setLocalFile(const char* comp_file_name) if(fopen(comp_file_name,"rb") != NULL) status = "ok"; - // Adding file with is informations + // Adding file with its information Engines::file infos; infos.file_name = CORBA::string_dup(file_name.c_str()); infos.path = CORBA::string_dup(path.c_str()); @@ -563,7 +563,7 @@ Salome_file_i::setDistributedFile(const char* comp_file_name) std::string cp_file_name(comp_file_name); std::size_t index = cp_file_name.rfind("/"); - if (index != -1) + if (index != std::string::npos) { file_name = cp_file_name.substr(index+1); path = cp_file_name.substr(0,index+1); @@ -585,7 +585,7 @@ Salome_file_i::setDistributedFile(const char* comp_file_name) throw SALOME::SALOME_Exception(es); } - // Adding file with his informations + // Adding file with its information Engines::file infos; infos.file_name = CORBA::string_dup(file_name.c_str()); infos.path = CORBA::string_dup(path.c_str()); @@ -883,7 +883,7 @@ Salome_file_i::getDistributedFile(std::string file_name) */ //============================================================================= void -Salome_file_i::removeFile(const char* file_name) +Salome_file_i::removeFile(const char* /*file_name*/) { MESSAGE("Salome_file_i::removeFile : NOT YET IMPLEMENTED"); } @@ -909,7 +909,7 @@ Engines::files* Salome_file_i::getFilesInfos() { Engines::files * infos = new Engines::files(); - infos->length(_fileManaged.size()); + infos->length((CORBA::ULong)_fileManaged.size()); _t_fileManaged::iterator begin = _fileManaged.begin(); _t_fileManaged::iterator end = _fileManaged.end(); @@ -962,7 +962,7 @@ Salome_file_i::getSalome_fileState() /*! * CORBA method: try to open the file given. If the file is readable, return * a positive integer else return 0; - * \param fileName file name to be transfered + * \param fileName file name to be transferred * \return fileId = positive integer > 0 if open OK. */ //============================================================================= @@ -1058,8 +1058,8 @@ Salome_file_i::getBlock(CORBA::Long fileId) // 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); - aBlock->replace(nbRed, nbRed, buf, 1); // 1 means give ownership + size_t nbRed = fread(buf, sizeof(CORBA::Octet), FILEBLOCK_SIZE, fp); + aBlock->replace((CORBA::ULong)nbRed, (CORBA::ULong)nbRed, buf, 1); // 1 means give ownership //!< TODO: conversion from size_t to CORBA::ULong return aBlock; }