diff options
author | mmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2007-05-31 19:44:52 +0000 |
---|---|---|
committer | mmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2007-05-31 19:44:52 +0000 |
commit | 2e0e2234b9e9d7d82c4c3c20396bdf8f18007e6c (patch) | |
tree | c6c1c415720fcaffed1f224b4e1fda7c86267565 /src/client | |
parent | Check allocation and array sizes in minidump.cc (#12). r=bryner (diff) | |
download | breakpad-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')
-rw-r--r-- | src/client/minidump_file_writer-inl.h | 18 | ||||
-rw-r--r-- | src/client/minidump_file_writer.h | 4 |
2 files changed, 12 insertions, 10 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 diff --git a/src/client/minidump_file_writer.h b/src/client/minidump_file_writer.h index 39fc90b8..f569a553 100644 --- a/src/client/minidump_file_writer.h +++ b/src/client/minidump_file_writer.h @@ -200,12 +200,12 @@ class TypedMDRVA : public UntypedMDRVA { // alter its contents. MDType *get() { return &data_; } - // Allocates sizeof(MDType) bytes. + // Allocates minidump_size<MDType>::size() bytes. // Must not call more than once. // Return true on success, or false on failure bool Allocate(); - // Allocates sizeof(MDType) + |additional| bytes. + // Allocates minidump_size<MDType>::size() + |additional| bytes. // Must not call more than once. // Return true on success, or false on failure bool Allocate(size_t additional); |