Fix a bunch of problems discovered by the Forte compiler, mostly type mixups and pointer arithmetics with void pointe...

Original commit message from CVS:
Patch by: Josep Torra Valles  <josep at fluendo com>
* ext/cairo/gsttimeoverlay.c: (gst_cairo_time_overlay_transform):
* ext/esd/esdsink.c: (gst_esdsink_write):
* ext/flac/gstflacdec.c: (gst_flac_dec_length),
(gst_flac_dec_read_seekable), (gst_flac_dec_chain),
(gst_flac_dec_send_newsegment):
* ext/flac/gstflacenc.c: (gst_flac_enc_seek_callback),
(gst_flac_enc_tell_callback):
* ext/jpeg/smokecodec.c: (find_best_size), (smokecodec_encode),
(smokecodec_parse_header), (smokecodec_decode):
* gst/avi/gstavimux.c: (gst_avi_mux_write_avix_index):
* gst/debug/efence.c: (gst_fenced_buffer_alloc):
* gst/goom/Makefile.am:
* gst/goom/gstgoom.c:
* gst/icydemux/gsticydemux.c: (gst_icydemux_typefind_or_forward):
* gst/rtsp/gstrtspsrc.c:
* gst/rtsp/rtspconnection.c: (rtsp_connection_read):
* gst/udp/gstudpsink.c:
* gst/udp/gstudpsrc.c:
* gst/wavparse/gstwavparse.c: (gst_wavparse_change_state):
* sys/sunaudio/gstsunaudiomixertrack.h:
Fix a bunch of problems discovered by the Forte compiler, mostly type
mixups and pointer arithmetics with void pointers. Fixes #362603.
This commit is contained in:
Josep Torra Valles 2006-10-16 18:22:47 +00:00 committed by Tim-Philipp Müller
parent afef1cdc2a
commit c4e7ebfe35
17 changed files with 79 additions and 56 deletions

View file

@ -1,3 +1,30 @@
2006-10-16 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Josep Torra Valles <josep at fluendo com>
* ext/cairo/gsttimeoverlay.c: (gst_cairo_time_overlay_transform):
* ext/esd/esdsink.c: (gst_esdsink_write):
* ext/flac/gstflacdec.c: (gst_flac_dec_length),
(gst_flac_dec_read_seekable), (gst_flac_dec_chain),
(gst_flac_dec_send_newsegment):
* ext/flac/gstflacenc.c: (gst_flac_enc_seek_callback),
(gst_flac_enc_tell_callback):
* ext/jpeg/smokecodec.c: (find_best_size), (smokecodec_encode),
(smokecodec_parse_header), (smokecodec_decode):
* gst/avi/gstavimux.c: (gst_avi_mux_write_avix_index):
* gst/debug/efence.c: (gst_fenced_buffer_alloc):
* gst/goom/Makefile.am:
* gst/goom/gstgoom.c:
* gst/icydemux/gsticydemux.c: (gst_icydemux_typefind_or_forward):
* gst/rtsp/gstrtspsrc.c:
* gst/rtsp/rtspconnection.c: (rtsp_connection_read):
* gst/udp/gstudpsink.c:
* gst/udp/gstudpsrc.c:
* gst/wavparse/gstwavparse.c: (gst_wavparse_change_state):
* sys/sunaudio/gstsunaudiomixertrack.h:
Fix a bunch of problems discovered by the Forte compiler, mostly type
mixups and pointer arithmetics with void pointers. Fixes #362603.
2006-10-12 Tim-Philipp Müller <tim at centricular dot net>
* ext/speex/gstspeex.c: (plugin_init):

View file

