| 727 | } |
| 728 | |
| 729 | void InformationRecoverFile(int threshold, const char *outFilename, char *const *inFilenames) |
| 730 | { |
| 731 | CRYPTOPP_ASSERT(threshold<=1000); |
| 732 | if (threshold < 1 || threshold > 1000) |
| 733 | throw InvalidArgument("InformationRecoverFile: " + IntToString(threshold) + " is not in range [1, 1000]"); |
| 734 | |
| 735 | InformationRecovery recovery(threshold, new FileSink(outFilename)); |
| 736 | |
| 737 | vector_member_ptrs<FileSource> fileSources(threshold); |
| 738 | SecByteBlock channel(4); |
| 739 | int i; |
| 740 | for (i=0; i<threshold; i++) |
| 741 | { |
| 742 | fileSources[i].reset(new FileSource(inFilenames[i], false)); |
| 743 | fileSources[i]->Pump(4); |
| 744 | fileSources[i]->Get(channel, 4); |
| 745 | fileSources[i]->Attach(new ChannelSwitch(recovery, string((char *)channel.begin(), 4))); |
| 746 | } |
| 747 | |
| 748 | while (fileSources[0]->Pump(256)) |
| 749 | for (i=1; i<threshold; i++) |
| 750 | fileSources[i]->Pump(256); |
| 751 | |
| 752 | for (i=0; i<threshold; i++) |
| 753 | fileSources[i]->PumpAll(); |
| 754 | } |
| 755 | |
| 756 | void GzipFile(const char *in, const char *out, int deflate_level) |
| 757 | { |
no test coverage detected