Merge branch 'master' into develop

This commit is contained in:
Bill Somerville 2018-12-10 17:14:07 +00:00
commit db3da81620

View File

@ -320,30 +320,27 @@ namespace
} }
} }
while ((end_position = buffer.indexOf ("<EOR>", 0, Qt::CaseInsensitive)) < 0 && !in.atEnd ()); while ((end_position = buffer.indexOf ("<EOR>", 0, Qt::CaseInsensitive)) < 0 && !in.atEnd ());
if (end_position < 0) if (end_position >= 0) // require valid ADIF record
// with terminator
{ {
throw LoaderException (std::runtime_error {"Invalid ADIF record starting at: " + buffer.left (40).toStdString ()}); auto record = buffer.left (end_position + 5).trimmed ();
} auto next_record = buffer.indexOf (QChar {'<'}, end_position + 5);
auto record = buffer.left (end_position + 5).trimmed (); buffer.remove (0, next_record >=0 ? next_record : buffer.size ());
auto next_record = buffer.indexOf (QChar {'<'}, end_position + 5); record = record.mid (record.indexOf (QChar {'<'}));
buffer.remove (0, next_record >=0 ? next_record : buffer.size ()); auto call = extractField (record, "CALL");
record = record.mid (record.indexOf (QChar {'<'})); if (call.size ()) // require CALL field before we
auto call = extractField (record, "CALL"); // will parse a record
if (call.size ()) {
{ auto const& entity = prefixes->lookup (call);
auto const& entity = prefixes->lookup (call); worked.emplace (call.toUpper ()
worked.emplace (call.toUpper () , extractField (record, "GRIDSQUARE").left (4).toUpper () // not interested in 6-digit grids
, extractField (record, "GRIDSQUARE").left (4).toUpper () // not interested in 6-digit grids , extractField (record, "BAND").toUpper ()
, extractField (record, "BAND").toUpper () , extractField (record, "MODE").toUpper ()
, extractField (record, "MODE").toUpper () , entity.entity_name
, entity.entity_name , entity.continent
, entity.continent , entity.CQ_zone
, entity.CQ_zone , entity.ITU_zone);
, entity.ITU_zone); }
}
else
{
throw LoaderException (std::runtime_error {"Invalid ADIF record with no CALL: " + record.toStdString ()});
} }
} }
} }