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

Method Seek

UTCP/src/UTDataSource.cpp:387–401  ·  view source on GitHub ↗

Seek Moves the file pointer to a specified location Params offset - number of bytes from origin origin - initial position SEEK_CUR SEEK_END SEEK_SET Return offset, in bytes, of the new position from the beginning of the file -1 - error *****************************************/

Source from the content-addressed store, hash-verified

385 -1 - error
386*****************************************/
387long CUT_FileDataSource::Seek(long offset, int origin)
388{
389 // When we reading the line of text we use buffering. Thats why
390 // actual file position will not match. Fix this problem by subtractng
391 // number of bytes read in buffer from current file position
392 if(origin == SEEK_CUR && m_nLoadedDataSize > 0) {
393 long lCurPos = m_file.Seek(0, SEEK_CUR) - m_nLoadedDataSize;
394 if(lCurPos > 0)
395 m_file.Seek(lCurPos, SEEK_SET);
396 }
397
398 m_nLoadedDataSize = 0;
399
400 return m_file.Seek(offset, origin);
401}
402
403// =================================================================
404// CUT_BufferDataSource class

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected