summaryrefslogtreecommitdiff
path: root/src/queuebuf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/queuebuf.cpp')
-rw-r--r--src/queuebuf.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/queuebuf.cpp b/src/queuebuf.cpp
index 9577793..01d92f8 100644
--- a/src/queuebuf.cpp
+++ b/src/queuebuf.cpp
@@ -76,7 +76,12 @@ size_t Bu::QueueBuf::read( void *pRawBuf, size_t nBytes )
76 return nBytes - iLeft; 76 return nBytes - iLeft;
77} 77}
78 78
79size_t Bu::QueueBuf::peek( void *pRawBuf, size_t nBytes ) 79size_t Bu::QueueBuf::peek( void *pBuf, size_t nBytes )
80{
81 return peek( pBuf, nBytes, 0 );
82}
83
84size_t Bu::QueueBuf::peek( void *pRawBuf, size_t nBytes, size_t nSkip )
80{ 85{
81 if( nBytes <= 0 ) 86 if( nBytes <= 0 )
82 return 0; 87 return 0;
@@ -87,12 +92,16 @@ size_t Bu::QueueBuf::peek( void *pRawBuf, size_t nBytes )
87 size_t iLeft = nBytes; 92 size_t iLeft = nBytes;
88 char *pBuf = (char *)pRawBuf; 93 char *pBuf = (char *)pRawBuf;
89 94
90 int iTmpReadOffset = iReadOffset; 95 int iTmpReadOffset = iReadOffset + nSkip;
91 size_t iTmpRemSize = iTotalSize; 96 size_t iTmpRemSize = iTotalSize;
92 BlockList::iterator iBlock = lBlocks.begin(); 97 BlockList::iterator iBlock = lBlocks.begin();
98 while( iTmpReadOffset > iBlockSize )
99 {
100 iTmpReadOffset -= iBlockSize;
101 iBlock++;
102 }
93 while( iLeft > 0 && iTmpRemSize > 0 ) 103 while( iLeft > 0 && iTmpRemSize > 0 )
94 { 104 {
95 // Switching to use temp variables instead of iReadOffset and iTotalSize
96 if( iTmpReadOffset == iBlockSize ) 105 if( iTmpReadOffset == iBlockSize )
97 { 106 {
98 iBlock++; 107 iBlock++;