From: cuz Date: Wed, 7 Feb 2007 14:25:51 +0000 (+0000) Subject: Fixed an error in SB_Slice. X-Git-Tag: V2.12.0~85 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6a9a5eeafc6f1600d7a8e260a0bac0f78e7873d3;p=cc65 Fixed an error in SB_Slice. git-svn-id: svn://svn.cc65.org/cc65/trunk@3770 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/common/strbuf.c b/src/common/strbuf.c index 369716c3f..2b2558edd 100644 --- a/src/common/strbuf.c +++ b/src/common/strbuf.c @@ -269,8 +269,9 @@ void SB_Slice (StrBuf* Target, const StrBuf* Source, unsigned Start, unsigned Le /* Target will be empty */ SB_Clear (Target); return; - } else if (Start + Len > Source->Len) { - Len = (Start + Len) - Source->Len; + } + if (Start + Len > Source->Len) { + Len = Source->Len - Start; } /* Make sure we have enough room in the target string buffer */