From 6a9a5eeafc6f1600d7a8e260a0bac0f78e7873d3 Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 7 Feb 2007 14:25:51 +0000 Subject: [PATCH] Fixed an error in SB_Slice. git-svn-id: svn://svn.cc65.org/cc65/trunk@3770 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/common/strbuf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 */ -- 2.39.5