Salome HOME
BUG: impossible to import a med file of size more than MAX_INT (~2.1 Gb)
[modules/smesh.git] / src / SMESHUtils / SMESH_File.cxx
index d4311bb71ef29464b7b926b689e2f1bbbc5dfa61..556212201577637d642265fd613a4cc9ecde78b8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -75,7 +75,7 @@ SMESH_File::~SMESH_File()
 
 bool SMESH_File::open()
 {
-  int length = size();
+  long length = size();
   if ( !_map && length > 0 )
   {
 #ifdef WIN32
@@ -188,7 +188,7 @@ long SMESH_File::size()
   boost::uintmax_t size = boofs::file_size( _name, err );
   _error = err.message();
 
-  return err ? -1 : (long) size;
+  return !err ? (long) size : -1;
 }
 
 //================================================================================
@@ -271,7 +271,7 @@ void SMESH_File::rewind()
 
 bool SMESH_File::getInts(std::vector<int>& ints)
 {
-  int i = 0;
+  size_t i = 0;
   while ( i < ints.size() )
   {
     while ( !isdigit( *_pos ) && !eof()) ++_pos;
@@ -330,7 +330,7 @@ bool SMESH_File::writeRaw(const void* data, size_t size)
 #else
 
   ssize_t nbWritten = ::write( _file, data, size );
-  return ( nbWritten == size );
+  return ( nbWritten == (ssize_t) size );
 
 #endif
 }