mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 10:56:11 +00:00
Reformat the code
This commit is contained in:
parent
0d9851c1e0
commit
041118dbd7
@ -13,7 +13,7 @@
|
||||
* @brief Attempt to connect to a parent console and configure outputs.
|
||||
*/
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h>
|
||||
# include <windows.h>
|
||||
|
||||
static void connectToConsole()
|
||||
{
|
||||
@ -67,9 +67,9 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
QCoreApplication::setApplicationName("cutter");
|
||||
|
||||
// Importing settings after setting rename, needs separate handling in addition to regular version to version upgrade.
|
||||
if (Cutter::shouldOfferSettingImport())
|
||||
{
|
||||
// Importing settings after setting rename, needs separate handling in addition to regular
|
||||
// version to version upgrade.
|
||||
if (Cutter::shouldOfferSettingImport()) {
|
||||
Cutter::showSettingImportDialog(argc, argv);
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,8 @@ static qreal GetDevicePixelRatio(qreal devicePixelRatio)
|
||||
}
|
||||
|
||||
HighDpiPixmap::HighDpiPixmap(int width, int height, qreal devicePixelRatio)
|
||||
: QPixmap(int(width *GetDevicePixelRatio(devicePixelRatio)),
|
||||
int(height *GetDevicePixelRatio(devicePixelRatio)))
|
||||
: QPixmap(int(width * GetDevicePixelRatio(devicePixelRatio)),
|
||||
int(height * GetDevicePixelRatio(devicePixelRatio)))
|
||||
{
|
||||
setDevicePixelRatio(GetDevicePixelRatio(devicePixelRatio));
|
||||
}
|
||||
|
@ -13,10 +13,10 @@
|
||||
#ifdef CUTTER_ENABLE_PYTHON_BINDINGS
|
||||
# include <shiboken.h>
|
||||
# include <pyside.h>
|
||||
#ifdef HAVE_PYSIDECLEANUP
|
||||
// This header is introduced in PySide 6
|
||||
# include <pysidecleanup.h>
|
||||
#endif
|
||||
# ifdef HAVE_PYSIDECLEANUP
|
||||
// This header is introduced in PySide 6
|
||||
# include <pysidecleanup.h>
|
||||
# endif
|
||||
# include <signalmanager.h>
|
||||
#endif
|
||||
|
||||
|
@ -7,7 +7,8 @@
|
||||
namespace Cutter {
|
||||
void initializeSettings();
|
||||
/**
|
||||
* @brief Check if Cutter should offer importing settings from version that can't be directly updated.
|
||||
* @brief Check if Cutter should offer importing settings from version that can't be directly
|
||||
* updated.
|
||||
* @return True if this is first time running Cutter and r2 based Cutter <= 1.12 settings exist.
|
||||
*/
|
||||
bool shouldOfferSettingImport();
|
||||
|
@ -15,7 +15,6 @@
|
||||
# undef max
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
|
||||
// Global information for Cutter
|
||||
#define APPNAME "Cutter"
|
||||
|
||||
|
@ -1,2 +1 @@
|
||||
#include "RizinCpp.h"
|
||||
|
||||
|
@ -46,8 +46,7 @@ static inline auto fromOwned(RZ_OWN RzPVector *data)
|
||||
return { data, {} };
|
||||
}
|
||||
|
||||
static inline auto fromOwned(RZ_OWN RzList *data)
|
||||
-> UniquePtrCP<decltype(data), &rz_list_free>
|
||||
static inline auto fromOwned(RZ_OWN RzList *data) -> UniquePtrCP<decltype(data), &rz_list_free>
|
||||
{
|
||||
return { data, {} };
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ private:
|
||||
QString fixedClass;
|
||||
|
||||
bool inputValid();
|
||||
static QString convertRealNameToName(const QString& realName);
|
||||
static QString convertRealNameToName(const QString &realName);
|
||||
};
|
||||
|
||||
#endif // EDITMETHODDIALOG_H
|
||||
|
@ -49,8 +49,7 @@ void GlibcHeapBinsDialog::setChainInfo(int index)
|
||||
RzHeapChunkListItem *item;
|
||||
RzList *chunks = binsModel->getChunks(index);
|
||||
QString chainInfo;
|
||||
CutterRzListForeach(chunks, iter, RzHeapChunkListItem, item)
|
||||
{
|
||||
CutterRzListForeach (chunks, iter, RzHeapChunkListItem, item) {
|
||||
chainInfo += " → " + RzAddressString(item->addr);
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,8 @@ void NewFileDialog::fillIOPluginsList()
|
||||
{
|
||||
ui->ioPlugin->clear();
|
||||
ui->ioPlugin->addItem("file://");
|
||||
ui->ioPlugin->setItemData(0, tr("Open a file without additional options/settings."), Qt::ToolTipRole);
|
||||
ui->ioPlugin->setItemData(0, tr("Open a file without additional options/settings."),
|
||||
Qt::ToolTipRole);
|
||||
|
||||
int index = 1;
|
||||
QList<RzIOPluginDescription> ioPlugins = Core()->getRIOPluginDescriptions();
|
||||
|
@ -66,12 +66,14 @@ void TypesInteractionDialog::done(int r)
|
||||
bool success;
|
||||
if (!typeName.isEmpty()) {
|
||||
success = rz_type_db_edit_base_type(
|
||||
core->analysis->typedb, this->typeName.toUtf8().constData(),
|
||||
ui->plainTextEdit->toPlainText().toUtf8().constData());
|
||||
core->analysis->typedb, this->typeName.toUtf8().constData(),
|
||||
ui->plainTextEdit->toPlainText().toUtf8().constData());
|
||||
} else {
|
||||
char *error_msg = NULL;
|
||||
success = rz_type_parse_string_stateless(core->analysis->typedb->parser,
|
||||
ui->plainTextEdit->toPlainText().toUtf8().constData(), &error_msg) == 0;
|
||||
success = rz_type_parse_string_stateless(
|
||||
core->analysis->typedb->parser,
|
||||
ui->plainTextEdit->toPlainText().toUtf8().constData(), &error_msg)
|
||||
== 0;
|
||||
if (error_msg) {
|
||||
RZ_LOG_ERROR("%s\n", error_msg);
|
||||
rz_mem_free(error_msg);
|
||||
|
@ -22,8 +22,7 @@ void ColorThemeComboBox::updateFromConfig(bool interfaceThemeChanged)
|
||||
|
||||
clear();
|
||||
for (const QString &theme : themes) {
|
||||
if (ThemeWorker().isCustomTheme(theme)
|
||||
|| !Configuration::relevantThemes[theme]
|
||||
if (ThemeWorker().isCustomTheme(theme) || !Configuration::relevantThemes[theme]
|
||||
|| (Configuration::cutterInterfaceThemesList()[curInterfaceThemeIndex].flag
|
||||
& Configuration::relevantThemes[theme])) {
|
||||
addItem(theme);
|
||||
|
@ -128,8 +128,8 @@ void ColorOptionDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
|
||||
painter->setPen(qApp->palette().text().color());
|
||||
|
||||
QFontMetrics fm2 = QFontMetrics(painter->font());
|
||||
QString name = fm2.elidedText(optionInfoMap__[currCO.optionName].displayingtext,
|
||||
Qt::ElideRight, optionNameRect.width());
|
||||
QString name = fm2.elidedText(optionInfoMap__[currCO.optionName].displayingtext, Qt::ElideRight,
|
||||
optionNameRect.width());
|
||||
painter->drawText(optionNameRect, name);
|
||||
|
||||
QPainterPath roundedOptionRect;
|
||||
@ -157,9 +157,9 @@ void ColorOptionDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
|
||||
painter->fillPath(roundedColorRect, currCO.color);
|
||||
|
||||
QFontMetrics fm3 = QFontMetrics(painter->font());
|
||||
QString desc = fm3.elidedText(
|
||||
currCO.optionName + ": " + optionInfoMap__[currCO.optionName].info, Qt::ElideRight,
|
||||
descTextRect.width());
|
||||
QString desc =
|
||||
fm3.elidedText(currCO.optionName + ": " + optionInfoMap__[currCO.optionName].info,
|
||||
Qt::ElideRight, descTextRect.width());
|
||||
painter->setPen(qApp->palette().text().color());
|
||||
painter->setBrush(qApp->palette().text());
|
||||
painter->drawText(descTextRect, desc);
|
||||
|
@ -12,8 +12,7 @@ ComboQuickFilterView::ComboQuickFilterView(QWidget *parent)
|
||||
connect(debounceTimer, &QTimer::timeout, this,
|
||||
[this]() { emit filterTextChanged(ui->lineEdit->text()); });
|
||||
|
||||
connect(ui->lineEdit, &QLineEdit::textChanged, this,
|
||||
[this]() { debounceTimer->start(150); });
|
||||
connect(ui->lineEdit, &QLineEdit::textChanged, this, [this]() { debounceTimer->start(150); });
|
||||
}
|
||||
|
||||
ComboQuickFilterView::~ComboQuickFilterView()
|
||||
|
@ -300,7 +300,7 @@ void DebugActions::onAttachedRemoteDebugger(bool successfully)
|
||||
// TODO(#2829): Investigate why this is happening
|
||||
if (remoteDialog == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
if (!successfully) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("Error connecting."));
|
||||
|
@ -234,9 +234,8 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
|
||||
QStringList summary {};
|
||||
{
|
||||
auto seeker = Core()->seekTemp(function.offset);
|
||||
auto strings = fromOwnedCharPtr(
|
||||
rz_core_print_disasm_strings(Core()->core(), RZ_CORE_DISASM_STRINGS_MODE_FUNCTION,
|
||||
0, NULL));
|
||||
auto strings = fromOwnedCharPtr(rz_core_print_disasm_strings(
|
||||
Core()->core(), RZ_CORE_DISASM_STRINGS_MODE_FUNCTION, 0, NULL));
|
||||
summary = strings.split('\n', CUTTER_QT_SKIP_EMPTY_PARTS);
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,7 @@ void HeapBinsGraphView::loadCurrentGraph()
|
||||
|| QString(heapBin->type) == QString("Tcache");
|
||||
|
||||
// store info about the chunks in a vector for easy access
|
||||
CutterRzListForeach(heapBin->chunks, iter, RzHeapChunkListItem, item)
|
||||
{
|
||||
CutterRzListForeach (heapBin->chunks, iter, RzHeapChunkListItem, item) {
|
||||
GraphHeapChunk graphHeapChunk;
|
||||
graphHeapChunk.addr = item->addr;
|
||||
RzHeapChunkSimple *chunkInfo = Core()->getHeapChunk(item->addr);
|
||||
|
@ -1407,8 +1407,8 @@ void HexWidget::w_writeRandom()
|
||||
}
|
||||
|
||||
bool ok = false;
|
||||
int nbytes = QInputDialog::getInt(this, tr("Write random bytes"), tr("Number of bytes:"), size, 1,
|
||||
0x7FFFFFFF, 1, &ok);
|
||||
int nbytes = QInputDialog::getInt(this, tr("Write random bytes"), tr("Number of bytes:"), size,
|
||||
1, 0x7FFFFFFF, 1, &ok);
|
||||
if (!ok) {
|
||||
return;
|
||||
}
|
||||
|
@ -248,19 +248,24 @@ void HexdumpWidget::updateParseWindow(RVA start_address, int size)
|
||||
ut64 old_offset = core->offset;
|
||||
rz_core_seek(core, start_address, true);
|
||||
ut8 *block = core->block;
|
||||
char *digest = rz_hash_cfg_calculate_small_block_string(core->hash, "md5", block, size, &digest_size, false);
|
||||
char *digest = rz_hash_cfg_calculate_small_block_string(core->hash, "md5", block, size,
|
||||
&digest_size, false);
|
||||
ui->bytesMD5->setText(QString(digest));
|
||||
free(digest);
|
||||
digest = rz_hash_cfg_calculate_small_block_string(core->hash, "sha1", block, size, &digest_size, false);
|
||||
digest = rz_hash_cfg_calculate_small_block_string(core->hash, "sha1", block, size,
|
||||
&digest_size, false);
|
||||
ui->bytesSHA1->setText(QString(digest));
|
||||
free(digest);
|
||||
digest = rz_hash_cfg_calculate_small_block_string(core->hash, "sha256", block, size, &digest_size, false);
|
||||
digest = rz_hash_cfg_calculate_small_block_string(core->hash, "sha256", block, size,
|
||||
&digest_size, false);
|
||||
ui->bytesSHA256->setText(QString(digest));
|
||||
free(digest);
|
||||
digest = rz_hash_cfg_calculate_small_block_string(core->hash, "crc32", block, size, &digest_size, false);
|
||||
digest = rz_hash_cfg_calculate_small_block_string(core->hash, "crc32", block, size,
|
||||
&digest_size, false);
|
||||
ui->bytesCRC32->setText(QString(digest));
|
||||
free(digest);
|
||||
digest = rz_hash_cfg_calculate_small_block_string(core->hash, "entropy", block, size, &digest_size, false);
|
||||
digest = rz_hash_cfg_calculate_small_block_string(core->hash, "entropy", block, size,
|
||||
&digest_size, false);
|
||||
ui->bytesEntropy->setText(QString(digest));
|
||||
free(digest);
|
||||
rz_core_seek(core, old_offset, true);
|
||||
|
@ -55,7 +55,8 @@ public:
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
|
||||
RVA address(const QModelIndex &index) const override;
|
||||
QString name(const QModelIndex &index) const override;
|
||||
|
@ -140,7 +140,8 @@ void VisualNavbar::fetchStats()
|
||||
if (to < from) {
|
||||
return;
|
||||
}
|
||||
stats.reset(rz_core_analysis_get_stats(core, from, to, RZ_MAX(1, (to + 1 - from) / blocksCount)));
|
||||
stats.reset(
|
||||
rz_core_analysis_get_stats(core, from, to, RZ_MAX(1, (to + 1 - from) / blocksCount)));
|
||||
}
|
||||
|
||||
enum class DataType : int { Empty, Code, String, Symbol, Count };
|
||||
|
Loading…
Reference in New Issue
Block a user