mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2025-12-30 11:14:50 +01:00
Treat warnings as error and fix most level 4 warnings in the breakpad windows client projects.
Some of the lint errors in the files touched by this change were also fixed. BUG=533 Review URL: https://breakpad.appspot.com/601002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1189 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
5bdee65f7a
commit
6b46d4e872
12 changed files with 173 additions and 124 deletions
|
|
@ -140,7 +140,7 @@ string UTF16ToUTF8(const vector<uint16_t> &in, bool swap) {
|
|||
scoped_array<UTF8> target_buffer(new UTF8[target_capacity]);
|
||||
UTF8 *target_ptr = target_buffer.get();
|
||||
UTF8 *target_end_ptr = target_ptr + target_capacity;
|
||||
ConversionResult result = ConvertUTF16toUTF8(&source_ptr, source_end_ptr,
|
||||
ConversionResult result = ConvertUTF16toUTF8(&source_ptr, source_end_ptr,
|
||||
&target_ptr, target_end_ptr,
|
||||
strictConversion);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
// Disable exception handler warnings.
|
||||
#pragma warning( disable : 4530 )
|
||||
#pragma warning(disable:4530)
|
||||
|
||||
#include <fstream>
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ bool HTTPUpload::SendRequest(const wstring &url,
|
|||
fwprintf(stderr, L"Could not unset receive timeout, continuing...\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!HttpSendRequest(request.get(), NULL, 0,
|
||||
const_cast<char *>(request_body.data()),
|
||||
static_cast<DWORD>(request_body.size()))) {
|
||||
|
|
@ -215,8 +215,7 @@ bool HTTPUpload::ReadResponse(HINTERNET request, wstring *response) {
|
|||
BOOL return_code;
|
||||
|
||||
while (((return_code = InternetQueryDataAvailable(request, &bytes_available,
|
||||
0, 0)) != 0) && bytes_available > 0) {
|
||||
|
||||
0, 0)) != 0) && bytes_available > 0) {
|
||||
vector<char> response_buffer(bytes_available);
|
||||
DWORD size_read;
|
||||
|
||||
|
|
@ -323,6 +322,7 @@ bool HTTPUpload::GenerateRequestBody(const map<wstring, wstring> ¶meters,
|
|||
// static
|
||||
bool HTTPUpload::GetFileContents(const wstring &filename,
|
||||
vector<char> *contents) {
|
||||
bool rv = false;
|
||||
// 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
|
||||
|
|
@ -336,15 +336,21 @@ bool HTTPUpload::GetFileContents(const wstring &filename,
|
|||
if (file.is_open()) {
|
||||
file.seekg(0, ios::end);
|
||||
std::streamoff length = file.tellg();
|
||||
contents->resize(length);
|
||||
if (length != 0) {
|
||||
file.seekg(0, ios::beg);
|
||||
file.read(&((*contents)[0]), length);
|
||||
// Check for loss of data when converting lenght from std::streamoff into
|
||||
// std::vector<char>::size_type
|
||||
std::vector<char>::size_type vector_size =
|
||||
static_cast<std::vector<char>::size_type>(length);
|
||||
if (static_cast<std::streamoff>(vector_size) == length) {
|
||||
contents->resize(vector_size);
|
||||
if (length != 0) {
|
||||
file.seekg(0, ios::beg);
|
||||
file.read(&((*contents)[0]), length);
|
||||
}
|
||||
rv = true;
|
||||
}
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue