[FFmpeg-devel] [PATCH 3/3] Metadata demuxer.
Anton Khirnov
anton
Sun Dec 26 10:02:57 CET 2010
On Sat, Dec 25, 2010 at 06:39:40PM +0100, Michael Niedermayer wrote:
> On Wed, Dec 15, 2010 at 01:15:14PM +0100, Anton Khirnov wrote:
> [...]
> > +
> > +static int read_tag(uint8_t *line, AVMetadata **m)
> > +{
> > + uint8_t *key, *value, *p = line, *p1, *p2;
> > +
> > + /* find first not escaped '=' */
> > + while (1) {
> > + if (*p == '=')
> > + break;
> > + else if (*p == '\\')
> > + p++;
> > +
> > + if (*p++)
> > + continue;
> > +
> > + return 0;
> > + }
> > +
> > + if (!(key = av_malloc((p - line + 1) * sizeof(*p))))
> > + return AVERROR(ENOMEM);
> > + if (!(value = av_malloc((strlen(p)) * sizeof(*p)))) {
> > + av_free(key);
> > + return AVERROR(ENOMEM);
> > + }
> > +
>
> > + /* unescape key/value */
> > + p1 = key;
> > + p2 = line;
> > + while(p2 < p) {
> > + if (*p2 == '\\')
> > + p2++;
> > + *p1++ = *p2++;
> > + }
> > + *p1 = 0;
> > +
> > + p1 = value;
> > + p2 = p + 1;
> > + while(*p2) {
> > + if (*p2 == '\\')
> > + p2++;
> > + *p1++ = *p2++;
> > + }
> > + *p1 = 0;
>
> duplicate code
fixed
--
Anton Khirnov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Metadata-demuxer.patch
Type: text/x-diff
Size: 7589 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101226/e01d0f6a/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101226/e01d0f6a/attachment.pgp>
More information about the ffmpeg-devel
mailing list