From f5c8f6fb61ce609452361ee9b61a343570f62d12 Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Sat, 14 Aug 2010 01:41:39 +0000 Subject: Fix a couple of bugs where we generate incorrect minidump files on Linux.o Patch by Markus Gutschke . R=thestig Review URL: http://breakpad.appspot.com/150001 Review URL: http://breakpad.appspot.com/155001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@649 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/linux/memory.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/common/linux/memory.h') diff --git a/src/common/linux/memory.h b/src/common/linux/memory.h index f10a194b..725ed8b3 100644 --- a/src/common/linux/memory.h +++ b/src/common/linux/memory.h @@ -148,6 +148,24 @@ class wasteful_vector { return used_; } + void resize(unsigned sz, T c = T()) { + // No need to test "sz >= 0", as "sz" is unsigned. + if (sz <= used_) { + used_ = sz; + } else { + unsigned a = allocated_; + if (sz > a) { + while (sz > a) { + a *= 2; + } + Realloc(a); + } + while (sz > used_) { + a_[used_++] = c; + } + } + } + T& operator[](size_t index) { return a_[index]; } -- cgit v1.2.1