Revision 36cf20f5

View differences:

libavformat/rmdec.c
22 22
#include "rm.h"
23 23
#include "avstring.h"
24 24

  
25
static void get_str(ByteIOContext *pb, char *buf, int buf_size)
25
static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len)
26 26
{
27
    int len, i;
27
    int i;
28 28
    char *q, r;
29 29

  
30
    len = get_be16(pb);
31 30
    q = buf;
32 31
    for(i=0;i<len;i++) {
33 32
        r = get_byte(pb);
......
37 36
    if (buf_size > 0) *q = '\0';
38 37
}
39 38

  
40
static void get_str8(ByteIOContext *pb, char *buf, int buf_size)
39
static void get_str16(ByteIOContext *pb, char *buf, int buf_size)
41 40
{
42
    int len, i;
43
    char *q, r;
41
    get_strl(pb, buf, buf_size, get_be16(pb));
42
}
44 43

  
45
    len = get_byte(pb);
46
    q = buf;
47
    for(i=0;i<len;i++) {
48
        r = get_byte(pb);
49
        if (i < buf_size - 1)
50
            *q++ = r;
51
    }
52
    if (buf_size > 0) *q = '\0';
44
static void get_str8(ByteIOContext *pb, char *buf, int buf_size)
45
{
46
    get_strl(pb, buf, buf_size, get_byte(pb));
53 47
}
54 48

  
55 49
static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
......
263 257
            flags = get_be16(pb); /* flags */
264 258
            break;
265 259
        case MKTAG('C', 'O', 'N', 'T'):
266
            get_str(pb, s->title, sizeof(s->title));
267
            get_str(pb, s->author, sizeof(s->author));
268
            get_str(pb, s->copyright, sizeof(s->copyright));
269
            get_str(pb, s->comment, sizeof(s->comment));
260
            get_str16(pb, s->title, sizeof(s->title));
261
            get_str16(pb, s->author, sizeof(s->author));
262
            get_str16(pb, s->copyright, sizeof(s->copyright));
263
            get_str16(pb, s->comment, sizeof(s->comment));
270 264
            break;
271 265
        case MKTAG('M', 'D', 'P', 'R'):
272 266
            st = av_new_stream(s, 0);

Also available in: Unified diff