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

Side by Side Diff: vm/os_win.cc

Issue 10792019: Address some leftover review comments from previous CL. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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
« vm/os_linux.cc ('K') | « vm/os_macos.cc ('k') | no next file » | 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 #include "vm/os.h" 5 #include "vm/os.h"
6 6
7 #include <time.h> 7 #include <time.h>
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 10
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 // Make sure to zero-terminate the string if the output was 180 // Make sure to zero-terminate the string if the output was
181 // truncated or if there was an error. 181 // truncated or if there was an error.
182 if (written >= size) { 182 if (written >= size) {
183 str[size - 1] = '\0'; 183 str[size - 1] = '\0';
184 } 184 }
185 return written; 185 return written;
186 } 186 }
187 187
188 188
189 bool OS::StringToInteger(const char* str, int64_t* value) { 189 bool OS::StringToInt64(const char* str, int64_t* value) {
190 ASSERT(str != NULL && strlen(str) > 0 && value != NULL); 190 ASSERT(str != NULL && strlen(str) > 0 && value != NULL);
191 bool negative_value = false;
192 int32_t base = 10; 191 int32_t base = 10;
192 char* endptr;
193 int i = 0;
193 if (str[0] == '-') { 194 if (str[0] == '-') {
194 negative_value = true; 195 i = 1;
195 str += 1;
196 } 196 }
197 if ((str[0] == '0') && (str[1] == 'x' || str[1] == 'X') && (str[2] != '\0')) { 197 if ((str[i] == '0') &&
198 (str[i + 1] == 'x' || str[i + 1] == 'X') &&
199 (str[i + 2] != '\0')) {
198 base = 16; 200 base = 16;
199 } 201 }
200 errno = 0; 202 errno = 0;
201 *value = _strtoi64(str, NULL, base); 203 *value = _strtoi64(str, &endptr, base);
202 if (errno == 0) { 204 if (errno != 0 || endptr == str || *endptr != 0) {
203 if (negative_value) { 205 return false;
204 *value = -(*value);
205 }
206 return true;
207 } 206 }
208 return false; 207 return true;
209 } 208 }
210 209
211 210
212 void OS::PrintErr(const char* format, ...) { 211 void OS::PrintErr(const char* format, ...) {
213 va_list args; 212 va_list args;
214 va_start(args, format); 213 va_start(args, format);
215 VFPrint(stderr, format, args); 214 VFPrint(stderr, format, args);
216 va_end(args); 215 va_end(args);
217 } 216 }
218 217
(...skipping 17 matching lines...) Expand all
236 void OS::Abort() { 235 void OS::Abort() {
237 abort(); 236 abort();
238 } 237 }
239 238
240 239
241 void OS::Exit(int code) { 240 void OS::Exit(int code) {
242 exit(code); 241 exit(code);
243 } 242 }
244 243
245 } // namespace dart 244 } // namespace dart
OLDNEW
« vm/os_linux.cc ('K') | « vm/os_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698