mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Typo fix.
This commit is contained in:
@@ -10,51 +10,53 @@
|
||||
class Fl2FluxSource : public FluxSource
|
||||
{
|
||||
public:
|
||||
Fl2FluxSource(const Fl2FluxSourceProto& config):
|
||||
_config(config)
|
||||
Fl2FluxSource(const Fl2FluxSourceProto& config): _config(config)
|
||||
{
|
||||
std::ifstream ifs(_config.filename(), std::ios::in | std::ios::binary);
|
||||
if (!ifs.is_open())
|
||||
Error() << fmt::format("cannot open input file '{}': {}",
|
||||
_config.filename(), strerror(errno));
|
||||
std::ifstream ifs(_config.filename(), std::ios::in | std::ios::binary);
|
||||
if (!ifs.is_open())
|
||||
Error() << fmt::format("cannot open input file '{}': {}",
|
||||
_config.filename(),
|
||||
strerror(errno));
|
||||
|
||||
if (!_proto.ParseFromIstream(&ifs))
|
||||
Error() << "unable to read input file";
|
||||
}
|
||||
if (!_proto.ParseFromIstream(&ifs))
|
||||
Error() << "unable to read input file";
|
||||
}
|
||||
|
||||
public:
|
||||
std::unique_ptr<Fluxmap> readFlux(int cylinder, int head)
|
||||
{
|
||||
for (const auto& track : _proto.track())
|
||||
{
|
||||
if ((track.cylinder() == cylinder) && (track.head() == head))
|
||||
return std::make_unique<Fluxmap>(track.flux());
|
||||
}
|
||||
for (const auto& track : _proto.track())
|
||||
{
|
||||
if ((track.cylinder() == cylinder) && (track.head() == head))
|
||||
return std::make_unique<Fluxmap>(track.flux());
|
||||
}
|
||||
|
||||
return std::make_unique<Fluxmap>();
|
||||
return std::make_unique<Fluxmap>();
|
||||
}
|
||||
|
||||
void recalibrate() {}
|
||||
|
||||
private:
|
||||
void check_for_error(std::ifstream& ifs)
|
||||
{
|
||||
if (ifs.fail())
|
||||
Error() << fmt::format("FL2 read I/O error: {}", strerror(errno));
|
||||
}
|
||||
void check_for_error(std::ifstream& ifs)
|
||||
{
|
||||
if (ifs.fail())
|
||||
Error() << fmt::format("FL2 read I/O error: {}", strerror(errno));
|
||||
}
|
||||
|
||||
private:
|
||||
const Fl2FluxSourceProto& _config;
|
||||
FluxFileProto _proto;
|
||||
FluxFileProto _proto;
|
||||
};
|
||||
|
||||
std::unique_ptr<FluxSource> FluxSource::createFl2FluxSource(const Fl2FluxSourceProto& config)
|
||||
std::unique_ptr<FluxSource> FluxSource::createFl2FluxSource(
|
||||
const Fl2FluxSourceProto& config)
|
||||
{
|
||||
char buffer[16];
|
||||
std::ifstream(config.filename(), std::ios::in | std::ios::binary).read(buffer, 16);
|
||||
if (strncmp(buffer, "SQLite format 3", 16) == 0)
|
||||
Error() << "this flux file is too old; please use the upgrade-flux-file to upgrade it";
|
||||
char buffer[16];
|
||||
std::ifstream(config.filename(), std::ios::in | std::ios::binary)
|
||||
.read(buffer, 16);
|
||||
if (strncmp(buffer, "SQLite format 3", 16) == 0)
|
||||
Error() << "this flux file is too old; please use the "
|
||||
"upgrade-flux-file tool to upgrade it";
|
||||
|
||||
return std::unique_ptr<FluxSource>(new Fl2FluxSource(config));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user