[companion] Minor warning fix.

This commit is contained in:
Max Paperno
2017-01-15 14:46:17 -05:00
parent 2b9badf728
commit 616eb9206d
+9 -9
View File
@@ -28,14 +28,14 @@
bool BinEepromFormat::load(RadioData & radioData) bool BinEepromFormat::load(RadioData & radioData)
{ {
QFile file(filename); QFile file(filename);
int size = file.size(); int size = file.size();
if (!file.open(QFile::ReadOnly)) { if (!file.open(QFile::ReadOnly)) {
qDebug() << "Unable to open" << filename << file.errorString(); qDebug() << "Unable to open" << filename << file.errorString();
return false; return false;
} }
QByteArray eeprom(size, 0); QByteArray eeprom(size, 0);
int result = file.read((char *)eeprom.data(), size); int result = file.read((char *)eeprom.data(), size);
if (result != size) { if (result != size) {
@@ -70,21 +70,21 @@ bool BinEepromFormat::writeToFile(const uint8_t * eeprom, uint32_t size)
setError(QObject::tr("Cannot open file %1:\n%2.").arg(filename).arg(file.errorString())); setError(QObject::tr("Cannot open file %1:\n%2.").arg(filename).arg(file.errorString()));
return false; return false;
} }
QTextStream outputStream(&file); QTextStream outputStream(&file);
long len = file.write((char *)eeprom, size); qint64 len = file.write((char *)eeprom, size);
if (len != size) { if (len != qint64(size)) {
setError(QObject::tr("Error writing file %1:\n%2.").arg(filename).arg(file.errorString())); setError(QObject::tr("Error writing file %1:\n%2.").arg(filename).arg(file.errorString()));
return false; return false;
} }
return true; return true;
} }
bool BinEepromFormat::extract(RadioData & radioData, const QByteArray & eeprom) bool BinEepromFormat::extract(RadioData & radioData, const QByteArray & eeprom)
{ {
std::bitset<NUM_ERRORS> errors; std::bitset<NUM_ERRORS> errors;
foreach(EEPROMInterface * eepromInterface, eepromInterfaces) { foreach(EEPROMInterface * eepromInterface, eepromInterfaces) {
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->load(radioData, (uint8_t *)eeprom.data(), eeprom.size())); std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->load(radioData, (uint8_t *)eeprom.data(), eeprom.size()));
if (result.test(ALL_OK)) { if (result.test(ALL_OK)) {
@@ -97,7 +97,7 @@ bool BinEepromFormat::extract(RadioData & radioData, const QByteArray & eeprom)
errors |= result; errors |= result;
} }
} }
setError(QObject::tr("Invalid EEPROM File %1: %2").arg(filename).arg(errors.to_ulong())); setError(QObject::tr("Invalid EEPROM File %1: %2").arg(filename).arg(errors.to_ulong()));
return false; return false;
} }