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

Method Read

UTCP/src/UT_Queue.cpp:138–159  ·  view source on GitHub ↗

Read Reads data from the read pointer and adjusts 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

136 The actual number of bytes read
137************************************************/
138int CUT_FIFO_Queue::Read(LPBYTE pbBuffer, unsigned int count) {
139
140 int nNumToRead = (std::min)(GetDataSize(), (int)count);
141 int nNumRead = 0;
142
143 if(m_iReadPointer + nNumToRead > m_cbBuffer) {
144
145 int nNumAtEnd = m_cbBuffer - m_iReadPointer;
146
147 memcpy(pbBuffer, m_pbBuffer + m_iReadPointer, nNumAtEnd);
148 nNumRead += nNumAtEnd;
149 nNumToRead -= nNumAtEnd;
150 m_iReadPointer = 0 ;
151 }
152
153 memcpy(pbBuffer + nNumRead, m_pbBuffer + m_iReadPointer, nNumToRead);
154
155 nNumRead += nNumToRead;
156 m_iReadPointer += nNumToRead;
157
158 return nNumRead;
159}
160
161/***********************************************
162Peek

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected