MCPcopy Create free account
hub / github.com/JayXon/Leanify / ProcessFile

Function ProcessFile

main.cpp:49–80  ·  view source on GitHub ↗

written like this in order to be callback funtion of ftw()

Source from the content-addressed store, hash-verified

47#else
48// written like this in order to be callback funtion of ftw()
49int 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
83void PauseIfNotTerminal()

Callers 1

mainFunction · 0.85

Calls 6

LeanifyFileFunction · 0.85
PrintSizeFunction · 0.85
IsOKMethod · 0.80
GetSizeMethod · 0.80
GetFilePionterMethod · 0.80
UnMapFileMethod · 0.80

Tested by

no test coverage detected