diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-18 13:36:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-19 09:59:21 +0100 |
commit | 94d8c0975852d7b12e4c8acf4ab1c7f1c1a73f61 (patch) | |
tree | 1d83a03cca3e821eb88b53146367bb3995c577a5 /connectivity | |
parent | 5d73752cc7d66edae26392f84e72e32a8cf598ca (diff) |
rework this in terms of read_uInt8s_AsOString
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/dbase/dindexnode.cxx | 15 |
1 files changed, 6 insertions, 9 deletions
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; } |