From bc8b890557940369bb669105691ba956e6148df1 Mon Sep 17 00:00:00 2001 From: xarkes Date: Sat, 10 Feb 2018 18:50:00 +0100 Subject: [PATCH] Fix strings list #322 --- src/cutter.cpp | 26 ++++++++++++-------------- src/widgets/StringsWidget.cpp | 7 +------ 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/cutter.cpp b/src/cutter.cpp index 12a94de6..d8641a9a 100644 --- a/src/cutter.cpp +++ b/src/cutter.cpp @@ -1054,22 +1054,20 @@ QList CutterCore::getAllRelocs() QList CutterCore::getAllStrings() { CORE_LOCK(); - RListIter *it; QList ret; - - RBinString *bs; - if (core_ && core_->bin && core_->bin->cur && core_->bin->cur->o) + QJsonArray stringsArray = cmdj("izzj")["strings"].toArray(); + for (QJsonValue value : stringsArray) { - CutterRListForeach(core_->bin->cur->o->strings, it, RBinString, bs) - { - StringDescription str; - str.vaddr = bs->vaddr; - str.string = bs->string; - str.type = bs->type; - str.length = bs->length; - str.size = bs->size; - ret << str; - } + QJsonObject stringObject = value.toObject(); + + StringDescription string; + string.string = QString(QByteArray::fromBase64(stringObject["string"].toVariant().toByteArray())); + string.vaddr = stringObject["vaddr"].toVariant().toULongLong(); + string.type = stringObject["type"].toString(); + string.size = stringObject["size"].toVariant().toUInt(); + string.length = stringObject["length"].toVariant().toUInt(); + + ret << string; } return ret; diff --git a/src/widgets/StringsWidget.cpp b/src/widgets/StringsWidget.cpp index 3d93866b..3f7ba560 100644 --- a/src/widgets/StringsWidget.cpp +++ b/src/widgets/StringsWidget.cpp @@ -41,12 +41,7 @@ QVariant StringsModel::data(const QModelIndex &index, int role) const case STRING: return str.string; case TYPE: - if (str.type == "a") - return "ASCII"; - else if (str.type == "u") - return "UTF-8"; - else - return str.type; + return str.type.toUpper(); case LENGTH: return str.length; case SIZE: