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

Method Write

UTCP/src/UT_Queue.cpp:206–227  ·  view source on GitHub ↗

Write Writes data to the write pointer and adjusts the write pointer. PARAM: pbBuffer - pointer to the buffer to receive write data count - the number of bytes to write RETURN: The actual number of bytes written ************************************************/

Source from the content-addressed store, hash-verified

204 The actual number of bytes written
205************************************************/
206int CUT_FIFO_Queue::Write(LPBYTE pbBuffer, unsigned int count) {
207
208 int nNumToWrite = (std::min)(GetFreeSize(), (int)count);
209 int nNumWritten = 0;
210
211 if(m_iWritePointer + nNumToWrite > m_cbBuffer) {
212
213 int nNumAtEnd = m_cbBuffer - m_iWritePointer;
214
215 memcpy(m_pbBuffer + m_iWritePointer, pbBuffer, nNumAtEnd);
216 nNumWritten += nNumAtEnd;
217 nNumToWrite -= nNumAtEnd;
218 m_iWritePointer = 0 ;
219 }
220
221 memcpy(m_pbBuffer + m_iWritePointer, pbBuffer + nNumWritten, nNumToWrite);
222
223 nNumWritten += nNumToWrite;
224 m_iWritePointer += nNumToWrite;
225
226 return nNumWritten;
227}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected