MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / Read

Method Read

Kernel/src/characterbuffer.cpp:48–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48size_t CharacterBuffer::Read(char* _buffer, size_t count){
49 acquireLock(&(this->lock));
50
51 if(count > bufferPos) {
52 count = bufferPos;
53 }
54
55 if(count <= 0) {
56 releaseLock(&(this->lock));
57 return 0;
58 }
59
60 for(unsigned i = 0; i < count; i++){
61 if(buffer[i] == '\0') {
62 lines--;
63 continue;
64 }
65
66 _buffer[i] = buffer[i];
67
68 if(buffer[i] == '\n') lines--;
69 }
70
71 for(unsigned i = 0; i < bufferSize - count; i++){
72 buffer[i] = buffer[count + i];
73 }
74
75 bufferPos -= count;
76
77 releaseLock(&(this->lock));
78
79 return count;
80}
81
82void CharacterBuffer::Flush(){
83 acquireLock(&(this->lock));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected