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

Side by Side Diff: runtime/bin/crypto_win.cc

Issue 619723004: Fix following compiler warnings: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/file_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef _CRT_RAND_S
5 #define _CRT_RAND_S 6 #define _CRT_RAND_S
7 #endif
6 8
7 #include "platform/globals.h" 9 #include "platform/globals.h"
8 #if defined(TARGET_OS_WINDOWS) 10 #if defined(TARGET_OS_WINDOWS)
9 11
10 #include "bin/crypto.h" 12 #include "bin/crypto.h"
11 13
12 14
13 namespace dart { 15 namespace dart {
14 namespace bin { 16 namespace bin {
15 17
16 bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) { 18 bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
17 uint32_t num; 19 uint32_t num;
18 intptr_t read = 0; 20 intptr_t read = 0;
19 while (read < count) { 21 while (read < count) {
20 if (rand_s(&num) != 0) { 22 if (rand_s(&num) != 0) {
21 return false; 23 return false;
22 } 24 }
23 for (int i = 0; i < 4 && read < count; i++) { 25 for (int i = 0; i < 4 && read < count; i++) {
24 buffer[read] = num >> (i * 8); 26 buffer[read] = num >> (i * 8);
25 read++; 27 read++;
26 } 28 }
27 } 29 }
28 return true; 30 return true;
29 } 31 }
30 32
31 } // namespace bin 33 } // namespace bin
32 } // namespace dart 34 } // namespace dart
33 35
34 #endif // defined(TARGET_OS_WINDOWS) 36 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698