MCPcopy Create free account
hub / github.com/CyanogenMod/android_frameworks_base / writeResFileFD

Function writeResFileFD

tools/aapt/Package.cpp:335–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333}
334
335status_t writeResFileFD(int fd, const sp<AaptAssets>& assets) {
336 FILE* fp = fdopen(fd, "w+");
337 sp<AaptFile> resFile(getResourceFile(assets));
338 if (resFile == NULL || resFile->getData() == NULL || resFile->getSize() == 0) {
339 fprintf(stderr, "Res table or its data is null or empty. Nothing to write\n");
340 fclose(fp);
341 return UNKNOWN_ERROR;
342 }
343
344 int count = 0;
345 count = fwrite(resFile->getData(), 1, resFile->getSize(), fp);
346
347 if (count == 0) {
348 fprintf(stderr, "Nothing written to %d\n", fd);
349 }
350 fclose(fp);
351
352 return NO_ERROR;
353}
354
355ssize_t processAssets(Bundle* bundle, ZipFile* zip,
356 const sp<AaptAssets>& assets, bool isOverlay)

Callers 1

doPackageFunction · 0.85

Calls 3

getResourceFileFunction · 0.85
getSizeMethod · 0.65
getDataMethod · 0.45

Tested by

no test coverage detected