in dmg/resources.c [716:761]
static void writeResourceData(AbstractFile* file, ResourceData* data, ResourceKey* curResource, FlipDataFunc flipData, int tabLength, bool plstNameIsAttribution) {
unsigned char* dataBuf;
char* tabs;
int i;
tabs = (char*) malloc(sizeof(char) * (tabLength + 1));
for(i = 0; i < tabLength; i++) {
tabs[i] = '\t';
}
tabs[tabLength] = '\0';
abstractFilePrint(file, "%s<dict>\n", tabs);
abstractFilePrint(file, "%s\t<key>Attributes</key>\n%s\t<string>0x%04x</string>\n", tabs, tabs, data->attributes);
if(strcmp((char*) curResource->key, "blkx") == 0)
abstractFilePrint(file, "%s\t<key>CFName</key>\n%s\t<string>%s</string>\n", tabs, tabs, data->name);
abstractFilePrint(file, "%s\t<key>Data</key>\n%s\t<data>\n", tabs, tabs);
if(flipData) {
dataBuf = (unsigned char*) malloc(data->dataLength);
memcpy(dataBuf, data->data, data->dataLength);
(*flipData)(dataBuf, 1);
writeBase64(file, dataBuf, data->dataLength, tabLength + 1, 43);
free(dataBuf);
} else {
writeBase64(file, data->data, data->dataLength, tabLength + 1, 43);
}
abstractFilePrint(file, "%s\t</data>\n", tabs);
abstractFilePrint(file, "%s\t<key>ID</key>\n%s\t<string>%d</string>\n", tabs, tabs, data->id);
if (strcmp((char*) curResource->key, "plst") == 0 && plstNameIsAttribution) {
unsigned char* nameBuf = (unsigned char*) malloc(sizeof(AttributionResource));
memcpy(nameBuf, data->name, sizeof(AttributionResource));
flipAttributionResource(nameBuf, 1);
abstractFilePrint(file, "%s\t<key>Name</key>\n%s\t<string>\n", tabs, tabs);
writeBase64(file, nameBuf, sizeof(AttributionResource), tabLength + 1, 43);
abstractFilePrint(file, "%s\t</string>\n", tabs);
}
else {
abstractFilePrint(file, "%s\t<key>Name</key>\n%s\t<string>%s</string>\n", tabs, tabs, data->name);
}
abstractFilePrint(file, "%s</dict>\n", tabs);
free(tabs);
}