aboutsummaryrefslogtreecommitdiff
path: root/src/common/windows/http_upload.cc
diff options
context:
space:
mode:
authormmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-11-15 22:24:42 +0000
committermmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-11-15 22:24:42 +0000
commit73cd14b4af906e77f3d8b019962fb9979ff12620 (patch)
treed24a12393c2f631c22db5b7e76e735b218025890 /src/common/windows/http_upload.cc
parentLimit use of default namespace in tests and utility programs (#71). r=bryner (diff)
downloadbreakpad-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/common/windows/http_upload.cc')
-rw-r--r--src/common/windows/http_upload.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/common/windows/http_upload.cc b/src/common/windows/http_upload.cc
index 6176bff8..8e5328b5 100644
--- a/src/common/windows/http_upload.cc
+++ b/src/common/windows/http_upload.cc
@@ -36,6 +36,8 @@
#include <fstream>
+#include "common/windows/string_utils-inl.h"
+
#include "common/windows/http_upload.h"
namespace google_airbag {
@@ -166,7 +168,8 @@ wstring HTTPUpload::GenerateMultipartBoundary() {
int r1 = rand();
wchar_t temp[kBoundaryLength];
- swprintf_s(temp, kBoundaryLength, L"%s%08X%08X", kBoundaryPrefix, r0, r1);
+ WindowsStringUtils::safe_swprintf(temp, kBoundaryLength, L"%s%08X%08X",
+ kBoundaryPrefix, r0, r1);
return wstring(temp);
}
@@ -232,8 +235,16 @@ bool HTTPUpload::GenerateRequestBody(const map<wstring, wstring> &parameters,
// static
void HTTPUpload::GetFileContents(const wstring &filename,
vector<char> *contents) {
+ // The "open" method on pre-MSVC8 ifstream implementations doesn't accept a
+ // 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
ifstream file;
file.open(filename.c_str(), ios::binary);
+#else // _MSC_VER >= 1400
+ ifstream file(_wfopen(filename.c_str(), L"rb"));
+#endif // _MSC_VER >= 1400
if (file.is_open()) {
file.seekg(0, ios::end);
int length = file.tellg();