From c3f29220eac1d1ed90f1262a55cd65c41d7a3b1e Mon Sep 17 00:00:00 2001 From: aura Date: Sat, 14 Mar 2026 01:12:57 +0100 Subject: fix textures in 2d render, some bugfix --- src/util/string.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/util/string.h') diff --git a/src/util/string.h b/src/util/string.h index 04bd9c6..2268a36 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -137,7 +137,7 @@ struct __str : public LIST { } U8 equals( const CT* rhs ) { - for( U32 i = 0; i < this->size; ++i ) { + for( U32 i = 0; i < this->size + 1; ++i ) { if( !rhs[i] || this->data[i] != rhs[i] ) return 0; } @@ -158,13 +158,15 @@ struct __str : public LIST { this->data[c] = 0; this->size = c; va_end( args2 ); + + return *this; } __str& append( const CT* str ) { U32 len; for( len = 0; !!str[len]; ++len ); if( this->size + len > this->capacity ) - this->reserve( this->size * 2 ); + this->reserve( this->size + len + 1 ); memcpy( this->data + this->size, str, len * sizeof(CT) ); this->size += len; @@ -173,7 +175,7 @@ struct __str : public LIST { } __str& append( const __str& str ) { - U32 len = str.len; + U32 len = str.size; if( this->size + len + 1 >= this->capacity ) this->reserve( this->size + len + 1 ); @@ -212,6 +214,8 @@ struct __str : public LIST { if( found ) return i; } + + return -1; } CT* find( const CT* str ) { -- cgit v1.2.3