* Copy all of the bytes in "src" to "dst". * * On exit, "srcFp" will be seeked to the end of the file, and "dstFp" * will be seeked immediately past the data. */
| 709 | * will be seeked immediately past the data. |
| 710 | */ |
| 711 | status_t ZipFile::copyFpToFp(FILE* dstFp, FILE* srcFp, unsigned long* pCRC32) |
| 712 | { |
| 713 | unsigned char tmpBuf[32768]; |
| 714 | size_t count; |
| 715 | |
| 716 | *pCRC32 = crc32(0L, Z_NULL, 0); |
| 717 | |
| 718 | while (1) { |
| 719 | count = fread(tmpBuf, 1, sizeof(tmpBuf), srcFp); |
| 720 | if (ferror(srcFp) || ferror(dstFp)) |
| 721 | return errnoToStatus(errno); |
| 722 | if (count == 0) |
| 723 | break; |
| 724 | |
| 725 | *pCRC32 = crc32(*pCRC32, tmpBuf, count); |
| 726 | |
| 727 | if (fwrite(tmpBuf, 1, count, dstFp) != count) { |
| 728 | ALOGD("fwrite %d bytes failed\n", (int) count); |
| 729 | return UNKNOWN_ERROR; |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | return NO_ERROR; |
| 734 | } |
| 735 | |
| 736 | /* |
| 737 | * Copy all of the bytes in "src" to "dst". |
nothing calls this directly
no test coverage detected