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

Side by Side Diff: src/plugin/PluginClientBase.cpp

Issue 4912420225024000: Issue #1234 - Convert strings associated with URL's (Closed)
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:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
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 } 40 }
41 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 }
59
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)
68 { 50 {
69 url = std::wstring(result.get(), result_length); 51 url = std::wstring(result.get(), result_length);
(...skipping 66 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 }
OLDNEW

Powered by Google App Engine
This is Rietveld