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

Function upgradeFluxFile

lib/external/fl2.cc:6–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <fstream>
5
6static void upgradeFluxFile(FluxFileProto& proto)
7{
8 if (proto.version() == FluxFileVersion::VERSION_1)
9 {
10 /* Change a flux datastream with multiple segments separated by F_DESYNC
11 * into multiple flux segments. */
12
13 for (auto& track : *proto.mutable_track())
14 {
15 if (track.flux_size() != 0)
16 {
17 Fluxmap oldFlux(track.flux(0));
18
19 track.clear_flux();
20 for (const auto& flux : oldFlux.split())
21 track.add_flux(flux->rawBytes());
22 }
23 }
24
25 proto.set_version(FluxFileVersion::VERSION_2);
26 }
27
28 if (proto.version() > FluxFileVersion::VERSION_2)
29 error(
30 "this is a version {} flux file, but this build of the client can "
31 "only handle up to version {} --- please upgrade",
32 (int)proto.version(),
33 (int)FluxFileVersion::VERSION_2);
34}
35
36FluxFileProto loadFl2File(const std::string filename)
37{

Callers 1

loadFl2FileFunction · 0.85

Calls 2

errorFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected