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

Side by Side Diff: mojo/public/c/lib/bindings/array.c

Issue 2232833003: Change the canonical way to include the C bindings headers to <mojo/bindings/*.h>. (Closed) Base URL: https://github.com/domokit/mojo.git@work791_mojo_tests
Patch Set: rebased Created 4 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
« no previous file with comments | « mojo/public/c/include/mojo/bindings/validation.h ('k') | mojo/public/c/lib/bindings/buffer.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/public/c/bindings/array.h" 5 #include <mojo/bindings/array.h>
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <mojo/bindings/buffer.h>
9 #include <mojo/bindings/interface.h>
10 #include <mojo/bindings/internal/type_descriptor.h>
11 #include <mojo/bindings/internal/util.h>
12 #include <mojo/bindings/union.h>
8 #include <stddef.h> 13 #include <stddef.h>
9 #include <stdint.h> 14 #include <stdint.h>
10 #include <string.h> 15 #include <string.h>
11 16
12 #include "mojo/public/c/bindings/buffer.h"
13 #include "mojo/public/c/bindings/interface.h"
14 #include "mojo/public/c/bindings/lib/type_descriptor.h"
15 #include "mojo/public/c/bindings/lib/util.h"
16 #include "mojo/public/c/bindings/union.h"
17
18 struct MojomArrayHeader* MojomArray_New(struct MojomBuffer* buf, 17 struct MojomArrayHeader* MojomArray_New(struct MojomBuffer* buf,
19 uint32_t num_elements, 18 uint32_t num_elements,
20 uint32_t element_byte_size) { 19 uint32_t element_byte_size) {
21 assert(buf); 20 assert(buf);
22 21
23 uint64_t num_bytes = sizeof(struct MojomArrayHeader) + 22 uint64_t num_bytes = sizeof(struct MojomArrayHeader) +
24 (uint64_t)num_elements * element_byte_size; 23 (uint64_t)num_elements * element_byte_size;
25 if (num_bytes > UINT32_MAX) 24 if (num_bytes > UINT32_MAX)
26 return NULL; 25 return NULL;
27 26
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 244
246 if (!MojomType_DispatchDeepCopy(buffer, in_type_desc->elem_type, 245 if (!MojomType_DispatchDeepCopy(buffer, in_type_desc->elem_type,
247 in_type_desc->elem_descriptor, in_elem_data, 246 in_type_desc->elem_descriptor, in_elem_data,
248 out_elem_data)) { 247 out_elem_data)) {
249 return false; 248 return false;
250 } 249 }
251 } 250 }
252 251
253 return true; 252 return true;
254 } 253 }
OLDNEW
« no previous file with comments | « mojo/public/c/include/mojo/bindings/validation.h ('k') | mojo/public/c/lib/bindings/buffer.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698