Skip to content

Commit

Permalink
JR: Fixed #57
Browse files Browse the repository at this point in the history
Co-authored-by: Jakob Riedle <[email protected]>
  • Loading branch information
DuffsDevice and Jakob Riedle authored Mar 9, 2021
1 parent 295c6a5 commit ff84a31
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions include/tinyutf8/tinyutf8.h
Original file line number Diff line number Diff line change
Expand Up @@ -643,12 +643,6 @@ namespace tiny_utf8
data{ value , '\0' }
, data_len( (unsigned char)( size - 1u ) << 1 )
{}
SSO( size_type data_len ) noexcept :
// Note: No initialization of .data (important for the constructor of basic_string(value_type)...)
data_len( (unsigned char)( ( size - data_len ) << 1 ) )
{
data[data_len] = '\0'; // Add delimiter to actual data
}
SSO() noexcept :
data{ '\0' }
, data_len( (unsigned char)( size - 0 ) << 1 )
Expand Down Expand Up @@ -1246,8 +1240,10 @@ namespace tiny_utf8
explicit inline basic_string( value_type cp , const allocator_type& alloc = allocator_type() )
noexcept(TINY_UTF8_NOEXCEPT)
: Allocator( alloc )
, t_sso( (size_type)encode_utf8( cp , t_sso.data ) )
{}
{
t_sso.data[ cp = encode_utf8( cp , t_sso.data ) ] = '\0';
set_sso_data_len( cp );
}
/**
* Constructor that fills the string with the supplied character
*
Expand Down

0 comments on commit ff84a31

Please sign in to comment.