| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 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/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 #include "PluginStdAfx.h" | 18 #include "PluginStdAfx.h" |
| 19 #include "PluginDebug.h" | 19 #include "PluginDebug.h" |
| 20 #include "PluginClientBase.h" | 20 #include "PluginClientBase.h" |
| 21 #include "PluginMutex.h" | 21 #include "PluginMutex.h" |
| 22 #include "PluginSettings.h" | 22 #include "PluginSettings.h" |
| 23 #include <cstdint> | |
| 23 | 24 |
| 24 class CPluginDebugLock : public CPluginMutex | 25 class CPluginDebugLock : public CPluginMutex |
| 25 { | 26 { |
| 26 | 27 |
| 27 private: | 28 private: |
| 28 | 29 |
| 29 static CComAutoCriticalSection s_criticalSectionDebugLock; | 30 static CComAutoCriticalSection s_criticalSectionDebugLock; |
| 30 | 31 |
| 31 public: | 32 public: |
| 32 | 33 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 srcTrunc = srcTrunc.Left(67) + L"..." + srcTrunc.Right(30); | 250 srcTrunc = srcTrunc.Left(67) + L"..." + srcTrunc.Right(30); |
| 250 } | 251 } |
| 251 | 252 |
| 252 CString blocking; | 253 CString blocking; |
| 253 blocking.Format(L"Ignored %-12s %s %s", ToCString(type), domain.empty()? L" -" : ToCString(domain), srcTrunc); | 254 blocking.Format(L"Ignored %-12s %s %s", ToCString(type), domain.empty()? L" -" : ToCString(domain), srcTrunc); |
| 254 | 255 |
| 255 DebugResultLegacy(blocking); | 256 DebugResultLegacy(blocking); |
| 256 } | 257 } |
| 257 | 258 |
| 258 #endif // ENABLE_DEBUG_RESULT_IGNORED | 259 #endif // ENABLE_DEBUG_RESULT_IGNORED |
| 260 | |
| 261 namespace | |
| 262 { | |
| 263 /* | |
| 264 * To convert a pointer to a hexadecimal number, we need an integral type that has the same size as that of the pointer. | |
| 265 */ | |
| 266 #if defined(_WIN64) | |
| 267 typedef uint64_t voidIntegral; | |
|
sergei
2015/12/21 11:14:28
What about using of `uintptr_t` but pay attention
Eric
2015/12/21 12:51:59
Already changed it once at your suggestion. We are
sergei
2015/12/21 13:04:47
According to http://en.cppreference.com/w/cpp/lang
Eric
2015/12/21 13:19:59
OK. Great. I didn't say it wouldn't work. I said i
sergei
2015/12/21 13:37:09
Less code less bugs, I think here it's proper plac
| |
| 268 static_assert(sizeof(void*)==sizeof(voidIntegral),"WIN64: sizeof(long long) is not the same as sizeof(void*)"); | |
|
sergei
2015/12/21 11:14:28
Here and below the message string is inconsistent
Eric
2015/12/21 12:51:59
Done.
| |
| 269 #elif defined(_WIN32) | |
| 270 typedef uint32_t voidIntegral; | |
| 271 static_assert(sizeof(void*)==sizeof(voidIntegral),"WIN32: sizeof(long) is not the same as sizeof(void*)"); | |
| 272 #else | |
| 273 #error Must compile with either _WIN32 or _WIN64 | |
| 274 #endif | |
| 275 } | |
| 276 | |
| 277 std::wstring ToHexLiteral(void const* p) | |
| 278 { | |
| 279 std::wstringstream ss; | |
| 280 ss << L"0x"; | |
| 281 ss.width(sizeof(p) * 2); | |
| 282 ss.fill(L'0'); | |
| 283 ss << std::hex << reinterpret_cast<voidIntegral>(p); | |
| 284 return ss.str(); | |
| 285 } | |
| OLD | NEW |