# HG changeset patch # User diego # Date 1185645911 0 # Node ID 8f90908f3c31b906ef63d4138a0cde07d81f58ee # Parent 572f7077ba4076ffbec55985f00c3cd3790a7b5e Merge get_str() and get_str8() functions. patch by Ronald S. Bultje, rsbultje gmail com diff -r 572f7077ba40 -r 8f90908f3c31 rmdec.c --- a/rmdec.c Sat Jul 28 18:02:19 2007 +0000 +++ b/rmdec.c Sat Jul 28 18:05:11 2007 +0000 @@ -22,12 +22,11 @@ #include "rm.h" #include "avstring.h" -static void get_str(ByteIOContext *pb, char *buf, int buf_size) +static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len) { - int len, i; + int i; char *q, r; - len = get_be16(pb); q = buf; for(i=0;i 0) *q = '\0'; } +static void get_str16(ByteIOContext *pb, char *buf, int buf_size) +{ + get_strl(pb, buf, buf_size, get_be16(pb)); +} + static void get_str8(ByteIOContext *pb, char *buf, int buf_size) { - int len, i; - char *q, r; - - len = get_byte(pb); - q = buf; - for(i=0;i 0) *q = '\0'; + get_strl(pb, buf, buf_size, get_byte(pb)); } static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st, @@ -263,10 +257,10 @@ flags = get_be16(pb); /* flags */ break; case MKTAG('C', 'O', 'N', 'T'): - get_str(pb, s->title, sizeof(s->title)); - get_str(pb, s->author, sizeof(s->author)); - get_str(pb, s->copyright, sizeof(s->copyright)); - get_str(pb, s->comment, sizeof(s->comment)); + get_str16(pb, s->title, sizeof(s->title)); + get_str16(pb, s->author, sizeof(s->author)); + get_str16(pb, s->copyright, sizeof(s->copyright)); + get_str16(pb, s->comment, sizeof(s->comment)); break; case MKTAG('M', 'D', 'P', 'R'): st = av_new_stream(s, 0);