| 4 | #include <fstream> |
| 5 | |
| 6 | static 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 | |
| 36 | FluxFileProto loadFl2File(const std::string filename) |
| 37 | { |
no test coverage detected