@ -186,7 +186,7 @@ gst_cairo_time_overlay_transform (GstBaseTransform * trans, GstBuffer * in,
int i, j;
unsigned char *image;
cairo_text_extents_t extents;
gpointer dest, src;
guint8 *dest, *src;
cairo_surface_t *font_surface;
cairo_t *text_cairo;
GstFlowReturn ret = GST_FLOW_OK;

View file

@ -403,7 +403,7 @@ gst_esdsink_write (GstAudioSink * asink, gpointer data, guint length)
goto write_error;
to_write -= done;
data += done;
data = (char *) data + done;
}
return length;

View file

@ -642,11 +642,11 @@ gst_flac_dec_length (const FLAC__SeekableStreamDecoder * decoder,
flacdec = GST_FLAC_DEC (client_data);
if (!(peer = gst_pad_get_peer (flacdec->sinkpad)))
return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR;
gst_pad_query_duration (peer, &fmt, &len);
gst_object_unref (peer);
if (fmt != GST_FORMAT_BYTES || len == -1)
return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR;
*length = len;
@ -696,7 +696,7 @@ gst_flac_dec_read_seekable (const FLAC__SeekableStreamDecoder * decoder,
if (gst_pad_pull_range (flacdec->sinkpad, flacdec->offset, *bytes,
&buf) != GST_FLOW_OK)
return FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR;
return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR;
GST_DEBUG ("Read %d bytes at %" G_GUINT64_FORMAT,
GST_BUFFER_SIZE (buf), flacdec->offset);
@ -1101,7 +1101,7 @@ gst_flac_dec_sink_event (GstPad * pad, GstEvent * event)
static GstFlowReturn
gst_flac_dec_chain (GstPad * pad, GstBuffer * buf)
{
FLAC__SeekableStreamDecoderState s;
FLAC__StreamDecoderState s;
GstFlacDec *dec;
gboolean got_audio_frame;
@ -1486,7 +1486,7 @@ gst_flac_dec_send_newsegment (GstFlacDec * flacdec, gboolean update)
{
GstSegment *s = &flacdec->segment;
GstFormat target_format = GST_FORMAT_TIME;
gint64 stop_time = GST_CLOCK_TIME_NONE;
gint64 stop_time = -1;
gint64 start_time = 0;
/* segment is in DEFAULT format, but we want to send a TIME newsegment */

View file

@ -501,7 +501,7 @@ gst_flac_enc_seek_callback (const FLAC__SeekableStreamEncoder * encoder,
flacenc = GST_FLAC_ENC (client_data);
if (flacenc->stopped)
return FLAC__STREAM_ENCODER_OK;
return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK;
event = gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES,
absolute_byte_offset, GST_BUFFER_OFFSET_NONE, 0);
@ -525,7 +525,7 @@ gst_flac_enc_seek_callback (const FLAC__SeekableStreamEncoder * encoder,
flacenc->offset = absolute_byte_offset;
return FLAC__STREAM_ENCODER_OK;
return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK;
}
static FLAC__StreamEncoderWriteStatus
@ -585,7 +585,7 @@ gst_flac_enc_tell_callback (const FLAC__SeekableStreamEncoder * encoder,
*absolute_byte_offset = flacenc->offset;
return FLAC__STREAM_ENCODER_OK;
return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK;
}
static gboolean

View file

@ -36,15 +36,7 @@
#include "smokecodec.h"
#include "smokeformat.h"
#ifndef WIN32
//#define DEBUG(a...) printf( a );
#define DEBUG(a,...)
#else
#include <gst/gstinfo.h>
#define DEBUG GST_DEBUG
#endif
struct _SmokeCodecInfo
{
@ -297,14 +289,14 @@ find_best_size (int blocks, unsigned int *width, unsigned int *height)
w = sqchng;
h = sqchng;
DEBUG ("guess: %d %d\n", w, h);
GST_DEBUG ("guess: %d %d", w, h);
free = w * h - blocks;
best = free;
bestw = w;
while (w < 256) {
DEBUG ("current: %d %d\n", w, h);
GST_DEBUG ("current: %d %d", w, h);
if (free < best) {
best = free;
bestw = w;
@ -468,7 +460,7 @@ smokecodec_encode (SmokeCodecInfo * info,
STORE16 (out, IDX_NUM_BLOCKS, blocks);
out[IDX_FLAGS] = (flags & 0xff);
DEBUG ("blocks %d, encoding %d\n", blocks, encoding);
GST_DEBUG ("blocks %d, encoding %d", blocks, encoding);
info->jdest.next_output_byte = &out[blocks * 2 + OFFS_PICT];
info->jdest.free_in_buffer = (*outsize) - OFFS_PICT;
@ -479,7 +471,7 @@ smokecodec_encode (SmokeCodecInfo * info,
if (!(flags & SMOKECODEC_KEYFRAME))
find_best_size (encoding, &blocks_w, &blocks_h);
DEBUG ("best: %d %d\n", blocks_w, blocks_h);
GST_DEBUG ("best: %d %d", blocks_w, blocks_h);
info->cinfo.image_width = blocks_w * DCTSIZE * 2;
info->cinfo.image_height = blocks_h * DCTSIZE * 2;
@ -492,9 +484,9 @@ smokecodec_encode (SmokeCodecInfo * info,
info->minquality) * blocks) / max;
}
DEBUG ("set q %d %d %d\n", quality, encoding, max);
GST_DEBUG ("set q %d %d %d", quality, encoding, max);
jpeg_set_quality (&info->cinfo, quality, TRUE);
DEBUG ("start\n");
GST_DEBUG ("start");
jpeg_start_compress (&info->cinfo, TRUE);
for (i = 0; i < encoding; i++) {
@ -523,11 +515,11 @@ smokecodec_encode (SmokeCodecInfo * info,
put (ip, op, DCTSIZE, DCTSIZE, width / 2, 256 * DCTSIZE);
if ((i % blocks_w) == (blocks_w - 1) || (i == encoding - 1)) {
DEBUG ("write %d\n", pos);
GST_DEBUG ("write %d", pos);
jpeg_write_raw_data (&info->cinfo, info->line, 2 * DCTSIZE);
}
}
DEBUG ("finish\n");
GST_DEBUG ("finish");
jpeg_finish_compress (&info->cinfo);
}
@ -535,7 +527,7 @@ smokecodec_encode (SmokeCodecInfo * info,
STORE16 (out, IDX_SIZE, size);
*outsize = size + blocks * 2 + OFFS_PICT;
DEBUG ("outsize %d\n", *outsize);
GST_DEBUG ("outsize %d", *outsize);
// and decode in reference frame again
if (info->refdec) {
@ -596,7 +588,7 @@ smokecodec_parse_header (SmokeCodecInfo * info,
if (info->width != *width ||
info->height != *height ||
info->fps_num != *fps_num || info->fps_denom != *fps_denom) {
DEBUG ("new width: %d %d\n", *width, *height);
GST_DEBUG ("new width: %d %d", *width, *height);
info->reference = realloc (info->reference, 3 * ((*width) * (*height)) / 2);
info->width = *width;
@ -627,7 +619,7 @@ smokecodec_decode (SmokeCodecInfo * info,
&fps_num, &fps_denom);
READ16 (in, IDX_NUM_BLOCKS, blocks);
DEBUG ("blocks %d\n", blocks);
GST_DEBUG ("blocks %d", blocks);
if (flags & SMOKECODEC_KEYFRAME)
decoding = width / (DCTSIZE * 2) * height / (DCTSIZE * 2);
@ -638,9 +630,9 @@ smokecodec_decode (SmokeCodecInfo * info,
info->jsrc.next_input_byte = &in[blocks * 2 + OFFS_PICT];
info->jsrc.bytes_in_buffer = insize - (blocks * 2 + OFFS_PICT);
DEBUG ("header %02x %d\n", in[blocks * 2 + OFFS_PICT], insize);
GST_DEBUG ("header %02x %d", in[blocks * 2 + OFFS_PICT], insize);
res = jpeg_read_header (&info->dinfo, TRUE);
DEBUG ("header %d %d %d\n", res, info->dinfo.image_width,
GST_DEBUG ("header %d %d %d", res, info->dinfo.image_width,
info->dinfo.image_height);
blocks_w = info->dinfo.image_width / (2 * DCTSIZE);
@ -649,7 +641,7 @@ smokecodec_decode (SmokeCodecInfo * info,
info->dinfo.output_width = info->dinfo.image_width;
info->dinfo.output_height = info->dinfo.image_height;
DEBUG ("start\n");
GST_DEBUG ("start");
info->dinfo.do_fancy_upsampling = FALSE;
info->dinfo.do_block_smoothing = FALSE;
info->dinfo.out_color_space = JCS_YCbCr;
@ -660,10 +652,10 @@ smokecodec_decode (SmokeCodecInfo * info,
blockptr = 0;
for (i = 0; i < blocks_h; i++) {
DEBUG ("read\n");
GST_DEBUG ("read");
jpeg_read_raw_data (&info->dinfo, info->line, 2 * DCTSIZE);
DEBUG ("copy %d\n", blocks_w);
GST_DEBUG ("copy %d", blocks_w);
for (j = 0; j < blocks_w; j++) {
int pos;
int x, y;
@ -676,7 +668,7 @@ smokecodec_decode (SmokeCodecInfo * info,
x = pos % (width / (DCTSIZE * 2));
y = pos / (width / (DCTSIZE * 2));
DEBUG ("block %d %d %d\n", pos, x, y);
GST_DEBUG ("block %d %d %d", pos, x, y);
ip = info->compbuf[0] + j * (DCTSIZE * 2);
op = info->reference + (x * (DCTSIZE * 2)) +
@ -693,20 +685,20 @@ smokecodec_decode (SmokeCodecInfo * info,
(y * DCTSIZE * width / 2);
put (ip, op, DCTSIZE, DCTSIZE, 256 * DCTSIZE, width / 2);
DEBUG ("block done %d %d %d\n", pos, x, y);
GST_DEBUG ("block done %d %d %d", pos, x, y);
blockptr++;
if (blockptr >= decoding)
break;
}
}
DEBUG ("finish\n");
GST_DEBUG ("finish");
jpeg_finish_decompress (&info->dinfo);
}
DEBUG ("copy\n");
GST_DEBUG ("copy");
if (out != info->reference)
memcpy (out, info->reference, 3 * (width * height) / 2);
DEBUG ("copy done\n");
GST_DEBUG ("copy done");
return SMOKECODEC_OK;
}

View file

@ -1109,7 +1109,7 @@ gst_avi_mux_write_avix_index (GstAviMux * avimux, guchar * code,
/* msb is set if not (!) keyframe */
GST_WRITE_UINT32_LE (buffdata + 4, GUINT32_FROM_LE (entry->size)
| (GUINT32_FROM_LE (entry->flags)
& GST_RIFF_IF_KEYFRAME ? 0 : 1 << 31));
& GST_RIFF_IF_KEYFRAME ? 0 : 1U << 31));
buffdata += 8;
}
i--;

View file

@ -473,7 +473,7 @@ gst_fenced_buffer_alloc (GstBuffer * buffer, unsigned int length,
fenced_buffer->length = alloc_size - page_size;
#else
mprotect (region, page_size, PROT_NONE);
mprotect (region + alloc_size - page_size, page_size, PROT_NONE);
mprotect ((char *) region + alloc_size - page_size, page_size, PROT_NONE);
fenced_buffer->region = region;
fenced_buffer->length = alloc_size;
@ -487,9 +487,9 @@ gst_fenced_buffer_alloc (GstBuffer * buffer, unsigned int length,
/* Align to top of region, but force alignment to 4 bytes */
offset = alloc_size - page_size - length;
offset &= ~0x3;
return region + offset;
return (void *) ((char *) region + offset);
} else {
return region + page_size;
return (void *) ((char *) region + page_size);
}
}

View file

@ -7,7 +7,7 @@ noinst_HEADERS = gstgoom.h filters.h goom_core.h goom_tools.h graphic.h lines.h
libgstgoom_la_SOURCES = gstgoom.c goom_core.c $(GOOM_FILTER_FILES) graphic.c lines.c
libgstgoom_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GOOM_FILTER_CFLAGS)
libgstgoom_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GOOM_FILTER_CFLAGS)
libgstgoom_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS)
libgstgoom_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)

View file

@ -95,8 +95,8 @@ static GstFlowReturn gst_goom_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_goom_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_goom_sink_event (GstPad * pad, GstEvent * event);
static GstPadLinkReturn gst_goom_sink_setcaps (GstPad * pad, GstCaps * caps);
static GstPadLinkReturn gst_goom_src_setcaps (GstPad * pad, GstCaps * caps);
static gboolean gst_goom_sink_setcaps (GstPad * pad, GstCaps * caps);
static gboolean gst_goom_src_setcaps (GstPad * pad, GstCaps * caps);
static GstElementClass *parent_class = NULL;

View file

@ -429,7 +429,7 @@ gst_icydemux_typefind_or_forward (GstICYDemux * icydemux, GstBuffer * buf)
if (icydemux->typefinding) {
GstBuffer *tf_buf;
GstCaps *caps;
guint prob;
GstTypeFindProbability prob;
if (icydemux->typefind_buf) {
icydemux->typefind_buf = gst_buffer_join (icydemux->typefind_buf, buf);

View file

@ -2222,7 +2222,7 @@ open_failed:
/*** GSTURIHANDLER INTERFACE *************************************************/
static guint
static GstURIType
gst_rtspsrc_uri_get_type (void)
{
return GST_URI_SRC;

View file

@ -40,6 +40,10 @@
* SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
@ -60,6 +64,10 @@
#include <arpa/inet.h>
#endif
#ifdef HAVE_FIONREAD_IN_SYS_FILIO
#include <sys/filio.h>
#endif
#include "rtspconnection.h"
/* the select call is also performed on the control sockets, that way
@ -542,7 +550,7 @@ rtsp_connection_read (RTSPConnection * conn, gpointer data, guint size)
goto read_error;
} else {
toread -= bytes;
data += bytes;
data = (char *) data + bytes;
}
}
return RTSP_OK;

View file

@ -200,7 +200,7 @@ gst_udpsink_get_property (GObject * object, guint prop_id, GValue * value,
/*** GSTURIHANDLER INTERFACE *************************************************/
static guint
static GstURIType
gst_udpsink_uri_get_type (void)
{
return GST_URI_SINK;

View file

@ -838,7 +838,7 @@ gst_udpsrc_stop (GstBaseSrc * bsrc)
/*** GSTURIHANDLER INTERFACE *************************************************/
static guint
static GstURIType
gst_udpsrc_uri_get_type (void)
{
return GST_URI_SRC;

View file

@ -1964,10 +1964,6 @@ gst_wavparse_change_state (GstElement * element, GstStateChange transition)
GstStateChangeReturn ret;
GstWavParse *wav = GST_WAVPARSE (element);
GST_DEBUG_OBJECT (wav, "changing state %s - %s",
gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
break;

View file

@ -62,7 +62,7 @@ typedef struct _GstSunAudioMixerTrackClass {
} GstSunAudioMixerTrackClass;
GType gst_sunaudiomixer_track_get_type (void);
GstMixerTrack* gst_sunaudiomixer_track_new (gint track_num, gint max_chans, gint flags);
GstMixerTrack* gst_sunaudiomixer_track_new (GstSunAudioTrackType track_num, gint max_chans, gint flags);
G_END_DECLS