Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/DefaultWebRequestWinInet.cpp

Issue 10459038: Clean up and fix Utils::ToUTF8String() and Utils::ToUTF16String() (Closed)
Patch Set: Created May 14, 2013, 1:54 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/DefaultFileSystem.cpp ('k') | src/Utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/DefaultWebRequestWinInet.cpp
===================================================================
--- a/src/DefaultWebRequestWinInet.cpp
+++ b/src/DefaultWebRequestWinInet.cpp
@@ -152,18 +152,18 @@ void ParseResponseHeaders(HINTERNET hReq
continue;
}
std::wstring headerNameW = responseHeaders.substr(prevHeaderStart, headerNameEnd - prevHeaderStart);
std::wstring headerValueW = responseHeaders.substr(headerValueStart, nextHeaderNameStart - headerValueStart);
headerNameW = AdblockPlus::Utils::TrimString(headerNameW);
headerValueW = AdblockPlus::Utils::TrimString(headerValueW);
- std::string headerName = AdblockPlus::Utils::ToUTF8String(headerNameW.c_str(), headerNameW.length());
- std::string headerValue = AdblockPlus::Utils::ToUTF8String(headerValueW.c_str(), headerValueW.length());
+ std::string headerName = AdblockPlus::Utils::ToUTF8String(headerNameW.c_str());
+ std::string headerValue = AdblockPlus::Utils::ToUTF8String(headerValueW.c_str());
std::transform(headerName.begin(), headerName.end(), headerName.begin(), ::tolower);
std::transform(headerValue.begin(), headerValue.end(), headerValue.begin(), ::tolower);
result->responseHeaders.push_back(
std::pair<std::string, std::string>(headerName, headerValue));
nextHeaderNameStart++;
@@ -191,25 +191,25 @@ AdblockPlus::ServerResponse AdblockPlus:
{
AdblockPlus::ServerResponse result;
result.status = NS_ERROR_FAILURE;
result.responseStatus = 0;
HRESULT hr;
BOOL res;
- std::wstring canonizedUrl = Utils::CanonizeUrl(Utils::ToUTF16String(url, url.length()));
+ std::wstring canonizedUrl = Utils::CanonizeUrl(Utils::ToUTF16String(url));
std::string headersString = "";
for (int i = 0; i < requestHeaders.size(); i++)
{
headersString += requestHeaders[i].first + ": ";
headersString += requestHeaders[i].second + ";";
}
- std::wstring headers = Utils::ToUTF16String(headersString, headersString.length());
+ std::wstring headers = Utils::ToUTF16String(headersString);
LPSTR outBuffer;
DWORD downloadSize, downloaded;
WinHttpHandle hSession(0), hConnect(0), hRequest(0);
// Use WinHttpOpen to obtain a session handle.
std::wstring proxyName, proxyBypass;
« no previous file with comments | « src/DefaultFileSystem.cpp ('k') | src/Utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld