diff options
author | 2019-12-09 09:39:22 -0800 | |
---|---|---|
committer | 2019-12-09 09:39:22 -0800 | |
commit | 0d4bd95f746fe21e2a24b1e66d2215acc130e136 (patch) | |
tree | 4af35876336fd20f48a8765f8851d104d062c7a9 | |
parent | 896bcfceafc9f696d5f93032bc2814f2e35c9bf2 (diff) | |
parent | 4f217ce217421e36381067cbabe615223c3a0a3e (diff) |
Merge "libui: use uint64_t in dump and getTotalSize to avoid overflow issues" am: 8fc7c37cfd am: 05a255c8c2
am: 4f217ce217
Change-Id: I6804e5c4d9130cb64d50bcdf811d5100687a7ed8
-rw-r--r-- | libs/ui/GraphicBufferAllocator.cpp | 6 | ||||
-rw-r--r-- | libs/ui/include/ui/GraphicBufferAllocator.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp index b2b9680b26..3a90a988dc 100644 --- a/libs/ui/GraphicBufferAllocator.cpp +++ b/libs/ui/GraphicBufferAllocator.cpp @@ -69,9 +69,9 @@ GraphicBufferAllocator::GraphicBufferAllocator() : mMapper(GraphicBufferMapper:: GraphicBufferAllocator::~GraphicBufferAllocator() {} -size_t GraphicBufferAllocator::getTotalSize() const { +uint64_t GraphicBufferAllocator::getTotalSize() const { Mutex::Autolock _l(sLock); - size_t total = 0; + uint64_t total = 0; for (size_t i = 0; i < sAllocList.size(); ++i) { total += sAllocList.valueAt(i).size; } @@ -81,7 +81,7 @@ size_t GraphicBufferAllocator::getTotalSize() const { void GraphicBufferAllocator::dump(std::string& result) const { Mutex::Autolock _l(sLock); KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList); - size_t total = 0; + uint64_t total = 0; result.append("Allocated buffers:\n"); const size_t c = list.size(); for (size_t i=0 ; i<c ; i++) { diff --git a/libs/ui/include/ui/GraphicBufferAllocator.h b/libs/ui/include/ui/GraphicBufferAllocator.h index 34a5b17ae6..a182104856 100644 --- a/libs/ui/include/ui/GraphicBufferAllocator.h +++ b/libs/ui/include/ui/GraphicBufferAllocator.h @@ -72,7 +72,7 @@ public: status_t free(buffer_handle_t handle); - size_t getTotalSize() const; + uint64_t getTotalSize() const; void dump(std::string& res) const; static void dumpToSystemLog(); |