OLD | NEW |
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/interfaces/bindings/tests/validation_parser/validation_par
ser.h" | 5 #include "mojo/public/interfaces/bindings/tests/validation_parser/validation_par
ser.h" |
6 | 6 |
| 7 #include <stdlib.h> |
| 8 |
7 #include "mojo/public/cpp/bindings/tests/validation_test_input_parser.h" | 9 #include "mojo/public/cpp/bindings/tests/validation_test_input_parser.h" |
8 | 10 |
9 // C interface for the validation test parser. | 11 // C interface for the validation test parser. |
10 // | 12 // |
11 // This routine malloc()s return error and space for data which | 13 // This routine malloc()s return error and space for data which |
12 // must be freed by the caller. Returns a null pointer in *data | 14 // must be freed by the caller. Returns a null pointer in *data |
13 // and a message in *(return value) on failure. Returns a valid | 15 // and a message in *(return value) on failure. Returns a valid |
14 // pointer and size in *data and *data_len on success, and a | 16 // pointer and size in *data and *data_len on success, and a |
15 // null pointer in *(return value). | 17 // null pointer in *(return value). |
16 extern "C" char* ParseValidationTest(const char* input, // Input | 18 extern "C" char* ParseValidationTest(const char* input, // Input |
(...skipping 25 matching lines...) Expand all Loading... |
42 *data_len = cpp_data_size; | 44 *data_len = cpp_data_size; |
43 // Copy the parsed output into the buffer. | 45 // Copy the parsed output into the buffer. |
44 memcpy(*data, cpp_data.data(), cpp_data_size); | 46 memcpy(*data, cpp_data.data(), cpp_data_size); |
45 } else { | 47 } else { |
46 // If we have no data, set the pointer to null and size to 0. | 48 // If we have no data, set the pointer to null and size to 0. |
47 *data = nullptr; | 49 *data = nullptr; |
48 *data_len = 0; | 50 *data_len = 0; |
49 } | 51 } |
50 return nullptr; | 52 return nullptr; |
51 } | 53 } |
OLD | NEW |