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

Function WriteAttribute

SampleFramework11/v1.02/TinyEXR.cpp:6765–6782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6763}
6764
6765void WriteAttribute(FILE *fp, const char *name, const char *type,
6766 const unsigned char *data, int len) {
6767 size_t n = fwrite(name, 1, strlen(name) + 1, fp);
6768 assert(n == strlen(name) + 1);
6769
6770 n = fwrite(type, 1, strlen(type) + 1, fp);
6771 assert(n == strlen(type) + 1);
6772
6773 int outLen = len;
6774 if (IsBigEndian()) {
6775 swap4(reinterpret_cast<unsigned int*>(&outLen));
6776 }
6777 n = fwrite(&outLen, 1, sizeof(int), fp);
6778 assert(n == sizeof(int));
6779
6780 n = fwrite(data, 1, len, fp);
6781 assert(n == len);
6782}
6783
6784typedef struct {
6785 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