From 94d8c0975852d7b12e4c8acf4ab1c7f1c1a73f61 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 18 Sep 2011 13:36:11 +0100 Subject: rework this in terms of read_uInt8s_AsOString --- connectivity/source/drivers/dbase/dindexnode.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index b2fea12ab294..1844e2708d87 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -674,16 +674,13 @@ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) } else { - ByteString aBuf; sal_uInt16 nLen = rIndex.getHeader().db_keylen; - char* pStr = aBuf.AllocBuffer(nLen+1); - - rStream.Read(pStr,nLen); - pStr[nLen] = 0; - aBuf.ReleaseBufferAccess(); - aBuf.EraseTrailingChars(); - - aKey = ONDXKey(::rtl::OUString(aBuf.GetBuffer(),aBuf.Len(),rIndex.m_pTable->getConnection()->getTextEncoding()) ,aKey.nRecord); + rtl::OString aBuf = read_uInt8s_AsOString(rStream, nLen); + //get length minus trailing whitespace + sal_Int32 nContentLen = aBuf.getLength(); + while (nContentLen && aBuf[nContentLen-1] == ' ') + --nContentLen; + aKey = ONDXKey(::rtl::OUString(aBuf.getStr(), nContentLen, rIndex.m_pTable->getConnection()->getTextEncoding()) ,aKey.nRecord); } rStream >> aChild; } -- cgit