From 3718980c096e55011097722ac447ce8493d9cfc7 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 15 Dec 2020 12:16:22 +0100 Subject: [PATCH 1/2] Only consider continuation tokens at end of line --- include/assimp/IOStreamBuffer.h | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/include/assimp/IOStreamBuffer.h b/include/assimp/IOStreamBuffer.h index 6ca9be84a..5bcc2671a 100644 --- a/include/assimp/IOStreamBuffer.h +++ b/include/assimp/IOStreamBuffer.h @@ -254,25 +254,16 @@ bool IOStreamBuffer::getNextDataLine( std::vector &buffer, T continuationT } } - bool continuationFound( false ); size_t i = 0; for( ;; ) { - if ( continuationToken == m_cache[ m_cachePos ] ) { - continuationFound = true; + if ( continuationToken == m_cache[ m_cachePos ] && IsLineEnd( m_cache[ m_cachePos + 1 ] ) ) { ++m_cachePos; - } - if ( IsLineEnd( m_cache[ m_cachePos ] ) ) { - if ( !continuationFound ) { - // the end of the data line - break; - } else { - // skip line end - while ( m_cache[m_cachePos] != '\n') { - ++m_cachePos; - } + while (m_cache[m_cachePos] != '\n') { ++m_cachePos; - continuationFound = false; } + ++m_cachePos; + } else if ( IsLineEnd ( m_cache[ m_cachePos ] ) ) { + break; } buffer[ i ] = m_cache[ m_cachePos ]; From 8003a016c29e686e3380952abcd5f214314bb4ba Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 15 Dec 2020 12:36:00 +0100 Subject: [PATCH 2/2] Add some spaces to format code consistently --- include/assimp/IOStreamBuffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/assimp/IOStreamBuffer.h b/include/assimp/IOStreamBuffer.h index 5bcc2671a..9a70ad115 100644 --- a/include/assimp/IOStreamBuffer.h +++ b/include/assimp/IOStreamBuffer.h @@ -258,7 +258,7 @@ bool IOStreamBuffer::getNextDataLine( std::vector &buffer, T continuationT for( ;; ) { if ( continuationToken == m_cache[ m_cachePos ] && IsLineEnd( m_cache[ m_cachePos + 1 ] ) ) { ++m_cachePos; - while (m_cache[m_cachePos] != '\n') { + while ( m_cache[ m_cachePos ] != '\n' ) { ++m_cachePos; } ++m_cachePos;