MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / loadFl2File

Function loadFl2File

lib/external/fl2.cc:36–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36FluxFileProto loadFl2File(const std::string filename)
37{
38 std::ifstream ifs(filename, std::ios::in | std::ios::binary);
39 if (!ifs.is_open())
40 error("cannot open input file '{}': {}", filename, strerror(errno));
41
42 char buffer[16];
43 ifs.read(buffer, sizeof(buffer));
44 if (strncmp(buffer, "SQLite format 3", 16) == 0)
45 error(
46 "this flux file is too old; please use the upgrade-flux-file tool "
47 "to upgrade it");
48
49 FluxFileProto proto;
50 ifs.seekg(0);
51 if (!proto.ParseFromIstream(&ifs))
52 error("unable to read input file '{}'", filename);
53 upgradeFluxFile(proto);
54 return proto;
55}
56
57void saveFl2File(const std::string filename, FluxFileProto& proto)
58{

Callers 4

Fl2FluxSourceMethod · 0.85
mainFluxfileRmFunction · 0.85
mainFluxfileLsFunction · 0.85
mainFluxfileCpFunction · 0.85

Calls 3

errorFunction · 0.85
upgradeFluxFileFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected