mirror of
https://github.com/serge1/ELFIO.git
synced 2024-12-29 18:16:53 +00:00
String section accessor refactoring
This commit is contained in:
parent
5e39e2197f
commit
c45e81fd32
@ -63,8 +63,8 @@ class string_section_accessor
|
|||||||
Elf_Word current_position = (Elf_Word)string_section->get_size();
|
Elf_Word current_position = (Elf_Word)string_section->get_size();
|
||||||
|
|
||||||
if ( current_position == 0 ) {
|
if ( current_position == 0 ) {
|
||||||
char empty_string[1] = {'\0'};
|
char empty_string = '\0';
|
||||||
string_section->append_data( empty_string, 1 );
|
string_section->append_data( &empty_string, 1 );
|
||||||
current_position++;
|
current_position++;
|
||||||
}
|
}
|
||||||
string_section->append_data( str, (Elf_Word)std::strlen( str ) + 1 );
|
string_section->append_data( str, (Elf_Word)std::strlen( str ) + 1 );
|
||||||
@ -77,18 +77,7 @@ class string_section_accessor
|
|||||||
Elf_Word
|
Elf_Word
|
||||||
add_string( const std::string& str )
|
add_string( const std::string& str )
|
||||||
{
|
{
|
||||||
// Strings are addeded to the end of the current section data
|
return add_string( str.c_str() );
|
||||||
Elf_Word current_position = (Elf_Word)string_section->get_size();
|
|
||||||
|
|
||||||
char empty_string[1] = {'\0'};
|
|
||||||
if ( current_position == 0 ) {
|
|
||||||
string_section->append_data( empty_string, 1 );
|
|
||||||
current_position++;
|
|
||||||
}
|
|
||||||
string_section->append_data( str );
|
|
||||||
string_section->append_data( empty_string, 1 );
|
|
||||||
|
|
||||||
return current_position;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user