From 0a229d80fdcbb3b260fcb38ecbe5cac3a51dd575 Mon Sep 17 00:00:00 2001 From: Matthew McRaven Date: Fri, 31 Dec 2021 10:42:07 -0800 Subject: [PATCH] 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. --- elfio/elfio_section.hpp | 4 ++-- elfio/elfio_segment.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/elfio/elfio_section.hpp b/elfio/elfio_section.hpp index ea828c8..3e68c52 100644 --- a/elfio/elfio_section.hpp +++ b/elfio/elfio_section.hpp @@ -26,7 +26,7 @@ THE SOFTWARE. #include #include #include -#include +#include namespace ELFIO { @@ -197,7 +197,7 @@ template class section_impl : public section set_stream_size( stream.tellg() ); } else { - set_stream_size( ULLONG_MAX ); + set_stream_size( std::numeric_limits::max() ); } stream.seekg( ( *translator )[header_offset] ); diff --git a/elfio/elfio_segment.hpp b/elfio/elfio_segment.hpp index f7224a4..42eac63 100644 --- a/elfio/elfio_segment.hpp +++ b/elfio/elfio_segment.hpp @@ -26,7 +26,7 @@ THE SOFTWARE. #include #include #include -#include +#include namespace ELFIO { @@ -166,7 +166,7 @@ template class segment_impl : public segment set_stream_size( stream.tellg() ); } else { - set_stream_size( ULLONG_MAX ); + set_stream_size( std::numeric_limits::max() ); } stream.seekg( ( *translator )[header_offset] );