MCPcopy Create free account
hub / github.com/HexHive/NASS / ReadDirToVectorOfUnits

Function ReadDirToVectorOfUnits

fuzz/libfuzzer/FuzzerIO.cpp:101–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V, long *Epoch,
102 size_t MaxSize, bool ExitOnError,
103 std::vector<std::string> *VPaths) {
104 long E = Epoch ? *Epoch : 0;
105 std::vector<std::string> Files;
106 ListFilesInDirRecursive(Path, Epoch, &Files, /*TopDir*/true);
107 size_t NumLoaded = 0;
108 for (size_t i = 0; i < Files.size(); i++) {
109 auto &X = Files[i];
110 if (Epoch && GetEpoch(X) < E) continue;
111 NumLoaded++;
112 if ((NumLoaded & (NumLoaded - 1)) == 0 && NumLoaded >= 1024)
113 Printf("Loaded %zd/%zd files from %s\n", NumLoaded, Files.size(), Path);
114 auto S = FileToVector(X, MaxSize, ExitOnError);
115 if (!S.empty()) {
116 V->push_back(S);
117 if (VPaths)
118 VPaths->push_back(X);
119 }
120 }
121}
122
123void GetSizedFilesFromDir(const std::string &Dir, std::vector<SizedFile> *V) {
124 std::vector<std::string> Files;

Callers 2

FuzzerDriverFunction · 0.85
RereadOutputCorpusMethod · 0.85

Calls 7

GetEpochFunction · 0.85
FileToVectorFunction · 0.85
ListFilesInDirRecursiveFunction · 0.70
PrintfFunction · 0.70
sizeMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected