OLD | NEW |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 unescapedUrl.ReleaseBuffer(); | 50 unescapedUrl.ReleaseBuffer(); |
51 unescapedUrl.Truncate(cb); | 51 unescapedUrl.Truncate(cb); |
52 | 52 |
53 url.ReleaseBuffer(); | 53 url.ReleaseBuffer(); |
54 url = unescapedUrl; | 54 url = unescapedUrl; |
55 } | 55 } |
56 | 56 |
57 return url; | 57 return url; |
58 } | 58 } |
59 | 59 |
| 60 void UnescapeUrl(std::wstring& url) |
| 61 { |
| 62 try |
| 63 { |
| 64 DWORD result_length = INTERNET_MAX_URL_LENGTH; |
| 65 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); |
| 67 if (hr == S_OK) |
| 68 { |
| 69 url = std::wstring(result.get(), result_length); |
| 70 } |
| 71 /* |
| 72 * Do nothing. This masks error return values from UrlUnescape without loggi
ng the error. |
| 73 */ |
| 74 } |
| 75 catch(std::bad_alloc e) |
| 76 { |
| 77 /* |
| 78 * When the code has a systematic way of handling bad_alloc, we'll rethrow (
probably). |
| 79 * Until then, we mask the exception and make no modification. |
| 80 */ |
| 81 } |
| 82 catch(...) |
| 83 { |
| 84 // no modification if any other exception |
| 85 } |
| 86 } |
60 | 87 |
61 void CPluginClientBase::LogPluginError(DWORD errorCode, int errorId, int errorSu
bid, const CString& description, bool isAsync, DWORD dwProcessId, DWORD dwThread
Id) | 88 void CPluginClientBase::LogPluginError(DWORD errorCode, int errorId, int errorSu
bid, const CString& description, bool isAsync, DWORD dwProcessId, DWORD dwThread
Id) |
62 { | 89 { |
63 // Prevent circular references | 90 // Prevent circular references |
64 if (CPluginSettings::HasInstance() && isAsync) | 91 if (CPluginSettings::HasInstance() && isAsync) |
65 { | 92 { |
66 DEBUG_ERROR_CODE_EX(errorCode, description, dwProcessId, dwThreadId); | 93 DEBUG_ERROR_CODE_EX(errorCode, description, dwProcessId, dwThreadId); |
67 | 94 |
68 CString pluginError; | 95 CString pluginError; |
69 pluginError.Format(L"%2.2d%2.2d", errorId, errorSubid); | 96 pluginError.Format(L"%2.2d%2.2d", errorId, errorSubid); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 136 |
110 hasError = true; | 137 hasError = true; |
111 | 138 |
112 s_pluginErrors.erase(it); | 139 s_pluginErrors.erase(it); |
113 } | 140 } |
114 } | 141 } |
115 s_criticalSectionLocal.Unlock(); | 142 s_criticalSectionLocal.Unlock(); |
116 | 143 |
117 return hasError; | 144 return hasError; |
118 } | 145 } |
OLD | NEW |