| 48 | } |
| 49 | |
| 50 | inline std::size_t JSONStringCopyCheckUtf8C(uint8_t* dst, uint8_t const* src, std::size_t limit) { |
| 51 | // Copy up to limit uint8_t from src to dst. |
| 52 | // Stop at the first control character or backslash or double quote. |
| 53 | // Also stop at byte with high bit set. |
| 54 | // Report the number of bytes copied. May copy less bytes, for example |
| 55 | // for alignment reasons. |
| 56 | uint8_t const* end = src + limit; |
| 57 | while (src < end && *src >= 32 && *src != '\\' && *src != '"' && |
| 58 | *src < 0x80) { |
| 59 | *dst++ = *src++; |
| 60 | } |
| 61 | return limit - (end - src); |
| 62 | } |
| 63 | |
| 64 | inline std::size_t JSONSkipWhiteSpaceC(uint8_t const* src, std::size_t limit) { |
| 65 | // Skip up to limit uint8_t from src as long as they are whitespace. |
no outgoing calls
no test coverage detected