Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: tools/crashpad_database_util.cc

Issue 1120383003: Get generate_dump compiling on Windows (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@tools
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 16 matching lines...) Expand all
27 #include "base/logging.h" 27 #include "base/logging.h"
28 #include "base/files/file_path.h" 28 #include "base/files/file_path.h"
29 #include "base/memory/scoped_ptr.h" 29 #include "base/memory/scoped_ptr.h"
30 #include "base/numerics/safe_conversions.h" 30 #include "base/numerics/safe_conversions.h"
31 #include "base/strings/string_util.h" 31 #include "base/strings/string_util.h"
32 #include "base/strings/utf_string_conversions.h" 32 #include "base/strings/utf_string_conversions.h"
33 #include "build/build_config.h" 33 #include "build/build_config.h"
34 #include "client/crash_report_database.h" 34 #include "client/crash_report_database.h"
35 #include "client/settings.h" 35 #include "client/settings.h"
36 #include "tools/tool_support.h" 36 #include "tools/tool_support.h"
37 #include "util/file/basename.h"
37 #include "util/file/file_io.h" 38 #include "util/file/file_io.h"
38 #include "util/file/file_reader.h" 39 #include "util/file/file_reader.h"
39 #include "util/misc/uuid.h" 40 #include "util/misc/uuid.h"
40 41
41 #if defined(OS_MACOSX) 42 #if defined(OS_MACOSX)
42 #include <libgen.h> 43 #include <libgen.h>
43 #endif // OS_MACOSX 44 #endif // OS_MACOSX
44 45
45 namespace crashpad { 46 namespace crashpad {
46 namespace { 47 namespace {
47 48
48 #if defined(OS_POSIX) 49 #if defined(OS_POSIX)
49 time_t TimeGM(struct tm* tm) { 50 time_t TimeGM(struct tm* tm) {
50 return timegm(tm); 51 return timegm(tm);
51 } 52 }
52 53
53 std::string Basename(const std::string& path) {
54 std::string copy(path);
55 return std::string(basename(&copy[0]));
56 }
57
58 const char* Strptime(const char* buf, const char* format, struct tm* tm) { 54 const char* Strptime(const char* buf, const char* format, struct tm* tm) {
59 return strptime(buf, format, tm); 55 return strptime(buf, format, tm);
60 } 56 }
61 #elif defined(OS_WIN) 57 #elif defined(OS_WIN)
62 time_t TimeGM(struct tm* tm) { 58 time_t TimeGM(struct tm* tm) {
63 return _mkgmtime(tm); 59 return _mkgmtime(tm);
64 } 60 }
65 61
66 std::string Basename(const std::string& path) {
67 char fname[_MAX_FNAME];
68 char ext[_MAX_EXT];
69 _splitpath(path.c_str(), nullptr, nullptr, fname, ext);
70 return std::string(fname) + std::string(ext);
71 }
72
73 const char* Strptime(const char* buf, const char* format, struct tm* tm) { 62 const char* Strptime(const char* buf, const char* format, struct tm* tm) {
74 // TODO(scottmg): strptime implementation. 63 // TODO(scottmg): strptime implementation.
75 NOTREACHED(); 64 NOTREACHED();
76 return nullptr; 65 return nullptr;
77 } 66 }
78 #endif // OS_POSIX 67 #endif // OS_POSIX
79 68
80 void Usage(const std::string& me) { 69 void Usage(const std::string& me) {
81 fprintf(stderr, 70 fprintf(stderr,
82 "Usage: %s [OPTION]... PID\n" 71 "Usage: %s [OPTION]... PID\n"
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 610
622 return EXIT_SUCCESS; 611 return EXIT_SUCCESS;
623 } 612 }
624 613
625 } // namespace 614 } // namespace
626 } // namespace crashpad 615 } // namespace crashpad
627 616
628 int main(int argc, char* argv[]) { 617 int main(int argc, char* argv[]) {
629 return crashpad::DatabaseUtilMain(argc, argv); 618 return crashpad::DatabaseUtilMain(argc, argv);
630 } 619 }
OLDNEW
« no previous file with comments | « compat/win/sys/types.h ('k') | tools/generate_dump.cc » ('j') | util/win/process_info.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698