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

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
« no previous file with comments | « 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 return ((errno == 0) && (endptr != str) && (*endptr == 0));
203 if (negative_value) {
204 *value = -(*value);
205 }
206 return true;
207 }
208 return false;
209 } 205 }
210 206
211 207
212 void OS::PrintErr(const char* format, ...) { 208 void OS::PrintErr(const char* format, ...) {
213 va_list args; 209 va_list args;
214 va_start(args, format); 210 va_start(args, format);
215 VFPrint(stderr, format, args); 211 VFPrint(stderr, format, args);
216 va_end(args); 212 va_end(args);
217 } 213 }
218 214
(...skipping 17 matching lines...) Expand all
236 void OS::Abort() { 232 void OS::Abort() {
237 abort(); 233 abort();
238 } 234 }
239 235
240 236
241 void OS::Exit(int code) { 237 void OS::Exit(int code) {
242 exit(code); 238 exit(code);
243 } 239 }
244 240
245 } // namespace dart 241 } // namespace dart
OLDNEW
« no previous file with comments | « vm/os_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698