diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-19 21:43:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-06-20 12:23:39 +0200 |
commit | 6e5e83025c948b699bb65839ef810a45a98ba014 (patch) | |
tree | d46e1ea731ce9e6ed0f809f33b0e7134936f62bf /vcl | |
parent | cb5c2d204b5dde6eff5d9ecfe46701eb8a82896f (diff) |
forcepoint: rework to explore loop
Change-Id: I14f6a3269fc3347a9976d899519e74f58d5975c8
Reviewed-on: https://gerrit.libreoffice.org/56125
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/generic/printer/jobdata.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/generic/printer/ppdparser.cxx | 11 |
2 files changed, 8 insertions, 6 deletions
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index edf377e7665e..8d3ae1cf9801 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -278,8 +278,9 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo nBytes = aStream.ReadBytes(aRemain.data(), nBytes); if (nBytes) { + aRemain.resize(nBytes+1); aRemain[nBytes] = 0; - rJobData.m_aContext.rebuildFromStreamBuffer(aRemain.data(), nBytes); + rJobData.m_aContext.rebuildFromStreamBuffer(aRemain); bContext = true; } } diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index e4b14c5c0b17..c333306bf0ef 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -1905,17 +1905,18 @@ char* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const return pBuffer; } -void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes ) +void PPDContext::rebuildFromStreamBuffer(const std::vector<char> &rBuffer) { if( ! m_pParser ) return; m_aCurrentValues.clear(); - char* pRun = pBuffer; - while( nBytes && *pRun ) + size_t nBytes = rBuffer.size() - 1; + size_t nRun = 0; + while (nBytes && rBuffer[nRun]) { - OString aLine( pRun ); + OString aLine(rBuffer.data() + nRun); sal_Int32 nPos = aLine.indexOf(':'); if( nPos != -1 ) { @@ -1935,7 +1936,7 @@ void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes ) } } nBytes -= aLine.getLength()+1; - pRun += aLine.getLength()+1; + nRun += aLine.getLength()+1; } } |