Skip to content

Commit

Permalink
Fix strings list radareorg#322
Browse files Browse the repository at this point in the history
  • Loading branch information
xarkes committed Feb 10, 2018
1 parent 5d1bf80 commit bc8b890
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
26 changes: 12 additions & 14 deletions src/cutter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,22 +1054,20 @@ QList<RelocDescription> CutterCore::getAllRelocs()
QList<StringDescription> CutterCore::getAllStrings()
{
CORE_LOCK();
RListIter *it;
QList<StringDescription> 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;
Expand Down
7 changes: 1 addition & 6 deletions src/widgets/StringsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bc8b890

Please sign in to comment.