| 635 | |
| 636 | |
| 637 | static off_t delta( |
| 638 | const Bytes& actualSize, |
| 639 | const shared_ptr<FetcherProcess::Cache::Entry>& entry) |
| 640 | { |
| 641 | if (actualSize < entry->size) { |
| 642 | Bytes delta = entry->size - actualSize; |
| 643 | LOG(WARNING) << "URI download result for '" << entry->key |
| 644 | << "' is smaller than expected by " << stringify(delta) |
| 645 | << " at: " << entry->path(); |
| 646 | |
| 647 | return -off_t(delta.bytes()); |
| 648 | } else if (actualSize > entry->size) { |
| 649 | Bytes delta = actualSize - entry->size; |
| 650 | LOG(WARNING) << "URI download result for '" << entry->key |
| 651 | << "' is larger than expected by " << stringify(delta) |
| 652 | << " at: " << entry->path(); |
| 653 | |
| 654 | return off_t(delta.bytes()); |
| 655 | } |
| 656 | |
| 657 | return 0; |
| 658 | } |
| 659 | |
| 660 | |
| 661 | // For testing only. |