aboutsummaryrefslogtreecommitdiff
path: root/src/client/minidump_file_writer-inl.h
diff options
context:
space:
mode:
authormmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2007-05-31 19:44:52 +0000
committermmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2007-05-31 19:44:52 +0000
commit2e0e2234b9e9d7d82c4c3c20396bdf8f18007e6c (patch)
treec6c1c415720fcaffed1f224b4e1fda7c86267565 /src/client/minidump_file_writer-inl.h
parentCheck allocation and array sizes in minidump.cc (#12). r=bryner (diff)
downloadbreakpad-2e0e2234b9e9d7d82c4c3c20396bdf8f18007e6c.tar.xz
Allow building with -pedantic (#186). r=ted.mielczarek
http://groups.google.com/group/google-breakpad-dev/browse_thread/thread/6aa39d7f0ffa3c42 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@183 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/minidump_file_writer-inl.h')
-rw-r--r--src/client/minidump_file_writer-inl.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/client/minidump_file_writer-inl.h b/src/client/minidump_file_writer-inl.h
index 4505b4f2..7c556a27 100644
--- a/src/client/minidump_file_writer-inl.h
+++ b/src/client/minidump_file_writer-inl.h
@@ -37,26 +37,27 @@
#include <assert.h>
#include "client/minidump_file_writer.h"
+#include "google_breakpad/common/minidump_size.h"
namespace google_breakpad {
template<typename MDType>
inline bool TypedMDRVA<MDType>::Allocate() {
allocation_state_ = SINGLE_OBJECT;
- return UntypedMDRVA::Allocate(sizeof(MDType));
+ return UntypedMDRVA::Allocate(minidump_size<MDType>::size());
}
template<typename MDType>
inline bool TypedMDRVA<MDType>::Allocate(size_t additional) {
allocation_state_ = SINGLE_OBJECT;
- return UntypedMDRVA::Allocate(sizeof(MDType) + additional);
+ return UntypedMDRVA::Allocate(minidump_size<MDType>::size() + additional);
}
template<typename MDType>
inline bool TypedMDRVA<MDType>::AllocateArray(size_t count) {
assert(count);
allocation_state_ = ARRAY;
- return UntypedMDRVA::Allocate(sizeof(MDType) * count);
+ return UntypedMDRVA::Allocate(minidump_size<MDType>::size() * count);
}
template<typename MDType>
@@ -64,14 +65,14 @@ inline bool TypedMDRVA<MDType>::AllocateObjectAndArray(unsigned int count,
size_t size) {
assert(count && size);
allocation_state_ = SINGLE_OBJECT_WITH_ARRAY;
- return UntypedMDRVA::Allocate(sizeof(MDType) + count * size);
+ return UntypedMDRVA::Allocate(minidump_size<MDType>::size() + count * size);
}
template<typename MDType>
inline bool TypedMDRVA<MDType>::CopyIndex(unsigned int index, MDType *item) {
assert(allocation_state_ == ARRAY);
- return writer_->Copy(position_ + index * sizeof(MDType), item,
- sizeof(MDType));
+ return writer_->Copy(position_ + index * minidump_size<MDType>::size(), item,
+ minidump_size<MDType>::size());
}
template<typename MDType>
@@ -79,12 +80,13 @@ inline bool TypedMDRVA<MDType>::CopyIndexAfterObject(unsigned int index,
const void *src,
size_t size) {
assert(allocation_state_ == SINGLE_OBJECT_WITH_ARRAY);
- return writer_->Copy(position_ + sizeof(MDType) + index * size, src, size);
+ return writer_->Copy(position_ + minidump_size<MDType>::size() + index * size,
+ src, size);
}
template<typename MDType>
inline bool TypedMDRVA<MDType>::Flush() {
- return writer_->Copy(position_, &data_, sizeof(MDType));
+ return writer_->Copy(position_, &data_, minidump_size<MDType>::size());
}
} // namespace google_breakpad