GNOME Bugzilla – Bug 369366
MacOSX printf fixes for CVS
Last modified: 2006-11-02 20:53:55 UTC
Please describe the problem: Gstreamer CVS HEAD fails to build on Mac OS/X 10.4.8 PPC using gcc 4.0.1. This is due to printf-ing 'sizeof' parameters using %d instead of %ld. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information: The warnings were gone after I made the following changes. These may not be the best or work for all platforms, but nevertheless, here they are: Index: plugins/elements/gstfilesink.c =================================================================== RCS file: /cvs/gstreamer/gstreamer/plugins/elements/gstfilesink.c,v retrieving revision 1.80 diff -r1.80 gstfilesink.c 143c143 < GST_LOG ("No large file support, sizeof (off_t) = %u", sizeof (off_t)); --- > GST_LOG ("No large file support, sizeof (off_t) = %lu", sizeof (off_t)); Index: plugins/elements/gstfilesrc.c =================================================================== RCS file: /cvs/gstreamer/gstreamer/plugins/elements/gstfilesrc.c,v retrieving revision 1.141 diff -r1.141 gstfilesrc.c 263c263 < GST_LOG ("No large file support, sizeof (off_t) = %u!", sizeof (off_t)); --- > GST_LOG ("No large file support, sizeof (off_t) = %lu!", sizeof (off_t)); 655c655 < "read buf %llu+%d lives in current mapbuf %lld+%d, creating subbuffer of mapbuf", --- > "read buf %llu+%d lives in current mapbuf %lld+%ld, creating subbuffer of mapbuf", 710c710 < "read buf %llu+%d in new mapbuf at %llu+%d, mapping and subbuffering", --- > "read buf %llu+%ld in new mapbuf at %llu+%ld, mapping and subbuffering", 719c719 < readsize, (int) mapsize); --- > (int)readsize, (int) mapsize);
Thanks, should be fixed now: 2006-11-02 Tim-Philipp Müller <tim at centricular dot net> Based on patch by: Jan David Mol <j.j.d.mol at tudelft nl> * plugins/elements/gstfilesink.c: (gst_file_sink_class_init): * plugins/elements/gstfilesrc.c: (gst_file_src_class_init), (gst_file_src_map_small_region), (gst_file_src_create_mmap): Printf fixes for gsize parameters (#369366). Also, don't cast to long long for portability reasons, but use GLib's types instead. Did it a bit differently, do let me know if I missed something.
Some are fixed, but I still get warnings: gstfilesrc.c: In function 'gst_file_src_create_mmap': gstfilesrc.c:708: warning: format '%d' expects type 'int', but argument 9 has type 'size_t' gstfilesrc.c:708: warning: format '%d' expects type 'int', but argument 11 has type 'size_t' gstfilesrc.c:717: warning: format '%08x' expects type 'unsigned int', but argument 8 has type 'size_t' Having peeked at your changes, the following seems appropriate: Index: ./plugins/elements/gstfilesrc.c =================================================================== RCS file: /cvs/gstreamer/gstreamer/plugins/elements/gstfilesrc.c,v retrieving revision 1.142 diff -r1.142 gstfilesrc.c 709c709 < "read buf %llu+%d in new mapbuf at %llu+%d, mapping and subbuffering", --- > "read buf %llu+%" G_GSIZE_FORMAT " in new mapbuf at %llu+%" G_GSIZE_FORMAT ", mapping and subbuffering", 717c717 < GST_LOG_OBJECT (src, "readsize smaller then mapsize %08x %d", --- > GST_LOG_OBJECT (src, "readsize smaller then mapsize %" G_GSIZE_FORMAT " %d",
Thanks, let's try this then: 2006-11-02 Tim-Philipp Müller <tim at centricular dot net> * plugins/elements/gstfilesrc.c: (gst_file_src_create_mmap): Printf fixes for PPC/OSX, take two (#369366).