[MPlayer-dev-eng] MPlayer-1.0pre6a http streaming seek bug

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Jan 15 17:29:46 CET 2005


Hi,
On Sat, Jan 15, 2005 at 06:29:56AM -0800, Wen-King Su wrote:
> In the file libmpdemux/network.c, there is one place where the format
> code used in a formatted print is wrong.  In function http_send_request,
> 
>     if(pos>0) {
>     // Extend http_send_request with possibility to do partial content retrieval
> 	snprintf(str, 256, "Range: bytes=%d-", pos);
> 	http_set_field(http_hdr, str);
>     }
> 
> The format string "%d" is used to print "pos", which is of type off_t.
> off_t can be 32 bits or 64 bits depending on the compilation environment.
> Perhaps one can use #ifdef to choose between %d and %lld (or %I64d for
> mingw/cygwin).

I'd prefer the attached patch. Comments?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.108
diff -u -r1.108 network.c
--- libmpdemux/network.c	28 Dec 2004 19:59:56 -0000	1.108
+++ libmpdemux/network.c	15 Jan 2005 16:28:54 -0000
@@ -460,7 +460,7 @@
 
 	if(pos>0) { 
 	// Extend http_send_request with possibility to do partial content retrieval
-	    snprintf(str, 256, "Range: bytes=%d-", pos);
+	    snprintf(str, 256, "Range: bytes=%lld-", (long long)pos);
 	    http_set_field(http_hdr, str);
 	}
 	    


More information about the MPlayer-dev-eng mailing list