summaryrefslogtreecommitdiff
path: root/vcl/unx/generic
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r--vcl/unx/generic/printer/jobdata.cxx3
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx12
2 files changed, 8 insertions, 7 deletions
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index 89673ba05b34..acad5897b9b4 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -279,8 +279,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 c882822200ed..3b81c539bf21 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1847,17 +1847,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 )
+ const size_t nBytes = rBuffer.size() - 1;
+ size_t nRun = 0;
+ while (nRun < nBytes && rBuffer[nRun])
{
- OString aLine( pRun );
+ OString aLine(rBuffer.data() + nRun);
sal_Int32 nPos = aLine.indexOf(':');
if( nPos != -1 )
{
@@ -1876,8 +1877,7 @@ void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes )
<< " }");
}
}
- nBytes -= aLine.getLength()+1;
- pRun += aLine.getLength()+1;
+ nRun += aLine.getLength()+1;
}
}