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

Side by Side Diff: runtime/bin/utils.h

Issue 9630012: Error reporting on File in dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased and implemented on all platforms Created 8 years, 9 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #ifndef BIN_UTILS_H_
6 #define BIN_UTILS_H_
7
8 #include <stdlib.h>
9 #include <string.h>
10
11 #include "include/dart_api.h"
12 #include "platform/globals.h"
13
14 class OSError {
15 public:
16 OSError();
17 OSError(int code, char* message) {
18 code_ = code;
19 SetMessage(message);
20 }
21 virtual ~OSError() { free(message_); }
22
23 int code() { return code_; }
24 void set_code(int code) { code_ = code; }
25 char* message() { return message_; }
26 void SetMessage(char* message) {
27 free(message_);
28 message_ = NULL;
Mads Ager (google) 2012/03/13 10:56:17 Redundant because of the next line.
Søren Gjesse 2012/03/13 12:39:49 Added NULL check.
29 message_ = strdup(message);
30 }
31
32 private:
33 int code_;
34 char* message_;
35
36 DISALLOW_COPY_AND_ASSIGN(OSError);
37 };
38
39 #endif // BIN_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698