MCPcopy Create free account
hub / github.com/TASEmulators/fceux / _fread

Method _fread

src/emufile.cpp:39–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39size_t EMUFILE_MEMORY::_fread(const void *ptr, size_t bytes){
40 size_t remain = len-pos;
41 size_t todo = std::min<size_t>(remain,bytes);
42 if(len==0)
43 {
44 failbit = true;
45 return 0;
46 }
47 if(todo<=4)
48 {
49 u8* src = buf()+pos;
50 u8* dst = (u8*)ptr;
51 for(size_t i=0;i<todo;i++)
52 *dst++ = *src++;
53 }
54 else
55 {
56 memcpy((void*)ptr,buf()+pos,todo);
57 }
58 pos += todo;
59 if(todo<bytes)
60 failbit = true;
61 return todo;
62}
63
64void EMUFILE_FILE::open(const char* fname, const char* mode)
65{

Callers 4

read8leFunction · 0.45
read32leFunction · 0.45
read16leFunction · 0.45
read64leFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected