MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / loadBufferFromResources

Function loadBufferFromResources

src/resource.cpp:83–102  ·  view source on GitHub ↗

* Get resource data into a supplied buffer. * @param filename Name of the file to get. * @param buffer Buffer to use as target storage. * @param n Size of the supplied buffer. * @return Whether the requested resource could be loaded (copied) into the supplied buffer. */

Source from the content-addressed store, hash-verified

81 * @return Whether the requested resource could be loaded (copied) into the supplied buffer.
82 */
83bool loadBufferFromResources(const std::string &filename, unsigned char *buffer, const size_t n)
84{
85 size_t length = 0;
86 const unsigned char *data = NULL;
87
88 if(!loadResource(filename, &data, &length))
89 {
90 LOG_ERROR << "failed to load resource: " << filename;
91 return false;
92 }
93
94 if(length != n)
95 {
96 LOG_ERROR << "wrong size of resource: " << filename;
97 return false;
98 }
99
100 memcpy(buffer, data, length);
101 return true;
102}
103
104} /* namespace libfreenect2 */

Callers

nothing calls this directly

Calls 1

loadResourceFunction · 0.85

Tested by

no test coverage detected