MCPcopy Create free account
hub / github.com/cocos/cocos-engine / fileRead

Method fileRead

native/cocos/audio/android/AudioDecoder.cpp:36–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34namespace cc {
35
36size_t AudioDecoder::fileRead(void *ptr, size_t size, size_t nmemb, void *datasource) {
37 AudioDecoder *thiz = (AudioDecoder *)datasource;
38 ssize_t toReadBytes = std::min((ssize_t)(thiz->_fileData.getSize() - thiz->_fileCurrPos), (ssize_t)(nmemb * size));
39 if (toReadBytes > 0) {
40 memcpy(ptr, (unsigned char *)thiz->_fileData.getBytes() + thiz->_fileCurrPos, toReadBytes);
41 thiz->_fileCurrPos += toReadBytes;
42 }
43 // ALOGD("File size: %d, After fileRead _fileCurrPos %d", (int)thiz->_fileData.getSize(), thiz->_fileCurrPos);
44 return toReadBytes;
45}
46
47int AudioDecoder::fileSeek(void *datasource, int64_t offset, int whence) {
48 AudioDecoder *thiz = (AudioDecoder *)datasource;

Callers

nothing calls this directly

Calls 3

minFunction · 0.70
getSizeMethod · 0.45
getBytesMethod · 0.45

Tested by

no test coverage detected