MCPcopy Create free account
hub / github.com/Tencent/libpag / ReadFileData

Function ReadFileData

exporter/src/utils/FileHelper.cpp:134–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134int ReadFileData(const std::string& filePath, uint8_t* buf, size_t bufSize) {
135 std::ifstream file(filePath, std::ios::binary | std::ios::ate);
136 if (!file) {
137 return 0;
138 }
139
140 size_t fileSize = file.tellg();
141 file.seekg(0);
142 file.read(reinterpret_cast<char*>(buf), std::min(fileSize, bufSize));
143 if (fileSize < bufSize) {
144 buf[fileSize] = '\0';
145 }
146 return std::min(fileSize, bufSize);
147}
148
149std::string GetFileName(const std::string& filePath) {
150 return PathToUtf8(Utf8ToPath(filePath).filename());

Callers 2

encodeHeadersMethod · 0.85
getEncodedFrameMethod · 0.85

Calls 1

readMethod · 0.80

Tested by

no test coverage detected