mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 08:37:26 +00:00
fixed some more undefined behavior
This commit is contained in:
parent
95a7e1ff44
commit
1232d41068
@ -139,7 +139,7 @@ void createNewDialog::on_buttonCreate_clicked()
|
||||
char file[32];
|
||||
int sz;
|
||||
QByteArray hexpairs = ui->plainTextEdit->toPlainText().toUtf8();
|
||||
ut8 *buf = (ut8*)malloc (strlen (hexpairs.constData()));
|
||||
ut8 *buf = (ut8*)malloc (strlen (hexpairs.constData()) + 1);
|
||||
sz = r_hex_str2bin (hexpairs.constData(), buf);
|
||||
if (sz>0) {
|
||||
snprintf (file, sizeof(file)-1, "malloc://%d", sz);
|
||||
|
@ -298,11 +298,10 @@ bool QRCore::tryFile(QString path, bool rw) {
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<QString> QRCore::getList(const QString type, const QString subtype) {
|
||||
QList<QString> QRCore::getList(const QString & type, const QString & subtype) {
|
||||
RListIter *it;
|
||||
QList<QString> ret = QList<QString>();
|
||||
|
||||
if (this == NULL) return ret;
|
||||
if (type == "bin") {
|
||||
if (subtype == "sections") {
|
||||
QString text = cmd ("S*~^S");
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
QString itoa(ut64 num, int rdx=16);
|
||||
QString config(const QString &k, const QString &v=NULL);
|
||||
int config(const QString &k, int v);
|
||||
QList<QString> getList(const QString type, const QString subtype="");
|
||||
QList<QString> getList(const QString & type, const QString & subtype="");
|
||||
QString assemble(const QString &code);
|
||||
QString disassemble(const QString &code);
|
||||
void setDefaultCPU();
|
||||
|
@ -28,7 +28,6 @@ CommentsWidget::CommentsWidget(MainWindow *main, QWidget *parent) :
|
||||
ui->frame->hide();
|
||||
|
||||
// Resize eventfilter
|
||||
this->installEventFilter(this);
|
||||
ui->commentsTreeWidget->viewport()->installEventFilter(this);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ private slots:
|
||||
|
||||
void on_actionVertical_triggered();
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
private:
|
||||
Ui::CommentsWidget *ui;
|
||||
|
@ -39,7 +39,6 @@ FunctionsWidget::FunctionsWidget(MainWindow *main, QWidget *parent) :
|
||||
this, SLOT(showTitleContextMenu(const QPoint &)));
|
||||
|
||||
// Resize eventfilter
|
||||
this->installEventFilter(this);
|
||||
ui->functionsTreeWidget->viewport()->installEventFilter(this);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ private slots:
|
||||
|
||||
void on_nestedFunctionsTree_itemDoubleClicked(QTreeWidgetItem *item, int column);
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
private:
|
||||
Ui::FunctionsWidget *ui;
|
||||
|
@ -99,7 +99,6 @@ MemoryWidget::MemoryWidget(MainWindow *main, QWidget *parent) :
|
||||
ui->actionRight_align_bytes->setDisabled(true);
|
||||
|
||||
// Resize eventfilter
|
||||
this->installEventFilter(this);
|
||||
ui->disasTextEdit_2->viewport()->installEventFilter(this);
|
||||
|
||||
// Set Splitter stretch factor
|
||||
@ -455,7 +454,7 @@ void MemoryWidget::refreshDisasm(QString off = "") {
|
||||
this->disasTextEdit->ensureCursorVisible();
|
||||
this->disasTextEdit->moveCursor(QTextCursor::End);
|
||||
|
||||
while ( this->disasTextEdit->find(QRegExp("^" + s), QTextDocument::FindBackward) ); {
|
||||
while ( this->disasTextEdit->find(QRegExp("^" + s), QTextDocument::FindBackward) ) {
|
||||
this->disasTextEdit->moveCursor(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
|
||||
}
|
||||
|
||||
@ -1382,7 +1381,7 @@ void MemoryWidget::setFcnName(QString addr) {
|
||||
// TDOD: FIX ME, ugly
|
||||
if (addr.contains("0x")) {
|
||||
fcn = this->main->core->functionAt(addr.toULongLong(&ok, 16));
|
||||
if (ok && fcn && fcn->name != "") {
|
||||
if (ok && fcn && *fcn) {
|
||||
QString segment = this->main->core->cmd("S. @ " + addr).split(" ").last();
|
||||
addr = segment.trimmed() + ":"+ fcn->name;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public slots:
|
||||
void selectHexPreview();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
private:
|
||||
Ui::MemoryWidget *ui;
|
||||
|
@ -15,9 +15,6 @@ SectionsWidget::SectionsWidget(MainWindow *main, QWidget *parent) :
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
//setStyleSheet("QSplitter::handle:horizontal { width: 3px; } QSplitter::handle:vertical { height: 3px; }");
|
||||
setStyleSheet("QSplitter::handle { height: 2px; background-color: rgb(255, 255, 255); image: url(:/new/prefix1/img/icons/tabs.png); }");
|
||||
|
||||
// Resize eventfilter
|
||||
this->installEventFilter(this);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -39,7 +39,7 @@ private:
|
||||
QAbstractItemView *pieChart;
|
||||
QItemSelectionModel *selectionModel;
|
||||
MainWindow *main;
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
};
|
||||
|
||||
#endif // SECTIONSWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user