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

Side by Side Diff: utils/archive/messaging.h

Issue 10832116: Attach the native entry struct to the ArchiveEntry object. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix the ISO9660 constant Created 8 years, 4 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 | « utils/archive/input_stream.dart ('k') | utils/archive/messaging.c » ('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 DART_ARCHIVE_MESSAGING_H_ 5 #ifndef DART_ARCHIVE_MESSAGING_H_
6 #define DART_ARCHIVE_MESSAGING_H_ 6 #define DART_ARCHIVE_MESSAGING_H_
7 7
8 #include "dart_archive.h" 8 #include "dart_archive.h"
9 9
10 /** 10 /**
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 /** 44 /**
45 * Checks [error], the return code of a libarchive call for error conditions, 45 * Checks [error], the return code of a libarchive call for error conditions,
46 * and sends an appropriate error response if any are detected. 46 * and sends an appropriate error response if any are detected.
47 * 47 *
48 * Returns `true` if an error is detected and the containing function should 48 * Returns `true` if an error is detected and the containing function should
49 * short-circuit. 49 * short-circuit.
50 */ 50 */
51 bool checkError(Dart_Port p, struct archive* a, int result); 51 bool checkError(Dart_Port p, struct archive* a, int result);
52 52
53 /** 53 /**
54 * Sends an error response if [pointer] is invalid. [name] is the name of the
55 * object being allocated, for error reporting.
56 *
57 * Returns `true` if an error is detected and the containing function should
58 * short-circuit.
59 */
60 bool checkPointerError(Dart_Port p, void* pointer, char* name);
61
62 /**
54 * Like [checkError], but sends a success message with no attached data if no 63 * Like [checkError], but sends a success message with no attached data if no
55 * error is detected. No further responses should be sent after calling this. 64 * error is detected. No further responses should be sent after calling this.
56 */ 65 */
57 void checkResult(Dart_Port p, struct archive* a, int result); 66 void checkResult(Dart_Port p, struct archive* a, int result);
58 67
59 /** 68 /**
69 * Like [checkPointerError], but sends a success message with the pointer as a
70 * Dart integer if no error is detected. No further responses should be sent
71 * after calling this.
72 */
73 void checkPointerResult(Dart_Port p, void* pointer, char* name);
74
75 /**
60 * Checks that [object] is of the expected type [type]. If not, sends an 76 * Checks that [object] is of the expected type [type]. If not, sends an
61 * appropriate error response. 77 * appropriate error response.
62 * 78 *
63 * Returns `true` if a type error is detected and the containing function should 79 * Returns `true` if a type error is detected and the containing function should
64 * short-circuit. 80 * short-circuit.
65 */ 81 */
66 bool checkType(Dart_Port p, Dart_CObject* object, enum Type type); 82 bool checkType(Dart_Port p, Dart_CObject* object, enum Type type);
67 83
68 /** 84 /**
69 * Gets the [i]th argument from [request], which should be the Dart object 85 * Gets the [i]th argument from [request], which should be the Dart object
(...skipping 14 matching lines...) Expand all
84 * of the argument. 100 * of the argument.
85 */ 101 */
86 Dart_CObject* getIntArgument(Dart_Port p, Dart_CObject* request, int i); 102 Dart_CObject* getIntArgument(Dart_Port p, Dart_CObject* request, int i);
87 103
88 /** 104 /**
89 * Gets the integer value of [object], which should be an `int32` or an `int64`. 105 * Gets the integer value of [object], which should be an `int32` or an `int64`.
90 * Note that this does not validate the type of its argument. 106 * Note that this does not validate the type of its argument.
91 */ 107 */
92 int64_t getInteger(Dart_CObject* object); 108 int64_t getInteger(Dart_CObject* object);
93 109
110 /**
111 * Like [getArgument], but also ensures that the argument is a string or null.
112 * [getNullableString] should be used to extract the actual value of the
113 * argument.
114 */
115 Dart_CObject* getNullableStringArgument(Dart_Port p, Dart_CObject* request,
116 int i);
117
118 /**
119 * Gets the string value of [object] or `NULL` if it's null. Note that this does
120 * not validate the type of its argument.
121 */
122 char* getNullableString(Dart_CObject* object);
123
94 /** Declares a null [Dart_CObject] named [name]. */ 124 /** Declares a null [Dart_CObject] named [name]. */
95 #define DART_NULL(name) \ 125 #define DART_NULL(name) \
96 Dart_CObject name; \ 126 Dart_CObject name; \
97 name.type = kNull; 127 name.type = kNull;
98 128
99 /** 129 /**
100 * Declares a [Dart_CObject] bool named [name] with value [val]. 130 * Declares a [Dart_CObject] bool named [name] with value [val].
101 * 131 *
102 * [val] should be a C boolean. 132 * [val] should be a C boolean.
103 */ 133 */
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 #define DART_STRING(name, val) \ 174 #define DART_STRING(name, val) \
145 Dart_CObject name; \ 175 Dart_CObject name; \
146 if (val == NULL) { \ 176 if (val == NULL) { \
147 name.type = kNull; \ 177 name.type = kNull; \
148 } else { \ 178 } else { \
149 name.type = kString; \ 179 name.type = kString; \
150 name.value.as_string = val; \ 180 name.value.as_string = val; \
151 } 181 }
152 182
153 #endif // DART_ARCHIVE_MESSAGING_H_ 183 #endif // DART_ARCHIVE_MESSAGING_H_
OLDNEW
« no previous file with comments | « utils/archive/input_stream.dart ('k') | utils/archive/messaging.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698