[Libreoffice-commits] online.git: tools/map.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Jan 11 08:09:02 UTC 2019
tools/map.cpp | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
New commits:
commit 6c8af8091f46d2b9397156ab40442ab96846c3c8
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Jan 11 09:08:29 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jan 11 09:08:44 2019 +0100
tools: make members private in StringData
Change-Id: I6c080264d2c66abdb6760c190f3727dd0159c865
diff --git a/tools/map.cpp b/tools/map.cpp
index f4cfd4fde..5f1df765f 100644
--- a/tools/map.cpp
+++ b/tools/map.cpp
@@ -121,12 +121,23 @@ public:
};
struct StringData {
+private:
size_t _count;
size_t _chars;
+
+public:
StringData() :
_count(0),
_chars(0)
{}
+
+ void setCount(size_t count) { _count = count; }
+
+ size_t getCount() const { return _count; }
+
+ void setChars(size_t chars) { _chars = chars; }
+
+ size_t getChars() const { return _chars; }
};
struct AddrSpace {
@@ -145,8 +156,8 @@ struct AddrSpace {
for (int i = 0; i < 3; ++i)
{
printf("%cStrings :%20lld, %lld chars\n",
- prefixes[i], (addr_t)_strings[i]._count,
- (addr_t)_strings[i]._chars);
+ prefixes[i], (addr_t)_strings[i].getCount(),
+ (addr_t)_strings[i].getChars());
}
}
@@ -219,8 +230,8 @@ struct AddrSpace {
if (isStringAtOffset(data, i + 8, len, isUnicode, str))
{
StringData &sdata = _strings[isUnicode ? 1 : 0];
- sdata._count ++;
- sdata._chars += len;
+ sdata.setCount(sdata.getCount() + 1);
+ sdata.setChars(sdata.getChars() + len);
_addrToStr[map.getStart() + i] = str;
i += ((4 + str.length() * (isUnicode ? 2 : 1)) >>2 ) * 4;
}
@@ -228,8 +239,8 @@ struct AddrSpace {
if ((i%8 == 0) && isCStringAtOffset(data, i, str))
{
StringData &sdata = _strings[2];
- sdata._count ++;
- sdata._chars += str.length();
+ sdata.setCount(sdata.getCount() + 1);
+ sdata.setChars(sdata.getChars() + str.length());
_addrToStr[map.getStart() + i] = str;
i += (str.length() >> 2) * 4;
}
More information about the Libreoffice-commits
mailing list