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

Delta Between Two Patch Sets: src/plugin/PluginClientBase.cpp

Issue 4912420225024000: Issue #1234 - Convert strings associated with URL's (Closed)
Left Patch Set: Created Oct. 14, 2014, 10:17 p.m.
Right Patch Set: Created Jan. 5, 2015, 4:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 // Internet / FTP 3 // Internet / FTP
4 #include <wininet.h> 4 #include <wininet.h>
5 5
6 // IP adapter 6 // IP adapter
7 #include <iphlpapi.h> 7 #include <iphlpapi.h>
8 8
9 #include "PluginSettings.h" 9 #include "PluginSettings.h"
10 #include "PluginSystem.h" 10 #include "PluginSystem.h"
(...skipping 19 matching lines...) Expand all
30 bool CPluginClientBase::s_isErrorLogging = false; 30 bool CPluginClientBase::s_isErrorLogging = false;
31 31
32 32
33 CPluginClientBase::CPluginClientBase() 33 CPluginClientBase::CPluginClientBase()
34 { 34 {
35 } 35 }
36 36
37 37
38 CPluginClientBase::~CPluginClientBase() 38 CPluginClientBase::~CPluginClientBase()
39 { 39 {
40 }
41
42
43 CString& CPluginClientBase::UnescapeUrl(CString& url)
44 {
45 CString unescapedUrl;
46 DWORD cb = 2048;
47
48 if (SUCCEEDED(::UrlUnescape(url.GetBuffer(), unescapedUrl.GetBufferSetLength(c b), &cb, 0)))
49 {
50 unescapedUrl.ReleaseBuffer();
51 unescapedUrl.Truncate(cb);
52
53 url.ReleaseBuffer();
54 url = unescapedUrl;
55 }
56
57 return url;
58 } 40 }
59 41
60 void UnescapeUrl(std::wstring& url) 42 void UnescapeUrl(std::wstring& url)
61 { 43 {
62 try 44 try
63 { 45 {
64 DWORD result_length = INTERNET_MAX_URL_LENGTH; 46 DWORD result_length = INTERNET_MAX_URL_LENGTH;
65 std::unique_ptr<wchar_t[]> result(new wchar_t[result_length]); 47 std::unique_ptr<wchar_t[]> result(new wchar_t[result_length]);
66 HRESULT hr = UrlUnescapeW(const_cast<wchar_t*>(url.c_str()), result.get(), & result_length, 0); 48 HRESULT hr = UrlUnescapeW(const_cast<wchar_t*>(url.c_str()), result.get(), & result_length, 0);
67 if (hr == S_OK) 49 if (hr == S_OK)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 118
137 hasError = true; 119 hasError = true;
138 120
139 s_pluginErrors.erase(it); 121 s_pluginErrors.erase(it);
140 } 122 }
141 } 123 }
142 s_criticalSectionLocal.Unlock(); 124 s_criticalSectionLocal.Unlock();
143 125
144 return hasError; 126 return hasError;
145 } 127 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld