LEFT | RIGHT |
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-2016 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 * |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 void Trace::ErrorCode(DWORD errorCode, const std::string& description, Trace::Lo
cation location) | 464 void Trace::ErrorCode(DWORD errorCode, const std::string& description, Trace::Lo
cation location) |
465 { | 465 { |
466 LogQueue::Insert(LogEntry(new LogTextErrorCode(errorCode, description), locati
on)); | 466 LogQueue::Insert(LogEntry(new LogTextErrorCode(errorCode, description), locati
on)); |
467 } | 467 } |
468 | 468 |
469 void Trace::TextFixed(const std::string& description, Trace::Location location) | 469 void Trace::TextFixed(const std::string& description, Trace::Location location) |
470 { | 470 { |
471 LogQueue::Insert(LogEntry(new LogTextFixed(description), location)); | 471 LogQueue::Insert(LogEntry(new LogTextFixed(description), location)); |
472 } | 472 } |
| 473 |
| 474 namespace |
| 475 { |
| 476 /* |
| 477 * To convert a pointer to a hexadecimal number, we need an integral type that
has the same size as that of the pointer. |
| 478 */ |
| 479 #if defined(_WIN64) |
| 480 typedef uint64_t voidIntegral; |
| 481 static_assert(sizeof(void*)==sizeof(voidIntegral),"WIN64: sizeof(uint64_t) is
not the same as sizeof(void*)"); |
| 482 #elif defined(_WIN32) |
| 483 typedef uint32_t voidIntegral; |
| 484 static_assert(sizeof(void*)==sizeof(voidIntegral),"WIN32: sizeof(uint32_t) is
not the same as sizeof(void*)"); |
| 485 #else |
| 486 #error Must compile with either _WIN32 or _WIN64 |
| 487 #endif |
| 488 } |
| 489 |
| 490 std::wstring ToHexLiteral(void const* p) |
| 491 { |
| 492 std::wstringstream ss; |
| 493 ss << L"0x"; |
| 494 ss.width(sizeof(p) * 2); |
| 495 ss.fill(L'0'); |
| 496 ss << std::hex << reinterpret_cast<voidIntegral>(p); |
| 497 return ss.str(); |
| 498 } |
LEFT | RIGHT |