diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-28 22:17:59 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-29 09:33:45 +0100 |
commit | d1c8b0bb8642f21bdc10f1ba76717d499556faac (patch) | |
tree | cac6a03a7e34d6fcad10f006fdc26fe50b8a2d8e /filter | |
parent | c50612d51619fb92393f32c6832628ffbbdcb920 (diff) |
ByteString->rtl::OString[Buffer}
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/graphicfilter/idxf/dxfgrprd.cxx | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.cxx b/filter/source/graphicfilter/idxf/dxfgrprd.cxx index 176db97c0ba5..e52662ee16ea 100644 --- a/filter/source/graphicfilter/idxf/dxfgrprd.cxx +++ b/filter/source/graphicfilter/idxf/dxfgrprd.cxx @@ -31,6 +31,7 @@ #include <string.h> #include <stdlib.h> +#include <rtl/strbuf.hxx> #include <tools/stream.hxx> #include "dxfgrprd.hxx" @@ -40,14 +41,14 @@ // a 0-sign occurs; this functions converts 0-signs to blanks and reads // a complete line until a cr/lf is found -sal_Bool DXFReadLine( SvStream& rIStm, ByteString& rStr ) +rtl::OString DXFReadLine(SvStream& rIStm) { char buf[256 + 1]; sal_Bool bEnd = sal_False; sal_uLong nOldFilePos = rIStm.Tell(); char c = 0; - rStr.Erase(); + rtl::OStringBuffer aBuf; while( !bEnd && !rIStm.GetError() ) // !!! nicht auf EOF testen, // !!! weil wir blockweise @@ -56,8 +57,8 @@ sal_Bool DXFReadLine( SvStream& rIStm, ByteString& rStr ) sal_uInt16 nLen = (sal_uInt16)rIStm.Read( buf, sizeof(buf)-1 ); if( !nLen ) { - if( rStr.Len() == 0 ) - return sal_False; + if( aBuf.getLength() == 0 ) + return rtl::OString(); else break; } @@ -69,7 +70,7 @@ sal_Bool DXFReadLine( SvStream& rIStm, ByteString& rStr ) { if( !c ) c = ' '; - rStr += c; + aBuf.append(c); } else { @@ -79,23 +80,23 @@ sal_Bool DXFReadLine( SvStream& rIStm, ByteString& rStr ) } } - if( !bEnd && !rIStm.GetError() && rStr.Len() ) + if( !bEnd && !rIStm.GetError() && aBuf.getLength() ) bEnd = sal_True; - nOldFilePos += rStr.Len(); + nOldFilePos += aBuf.getLength(); if( rIStm.Tell() > nOldFilePos ) nOldFilePos++; rIStm.Seek( nOldFilePos ); // seeken wg. obigem BlockRead! if( bEnd && (c=='\r' || c=='\n')) // Sonderbehandlung DOS-Dateien { - char cTemp; - rIStm.Read((char*)&cTemp , sizeof(cTemp) ); + char cTemp(0); + rIStm.Read(&cTemp, 1); if( cTemp == c || (cTemp != '\n' && cTemp != '\r') ) rIStm.Seek( nOldFilePos ); } - return bEnd; + return aBuf.makeStringAndClear(); } // ------------------ @@ -274,30 +275,14 @@ void DXFGroupReader::SetS(sal_uInt16 nG, const char * sS) void DXFGroupReader::ReadLine(char * ptgt) { - ByteString aStr; - sal_uLong nLen; + rtl::OString aStr = DXFReadLine(rIS); - DXFReadLine( rIS, aStr ); - - nLen = aStr.Len(); + size_t nLen = aStr.getLength(); if ( nLen > DXF_MAX_STRING_LEN ) nLen = DXF_MAX_STRING_LEN; - memcpy( ptgt, aStr.GetBuffer(), nLen ); + memcpy( ptgt, aStr.getStr(), nLen ); ptgt[ nLen ] = 0x00; -/* - if ( pCallback ) - { - const sal_uLong nPercent= nMinPercent + (nMaxPercent-nMinPercent)*rIS.Tell() / nFileSize; - - if ( nPercent >= nLastPercent + 4 ) - { - nLastPercent=nPercent; - if (((*pCallback)(pCallerData,(sal_uInt16)nPercent))==sal_True) - bStatus=sal_False; - } - } -*/ } |