summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/ppdparser.hxx2
-rw-r--r--vcl/unx/generic/printer/jobdata.cxx3
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx11
3 files changed, 9 insertions, 7 deletions
diff --git a/include/vcl/ppdparser.hxx b/include/vcl/ppdparser.hxx
index 78f47417ae84..b0bddea9acb1 100644
--- a/include/vcl/ppdparser.hxx
+++ b/include/vcl/ppdparser.hxx
@@ -261,7 +261,7 @@ public:
// for printer setup
char* getStreamableBuffer( sal_uLong& rBytes ) const;
- void rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes );
+ void rebuildFromStreamBuffer(const std::vector<char> &rBuffer);
// convenience
int getRenderResolution() const;
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;
}
}