diff options
author | mmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2006-11-15 22:24:42 +0000 |
---|---|---|
committer | mmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2006-11-15 22:24:42 +0000 |
commit | 73cd14b4af906e77f3d8b019962fb9979ff12620 (patch) | |
tree | d24a12393c2f631c22db5b7e76e735b218025890 /src/tools | |
parent | Limit use of default namespace in tests and utility programs (#71). r=bryner (diff) | |
download | breakpad-73cd14b4af906e77f3d8b019962fb9979ff12620.tar.xz |
Airbag client libraries should compile under MSVC .NET 2003/7.1 (#64).
r=bryner
http://groups.google.com/group/airbag-dev/browse_thread/thread/b838faeb50f71818
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@64 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/windows/dump_syms/dump_syms.cc | 12 | ||||
-rw-r--r-- | src/tools/windows/dump_syms/dump_syms.vcproj | 4 | ||||
-rw-r--r-- | src/tools/windows/symupload/symupload.cc | 28 | ||||
-rwxr-xr-x | src/tools/windows/symupload/symupload.vcproj | 4 |
4 files changed, 31 insertions, 17 deletions
diff --git a/src/tools/windows/dump_syms/dump_syms.cc b/src/tools/windows/dump_syms/dump_syms.cc index 02645308..0018d308 100644 --- a/src/tools/windows/dump_syms/dump_syms.cc +++ b/src/tools/windows/dump_syms/dump_syms.cc @@ -39,20 +39,14 @@ using std::wstring; using google_airbag::PDBSourceLineWriter; -int main(int argc, char **argv) { +int wmain(int argc, wchar_t **argv) { if (argc < 2) { - fprintf(stderr, "Usage: %s <pdb file>\n", argv[0]); - return 1; - } - - wchar_t filename[_MAX_PATH]; - if (mbstowcs_s(NULL, filename, argv[1], _MAX_PATH) == -1) { - fprintf(stderr, "invalid multibyte character in %s\n", argv[1]); + fprintf(stderr, "Usage: %ws <pdb file>\n", argv[0]); return 1; } PDBSourceLineWriter writer; - if (!writer.Open(wstring(filename), PDBSourceLineWriter::ANY_FILE)) { + if (!writer.Open(wstring(argv[1]), PDBSourceLineWriter::ANY_FILE)) { fprintf(stderr, "Open failed\n"); return 1; } diff --git a/src/tools/windows/dump_syms/dump_syms.vcproj b/src/tools/windows/dump_syms/dump_syms.vcproj index c0a3390f..360b7d9b 100644 --- a/src/tools/windows/dump_syms/dump_syms.vcproj +++ b/src/tools/windows/dump_syms/dump_syms.vcproj @@ -183,6 +183,10 @@ RelativePath="..\..\..\common\windows\pdb_source_line_writer.h"
>
</File>
+ <File
+ RelativePath="..\..\..\common\windows\string_utils-inl.h"
+ >
+ </File>
</Filter>
<Filter
Name="Resource Files"
diff --git a/src/tools/windows/symupload/symupload.cc b/src/tools/windows/symupload/symupload.cc index 33f8e51f..602a0568 100644 --- a/src/tools/windows/symupload/symupload.cc +++ b/src/tools/windows/symupload/symupload.cc @@ -46,6 +46,8 @@ #include <string> #include <vector> +#include "common/windows/string_utils-inl.h" + #include "common/windows/http_upload.h" #include "common/windows/pdb_source_line_writer.h" @@ -55,6 +57,7 @@ using std::vector; using std::map; using google_airbag::HTTPUpload; using google_airbag::PDBSourceLineWriter; +using google_airbag::WindowsStringUtils; // Extracts the file version information for the given filename, // as a string, for example, "1.2.3.4". Returns true on success. @@ -82,12 +85,13 @@ static bool GetFileVersionString(const wchar_t *filename, wstring *version) { wchar_t ver_string[24]; VS_FIXEDFILEINFO *file_info = reinterpret_cast<VS_FIXEDFILEINFO*>(file_info_buffer); - _snwprintf_s(ver_string, sizeof(ver_string) / sizeof(wchar_t), _TRUNCATE, - L"%d.%d.%d.%d", - file_info->dwFileVersionMS >> 16, - file_info->dwFileVersionMS & 0xffff, - file_info->dwFileVersionLS >> 16, - file_info->dwFileVersionLS & 0xffff); + WindowsStringUtils::safe_swprintf( + ver_string, sizeof(ver_string) / sizeof(ver_string[0]), + L"%d.%d.%d.%d", + file_info->dwFileVersionMS >> 16, + file_info->dwFileVersionMS & 0xffff, + file_info->dwFileVersionLS >> 16, + file_info->dwFileVersionLS & 0xffff); *version = ver_string; return true; } @@ -116,7 +120,13 @@ static bool DumpSymbolsToTempFile(const wchar_t *file, } FILE *temp_file = NULL; +#if _MSC_VER >= 1400 // MSVC 2005/8 if (_wfopen_s(&temp_file, temp_filename, L"w") != 0) { +#else // _MSC_VER >= 1400 + // _wfopen_s was introduced in MSVC8. Use _wfopen for earlier environments. + // Don't use it with MSVC8 and later, because it's deprecated. + if (!(temp_file = _wfopen(temp_filename, L"w"))) { +#endif // _MSC_VER >= 1400 return false; } @@ -148,8 +158,10 @@ int wmain(int argc, wchar_t *argv[]) { } wchar_t module_age_string[11]; - _snwprintf_s(module_age_string, sizeof(module_age_string) / sizeof(wchar_t), - _TRUNCATE, L"0x%x", module_age); + WindowsStringUtils::safe_swprintf( + module_age_string, + sizeof(module_age_string) / sizeof(module_age_string[0]), + L"0x%x", module_age); map<wstring, wstring> parameters; parameters[L"module"] = module_basename; diff --git a/src/tools/windows/symupload/symupload.vcproj b/src/tools/windows/symupload/symupload.vcproj index ddd63fc1..c1458854 100755 --- a/src/tools/windows/symupload/symupload.vcproj +++ b/src/tools/windows/symupload/symupload.vcproj @@ -188,6 +188,10 @@ RelativePath="..\..\..\common\windows\pdb_source_line_writer.h"
>
</File>
+ <File
+ RelativePath="..\..\..\common\windows\string_utils-inl.h"
+ >
+ </File>
</Filter>
<Filter
Name="Resource Files"
|