diff --git a/elfio/elfio.hpp b/elfio/elfio.hpp index bdbbd4f..32e4b2b 100644 --- a/elfio/elfio.hpp +++ b/elfio/elfio.hpp @@ -281,7 +281,7 @@ class elfio return 0; } - new_section->set_index( sections_.size() ); + new_section->set_index( (Elf_Half)sections_.size() ); sections_.push_back( new_section ); return new_section; diff --git a/elfio/elfio_note.hpp b/elfio/elfio_note.hpp index cf93710..b839eaf 100644 --- a/elfio/elfio_note.hpp +++ b/elfio/elfio_note.hpp @@ -40,7 +40,7 @@ class note_section_accessor Elf_Word get_notes_num() const { - return note_start_positions.size(); + return (Elf_Word)note_start_positions.size(); } //------------------------------------------------------------------------------ @@ -85,7 +85,7 @@ class note_section_accessor { const endianess_convertor& convertor = elf_file.get_convertor(); - Elf_Word nameLen = name.size() + 1; + Elf_Word nameLen = (Elf_Word)name.size() + 1; Elf_Word nameLenConv = convertor( nameLen ); std::string buffer( reinterpret_cast( &nameLenConv ), sizeof( nameLenConv ) ); Elf_Word descSizeConv = convertor( descSize ); diff --git a/elfio/elfio_section.hpp b/elfio/elfio_section.hpp index 9b46b86..bf4890a 100644 --- a/elfio/elfio_section.hpp +++ b/elfio/elfio_section.hpp @@ -162,7 +162,7 @@ class section_impl : public section void set_data( const std::string& str_data ) { - return set_data( str_data.c_str(), str_data.size() ); + return set_data( str_data.c_str(), (Elf_Word)str_data.size() ); } //------------------------------------------------------------------------------ @@ -191,7 +191,7 @@ class section_impl : public section void append_data( const std::string& str_data ) { - return append_data( str_data.c_str(), str_data.size() ); + return append_data( str_data.c_str(), (Elf_Word)str_data.size() ); } //------------------------------------------------------------------------------ diff --git a/elfio/elfio_segment.hpp b/elfio/elfio_segment.hpp index d61df84..be90d8b 100644 --- a/elfio/elfio_segment.hpp +++ b/elfio/elfio_segment.hpp @@ -112,14 +112,14 @@ class segment_impl : public segment set_align( addr_align ); } - return sections.size(); + return (Elf_Half)sections.size(); } //------------------------------------------------------------------------------ Elf_Half get_sections_num() const { - return sections.size(); + return (Elf_Half)sections.size(); } //------------------------------------------------------------------------------ diff --git a/elfio/elfio_strings.hpp b/elfio/elfio_strings.hpp index fa37b83..4c688cf 100644 --- a/elfio/elfio_strings.hpp +++ b/elfio/elfio_strings.hpp @@ -67,7 +67,7 @@ class string_section_accessor string_section->append_data( empty_string, 1 ); current_position++; } - string_section->append_data( str, std::strlen( str ) + 1 ); + string_section->append_data( str, (Elf_Word)std::strlen( str ) + 1 ); return current_position; }