From e2f548d55e8c901fb0d8eda814f136a9fbb7e50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 15 Dec 2018 18:45:53 +0100 Subject: [PATCH] Strings - Fixed compiler warning --- src/Strings.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Strings.cc b/src/Strings.cc index 74d2e32..245a102 100644 --- a/src/Strings.cc +++ b/src/Strings.cc @@ -1425,24 +1425,27 @@ T_String T_String::trim( ) const noexcept return T_String( ); } - T_Optional< uint32_t > firstNws; + bool hasFirst = false; + uint32_t firstNws = 0; uint32_t lastNws = 0; T_StringIterator it( *this ); while ( !it.atEnd( ) ) { T_Character c( it ); if ( !c.isWhitespace( ) ) { - if ( !firstNws ) { + if ( !hasFirst ) { firstNws = it.index( ); + hasFirst = true; } lastNws = it.index( ); } it.next( ); } - if ( !firstNws ) { + if ( hasFirst ) { + return range( firstNws , lastNws ); + } else { return T_String( ); } - return range( *firstNws , lastNws ); } /*----------------------------------------------------------------------------*/