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

Unified Diff: src/shared/Utils.cpp

Issue 29351560: Issue 4395 - Setting page is loaded non-populated on some systems
Patch Set: Don't use UrlEscape and just compare unescaped canonical URLs Created Sept. 8, 2016, 2:48 a.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/shared/Utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/shared/Utils.cpp
===================================================================
--- a/src/shared/Utils.cpp
+++ b/src/shared/Utils.cpp
@@ -22,6 +22,7 @@
#include <Windows.h>
#include <ShlObj.h>
#include <Shlwapi.h>
+#include <WinInet.h>
#include "Utils.h"
@@ -208,21 +209,11 @@
std::wstring CanonicalizeUrl(const std::wstring& url)
{
- std::wstring urlCanonicalized;
- urlCanonicalized.resize(url.length() * 2);
- DWORD urlSize = urlCanonicalized.length();
- UrlCanonicalizeW(url.c_str(), &urlCanonicalized[0], &urlSize, 0);
- urlCanonicalized.resize(urlSize);
- return urlCanonicalized;
+ std::wstring urlCanonical;
+ DWORD urlSize = INTERNET_MAX_URL_LENGTH;
+ urlCanonical.resize(urlSize);
+ if ((UrlCanonicalizeW(url.c_str(), &urlCanonical[0], &urlSize, URL_UNESCAPE) != S_OK) || (urlSize <= 0))
+ return L"";
+ urlCanonical.resize(urlSize);
+ return urlCanonical;
}
-
-std::wstring EscapeUrl(const std::wstring& url)
-{
- std::wstring urlEscaped;
- urlEscaped.resize(url.length() * 2);
- DWORD urlSize = urlEscaped.length();
- UrlEscapeW(url.c_str(), &urlEscaped[0], &urlSize, 0);
- urlEscaped.resize(urlSize);
- return urlEscaped;
-}
-
« no previous file with comments | « src/shared/Utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld