| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 /* | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | |
| 4 * | |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | |
| 6 * it under the terms of the GNU General Public License version 3 as | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 */ | |
| 17 | |
| 1 #include "PluginStdAfx.h" | 18 #include "PluginStdAfx.h" |
| 2 #include <algorithm> | 19 #include <algorithm> |
| 3 #include <stdexcept> | 20 #include <stdexcept> |
| 4 #include <vector> | 21 #include <vector> |
| 5 | 22 |
| 6 #include "../shared/Utils.h" | 23 #include "../shared/Utils.h" |
| 7 #include "PluginUtil.h" | 24 #include "PluginUtil.h" |
| 8 #include "PluginSettings.h" | 25 #include "PluginSettings.h" |
| 9 | 26 |
| 10 std::wstring HtmlFolderPath() | 27 std::wstring HtmlFolderPath() |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 | 41 |
| 25 std::wstring FileUrl(const std::wstring& path) | 42 std::wstring FileUrl(const std::wstring& path) |
| 26 { | 43 { |
| 27 std::wstring url = path; | 44 std::wstring url = path; |
| 28 std::replace(url.begin(), url.end(), L'\\', L'/'); | 45 std::replace(url.begin(), url.end(), L'\\', L'/'); |
| 29 return L"file:///" + url; | 46 return L"file:///" + url; |
| 30 } | 47 } |
| 31 | 48 |
| 32 std::wstring GetLocationUrl(IWebBrowser2& browser) | 49 std::wstring GetLocationUrl(IWebBrowser2& browser) |
| 33 { | 50 { |
| 34 std::wstring retValue; | |
|
Eric
2015/01/13 17:04:20
Use of this variable requires extraneous assignmen
sergei
2015/01/29 12:42:11
I've changed the body of this function and removed
| |
| 35 ATL::CComBSTR locationUrl; | 51 ATL::CComBSTR locationUrl; |
| 36 if (SUCCEEDED(browser.get_LocationURL(&locationUrl)) && !!locationUrl) | 52 if (FAILED(browser.get_LocationURL(&locationUrl)) || !locationUrl) |
|
Eric
2015/01/13 17:04:20
No need for double negation. Testing a converted p
| |
| 37 { | 53 { |
| 38 retValue.assign(locationUrl, locationUrl.Length()); | 54 return std::wstring(); |
|
Eric
2015/01/13 17:04:20
return std::wstring(locationUrl, locationUrl.Lengt
| |
| 39 } | 55 } |
| 40 return retValue; | 56 return std::wstring(locationUrl, locationUrl.Length()); |
|
Eric
2015/01/13 17:04:20
return L"";
-- or --
return std:;wstring();
| |
| 41 } | 57 } |
| LEFT | RIGHT |