Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: webrtc/base/helpers.cc

Issue 1186093004: Define uint64 and int64 using long long. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/basictypes_unittest.cc ('k') | webrtc/base/nssidentity.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/base/helpers.h" 11 #include "webrtc/base/helpers.h"
12 12
13 #include <limits> 13 #include <limits>
14 14
15 #if defined(FEATURE_ENABLE_SSL) 15 #if defined(FEATURE_ENABLE_SSL)
16 #include "webrtc/base/sslconfig.h" 16 #include "webrtc/base/sslconfig.h"
17 #if defined(SSL_USE_OPENSSL) 17 #if defined(SSL_USE_OPENSSL)
18 #include <openssl/rand.h> 18 #include <openssl/rand.h>
19 #elif defined(SSL_USE_NSS_RNG) 19 #elif defined(SSL_USE_NSS_RNG)
20 // Hack: Define+undefine int64 and uint64 to avoid typedef conflict with NSS.
21 // TODO(kjellander): Remove when webrtc:4497 is completed.
22 #define uint64 foo_uint64
23 #define int64 foo_int64
20 #include "pk11func.h" 24 #include "pk11func.h"
25 #undef uint64
26 #undef int64
21 #else 27 #else
22 #if defined(WEBRTC_WIN) 28 #if defined(WEBRTC_WIN)
23 #define WIN32_LEAN_AND_MEAN 29 #define WIN32_LEAN_AND_MEAN
24 #include <windows.h> 30 #include <windows.h>
25 #include <ntsecapi.h> 31 #include <ntsecapi.h>
26 #endif // WEBRTC_WIN 32 #endif // WEBRTC_WIN
27 #endif // else 33 #endif // else
28 #endif // FEATURE_ENABLED_SSL 34 #endif // FEATURE_ENABLED_SSL
29 35
30 #include "webrtc/base/base64.h" 36 #include "webrtc/base/base64.h"
31 #include "webrtc/base/basictypes.h" 37 #include "webrtc/base/basictypes.h"
32 #include "webrtc/base/logging.h" 38 #include "webrtc/base/logging.h"
33 #include "webrtc/base/scoped_ptr.h" 39 #include "webrtc/base/scoped_ptr.h"
34 #include "webrtc/base/timeutils.h" 40 #include "webrtc/base/timeutils.h"
35 41
36 // Protect against max macro inclusion. 42 // Protect against max macro inclusion.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bytes[i] = static_cast<char>(rand()); 140 bytes[i] = static_cast<char>(rand());
135 } 141 }
136 return true; 142 return true;
137 } 143 }
138 }; 144 };
139 145
140 #else 146 #else
141 147
142 #error No SSL implementation has been selected! 148 #error No SSL implementation has been selected!
143 149
144 #endif // WEBRTC_WIN 150 #endif // WEBRTC_WIN
145 #endif 151 #endif
146 152
147 // A test random generator, for predictable output. 153 // A test random generator, for predictable output.
148 class TestRandomGenerator : public RandomGenerator { 154 class TestRandomGenerator : public RandomGenerator {
149 public: 155 public:
150 TestRandomGenerator() : seed_(7) { 156 TestRandomGenerator() : seed_(7) {
151 } 157 }
152 ~TestRandomGenerator() override { 158 ~TestRandomGenerator() override {
153 } 159 }
154 bool Init(const void* seed, size_t len) override { return true; } 160 bool Init(const void* seed, size_t len) override { return true; }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } while (id == 0); 268 } while (id == 0);
263 return id; 269 return id;
264 } 270 }
265 271
266 double CreateRandomDouble() { 272 double CreateRandomDouble() {
267 return CreateRandomId() / (std::numeric_limits<uint32>::max() + 273 return CreateRandomId() / (std::numeric_limits<uint32>::max() +
268 std::numeric_limits<double>::epsilon()); 274 std::numeric_limits<double>::epsilon());
269 } 275 }
270 276
271 } // namespace rtc 277 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/basictypes_unittest.cc ('k') | webrtc/base/nssidentity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698