aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorted.mielczarek@gmail.com <ted.mielczarek@gmail.com>2014-11-03 17:05:39 +0000
committerted.mielczarek@gmail.com <ted.mielczarek@gmail.com>2014-11-03 17:05:39 +0000
commitc971cf439cec3d412e297199db2416523c1a889d (patch)
tree491b9867f0696cb5007d627c82fc183085effc5a /src
parentIntroduce microdump writer class. (diff)
downloadbreakpad-c971cf439cec3d412e297199db2416523c1a889d.tar.xz
Fix Windows client compilation on mingw.
A=Jacek Caban <jacek@codeweavers.com>, R=ted at http://breakpad.appspot.com/548002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1399 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r--src/client/windows/common/auto_critical_section.h2
-rw-r--r--src/client/windows/common/ipc_protocol.h4
-rw-r--r--src/client/windows/crash_generation/client_info.h4
-rw-r--r--src/client/windows/crash_generation/minidump_generator.cc9
-rw-r--r--src/client/windows/crash_generation/minidump_generator.h1
-rw-r--r--src/client/windows/handler/exception_handler.cc2
-rw-r--r--src/client/windows/handler/exception_handler.h4
-rw-r--r--src/common/windows/guid_string.h2
-rw-r--r--src/common/windows/http_upload.cc14
-rw-r--r--src/common/windows/http_upload.h13
-rw-r--r--src/common/windows/string_utils.cc8
-rw-r--r--src/google_breakpad/common/breakpad_types.h2
-rw-r--r--src/tools/windows/converter/ms_symbol_server_converter.cc4
-rw-r--r--src/tools/windows/converter/ms_symbol_server_converter.h2
-rw-r--r--src/tools/windows/symupload/symupload.cc6
15 files changed, 45 insertions, 32 deletions
diff --git a/src/client/windows/common/auto_critical_section.h b/src/client/windows/common/auto_critical_section.h
index 40287427..3fd4b9b7 100644
--- a/src/client/windows/common/auto_critical_section.h
+++ b/src/client/windows/common/auto_critical_section.h
@@ -30,7 +30,7 @@
#ifndef CLIENT_WINDOWS_COMMON_AUTO_CRITICAL_SECTION_H__
#define CLIENT_WINDOWS_COMMON_AUTO_CRITICAL_SECTION_H__
-#include <Windows.h>
+#include <windows.h>
namespace google_breakpad {
diff --git a/src/client/windows/common/ipc_protocol.h b/src/client/windows/common/ipc_protocol.h
index b03c032b..c7486819 100644
--- a/src/client/windows/common/ipc_protocol.h
+++ b/src/client/windows/common/ipc_protocol.h
@@ -30,8 +30,8 @@
#ifndef CLIENT_WINDOWS_COMMON_IPC_PROTOCOL_H__
#define CLIENT_WINDOWS_COMMON_IPC_PROTOCOL_H__
-#include <Windows.h>
-#include <DbgHelp.h>
+#include <windows.h>
+#include <dbghelp.h>
#include <string>
#include <utility>
#include "common/windows/string_utils-inl.h"
diff --git a/src/client/windows/crash_generation/client_info.h b/src/client/windows/crash_generation/client_info.h
index 9f94bec8..6a8fba31 100644
--- a/src/client/windows/crash_generation/client_info.h
+++ b/src/client/windows/crash_generation/client_info.h
@@ -30,8 +30,8 @@
#ifndef CLIENT_WINDOWS_CRASH_GENERATION_CLIENT_INFO_H__
#define CLIENT_WINDOWS_CRASH_GENERATION_CLIENT_INFO_H__
-#include <Windows.h>
-#include <DbgHelp.h>
+#include <windows.h>
+#include <dbghelp.h>
#include "client/windows/common/ipc_protocol.h"
#include "common/scoped_ptr.h"
#include "google_breakpad/common/minidump_format.h"
diff --git a/src/client/windows/crash_generation/minidump_generator.cc b/src/client/windows/crash_generation/minidump_generator.cc
index 22e8d365..c3e91681 100644
--- a/src/client/windows/crash_generation/minidump_generator.cc
+++ b/src/client/windows/crash_generation/minidump_generator.cc
@@ -176,9 +176,14 @@ bool HandleTraceData::CollectHandleData(
stream_data->Reserved = 0;
std::copy(operations_.begin(),
operations_.end(),
+#ifdef _MSC_VER
stdext::checked_array_iterator<AVRF_HANDLE_OPERATION*>(
reinterpret_cast<AVRF_HANDLE_OPERATION*>(stream_data + 1),
- operations_.size()));
+ operations_.size())
+#else
+ reinterpret_cast<AVRF_HANDLE_OPERATION*>(stream_data + 1)
+#endif
+ );
return true;
}
@@ -350,7 +355,7 @@ bool MinidumpGenerator::WriteMinidump() {
user_streams.UserStreamArray = user_stream_array.get();
MDRawAssertionInfo* actual_assert_info = assert_info_;
- MDRawAssertionInfo client_assert_info = {0};
+ MDRawAssertionInfo client_assert_info = {{0}};
if (assert_info_) {
// If the assertion info object lives in the client process,
diff --git a/src/client/windows/crash_generation/minidump_generator.h b/src/client/windows/crash_generation/minidump_generator.h
index b95e04eb..a3c12305 100644
--- a/src/client/windows/crash_generation/minidump_generator.h
+++ b/src/client/windows/crash_generation/minidump_generator.h
@@ -34,6 +34,7 @@
#include <dbghelp.h>
#include <rpc.h>
#include <list>
+#include <string>
#include "google_breakpad/common/minidump_format.h"
namespace google_breakpad {
diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc
index 3a2f824c..b4ebbdac 100644
--- a/src/client/windows/handler/exception_handler.cc
+++ b/src/client/windows/handler/exception_handler.cc
@@ -27,7 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <ObjBase.h>
+#include <objbase.h>
#include <algorithm>
#include <cassert>
diff --git a/src/client/windows/handler/exception_handler.h b/src/client/windows/handler/exception_handler.h
index 539c6662..3c935089 100644
--- a/src/client/windows/handler/exception_handler.h
+++ b/src/client/windows/handler/exception_handler.h
@@ -57,8 +57,8 @@
#define CLIENT_WINDOWS_HANDLER_EXCEPTION_HANDLER_H__
#include <stdlib.h>
-#include <Windows.h>
-#include <DbgHelp.h>
+#include <windows.h>
+#include <dbghelp.h>
#include <rpc.h>
#pragma warning(push)
diff --git a/src/common/windows/guid_string.h b/src/common/windows/guid_string.h
index 6b92675b..48a5c1d3 100644
--- a/src/common/windows/guid_string.h
+++ b/src/common/windows/guid_string.h
@@ -32,7 +32,7 @@
#ifndef COMMON_WINDOWS_GUID_STRING_H_
#define COMMON_WINDOWS_GUID_STRING_H_
-#include <Guiddef.h>
+#include <guiddef.h>
#include <string>
diff --git a/src/common/windows/http_upload.cc b/src/common/windows/http_upload.cc
index 838185b7..ba04d7d0 100644
--- a/src/common/windows/http_upload.cc
+++ b/src/common/windows/http_upload.cc
@@ -327,11 +327,13 @@ bool HTTPUpload::GetFileContents(const wstring &filename,
// wchar_t* filename, so use _wfopen directly in that case. For VC8 and
// later, _wfopen has been deprecated in favor of _wfopen_s, which does
// not exist in earlier versions, so let the ifstream open the file itself.
-#if _MSC_VER >= 1400 // MSVC 2005/8
+ // GCC doesn't support wide file name and opening on FILE* requires ugly
+ // hacks, so fallback to multi byte file.
+#ifdef _MSC_VER
ifstream file;
file.open(filename.c_str(), ios::binary);
-#else // _MSC_VER >= 1400
- ifstream file(_wfopen(filename.c_str(), L"rb"));
+#else // GCC
+ ifstream file(WideToMBCP(filename, CP_ACP).c_str(), ios::binary);
#endif // _MSC_VER >= 1400
if (file.is_open()) {
file.seekg(0, ios::end);
@@ -375,13 +377,13 @@ wstring HTTPUpload::UTF8ToWide(const string &utf8) {
}
// static
-string HTTPUpload::WideToUTF8(const wstring &wide) {
+string HTTPUpload::WideToMBCP(const wstring &wide, unsigned int cp) {
if (wide.length() == 0) {
return string();
}
// compute the length of the buffer we'll need
- int charcount = WideCharToMultiByte(CP_UTF8, 0, wide.c_str(), -1,
+ int charcount = WideCharToMultiByte(cp, 0, wide.c_str(), -1,
NULL, 0, NULL, NULL);
if (charcount == 0) {
return string();
@@ -389,7 +391,7 @@ string HTTPUpload::WideToUTF8(const wstring &wide) {
// convert
char *buf = new char[charcount];
- WideCharToMultiByte(CP_UTF8, 0, wide.c_str(), -1, buf, charcount,
+ WideCharToMultiByte(cp, 0, wide.c_str(), -1, buf, charcount,
NULL, NULL);
string result(buf);
diff --git a/src/common/windows/http_upload.h b/src/common/windows/http_upload.h
index 0594cde3..e485b70e 100644
--- a/src/common/windows/http_upload.h
+++ b/src/common/windows/http_upload.h
@@ -38,8 +38,8 @@
// Disable exception handler warnings.
#pragma warning(disable : 4530)
-#include <Windows.h>
-#include <WinInet.h>
+#include <windows.h>
+#include <wininet.h>
#include <map>
#include <string>
@@ -80,7 +80,7 @@ class HTTPUpload {
// this merely checks (via the return value) that we were successfully
// able to retrieve exactly as many bytes of content in the response as
// were specified in the Content-Length header.
- static bool HTTPUpload::ReadResponse(HINTERNET request, wstring* response);
+ static bool ReadResponse(HINTERNET request, wstring* response);
// Generates a new multipart boundary for a POST request
static wstring GenerateMultipartBoundary();
@@ -104,7 +104,12 @@ class HTTPUpload {
static wstring UTF8ToWide(const string &utf8);
// Converts a UTF16 string to UTF8.
- static string WideToUTF8(const wstring &wide);
+ static string WideToUTF8(const wstring &wide) {
+ return WideToMBCP(wide, CP_UTF8);
+ }
+
+ // Converts a UTF16 string to specified code page.
+ static string WideToMBCP(const wstring &wide, unsigned int cp);
// Checks that the given list of parameters has only printable
// ASCII characters in the parameter name, and does not contain
diff --git a/src/common/windows/string_utils.cc b/src/common/windows/string_utils.cc
index e6ffa082..27280003 100644
--- a/src/common/windows/string_utils.cc
+++ b/src/common/windows/string_utils.cc
@@ -58,7 +58,7 @@ bool WindowsStringUtils::safe_mbstowcs(const string &mbs, wstring *wcs) {
}
assert(wcs_length > 0);
#else // _MSC_VER >= 1400
- if ((wcs_length = mbstowcs(NULL, mbs.c_str(), mbs.length())) < 0) {
+ if ((wcs_length = mbstowcs(NULL, mbs.c_str(), mbs.length())) == (size_t)-1) {
return false;
}
@@ -75,7 +75,7 @@ bool WindowsStringUtils::safe_mbstowcs(const string &mbs, wstring *wcs) {
return false;
}
#else // _MSC_VER >= 1400
- if (mbstowcs(&wcs_v[0], mbs.c_str(), mbs.length()) < 0) {
+ if (mbstowcs(&wcs_v[0], mbs.c_str(), mbs.length()) == (size_t)-1) {
return false;
}
@@ -101,7 +101,7 @@ bool WindowsStringUtils::safe_wcstombs(const wstring &wcs, string *mbs) {
}
assert(mbs_length > 0);
#else // _MSC_VER >= 1400
- if ((mbs_length = wcstombs(NULL, wcs.c_str(), wcs.length())) < 0) {
+ if ((mbs_length = wcstombs(NULL, wcs.c_str(), wcs.length())) == (size_t)-1) {
return false;
}
@@ -118,7 +118,7 @@ bool WindowsStringUtils::safe_wcstombs(const wstring &wcs, string *mbs) {
return false;
}
#else // _MSC_VER >= 1400
- if (wcstombs(&mbs_v[0], wcs.c_str(), wcs.length()) < 0) {
+ if (wcstombs(&mbs_v[0], wcs.c_str(), wcs.length()) == (size_t)-1) {
return false;
}
diff --git a/src/google_breakpad/common/breakpad_types.h b/src/google_breakpad/common/breakpad_types.h
index a60c5f35..e92436ff 100644
--- a/src/google_breakpad/common/breakpad_types.h
+++ b/src/google_breakpad/common/breakpad_types.h
@@ -58,7 +58,7 @@
*/
#include BREAKPAD_CUSTOM_STDINT_H
#else
-#include <WTypes.h>
+#include <wtypes.h>
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
diff --git a/src/tools/windows/converter/ms_symbol_server_converter.cc b/src/tools/windows/converter/ms_symbol_server_converter.cc
index fad35faf..dd3f770f 100644
--- a/src/tools/windows/converter/ms_symbol_server_converter.cc
+++ b/src/tools/windows/converter/ms_symbol_server_converter.cc
@@ -34,8 +34,8 @@
//
// Author: Mark Mentovai
-#include <Windows.h>
-#include <DbgHelp.h>
+#include <windows.h>
+#include <dbghelp.h>
#include <cassert>
#include <cstdio>
diff --git a/src/tools/windows/converter/ms_symbol_server_converter.h b/src/tools/windows/converter/ms_symbol_server_converter.h
index 3db84f47..d601b433 100644
--- a/src/tools/windows/converter/ms_symbol_server_converter.h
+++ b/src/tools/windows/converter/ms_symbol_server_converter.h
@@ -65,7 +65,7 @@
#ifndef TOOLS_WINDOWS_MS_SYMBOL_SERVER_CONVERTER_H_
#define TOOLS_WINDOWS_MS_SYMBOL_SERVER_CONVERTER_H_
-#include <Windows.h>
+#include <windows.h>
#include <string>
#include <vector>
diff --git a/src/tools/windows/symupload/symupload.cc b/src/tools/windows/symupload/symupload.cc
index e0d78f4f..eafd9b47 100644
--- a/src/tools/windows/symupload/symupload.cc
+++ b/src/tools/windows/symupload/symupload.cc
@@ -42,9 +42,9 @@
// cpu: the CPU that the module was built for, typically "x86".
// symbol_file: the contents of the breakpad-format symbol file
-#include <Windows.h>
-#include <DbgHelp.h>
-#include <WinInet.h>
+#include <windows.h>
+#include <dbghelp.h>
+#include <wininet.h>
#include <cstdio>
#include <map>