MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / Peek

Method Peek

UTCP/src/UT_Queue.cpp:172–193  ·  view source on GitHub ↗

Peek Reads data from the read pointer but does not adjust the read pointer. PARAM: pbBuffer - pointer to the buffer to receive read data count - the number of bytes to read RETURN: The actual number of bytes read ************************************************/

Source from the content-addressed store, hash-verified

170 The actual number of bytes read
171************************************************/
172int CUT_FIFO_Queue::Peek(LPBYTE pbBuffer, unsigned int count) {
173
174 int iReadPointer = m_iReadPointer;
175 int nNumToRead = (std::min)(GetDataSize(), (int)count);
176 int nNumRead = 0;
177
178 if(iReadPointer + nNumToRead > m_cbBuffer) {
179
180 int nNumAtEnd = m_cbBuffer - iReadPointer;
181
182 memcpy(pbBuffer, m_pbBuffer + iReadPointer, nNumAtEnd);
183 nNumRead += nNumAtEnd;
184 nNumToRead -= nNumAtEnd;
185 iReadPointer = 0 ;
186 }
187
188 memcpy(pbBuffer + nNumRead, m_pbBuffer + iReadPointer, nNumToRead);
189
190 nNumRead += nNumToRead;
191
192 return nNumRead;
193}
194
195/***********************************************
196Write

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected