From b84383bfe8662e00d5699241097758b6a6e9d421 Mon Sep 17 00:00:00 2001 From: Jon Palmisciano Date: Thu, 7 Oct 2021 12:27:07 -0400 Subject: Add infrastructure for UTF-{16,32} string creation actions LinearView: Update string methods for UTF-{16,32} string quick-creation - Update `makeString` to accept a character size for wide strings - Update `getStringLength` to handle wide strings, add doc comment TypeView, TypeView: Add `charSize` parameter to `makeString` --- ui/linearview.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ui/linearview.h') diff --git a/ui/linearview.h b/ui/linearview.h index d7a4983e..7edf8097 100644 --- a/ui/linearview.h +++ b/ui/linearview.h @@ -264,7 +264,7 @@ private Q_SLOTS: void makeFloat64(); void toggleFloatSize(); void makePtr(); - void makeString(); + void makeString(size_t charSize = 1); void changeType(const UIActionContext& context); void undefineVariable(); void displayAs(const UIActionContext& context, BNIntegerDisplayType displayType) override; @@ -274,7 +274,13 @@ private Q_SLOTS: void createNewTypes(); void autoCreateMembers(); - size_t getStringLength(uint64_t startAddr); + //! Get the length of of the string (if there is one) starting at the + //! given address. String type is assumed to be UTF-8 by default, but the + //! `charSize` parameter can be set to 2 or 4 to look for UTF-16 or + //! UTF-32 string, respectively. + //! + //! Returns the length of the string in bytes, NOT the number of characters. + size_t getStringLength(uint64_t startAddr, size_t charSize = 1); void setInstructionHighlight(BNHighlightColor color); void setBlockHighlight(BNHighlightColor color); -- cgit v1.3.1