Some bug fixes

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1008 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2002-09-10 13:38:43 +00:00
parent 9bdc18602a
commit 8f86fcdc82
+3 -5
View File
@@ -518,11 +518,9 @@ BString::UnlockBuffer(int32 length)
if (len < 0) if (len < 0)
len = strlen(_privateData); len = strlen(_privateData);
else if (len > Length())
len = Length();
if (len > 0) if (len != Length())
_privateData = _ShrinkAtBy(len, Length() - len); _privateData = _GrowBy(len - Length()); // Can be negative
return *this; return *this;
} }
@@ -690,7 +688,7 @@ BString::_OpenAtBy(int32 offset, int32 length)
char* char*
BString::_ShrinkAtBy(int32 offset, int32 length) BString::_ShrinkAtBy(int32 offset, int32 length)
{ {
assert(offset + length < Length()); assert(offset + length <= Length());
int32 oldLength = Length(); int32 oldLength = Length();
memmove(_privateData + offset, _privateData + offset + length, memmove(_privateData + offset, _privateData + offset + length,