MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / WriteAttribute

Function WriteAttribute

SampleFramework12/v1.00/TinyEXR.cpp:6766–6783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6764}
6765
6766void WriteAttribute(FILE *fp, const char *name, const char *type,
6767 const unsigned char *data, int len) {
6768 size_t n = fwrite(name, 1, strlen(name) + 1, fp);
6769 assert(n == strlen(name) + 1);
6770
6771 n = fwrite(type, 1, strlen(type) + 1, fp);
6772 assert(n == strlen(type) + 1);
6773
6774 int outLen = len;
6775 if (IsBigEndian()) {
6776 swap4(reinterpret_cast<unsigned int*>(&outLen));
6777 }
6778 n = fwrite(&outLen, 1, sizeof(int), fp);
6779 assert(n == sizeof(int));
6780
6781 n = fwrite(data, 1, len, fp);
6782 assert(n == len);
6783}
6784
6785typedef struct {
6786 std::string name; // less than 255 bytes long

Callers 3

SaveEXRFunction · 0.85
SaveMultiChannelEXRFunction · 0.85
SaveDeepEXRFunction · 0.85

Calls 2

IsBigEndianFunction · 0.85
swap4Function · 0.85

Tested by

no test coverage detected