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

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

Issue 29332020: Noissue - Add tracing function 'ToHexLiteral()' (Closed)
Left Patch Set: Created Dec. 6, 2015, 6:24 p.m.
Right Patch Set: fix error messages Created Dec. 21, 2015, 12:51 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/plugin/PluginDebug.h ('k') | test/plugin/DebugTest.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 257 }
257 258
258 #endif // ENABLE_DEBUG_RESULT_IGNORED 259 #endif // ENABLE_DEBUG_RESULT_IGNORED
259 260
260 namespace 261 namespace
261 { 262 {
262 /* 263 /*
263 * To convert a pointer to a hexadecimal number, we need an integral type that has the same size as that of the pointer. 264 * To convert a pointer to a hexadecimal number, we need an integral type that has the same size as that of the pointer.
264 */ 265 */
265 #if defined(_WIN64) 266 #if defined(_WIN64)
266 typedef long long voidIntegral; 267 typedef uint64_t voidIntegral;
sergei 2015/12/07 11:04:02 what about uint64_t and uint32_t instead of `long
Eric 2015/12/07 13:06:57 Done. Do not, however, ask me to remove the 'stat
267 static_assert(sizeof(void*)==sizeof(voidIntegral),"WIN64: sizeof(long long) is not the same as sizeof(void*)"); 268 static_assert(sizeof(void*)==sizeof(voidIntegral),"WIN64: sizeof(uint64_t) is not the same as sizeof(void*)");
268 #elif defined(_WIN32) 269 #elif defined(_WIN32)
269 typedef long voidIntegral; 270 typedef uint32_t voidIntegral;
270 static_assert(sizeof(void*)==sizeof(voidIntegral),"WIN32: sizeof(long) is not the same as sizeof(void*)"); 271 static_assert(sizeof(void*)==sizeof(voidIntegral),"WIN32: sizeof(uint32_t) is not the same as sizeof(void*)");
271 #else 272 #else
272 #error Must compile with either _WIN32 or _WIN64 273 #error Must compile with either _WIN32 or _WIN64
273 #endif 274 #endif
274 } 275 }
275 276
276 std::wstring ToHexLiteral(void const* p) 277 std::wstring ToHexLiteral(void const* p)
sergei 2016/01/05 10:55:27 How does it happen that in header it's `const void
Eric 2016/01/05 14:38:26 Not using copy-paste, in all likelihood. I really
277 { 278 {
278 std::wstringstream ss; 279 std::wstringstream ss;
279 ss << L"0x"; 280 ss << L"0x";
280 ss.width(sizeof(p) * 2); 281 ss.width(sizeof(p) * 2);
281 ss.fill(L'0'); 282 ss.fill(L'0');
282 ss << std::hex << reinterpret_cast<voidIntegral>(p); 283 ss << std::hex << reinterpret_cast<voidIntegral>(p);
283 return ss.str(); 284 return ss.str();
sergei 2015/12/07 11:04:02 Do we really need it so complicated? It seems `bas
Oleksandr 2015/12/07 12:00:50 Alternatively there's also StringCbPrintf (aka spr
Eric 2015/12/07 13:06:57 I doesn't do the same thing. The formatting is dif
Eric 2015/12/07 13:06:57 It doesn't save code to use a C-style function tha
Eric 2015/12/15 16:31:16 Actual tracing in new review: https://codereview.a
284 } 285 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld