Some C89 fixes, moving variable declarations to the beginning of a block. Fixes bug #517937.

Original commit message from CVS:
Patch by: Jens Granseuer <jensgr at gmx dot net>
* gst/librfb/gstrfbsrc.c: (gst_rfb_property_set_version):
* gst/librfb/rfbdecoder.c: (rfb_decoder_message_set_encodings),
(rfb_decoder_state_set_encodings):
* gst/mpegtsparse/mpegtspacketizer.c:
(mpegts_packetizer_parse_nit), (mpegts_packetizer_parse_sdt),
(mpegts_packetizer_parse_eit):
* sys/fbdev/gstfbdevsink.c: (gst_fbdevsink_getcaps),
(gst_fbdevsink_setcaps), (gst_fbdevsink_render):
Some C89 fixes, moving variable declarations to the beginning
of a block. Fixes bug #517937.
This commit is contained in:
Jens Granseuer 2008-02-22 05:33:59 +00:00 committed by Sebastian Dröge
parent 6c322640d5
commit 266e4741cd
5 changed files with 54 additions and 25 deletions

View file

@ -1,3 +1,18 @@
2008-02-22 Sebastian Dröge <slomo@circular-chaos.org>
Patch by: Jens Granseuer <jensgr at gmx dot net>
* gst/librfb/gstrfbsrc.c: (gst_rfb_property_set_version):
* gst/librfb/rfbdecoder.c: (rfb_decoder_message_set_encodings),
(rfb_decoder_state_set_encodings):
* gst/mpegtsparse/mpegtspacketizer.c:
(mpegts_packetizer_parse_nit), (mpegts_packetizer_parse_sdt),
(mpegts_packetizer_parse_eit):
* sys/fbdev/gstfbdevsink.c: (gst_fbdevsink_getcaps),
(gst_fbdevsink_setcaps), (gst_fbdevsink_render):
Some C89 fixes, moving variable declarations to the beginning
of a block. Fixes bug #517937.
2008-02-21 Jan Schmidt <jan.schmidt@sun.com>
* configure.ac:

View file

