From 0cbd50c975c1680a6cd0f1ce2760e157e2bfd46f Mon Sep 17 00:00:00 2001 From: "ted.mielczarek" Date: Wed, 9 Dec 2009 01:24:37 +0000 Subject: Allow Minidump class to be instantiated with stream instead of file. r=mark at http://breakpad.appspot.com/46001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@438 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/google_breakpad/processor/minidump.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/google_breakpad') diff --git a/src/google_breakpad/processor/minidump.h b/src/google_breakpad/processor/minidump.h index d3a7b92b..695a7254 100644 --- a/src/google_breakpad/processor/minidump.h +++ b/src/google_breakpad/processor/minidump.h @@ -81,6 +81,7 @@ #include +#include #include #include #include @@ -796,9 +797,14 @@ class Minidump { public: // path is the pathname of a file containing the minidump. explicit Minidump(const string& path); + // input is an istream wrapping minidump data. Minidump holds a + // weak pointer to input, and the caller must ensure that the stream + // is valid as long as the Minidump object is. + explicit Minidump(std::istream& input); virtual ~Minidump(); + // path may be empty if the minidump was not opened from a file virtual string path() const { return path_; } @@ -854,7 +860,7 @@ class Minidump { bool SeekSet(off_t offset); // Returns the current position of the minidump file. - off_t Tell() { return valid_ ? lseek(fd_, 0, SEEK_CUR) : (off_t)-1; } + off_t Tell(); // The next 2 methods are medium-level I/O routines. @@ -925,11 +931,12 @@ class Minidump { MinidumpStreamMap* stream_map_; // The pathname of the minidump file to process, set in the constructor. + // This may be empty if the minidump was opened directly from a stream. const string path_; - // The file descriptor for all file I/O. Used by ReadBytes and SeekSet. - // Set based on the |path_| member by Open, which is called by Read. - int fd_; + // The stream for all file I/O. Used by ReadBytes and SeekSet. + // Set based on the path in Open, or directly in the constructor. + std::istream* stream_; // swap_ is true if the minidump file should be byte-swapped. If the // minidump was produced by a CPU that is other-endian than the CPU -- cgit v1.2.1