written like this in order to be callback funtion of ftw()
| 47 | #else |
| 48 | // written like this in order to be callback funtion of ftw() |
| 49 | int ProcessFile(const char file_path[], const struct stat *sb = nullptr, int typeflag = FTW_F) |
| 50 | { |
| 51 | if (typeflag != FTW_F) |
| 52 | { |
| 53 | return 0; |
| 54 | } |
| 55 | cout << "Processing: " << file_path << endl; |
| 56 | string filename(file_path); |
| 57 | #endif // _WIN32 |
| 58 | |
| 59 | |
| 60 | File input_file(file_path); |
| 61 | |
| 62 | if (input_file.IsOK()) |
| 63 | { |
| 64 | size_t original_size = input_file.GetSize(); |
| 65 | |
| 66 | size_t new_size = LeanifyFile(input_file.GetFilePionter(), original_size, 0, filename); |
| 67 | |
| 68 | PrintSize(original_size); |
| 69 | cout << " -> "; |
| 70 | PrintSize(new_size); |
| 71 | cout << "\tLeanified: "; |
| 72 | PrintSize(original_size - new_size); |
| 73 | |
| 74 | cout << " (" << 100 - 100.0 * new_size / original_size << "%)" << endl; |
| 75 | |
| 76 | input_file.UnMapFile(new_size); |
| 77 | } |
| 78 | |
| 79 | return 0; |
| 80 | } |
| 81 | |
| 82 | |
| 83 | void PauseIfNotTerminal() |
no test coverage detected