@ -192,11 +192,14 @@ gst_rfb_src_dispose (GObject * object)
static void
gst_rfb_property_set_version (GstRfbSrc * src, gchar * value)
{
gchar *major;
gchar *minor;
g_return_if_fail (src != NULL);
g_return_if_fail (value != NULL);
gchar *major = g_strdup (value);
gchar *minor = g_strrstr (value, ".");
major = g_strdup (value);
minor = g_strrstr (value, ".");
g_return_if_fail (minor != NULL);

View file

@ -406,12 +406,13 @@ rfb_decoder_message_set_encodings (GSList * encodings_list)
{
guint8 *message = g_malloc0 (4 + 4 * g_slist_length (encodings_list));
guint32 *encoding_type;
message[0] = 0x02; /* message type */
RFB_SET_UINT16 (message + 2, g_slist_length (encodings_list)); /* number of encodings */
/* write all the encoding types */
guint32 *encoding_type = (guint32 *) (message + 4);
encoding_type = (guint32 *) (message + 4);
while (encodings_list) {
RFB_SET_UINT32 (encoding_type, GPOINTER_TO_UINT (encodings_list->data));
@ -434,6 +435,7 @@ static gboolean
rfb_decoder_state_set_encodings (RfbDecoder * decoder)
{
GSList *encoder_list = NULL;
guint8 *message;
GST_DEBUG ("entered set encodings");
@ -449,7 +451,7 @@ rfb_decoder_state_set_encodings (RfbDecoder * decoder)
encoder_list =
g_slist_append (encoder_list, GUINT_TO_POINTER (ENCODING_TYPE_RAW));
guint8 *message = rfb_decoder_message_set_encodings (encoder_list);
message = rfb_decoder_message_set_encodings (encoder_list);
rfb_decoder_send (decoder, message, 4 + 4 * g_slist_length (encoder_list));

View file

@ -600,15 +600,16 @@ mpegts_packetizer_parse_nit (MpegTSPacketizer * packetizer,
/* see if the buffer is large enough */
if (descriptors_loop_length) {
guint8 *networkname_descriptor;
GstMPEGDescriptor *mpegdescriptor;
if (data + descriptors_loop_length > end - 4) {
GST_WARNING ("PID %d invalid NIT descriptors loop length %d",
section->pid, descriptors_loop_length);
gst_structure_free (nit);
goto error;
}
guint8 *networkname_descriptor;
GstMPEGDescriptor *mpegdescriptor =
gst_mpeg_descriptor_parse (data, descriptors_loop_length);
mpegdescriptor = gst_mpeg_descriptor_parse (data, descriptors_loop_length);
networkname_descriptor =
gst_mpeg_descriptor_find (mpegdescriptor, DESC_DVB_NETWORK_NAME);
if (networkname_descriptor != NULL) {
@ -676,15 +677,17 @@ mpegts_packetizer_parse_nit (MpegTSPacketizer * packetizer,
g_free (transport_name);
if (descriptors_loop_length) {
GstMPEGDescriptor *mpegdescriptor;
guint8 *delivery;
if (data + descriptors_loop_length > end - 4) {
GST_WARNING ("PID %d invalid NIT entry %d descriptors loop length %d",
section->pid, transport_stream_id, descriptors_loop_length);
gst_structure_free (transport);
goto error;
}
GstMPEGDescriptor *mpegdescriptor =
mpegdescriptor =
gst_mpeg_descriptor_parse (data, descriptors_loop_length);
guint8 *delivery;
if ((delivery =
gst_mpeg_descriptor_find (mpegdescriptor,
@ -944,10 +947,10 @@ mpegts_packetizer_parse_nit (MpegTSPacketizer * packetizer,
GstStructure *channel;
GValue channel_value = { 0 };
guint16 service_id = GST_READ_UINT16_BE (current_pos);
guint16 logical_channel_number;
current_pos += 2;
guint16 logical_channel_number =
GST_READ_UINT16_BE (current_pos) & 0x03ff;
logical_channel_number = GST_READ_UINT16_BE (current_pos) & 0x03ff;
channel =
gst_structure_new ("channels", "service-id", G_TYPE_UINT,
service_id, "logical-channel-number", G_TYPE_UINT,
@ -1109,14 +1112,16 @@ mpegts_packetizer_parse_sdt (MpegTSPacketizer * packetizer,
g_free (service_name);
if (descriptors_loop_length) {
guint8 *service_descriptor;
GstMPEGDescriptor *mpegdescriptor;
if (data + descriptors_loop_length > end - 4) {
GST_WARNING ("PID %d invalid SDT entry %d descriptors loop length %d",
section->pid, service_id, descriptors_loop_length);
gst_structure_free (service);
goto error;
}
guint8 *service_descriptor;
GstMPEGDescriptor *mpegdescriptor =
mpegdescriptor =
gst_mpeg_descriptor_parse (data, descriptors_loop_length);
service_descriptor =
gst_mpeg_descriptor_find (mpegdescriptor, DESC_DVB_SERVICE);
@ -1333,15 +1338,17 @@ mpegts_packetizer_parse_eit (MpegTSPacketizer * packetizer,
g_free (event_name);
if (descriptors_loop_length) {
guint8 *event_descriptor;
GArray *component_descriptors;
GstMPEGDescriptor *mpegdescriptor;
if (data + descriptors_loop_length > end - 4) {
GST_WARNING ("PID %d invalid EIT descriptors loop length %d",
section->pid, descriptors_loop_length);
gst_structure_free (event);
goto error;
}
guint8 *event_descriptor;
GArray *component_descriptors;
GstMPEGDescriptor *mpegdescriptor =
mpegdescriptor =
gst_mpeg_descriptor_parse (data, descriptors_loop_length);
event_descriptor =
gst_mpeg_descriptor_find (mpegdescriptor, DESC_DVB_SHORT_EVENT);

View file

@ -136,22 +136,25 @@ static GstCaps *
gst_fbdevsink_getcaps (GstBaseSink * bsink)
{
GstFBDEVSink *fbdevsink;
GstCaps *caps;
uint32_t rmask;
uint32_t gmask;
uint32_t bmask;
int endianness;
fbdevsink = GST_FBDEVSINK (bsink);
if (!fbdevsink->framebuffer)
return gst_caps_from_string (GST_FBDEV_TEMPLATE_CAPS);
GstCaps *caps;
uint32_t rmask = ((1 << fbdevsink->varinfo.red.length) - 1)
rmask = ((1 << fbdevsink->varinfo.red.length) - 1)
<< fbdevsink->varinfo.red.offset;
uint32_t gmask = ((1 << fbdevsink->varinfo.green.length) - 1)
gmask = ((1 << fbdevsink->varinfo.green.length) - 1)
<< fbdevsink->varinfo.green.offset;
uint32_t bmask = ((1 << fbdevsink->varinfo.blue.length) - 1)
bmask = ((1 << fbdevsink->varinfo.blue.length) - 1)
<< fbdevsink->varinfo.blue.offset;
int endianness = 0;
endianness = 0;
switch (fbdevsink->varinfo.bits_per_pixel) {
case 32:
@ -199,13 +202,12 @@ gst_fbdevsink_setcaps (GstBaseSink * bsink, GstCaps * vscapslist)
{
GstFBDEVSink *fbdevsink;
GstStructure *structure;
const GValue *fps;
fbdevsink = GST_FBDEVSINK (bsink);
structure = gst_caps_get_structure (vscapslist, 0);
const GValue *fps;
fps = gst_structure_get_value (structure, "framerate");
fbdevsink->fps_n = gst_value_get_fraction_numerator (fps);
fbdevsink->fps_d = gst_value_get_fraction_denominator (fps);
@ -241,13 +243,13 @@ gst_fbdevsink_render (GstBaseSink * bsink, GstBuffer * buf)
{
GstFBDEVSink *fbdevsink;
int i;
fbdevsink = GST_FBDEVSINK (bsink);
/* optimization could remove this memcpy by allocating the buffer
in framebuffer memory, but would only work when xres matches
the video width */
int i;
for (i = 0; i < fbdevsink->lines; i++)
memcpy (fbdevsink->framebuffer