Revision f9d6b13a libavformat/aviobuf.c

View differences:

libavformat/aviobuf.c
602 602
    return i;
603 603
}
604 604

  
605
#define GET_STR16(type, read) \
606
    int avio_get_str16 ##type(ByteIOContext *pb, int maxlen, char *buf, int buflen)\
607
{\
608
    char* q = buf;\
609
    int ret = 0;\
610
    while (ret + 1 < maxlen) {\
611
        uint8_t tmp;\
612
        uint32_t ch;\
613
        GET_UTF16(ch, (ret += 2) <= maxlen ? read(pb) : 0, break;)\
614
        if (!ch)\
615
            break;\
616
        PUT_UTF8(ch, tmp, if (q - buf < buflen - 1) *q++ = tmp;)\
617
    }\
618
    *q = 0;\
619
    return ret;\
620
}\
621

  
622
GET_STR16(le, get_le16)
623
GET_STR16(be, get_be16)
624

  
625
#undef GET_STR16
626

  
605 627
uint64_t get_be64(ByteIOContext *s)
606 628
{
607 629
    uint64_t val;

Also available in: Unified diff