[FFmpeg-devel] [PATCH] http Transfer-Encoding chunked

Michael Niedermayer michaelni
Mon Jun 1 12:22:03 CEST 2009


On Mon, Jun 01, 2009 at 12:20:03PM +0200, Peter Holik wrote:
> > On Wed, May 27, 2009 at 08:54:37AM +0200, Peter Holik wrote:
> >> > Hi Peter,
> >> >
> >> > On Tue, May 26, 2009 at 3:20 PM, Peter Holik <peter at holik.at> wrote:
> >> >> i used printf with DEBUG like i saw in http.c:
> >> >>
> >> >> process_line
> >> >>
> >> >> #ifdef DEBUG
> >> >> ? ? ? ?printf("http_code=%d\n", s->http_code);
> >> >> #endif
> >> >>
> >> >>
> >> >> http_connect
> >> >>
> >> >> #ifdef DEBUG
> >> >> ? ? ? ? ? ?printf("header='%s'\n", line);
> >> >> #endif
> >> >>
> >> >>
> >> >> why now use av_log?
> >> >
> >> > That's a good catch. These lines of code are rather old, and most
> >> > likely predate the "forbidding" of printf(). They were not converted
> >> > for the simple reason that the compilation doesn't fail because DEBUG
> >> > is, by default, not included in CFLAGS. A separate patch which
> >> > converts them to av_log() at debugging-level would be much
> >> > appreciated. Alternatively, they could also be removed.
> >> >
> >>
> > [...]
> >> +            for(;;) {
> >> +                ch = http_getc(s);
> >> +                if (ch < 0)
> >> +                    return 0;
> >> +                if (ch == '\n') {
> >> +                    /* process chunk size */
> >> +                    if (q > line && q[-1] == '\r')
> >> +                         q--;
> >> +                    *q = '\0';
> >> +                    /* skip CR LF from last chunk */
> >> +                    if (!(*line)) continue;
> >> +
> >> +                    s->chunksize = strtoll(line, NULL, 16);
> >> +
> >> +                    av_log(NULL, AV_LOG_DEBUG, "Chunked encoding data size: %"PRId64"'\n",
> >> s->chunksize);
> >> +
> >> +                    if (!s->chunksize)
> >> +                        return 0;
> >> +                    break;
> >> +                } else
> >> +                    if ((q - line) < sizeof(line) - 1)
> >> +                        *q++ = ch;
> >> +            }
> >
> > looks like code duplication
> 
> looks like, but it is not exactly the same.

can it be factorized?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090601/fcf78a41/attachment.pgp>



More information about the ffmpeg-devel mailing list