MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / utf8_check

Function utf8_check

libavcodec/decode.c:897–914  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

895}
896
897static int utf8_check(const uint8_t *str)
898{
899 const uint8_t *byte;
900 uint32_t codepoint, min;
901
902 while (*str) {
903 byte = str;
904 GET_UTF8(codepoint, *(byte++), return 0;);
905 min = byte - str == 1 ? 0 : byte - str == 2 ? 0x80 :
906 1 << (5 * (byte - str) - 4);
907 if (codepoint < min || codepoint >= 0x110000 ||
908 codepoint == 0xFFFE /* BOM */ ||
909 codepoint >= 0xD800 && codepoint <= 0xDFFF /* surrogates */)
910 return 0;
911 str = byte;
912 }
913 return 1;
914}
915
916int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
917 int *got_sub_ptr, const AVPacket *avpkt)

Callers 1

avcodec_decode_subtitle2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected