Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | |
|
titzer
2016/05/12 08:29:14
I think we should put this in src/base, since it's
Clemens Hammacher
2016/05/12 11:21:41
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef V8_WASM_UNICODE_H_ | |
| 6 #define V8_WASM_UNICODE_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 // UTF8 validation is currently only needed for WASM, so we add this utility | |
| 11 // here. | |
| 12 | |
| 13 namespace v8 { | |
| 14 namespace internal { | |
| 15 namespace wasm { | |
| 16 | |
| 17 // Check if byte buffer contains a valid UTF8-encoded string. | |
| 18 // Returns true if multi-byte decoding succeeded and all decoded characters are | |
| 19 // valid character codepoints. Returns false otherwise. | |
| 20 bool IsValidUtf8(const uint8_t *buf, int32_t len); | |
| 21 | |
| 22 } // namespace wasm | |
| 23 } // namespace internal | |
| 24 } // namespace v8 | |
| 25 | |
| 26 #endif // V8_WASM_UNICODE_H_ | |
| OLD | NEW |