diff options
author | Luis de Bethencourt <luisbg@osg.samsung.com> | 2016-07-01 14:05:49 +0100 |
---|---|---|
committer | Luis de Bethencourt <luisbg@osg.samsung.com> | 2016-07-01 14:08:13 +0100 |
commit | 418e643b61dc1a58178c6b23acf0605d19e88271 (patch) | |
tree | d744aa92cf7a231228871e3fb833f9790375d2c5 /gst/videoparsers | |
parent | 154698389dc8c3a7efc8813f1584eaf698af5fdc (diff) | |
download | gstreamer-plugins-bad-418e643b61dc1a58178c6b23acf0605d19e88271.tar.gz |
gstjpeg2000parse: no need for else after a goto
else clause is redundant when the end of the if statement is a jump.
If we haven't gone to the beach, we are in the false branch.
Diffstat (limited to 'gst/videoparsers')
-rw-r--r-- | gst/videoparsers/gstjpeg2000parse.c | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/gst/videoparsers/gstjpeg2000parse.c b/gst/videoparsers/gstjpeg2000parse.c index d6edc3aa7..93887719a 100644 --- a/gst/videoparsers/gstjpeg2000parse.c +++ b/gst/videoparsers/gstjpeg2000parse.c @@ -235,49 +235,46 @@ gst_jpeg2000_parse_handle_frame (GstBaseParse * parse, if (magic_offset == -1) { *skipsize = gst_byte_reader_get_size (&reader) - num_prefix_bytes; goto beach; - } else { - - /* see if we need to skip any bytes at beginning of frame */ - GST_DEBUG_OBJECT (jpeg2000parse, "Found magic at offset = %d", - magic_offset); - if (magic_offset > 0) { - *skipsize = magic_offset; - /* J2C has 8 bytes preceding J2K magic */ - if (is_j2c) - *skipsize -= GST_JPEG2000_PARSE_SIZE_OF_J2C_PREFIX_BYTES; - if (*skipsize > 0) - goto beach; - } + } - if (is_j2c) { + /* see if we need to skip any bytes at beginning of frame */ + GST_DEBUG_OBJECT (jpeg2000parse, "Found magic at offset = %d", magic_offset); + if (magic_offset > 0) { + *skipsize = magic_offset; + /* J2C has 8 bytes preceding J2K magic */ + if (is_j2c) + *skipsize -= GST_JPEG2000_PARSE_SIZE_OF_J2C_PREFIX_BYTES; + if (*skipsize > 0) + goto beach; + } - /* sanity check on box id offset */ - if (j2c_box_id_offset + GST_JPEG2000_JP2_SIZE_OF_BOX_ID != magic_offset) { - GST_ELEMENT_ERROR (jpeg2000parse, STREAM, DECODE, NULL, - ("Corrupt contiguous code stream box for j2c stream")); - ret = GST_FLOW_ERROR; - goto beach; - } + if (is_j2c) { + /* sanity check on box id offset */ + if (j2c_box_id_offset + GST_JPEG2000_JP2_SIZE_OF_BOX_ID != magic_offset) { + GST_ELEMENT_ERROR (jpeg2000parse, STREAM, DECODE, NULL, + ("Corrupt contiguous code stream box for j2c stream")); + ret = GST_FLOW_ERROR; + goto beach; + } - /* check that we have enough bytes for the J2C box length */ - if (j2c_box_id_offset < GST_JPEG2000_JP2_SIZE_OF_BOX_LEN) { - *skipsize = gst_byte_reader_get_size (&reader) - num_prefix_bytes; - goto beach; - } + /* check that we have enough bytes for the J2C box length */ + if (j2c_box_id_offset < GST_JPEG2000_JP2_SIZE_OF_BOX_LEN) { + *skipsize = gst_byte_reader_get_size (&reader) - num_prefix_bytes; + goto beach; + } - if (!gst_byte_reader_skip (&reader, - j2c_box_id_offset - GST_JPEG2000_JP2_SIZE_OF_BOX_LEN)) - goto beach; + if (!gst_byte_reader_skip (&reader, + j2c_box_id_offset - GST_JPEG2000_JP2_SIZE_OF_BOX_LEN)) + goto beach; - /* read the box length, and adjust num_prefix_bytes accordingly */ - if (!gst_byte_reader_get_uint32_be (&reader, &frame_size)) - goto beach; - num_prefix_bytes -= GST_JPEG2000_JP2_SIZE_OF_BOX_LEN; + /* read the box length, and adjust num_prefix_bytes accordingly */ + if (!gst_byte_reader_get_uint32_be (&reader, &frame_size)) + goto beach; + num_prefix_bytes -= GST_JPEG2000_JP2_SIZE_OF_BOX_LEN; - /* bail out if not enough data for frame */ - if ((gst_byte_reader_get_size (&reader) < frame_size)) - goto beach; - } + /* bail out if not enough data for frame */ + if ((gst_byte_reader_get_size (&reader) < frame_size)) + goto beach; } /* 2 to skip marker size, and another 2 to skip rsiz field */ |