plugins/elements/: Printf fixes for gsize parameters on PPC/OSX (#369366). Also, don't cast to long long for portabil...

Original commit message from CVS:
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 on PPC/OSX (#369366). Also,
don't cast to long long for portability reasons, but use
GLib's types instead.
This commit is contained in:
Jan David Mol 2006-11-02 13:00:38 +00:00 committed by Tim-Philipp Müller
parent 94fc10847a
commit bd16d69148
3 changed files with 28 additions and 17 deletions

View file

@ -1,3 +1,14 @@
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 on PPC/OSX (#369366). Also,
don't cast to long long for portability reasons, but use
GLib's types instead.
2006-10-30 Michael Smith <msmith@fluendo.com> 2006-10-30 Michael Smith <msmith@fluendo.com>
* plugins/elements/gstfdsrc.c: (gst_fd_src_update_fd): * plugins/elements/gstfdsrc.c: (gst_fd_src_update_fd):

View file

@ -140,7 +140,8 @@ gst_file_sink_class_init (GstFileSinkClass * klass)
gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_file_sink_event); gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_file_sink_event);
if (sizeof (off_t) < 8) { if (sizeof (off_t) < 8) {
GST_LOG ("No large file support, sizeof (off_t) = %u", sizeof (off_t)); GST_LOG ("No large file support, sizeof (off_t) = %" G_GSIZE_FORMAT "!",
sizeof (off_t));
} }
} }

View file

@ -260,7 +260,8 @@ gst_file_src_class_init (GstFileSrcClass * klass)
gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_file_src_create); gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_file_src_create);
if (sizeof (off_t) < 8) { if (sizeof (off_t) < 8) {
GST_LOG ("No large file support, sizeof (off_t) = %u!", sizeof (off_t)); GST_LOG ("No large file support, sizeof (off_t) = %" G_GSIZE_FORMAT "!",
sizeof (off_t));
} }
} }
@ -590,8 +591,8 @@ gst_file_src_map_small_region (GstFileSrc * src, off_t offset, size_t size)
guint pagesize; guint pagesize;
GST_LOG_OBJECT (src, GST_LOG_OBJECT (src,
"attempting to map a small buffer at %llu+%d", "attempting to map a small buffer at %" G_GUINT64_FORMAT "+%d",
(unsigned long long) offset, (gint) size); (guint64) offset, (gint) size);
pagesize = src->pagesize; pagesize = src->pagesize;
@ -607,8 +608,8 @@ gst_file_src_map_small_region (GstFileSrc * src, off_t offset, size_t size)
mapsize = ((size + mod + pagesize - 1) / pagesize) * pagesize; mapsize = ((size + mod + pagesize - 1) / pagesize) * pagesize;
GST_LOG_OBJECT (src, GST_LOG_OBJECT (src,
"not on page boundaries, resizing to map to %llu+%d", "not on page boundaries, resizing to map to %" G_GUINT64_FORMAT "+%d",
(unsigned long long) mapbase, (gint) mapsize); (guint64) mapbase, (gint) mapsize);
map = gst_file_src_map_region (src, mapbase, mapsize, FALSE); map = gst_file_src_map_region (src, mapbase, mapsize, FALSE);
if (map == NULL) if (map == NULL)
@ -651,18 +652,17 @@ gst_file_src_create_mmap (GstFileSrc * src, guint64 offset, guint length,
/* if the end is before the mapend, the buffer is in current mmap region... */ /* if the end is before the mapend, the buffer is in current mmap region... */
/* ('cause by definition if readend is in the buffer, so's readstart) */ /* ('cause by definition if readend is in the buffer, so's readstart) */
if (readend <= mapend) { if (readend <= mapend) {
GST_LOG_OBJECT (src, GST_LOG_OBJECT (src, "read buf %" G_GUINT64_FORMAT "+%u lives in "
"read buf %llu+%d lives in current mapbuf %lld+%d, creating subbuffer of mapbuf", "current mapbuf %u+%u, creating subbuffer of mapbuf",
offset, (int) readsize, mapstart, mapsize); offset, (guint) readsize, (guint) mapstart, (guint) mapsize);
buf = gst_buffer_create_sub (src->mapbuf, offset - mapstart, readsize); buf = gst_buffer_create_sub (src->mapbuf, offset - mapstart, readsize);
GST_BUFFER_OFFSET (buf) = offset; GST_BUFFER_OFFSET (buf) = offset;
/* if the start actually is within the current mmap region, map an overlap buffer */ /* if the start actually is within the current mmap region, map an overlap buffer */
} else if (offset < mapend) { } else if (offset < mapend) {
GST_LOG_OBJECT (src, GST_LOG_OBJECT (src, "read buf %" G_GUINT64_FORMAT "+%u starts in "
"read buf %llu+%d starts in mapbuf %d+%d but ends outside, creating new mmap", "mapbuf %u+%u but ends outside, creating new mmap",
(unsigned long long) offset, (gint) readsize, (gint) mapstart, offset, (guint) readsize, (guint) mapstart, (guint) mapsize);
(gint) mapsize);
buf = gst_file_src_map_small_region (src, offset, readsize); buf = gst_file_src_map_small_region (src, offset, readsize);
if (buf == NULL) if (buf == NULL)
goto could_not_mmap; goto could_not_mmap;
@ -676,10 +676,9 @@ gst_file_src_create_mmap (GstFileSrc * src, guint64 offset, guint length,
/* either the read buffer overlaps the start of the mmap region */ /* either the read buffer overlaps the start of the mmap region */
/* or the read buffer fully contains the current mmap region */ /* or the read buffer fully contains the current mmap region */
/* either way, it's really not relevant, we just create a new region anyway */ /* either way, it's really not relevant, we just create a new region anyway */
GST_LOG_OBJECT (src, GST_LOG_OBJECT (src, "read buf %" G_GUINT64_FORMAT "+%d starts before "
"read buf %llu+%d starts before mapbuf %d+%d, but overlaps it", "mapbuf %d+%d, but overlaps it", (guint64) offset, (gint) readsize,
(unsigned long long) offset, (gint) readsize, (gint) mapstart, (gint) mapstart, (gint) mapsize);
(gint) mapsize);
buf = gst_file_src_map_small_region (src, offset, readsize); buf = gst_file_src_map_small_region (src, offset, readsize);
if (buf == NULL) if (buf == NULL)
goto could_not_mmap; goto could_not_mmap;