| Left: | ||
| Right: |
| 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-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 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 } | 257 } |
| 258 | 258 |
| 259 #endif // ENABLE_DEBUG_RESULT_IGNORED | 259 #endif // ENABLE_DEBUG_RESULT_IGNORED |
| 260 | 260 |
| 261 namespace | 261 namespace |
| 262 { | 262 { |
| 263 /* | 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. | 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 */ | 265 */ |
| 266 #if defined(_WIN64) | 266 #if defined(_WIN64) |
| 267 typedef uint64_t voidIntegral; | 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*)"); | 268 static_assert(sizeof(void*)==sizeof(voidIntegral),"WIN64: sizeof(uint64_t) 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) | 269 #elif defined(_WIN32) |
| 270 typedef uint32_t voidIntegral; | 270 typedef uint32_t voidIntegral; |
| 271 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*)"); |
| 272 #else | 272 #else |
| 273 #error Must compile with either _WIN32 or _WIN64 | 273 #error Must compile with either _WIN32 or _WIN64 |
| 274 #endif | 274 #endif |
| 275 } | 275 } |
| 276 | 276 |
| 277 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
| |
| 278 { | 278 { |
| 279 std::wstringstream ss; | 279 std::wstringstream ss; |
| 280 ss << L"0x"; | 280 ss << L"0x"; |
| 281 ss.width(sizeof(p) * 2); | 281 ss.width(sizeof(p) * 2); |
| 282 ss.fill(L'0'); | 282 ss.fill(L'0'); |
| 283 ss << std::hex << reinterpret_cast<voidIntegral>(p); | 283 ss << std::hex << reinterpret_cast<voidIntegral>(p); |
| 284 return ss.str(); | 284 return ss.str(); |
| 285 } | 285 } |
| LEFT | RIGHT |