[Libreoffice-commits] online.git: tools/map.cpp wsd/Admin.hpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Jan 10 08:12:13 UTC 2019
tools/map.cpp | 29 ++++++++++++++++++++---------
wsd/Admin.hpp | 2 +-
2 files changed, 21 insertions(+), 10 deletions(-)
New commits:
commit 5391c09fba246a3f3c64adf151d71b5c18462e0d
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jan 10 09:11:38 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Jan 10 09:11:55 2019 +0100
tools: make members private in Map
Change-Id: I9f23d5095e387888e43c0a0d2e6ed041ac5aed68
diff --git a/tools/map.cpp b/tools/map.cpp
index 56906bf85..f4cfd4fde 100644
--- a/tools/map.cpp
+++ b/tools/map.cpp
@@ -103,9 +103,20 @@ static int openPid(unsigned proc_id, const char *name)
}
struct Map {
+private:
addr_t _start;
addr_t _end;
std::string _name;
+public:
+ void setStart(addr_t start) { _start = start; }
+ addr_t getStart() const { return _start; }
+
+ void setEnd(addr_t end) { _end = end; }
+ addr_t getEnd() const { return _end; }
+
+ void setName(const std::string& name) { _name = name; }
+ const std::string& getName() const { return _name; }
+
size_t size() { return _end - _start; }
};
@@ -143,8 +154,8 @@ struct AddrSpace {
{
for (const Map &i : _maps)
{
- if (i._start <= page && i._end > page)
- return i._name;
+ if (i.getStart() <= page && i.getEnd() > page)
+ return i.getName();
}
return std::string("");
}
@@ -152,9 +163,9 @@ struct AddrSpace {
void insert(addr_t start, addr_t end, const char *name)
{
Map map;
- map._start = start;
- map._end = end;
- map._name = std::string(name, 0, strlen(name) - 1);
+ map.setStart(start);
+ map.setEnd(end);
+ map.setName(std::string(name, 0, strlen(name) - 1));
_maps.push_back(map);
}
@@ -210,7 +221,7 @@ struct AddrSpace {
StringData &sdata = _strings[isUnicode ? 1 : 0];
sdata._count ++;
sdata._chars += len;
- _addrToStr[map._start + i] = str;
+ _addrToStr[map.getStart() + i] = str;
i += ((4 + str.length() * (isUnicode ? 2 : 1)) >>2 ) * 4;
}
}
@@ -219,7 +230,7 @@ struct AddrSpace {
StringData &sdata = _strings[2];
sdata._count ++;
sdata._chars += str.length();
- _addrToStr[map._start + i] = str;
+ _addrToStr[map.getStart() + i] = str;
i += (str.length() >> 2) * 4;
}
}
@@ -232,10 +243,10 @@ struct AddrSpace {
{
std::vector<unsigned char> data;
data.resize (map.size());
- if (lseek(mem_fd, map._start, SEEK_SET) < 0 ||
+ if (lseek(mem_fd, map.getStart(), SEEK_SET) < 0 ||
read(mem_fd, &data[0], map.size()) != (int)map.size())
error(EXIT_FAILURE, errno, "Failed to seek in /proc/%d/mem to %lld",
- _proc_id, map._start);
+ _proc_id, map.getStart());
scanForSalStrings(map, data);
}
diff --git a/wsd/Admin.hpp b/wsd/Admin.hpp
index d818a6cea..f29ea2c4f 100644
--- a/wsd/Admin.hpp
+++ b/wsd/Admin.hpp
@@ -163,7 +163,7 @@ private:
void setUri(const std::string& uri) { _uri = uri; }
std::string getUri() const { return _uri; }
- protected:
+ private:
std::chrono::steady_clock::time_point _when;
std::string _uri;
};
More information about the Libreoffice-commits
mailing list