| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright 2010 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "native_client/src/shared/platform/nacl_check.h" | 9 #include "native_client/src/shared/platform/nacl_check.h" |
| 10 #include "native_client/src/trusted/plugin/srpc/string_encoding.h" | 10 #include "native_client/src/trusted/plugin/string_encoding.h" |
| 11 | 11 |
| 12 | 12 |
| 13 int main() { | 13 int main() { |
| 14 const char* input; | 14 const char* input; |
| 15 char* output; | 15 char* output; |
| 16 size_t output_size; | 16 size_t output_size; |
| 17 | 17 |
| 18 // Valid input. | 18 // Valid input. |
| 19 | 19 |
| 20 input = "Hello world, \x80 and \xff"; | 20 input = "Hello world, \x80 and \xff"; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 46 CHECK(!plugin::ByteStringFromUTF8(input, strlen(input), | 46 CHECK(!plugin::ByteStringFromUTF8(input, strlen(input), |
| 47 &output, &output_size)); | 47 &output, &output_size)); |
| 48 // Over long encoding | 48 // Over long encoding |
| 49 // This is a non-canonical encoding for \x00 | 49 // This is a non-canonical encoding for \x00 |
| 50 input = "\xc0\x80"; | 50 input = "\xc0\x80"; |
| 51 CHECK(!plugin::ByteStringFromUTF8(input, strlen(input), | 51 CHECK(!plugin::ByteStringFromUTF8(input, strlen(input), |
| 52 &output, &output_size)); | 52 &output, &output_size)); |
| 53 | 53 |
| 54 return 0; | 54 return 0; |
| 55 } | 55 } |
| OLD | NEW |