diff --git a/common/pm3process.cpp b/common/pm3process.cpp index 08aef5a..8181353 100644 --- a/common/pm3process.cpp +++ b/common/pm3process.cpp @@ -14,7 +14,7 @@ PM3Process::PM3Process(QThread* thread, QObject* parent): QProcess(parent) connect(this, &PM3Process::readyRead, this, &PM3Process::onReadyRead); } -void PM3Process::connectPM3(const QString path, const QString port) +void PM3Process::connectPM3(const QString& path, const QString& port) { QString result; Util::ClientType clientType = Util::CLIENTTYPE_OFFICIAL; @@ -93,7 +93,6 @@ void PM3Process::testThread() qDebug() << "PM3:" << QThread::currentThread(); } - qint64 PM3Process::write(QString data) { return QProcess::write(data.toLatin1()); diff --git a/common/pm3process.h b/common/pm3process.h index 093ebfd..749c501 100644 --- a/common/pm3process.h +++ b/common/pm3process.h @@ -21,8 +21,8 @@ public: void testThread(); public slots: - void connectPM3(const QString path, const QString port); - void setSerialListener(const QString &name, bool state); + void connectPM3(const QString& path, const QString& port); + void setSerialListener(const QString& name, bool state); qint64 write(QString data); private slots: void onTimeout(); @@ -34,8 +34,8 @@ private: QTimer* serialListener; QSerialPortInfo* portInfo; signals: - void PM3StatedChanged(bool st, QString info = ""); - void newOutput(QString output); + void PM3StatedChanged(bool st, const QString& info = ""); + void newOutput(const QString& output); void changeClientType(Util::ClientType); }; diff --git a/common/util.cpp b/common/util.cpp index bb4f3ab..1da8256 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -9,7 +9,7 @@ Util::Util(QObject *parent) : QObject(parent) qRegisterMetaType("Util::ClientType"); } -void Util::processOutput(QString output) +void Util::processOutput(const QString& output) { // qDebug() << "Util::processOutput:" << output; if(isRequiringOutput) @@ -20,14 +20,14 @@ void Util::processOutput(QString output) emit refreshOutput(output); } -void Util::execCMD(QString cmd) +void Util::execCMD(const QString& cmd) { qDebug() << cmd; if(isRunning) emit write(cmd + "\r\n"); } -QString Util::execCMDWithOutput(QString cmd, ReturnTrigger trigger) +QString Util::execCMDWithOutput(const QString& cmd, ReturnTrigger trigger) { bool isResultFound = false; QRegularExpression re; diff --git a/common/util.h b/common/util.h index bbf935a..04a4ec0 100644 --- a/common/util.h +++ b/common/util.h @@ -30,12 +30,12 @@ public: waitTime = time; expectedOutputs = QStringList(); } - ReturnTrigger(QStringList outputs) + ReturnTrigger(const QStringList& outputs) { waitTime = 10000; expectedOutputs = outputs; } - ReturnTrigger(unsigned long time, QStringList outputs) + ReturnTrigger(unsigned long time, const QStringList& outputs) { waitTime = time; expectedOutputs = outputs; @@ -46,12 +46,12 @@ public: explicit Util(QObject *parent = nullptr); - void execCMD(QString cmd); - QString execCMDWithOutput(QString cmd, ReturnTrigger trigger = 10000); + void execCMD(const QString& cmd); + QString execCMDWithOutput(const QString& cmd, ReturnTrigger trigger = 10000); void delay(unsigned int msec); ClientType getClientType(); public slots: - void processOutput(QString output); + void processOutput(const QString& output); void setClientType(Util::ClientType clientType); void setRunningState(bool st); @@ -63,7 +63,7 @@ private: ClientType clientType; signals: void refreshOutput(const QString& output); - void write(QString data); + void write(QString data); // connected to PM3Process::write(QString data); }; #endif // UTIL_H diff --git a/module/mifare.cpp b/module/mifare.cpp index 92d377e..b07593e 100644 --- a/module/mifare.cpp +++ b/module/mifare.cpp @@ -872,7 +872,7 @@ void Mifare::data_clearKey(bool clearAll) } } -bool Mifare::data_isKeyValid(const QString &key) +bool Mifare::data_isKeyValid(const QString& key) { if(key.length() != 12) return false; @@ -938,7 +938,7 @@ void Mifare::setCardType(int type) } } -bool Mifare::data_loadDataFile(const QString &filename) +bool Mifare::data_loadDataFile(const QString& filename) { QFile file(filename, this); if(file.open(QIODevice::ReadOnly)) @@ -985,7 +985,7 @@ bool Mifare::data_loadDataFile(const QString &filename) } } -bool Mifare::data_loadKeyFile(const QString &filename) +bool Mifare::data_loadKeyFile(const QString& filename) { QFile file(filename, this); if(file.open(QIODevice::ReadOnly)) @@ -1022,7 +1022,7 @@ bool Mifare::data_loadKeyFile(const QString &filename) } } -QString Mifare::bin2text(const QByteArray &buff, int i, int length) +QString Mifare::bin2text(const QByteArray& buff, int i, int length) { QString ret = ""; char LByte, RByte; @@ -1040,7 +1040,7 @@ QString Mifare::bin2text(const QByteArray &buff, int i, int length) return ret; } -bool Mifare::data_saveDataFile(const QString &filename, bool isBin) +bool Mifare::data_saveDataFile(const QString& filename, bool isBin) { QFile file(filename, this); if(file.open(QIODevice::WriteOnly)) @@ -1084,7 +1084,7 @@ bool Mifare::data_saveDataFile(const QString &filename, bool isBin) } } -bool Mifare::data_saveKeyFile(const QString &filename, bool isBin) +bool Mifare::data_saveKeyFile(const QString& filename, bool isBin) { QFile file(filename, this); if(file.open(QIODevice::WriteOnly)) @@ -1179,12 +1179,12 @@ void Mifare::data_data2Key() } } -void Mifare::data_setData(int block, const QString &data) +void Mifare::data_setData(int block, const QString& data) { dataList->replace(block, data); } -void Mifare::data_setKey(int sector, KeyType keyType, const QString &key) +void Mifare::data_setKey(int sector, KeyType keyType, const QString& key) { if(keyType == KEY_A) keyAList->replace(sector, key); diff --git a/module/mifare.h b/module/mifare.h index b328314..dfde298 100644 --- a/module/mifare.h +++ b/module/mifare.h @@ -106,9 +106,9 @@ public: void saveSniff(const QString& file); void data_fillKeys(); - static QList data_getACBits(const QString &text); + static QList data_getACBits(const QString& text); static int data_b2s(int block); - static bool data_isACBitsValid(const QString &text, QList *returnHalfBytes = nullptr); + static bool data_isACBitsValid(const QString& text, QList *returnHalfBytes = nullptr); public slots: signals: @@ -125,9 +125,9 @@ private: QRegularExpression* keyPattern; QString bin2text(const QByteArray& buff, int start, int length); - QString _readblk(int blockId, KeyType keyType, const QString &key, TargetType targetType = TARGET_MIFARE, int waitTime = 300); - QStringList _readsec(int sectorId, KeyType keyType, const QString &key, TargetType targetType = TARGET_MIFARE, int waitTime = 300); - bool _writeblk(int blockId, KeyType keyType, const QString &key, const QString &data, TargetType targetType = TARGET_MIFARE, int waitTime = 300); + QString _readblk(int blockId, KeyType keyType, const QString& key, TargetType targetType = TARGET_MIFARE, int waitTime = 300); + QStringList _readsec(int sectorId, KeyType keyType, const QString& key, TargetType targetType = TARGET_MIFARE, int waitTime = 300); + bool _writeblk(int blockId, KeyType keyType, const QString& key, const QString& data, TargetType targetType = TARGET_MIFARE, int waitTime = 300); }; #endif // MIFARE_H diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index aac66f5..421a019 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -86,7 +86,7 @@ void MainWindow::on_PM3_connectButton_clicked() } } -void MainWindow::onPM3StateChanged(bool st, QString info) +void MainWindow::onPM3StateChanged(bool st, const QString& info) { pm3state = st; setState(st); @@ -898,7 +898,7 @@ void MainWindow::signalInit() connect(stopButton, &QPushButton::clicked, this, &MainWindow::on_stopButton_clicked); } -void MainWindow::setStatusBar(QLabel * target, const QString & text) +void MainWindow::setStatusBar(QLabel * target, const QString& text) { if(target == PM3VersionBar) target->setText(tr("HW Version:") + text); @@ -908,7 +908,7 @@ void MainWindow::setStatusBar(QLabel * target, const QString & text) target->setText(tr("State:") + text); } -void MainWindow::setTableItem(QTableWidget * widget, int row, int column, const QString & text) +void MainWindow::setTableItem(QTableWidget * widget, int row, int column, const QString& text) { if(widget->item(row, column) == nullptr) widget->setItem(row, column, new QTableWidgetItem()); @@ -993,7 +993,7 @@ void MainWindow::on_GroupBox_clicked(bool checked) settings->endGroup(); } -void MainWindow::saveClientPath(const QString & path) +void MainWindow::saveClientPath(const QString& path) { settings->beginGroup("Client_Path"); settings->setValue("path", path); diff --git a/ui/mainwindow.h b/ui/mainwindow.h index 55c8c6f..2c7fcd5 100644 --- a/ui/mainwindow.h +++ b/ui/mainwindow.h @@ -44,10 +44,10 @@ public: void initUI(); bool eventFilter(QObject *watched, QEvent *event); public slots: - void refreshOutput(const QString &output); - void refreshCMD(const QString &cmd); - void setStatusBar(QLabel* target, const QString & text); - void onPM3StateChanged(bool st, QString info); + void refreshOutput(const QString& output); + void refreshCMD(const QString& cmd); + void setStatusBar(QLabel* target, const QString& text); + void onPM3StateChanged(bool st, const QString& info); void MF_onTypeChanged(int id, bool st); private slots: @@ -175,12 +175,12 @@ private: void signalInit(); void MF_widgetReset(); - void setTableItem(QTableWidget *widget, int row, int column, const QString &text); + void setTableItem(QTableWidget *widget, int row, int column, const QString& text); void setState(bool st); - void saveClientPath(const QString &path); + void saveClientPath(const QString& path); signals: - void connectPM3(const QString path, const QString port); + void connectPM3(const QString& path, const QString& port); void killPM3(); - void setSerialListener(const QString &name, bool state); + void setSerialListener(const QString& name, bool state); }; #endif // MAINWINDOW_H diff --git a/ui/mf_attack_hardnesteddialog.h b/ui/mf_attack_hardnesteddialog.h index 0f13bf7..d120b2a 100644 --- a/ui/mf_attack_hardnesteddialog.h +++ b/ui/mf_attack_hardnesteddialog.h @@ -3,7 +3,8 @@ #include -namespace Ui { +namespace Ui +{ class MF_Attack_hardnestedDialog; } @@ -19,7 +20,7 @@ public: private: Ui::MF_Attack_hardnestedDialog *ui; signals: - void sendCMD(QString cmd); + void sendCMD(const QString& cmd); private slots: void on_buttonBox_accepted(); }; diff --git a/ui/mf_sim_simdialog.h b/ui/mf_sim_simdialog.h index 7fa53a1..49c9ba2 100644 --- a/ui/mf_sim_simdialog.h +++ b/ui/mf_sim_simdialog.h @@ -26,7 +26,7 @@ private: Ui::MF_Sim_simDialog *ui; int cardType; signals: - void sendCMD(QString cmd); + void sendCMD(const QString& cmd); private slots: void on_buttonBox_accepted(); }; diff --git a/ui/mf_trailerdecoderdialog.h b/ui/mf_trailerdecoderdialog.h index 93a6abd..e863f1c 100644 --- a/ui/mf_trailerdecoderdialog.h +++ b/ui/mf_trailerdecoderdialog.h @@ -23,11 +23,11 @@ public: private slots: - void on_accessBitsEdit_textChanged(const QString &arg1); + void on_accessBitsEdit_textChanged(const QString& arg1); void on_blockSizeChanged(int id, bool st); - void on_boxChanged(const QString &arg1); + void on_boxChanged(const QString& arg1); private: Ui::MF_trailerDecoderDialog *ui; QRegularExpressionValidator* validator; diff --git a/ui/mf_uid_parameterdialog.h b/ui/mf_uid_parameterdialog.h index ec580cb..85e9fc0 100644 --- a/ui/mf_uid_parameterdialog.h +++ b/ui/mf_uid_parameterdialog.h @@ -3,7 +3,8 @@ #include -namespace Ui { +namespace Ui +{ class MF_UID_parameterDialog; } @@ -18,7 +19,7 @@ public: private: Ui::MF_UID_parameterDialog *ui; signals: - void sendCMD(QString cmd); + void sendCMD(const QString& cmd); private slots: void on_buttonBox_accepted(); };