MCPcopy Create free account
hub / github.com/dobin/RedEdr / AnalyzeFile

Function AnalyzeFile

RedEdrTester/RedEdrTester.cpp:139–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137
138
139void AnalyzeFile(char *fname) {
140 g_Config.hide_full_output = 1;
141 g_Config.debug = 1;
142 std::string filename = std::string(fname);
143 LOG_A(LOG_INFO, "Analyzer: Reading %s", filename.c_str());
144 std::string json_file_content = read_file(filename);
145 if (json_file_content.empty()) {
146 LOG_A(LOG_ERROR, "Could not read file");
147 return; // Exit if the file could not be read
148 }
149
150 nlohmann::json json_data;
151 try {
152 json_data = nlohmann::json::parse(json_file_content);
153 }
154 catch (const std::exception& e) {
155 std::cerr << "Failed to parse JSON: " << e.what() << std::endl;
156 return;
157 }
158 if (!json_data.is_array()) {
159 std::cerr << "JSON data is not an array." << std::endl;
160 return;
161 }
162}
163
164
165

Callers 1

mainFunction · 0.85

Calls 6

stringFunction · 0.85
parseFunction · 0.85
emptyMethod · 0.80
LOG_AFunction · 0.50
read_fileFunction · 0.50
whatMethod · 0.45

Tested by

no test coverage detected