Respect maximum value of size_t in set_stream_size

When size_t is 32-bits (like in a WASM project), passing in a 64-bit constant leads to compile-time warnings.
This commit is contained in:
Matthew McRaven 2021-12-31 10:42:07 -08:00 committed by Serge Lamikhov-Center
parent 62a6f61acf
commit 0a229d80fd
2 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ THE SOFTWARE.
#include <string>
#include <iostream>
#include <new>
#include <climits>
#include <limits>
namespace ELFIO {
@ -197,7 +197,7 @@ template <class T> class section_impl : public section
set_stream_size( stream.tellg() );
}
else {
set_stream_size( ULLONG_MAX );
set_stream_size( std::numeric_limits<size_t>::max() );
}
stream.seekg( ( *translator )[header_offset] );

View File

@ -26,7 +26,7 @@ THE SOFTWARE.
#include <iostream>
#include <vector>
#include <new>
#include <climits>
#include <limits>
namespace ELFIO {
@ -166,7 +166,7 @@ template <class T> class segment_impl : public segment
set_stream_size( stream.tellg() );
}
else {
set_stream_size( ULLONG_MAX );
set_stream_size( std::numeric_limits<size_t>::max() );
}
stream.seekg( ( *translator )[header_offset] );