Skip to content

Commit

Permalink
Rev.G. Fix compilation warnings under macos
Browse files Browse the repository at this point in the history
  • Loading branch information
robsonsmartins committed Nov 21, 2023
1 parent e3cca27 commit 3659129
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 22 deletions.
5 changes: 3 additions & 2 deletions software/usbflashprog/backend/epromfile/qatmelfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bool QAtmelFile::isReadable(const QString &filename) {
return true;
}

QByteArray QAtmelFile::read(const QString &filename, qint64 size) {
QByteArray QAtmelFile::read(const QString &filename, qint32 size) {
QByteArray result;
FILE *fd = fopen(filename.toStdString().c_str(), "r");
if (fd == NULL) {
Expand All @@ -58,7 +58,8 @@ QByteArray QAtmelFile::read(const QString &filename, qint64 size) {
ret != ATMEL_GENERIC_OK) { break; }
if (address == -1) { address = arec.address; }
if (arec.address - address + 2 > result.size()) {
result.append(QByteArray(arec.address - address
result.append(QByteArray(
static_cast<int>(arec.address - address)
+ 2 - result.size(), 0xFF));
}
for (int i = 0; i < 2; i++) {
Expand Down
2 changes: 1 addition & 1 deletion software/usbflashprog/backend/epromfile/qatmelfile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class QAtmelFile: public QEpromFileBase {
* than this parameter, data is filled with 0xFF.
* @return Byte array with data, or empty if an error occurs.
*/
QByteArray read(const QString &filename, qint64 size);
QByteArray read(const QString &filename, qint32 size);
/**
* @brief Writes data to a file.
* @param type Type of the file to write.
Expand Down
2 changes: 1 addition & 1 deletion software/usbflashprog/backend/epromfile/qbinfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bool QBinFile::isReadable(const QString &filename) {
return true;
}

QByteArray QBinFile::read(const QString &filename, qint64 size) {
QByteArray QBinFile::read(const QString &filename, qint32 size) {
QByteArray result;
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
Expand Down
2 changes: 1 addition & 1 deletion software/usbflashprog/backend/epromfile/qbinfile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class QBinFile: public QEpromFileBase {
* than this parameter, data is filled with 0xFF.
* @return Byte array with data, or empty if an error occurs.
*/
QByteArray read(const QString &filename, qint64 size);
QByteArray read(const QString &filename, qint32 size);
/**
* @brief Writes data to a file.
* @param type Type of the file to write.
Expand Down
2 changes: 1 addition & 1 deletion software/usbflashprog/backend/epromfile/qepromfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
QEpromFile::QEpromFile(QObject *parent): QEpromFileBase(parent),
eepromFile_(nullptr) {}

QByteArray QEpromFile::read(const QString &filename, qint64 size) {
QByteArray QEpromFile::read(const QString &filename, qint32 size) {
if (QAtmelFile::isReadable(filename)) {
type_ = EpromFileAtmel;
eepromFile_.reset(new QAtmelFile());
Expand Down
2 changes: 1 addition & 1 deletion software/usbflashprog/backend/epromfile/qepromfile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class QEpromFile: public QEpromFileBase {
* than this parameter, data is filled with 0xFF.
* @return Byte array with data, or empty if an error occurs.
*/
QByteArray read(const QString &filename, qint64 size);
QByteArray read(const QString &filename, qint32 size);
/**
* @brief Writes data to a file.
* @param type Type of the file to write.
Expand Down
2 changes: 1 addition & 1 deletion software/usbflashprog/backend/epromfile/qepromfilebase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class QEpromFileBase: public QObject {
* than this parameter, data is filled with 0xFF.
* @return Byte array with data, or empty if an error occurs.
*/
virtual QByteArray read(const QString &filename, qint64 size) = 0;
virtual QByteArray read(const QString &filename, qint32 size) = 0;
/**
* @brief Writes data to a file.
* @param type Type of the file to write.
Expand Down
5 changes: 3 additions & 2 deletions software/usbflashprog/backend/epromfile/qhexfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool QHexFile::isReadable(const QString &filename) {
return true;
}

QByteArray QHexFile::read(const QString &filename, qint64 size) {
QByteArray QHexFile::read(const QString &filename, qint32 size) {
QByteArray result;
FILE *fd = fopen(filename.toStdString().c_str(), "r");
if (fd == NULL) {
Expand All @@ -66,7 +66,8 @@ QByteArray QHexFile::read(const QString &filename, qint64 size) {
if (irec.dataLen) {
if (address == 0) { address = irec.address; }
if (irec.address - address + irec.dataLen > result.size()) {
result.append(QByteArray(irec.address - address
result.append(QByteArray(
static_cast<int>(irec.address - address)
+ irec.dataLen - result.size(), 0xFF));
}
for (int i = 0; i < irec.dataLen; i++) {
Expand Down
2 changes: 1 addition & 1 deletion software/usbflashprog/backend/epromfile/qhexfile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class QHexFile: public QEpromFileBase {
* than this parameter, data is filled with 0xFF.
* @return Byte array with data, or empty if an error occurs.
*/
QByteArray read(const QString &filename, qint64 size);
QByteArray read(const QString &filename, qint32 size);
/**
* @brief Writes data to a file.
* @param type Type of the file to write.
Expand Down
5 changes: 3 additions & 2 deletions software/usbflashprog/backend/epromfile/qsrecfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool QSrecFile::isReadable(const QString &filename) {
return true;
}

QByteArray QSrecFile::read(const QString &filename, qint64 size) {
QByteArray QSrecFile::read(const QString &filename, qint32 size) {
QByteArray result;
FILE *fd = fopen(filename.toStdString().c_str(), "r");
if (fd == NULL) {
Expand All @@ -66,7 +66,8 @@ QByteArray QSrecFile::read(const QString &filename, qint64 size) {
if (srec.dataLen) {
if (address == -1) { address = srec.address; }
if (srec.address - address + srec.dataLen > result.size()) {
result.append(QByteArray(srec.address - address
result.append(QByteArray(
static_cast<int>(srec.address - address)
+ srec.dataLen - result.size(), 0xFF));
}
for (int i = 0; i < srec.dataLen; i++) {
Expand Down
2 changes: 1 addition & 1 deletion software/usbflashprog/backend/epromfile/qsrecfile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class QSrecFile: public QEpromFileBase {
* than this parameter, data is filled with 0xFF.
* @return Byte array with data, or empty if an error occurs.
*/
QByteArray read(const QString &filename, qint64 size);
QByteArray read(const QString &filename, qint32 size);
/**
* @brief Writes data to a file.
* @param type Type of the file to write.
Expand Down
8 changes: 4 additions & 4 deletions software/usbflashprog/ui/qhexeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void QHexEditor::fill(quint8 value) {

void QHexEditor::random(void) {
QByteArray data;
for (qint64 i = 0; i < size_; i++) {
for (qint32 i = 0; i < size_; i++) {
data += (QRandomGenerator::global()->bounded(256) & 0xFF);
}
QHexDocument *document =
Expand All @@ -98,7 +98,7 @@ void QHexEditor::random(void) {
emit changed(true);
}

void QHexEditor::setSize(qint64 value) {
void QHexEditor::setSize(qint32 value) {
if (value == size_) { return; }
QHexDocument *document = this->hexDocument();
QByteArray data;
Expand All @@ -114,7 +114,7 @@ void QHexEditor::setSize(qint64 value) {
size_ = value;
}

qint64 QHexEditor::size(void) const {
qint32 QHexEditor::size(void) const {
return size_;
}

Expand Down Expand Up @@ -160,7 +160,7 @@ void QHexEditor::showReplaceDialog(void) {
dialog.exec();
}

void QHexEditor::onDataChanged(const QByteArray& data, quint64 offset,
void QHexEditor::onDataChanged(const QByteArray& data, quint32 offset,
QHexDocument::ChangeReason reason) {
changed_ = true;
emit changed();
Expand Down
8 changes: 4 additions & 4 deletions software/usbflashprog/ui/qhexeditor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ class QHexEditor : public QHexView {
* @brief Sets the data size of the viewer.
* @param value Data size, in bytes.
*/
void setSize(qint64 value);
void setSize(qint32 value);
/**
* @brief Gets the data size of the viewer.
* @return Data size, in bytes.
*/
qint64 size(void) const;
qint32 size(void) const;
/**
* @brief Sets the bit grouping mode.
* @param mode Bit grouping mode.
Expand Down Expand Up @@ -129,7 +129,7 @@ class QHexEditor : public QHexView {
* @param offset Offset of changed data.
* @param reason Reason of the change.
*/
void onDataChanged(const QByteArray& data, quint64 offset,
void onDataChanged(const QByteArray& data, quint32 offset,
QHexDocument::ChangeReason reason);

private:
Expand All @@ -138,7 +138,7 @@ class QHexEditor : public QHexView {
/* @brief Current filename. */
QString filename_;
/* @brief Data viewer size. */
qint64 size_;
qint32 size_;
/* @brief Type of the current loaded file. */
QEpromFile::QEpromFileType type_;
/* @brief Editor mode. */
Expand Down

0 comments on commit 3659129

Please sign in to comment.