Make some parts of the processor compile on Win32/MSVC
R=mark at http://breakpad.appspot.com/250001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@751 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
fd00ae5f55
commit
c77fc8a32c
@ -79,7 +79,9 @@
|
|||||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_H__
|
#ifndef GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_H__
|
||||||
#define GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_H__
|
#define GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_H__
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -44,13 +44,21 @@
|
|||||||
|
|
||||||
namespace google_breakpad {
|
namespace google_breakpad {
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
LogStream::LogStream(std::ostream &stream, Severity severity,
|
LogStream::LogStream(std::ostream &stream, Severity severity,
|
||||||
const char *file, int line)
|
const char *file, int line)
|
||||||
: stream_(stream) {
|
: stream_(stream) {
|
||||||
time_t clock;
|
time_t clock;
|
||||||
time(&clock);
|
time(&clock);
|
||||||
struct tm tm_struct;
|
struct tm tm_struct;
|
||||||
|
#ifdef _WIN32
|
||||||
|
localtime_s(&tm_struct, &clock);
|
||||||
|
#else
|
||||||
localtime_r(&clock, &tm_struct);
|
localtime_r(&clock, &tm_struct);
|
||||||
|
#endif
|
||||||
char time_string[20];
|
char time_string[20];
|
||||||
strftime(time_string, sizeof(time_string), "%Y-%m-%d %H:%M:%S", &tm_struct);
|
strftime(time_string, sizeof(time_string), "%Y-%m-%d %H:%M:%S", &tm_struct);
|
||||||
|
|
||||||
|
@ -68,6 +68,15 @@
|
|||||||
|
|
||||||
namespace google_breakpad {
|
namespace google_breakpad {
|
||||||
|
|
||||||
|
// These are defined in Microsoft headers.
|
||||||
|
#ifdef SEVERITY_ERROR
|
||||||
|
#undef SEVERITY_ERROR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ERROR
|
||||||
|
#undef ERROR
|
||||||
|
#endif
|
||||||
|
|
||||||
class LogStream {
|
class LogStream {
|
||||||
public:
|
public:
|
||||||
enum Severity {
|
enum Severity {
|
||||||
|
@ -40,14 +40,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
typedef SSIZE_T ssize_t;
|
typedef SSIZE_T ssize_t;
|
||||||
#define open _open
|
#define PRIx64 "llx"
|
||||||
#define read _read
|
#define PRIx32 "lx"
|
||||||
#define lseek _lseek
|
#define snprintf _snprintf
|
||||||
#else // _WIN32
|
#else // _WIN32
|
||||||
|
#include <unistd.h>
|
||||||
#define O_BINARY 0
|
#define O_BINARY 0
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
@ -1101,7 +1102,7 @@ void MinidumpMemoryRegion::SetDescriptor(MDMemoryDescriptor* descriptor) {
|
|||||||
descriptor_ = descriptor;
|
descriptor_ = descriptor;
|
||||||
valid_ = descriptor &&
|
valid_ = descriptor &&
|
||||||
descriptor_->memory.data_size <=
|
descriptor_->memory.data_size <=
|
||||||
numeric_limits<uint64_t>::max() -
|
numeric_limits<u_int64_t>::max() -
|
||||||
descriptor_->start_of_memory_range;
|
descriptor_->start_of_memory_range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3694,7 +3695,11 @@ void Minidump::Print() {
|
|||||||
printf(" stream_directory_rva = 0x%x\n", header_.stream_directory_rva);
|
printf(" stream_directory_rva = 0x%x\n", header_.stream_directory_rva);
|
||||||
printf(" checksum = 0x%x\n", header_.checksum);
|
printf(" checksum = 0x%x\n", header_.checksum);
|
||||||
struct tm timestruct;
|
struct tm timestruct;
|
||||||
|
#ifdef _WIN32
|
||||||
|
gmtime_s(×truct, reinterpret_cast<time_t*>(&header_.time_date_stamp));
|
||||||
|
#else
|
||||||
gmtime_r(reinterpret_cast<time_t*>(&header_.time_date_stamp), ×truct);
|
gmtime_r(reinterpret_cast<time_t*>(&header_.time_date_stamp), ×truct);
|
||||||
|
#endif
|
||||||
char timestr[20];
|
char timestr[20];
|
||||||
strftime(timestr, 20, "%Y-%m-%d %H:%M:%S", ×truct);
|
strftime(timestr, 20, "%Y-%m-%d %H:%M:%S", ×truct);
|
||||||
printf(" time_date_stamp = 0x%x %s\n", header_.time_date_stamp,
|
printf(" time_date_stamp = 0x%x %s\n", header_.time_date_stamp,
|
||||||
|
Loading…
Reference in New Issue
Block a user