[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12122: Fix compiler warnings. Try t
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12122: Fix compiler warnings. Try to make new code adhere to guidelines. |
Date: |
Wed, 31 Mar 2010 18:50:39 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12122 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2010-03-31 18:50:39 +0200
message:
Fix compiler warnings. Try to make new code adhere to guidelines.
modified:
libcore/asobj/flash/net/URLVariables_as.cpp
libcore/swf/DefineFontAlignZonesTag.cpp
libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
librender/PathParser.cpp
librender/Renderer_cairo.cpp
librender/Renderer_ogl.cpp
=== modified file 'libcore/asobj/flash/net/URLVariables_as.cpp'
--- a/libcore/asobj/flash/net/URLVariables_as.cpp 2010-01-25 18:52:20
+0000
+++ b/libcore/asobj/flash/net/URLVariables_as.cpp 2010-03-31 16:27:35
+0000
@@ -53,7 +53,7 @@
}
void
-attachURLVariablesStaticInterface(as_object& o)
+attachURLVariablesStaticInterface(as_object& /*o*/)
{
}
=== modified file 'libcore/swf/DefineFontAlignZonesTag.cpp'
--- a/libcore/swf/DefineFontAlignZonesTag.cpp 2010-03-11 01:47:08 +0000
+++ b/libcore/swf/DefineFontAlignZonesTag.cpp 2010-03-31 16:05:55 +0000
@@ -31,14 +31,13 @@
namespace gnash {
namespace SWF {
-DefineFontAlignZonesTag::DefineFontAlignZonesTag(movie_definition& /* m */,
- SWFStream& /* in */)
+DefineFontAlignZonesTag::DefineFontAlignZonesTag(movie_definition& /*m*/,
+ SWFStream& /*in*/)
:
_csm_table_int(2)
{
}
-/* public static */
void
DefineFontAlignZonesTag::loader(SWFStream& in, TagType tag,
movie_definition& m, const RunResources& /*r*/)
@@ -63,36 +62,48 @@
// 2bits are cms table, 6bits are reserved
const boost::uint8_t flags = in.read_u8();
+ // What is this?
+ const boost::uint16_t csm_table_int = flags >> 6;
+
// TODO:
// The first thing to to is test what this does. According to some
// sources, the tag is ignored and merely turns on the player's
// font engine.
IF_VERBOSE_PARSE (
- log_parse(_(" ** DefineFontAlignZones: font=%d, flags=%d"), ref,
flags);
+ log_parse(_("DefineFontAlignZones: font=%d, flags=%d, "
+ "table int: %s"), ref, flags, csm_table_int);
);
- const boost::uint16_t csm_table_int_temp = flags >> 6;
-
- Font::GlyphInfoRecords::size_type glyphs_count_temp =
+ const Font::GlyphInfoRecords::size_type glyphs_count =
referencedFont->glyphCount();
- for (size_t i = 0; i != glyphs_count_temp; ++i) {
+ for (size_t i = 0; i != glyphs_count; ++i) {
+
in.ensureBytes(1);
+ // What is this for?
in.read_u8();
- for (int j = 0; j != 2; ++j) {
- in.ensureBytes(2);
- float f_zone_position_temp = in.read_u16();
- in.ensureBytes(2);
- float f_zone_size_temp = in.read_u16();
+ for (size_t j = 0; j != 2; ++j) {
+ in.ensureBytes(4);
+ const boost::uint16_t zone_position = in.read_u16();
+ const boost::uint16_t zone_size = in.read_u16();
+
+ IF_VERBOSE_PARSE(
+ log_parse("Zone position: %s, size: %s", zone_position,
+ zone_size);
+ );
}
+
in.ensureBytes(1);
-
// What is this?
- boost::uint8_t u = in.read_u8();
- const boost::uint32_t f_zone_x_temp = u & 0x0001;
- unsigned f_zone_y_temp = (u >> 1) & 0x0001;
+ const boost::uint8_t u = in.read_u8();
+ const bool zone_x = u & 0x01;
+ const bool zone_y = (u >> 1) & 0x01;
+
+ IF_VERBOSE_PARSE(
+ log_parse("Zone x: %s, y: %s", zone_x, zone_y);
+ );
}
in.skip_to_tag_end();
=== modified file 'libmedia/ffmpeg/VideoDecoderFfmpeg.cpp'
--- a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp 2010-03-19 21:14:13 +0000
+++ b/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp 2010-03-31 16:20:15 +0000
@@ -9,12 +9,12 @@
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifdef HAVE_CONFIG_H
@@ -38,6 +38,7 @@
#include "VideoDecoderFfmpeg.h"
#include "MediaParserFfmpeg.h" // for ExtraVideoInfoFfmpeg
#include "GnashException.h" // for MediaException
+#include "utility.h"
#include <boost/scoped_array.hpp>
#include <boost/format.hpp>
@@ -55,6 +56,21 @@
namespace media {
namespace ffmpeg {
+// Forward declarations of VAAPI functions.
+namespace {
+
+ class VaapiContextFfmpeg;
+
+ VaapiContextFfmpeg* get_vaapi_context(AVCodecContext* avctx);
+ void set_vaapi_context(AVCodecContext* avctx, VaapiContextFfmpeg* vactx);
+ void clear_vaapi_context(AVCodecContext* avctx);
+ void reset_context(AVCodecContext* avctx, VaapiContextFfmpeg* vactx = 0);
+ PixelFormat get_format(AVCodecContext* avctx, const PixelFormat* fmt);
+ int get_buffer(AVCodecContext* avctx, AVFrame* pic);
+ int reget_buffer(AVCodecContext* avctx, AVFrame* pic);
+ void release_buffer(AVCodecContext *avctx, AVFrame *pic);
+}
+
#ifdef HAVE_SWSCALE_H
/// A wrapper round an SwsContext that ensures it's
/// freed on destruction.
@@ -80,38 +96,6 @@
};
#endif
-class VaapiContextFfmpeg;
-
-static inline VaapiContextFfmpeg *
-get_vaapi_context(AVCodecContext *avctx)
-{
-#if USE_VAAPI
- return static_cast<VaapiContextFfmpeg *>(avctx->hwaccel_context);
-#else
- return NULL;
-#endif
-}
-
-static inline void
-set_vaapi_context(AVCodecContext *avctx, VaapiContextFfmpeg *vactx)
-{
-#if USE_VAAPI
- avctx->hwaccel_context = vactx;
-#endif
-}
-
-static inline void
-clear_vaapi_context(AVCodecContext *avctx)
-{
-#if USE_VAAPI
- VaapiContextFfmpeg * const vactx = get_vaapi_context(avctx);
- if (!vactx)
- return;
-
- delete vactx;
- set_vaapi_context(avctx, NULL);
-#endif
-}
// A Wrapper ensuring an AVCodecContext is closed and freed
// on destruction.
@@ -139,101 +123,6 @@
AVCodecContext* _codecCtx;
};
-/// (Re)set AVCodecContext to sane values
-static void
-reset_context(AVCodecContext *avctx, VaapiContextFfmpeg *vactx = NULL)
-{
- clear_vaapi_context(avctx);
- set_vaapi_context(avctx, vactx);
-
- avctx->thread_count = 1;
- avctx->draw_horiz_band = NULL;
- if (vactx)
- avctx->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
- else
- avctx->slice_flags = 0;
-}
-
-/// AVCodecContext.get_format() implementation
-static enum PixelFormat
-get_format(AVCodecContext *avctx, const enum PixelFormat *fmt)
-{
-#if USE_VAAPI
- VaapiContextFfmpeg * const vactx = get_vaapi_context(avctx);
-
- if (vactx) {
- for (int i = 0; fmt[i] != PIX_FMT_NONE; i++) {
- if (fmt[i] != PIX_FMT_VAAPI_VLD)
- continue;
- if (vactx->initDecoder(avctx->width, avctx->height))
- return fmt[i];
- }
- }
-#endif
-
- reset_context(avctx);
- return avcodec_default_get_format(avctx, fmt);
-}
-
-/// AVCodecContext.get_buffer() implementation
-static int
-get_buffer(AVCodecContext *avctx, AVFrame *pic)
-{
- VaapiContextFfmpeg * const vactx = get_vaapi_context(avctx);
- if (!vactx)
- return avcodec_default_get_buffer(avctx, pic);
-
-#if USE_VAAPI
- if (!vactx->initDecoder(avctx->width, avctx->height))
- return -1;
-
- VaapiSurfaceFfmpeg * const surface = vactx->getSurface();
- if (!surface)
- return -1;
- vaapi_set_surface(pic, surface);
-
- static unsigned int pic_num = 0;
- pic->type = FF_BUFFER_TYPE_USER;
- pic->age = ++pic_num - surface->getPicNum();
- surface->setPicNum(pic_num);
- return 0;
-#endif
- return -1;
-}
-
-/// AVCodecContext.reget_buffer() implementation
-static int
-reget_buffer(AVCodecContext *avctx, AVFrame *pic)
-{
- VaapiContextFfmpeg * const vactx = get_vaapi_context(avctx);
-
- if (!vactx)
- return avcodec_default_reget_buffer(avctx, pic);
-
- return get_buffer(avctx, pic);
-}
-
-/// AVCodecContext.release_buffer() implementation
-static void
-release_buffer(AVCodecContext *avctx, AVFrame *pic)
-{
- VaapiContextFfmpeg * const vactx = get_vaapi_context(avctx);
- if (!vactx) {
- avcodec_default_release_buffer(avctx, pic);
- return;
- }
-
-#if USE_VAAPI
- VaapiSurfaceFfmpeg * const surface = vaapi_get_surface(pic);
- if (surface)
- delete surface;
-
- pic->data[0] = NULL;
- pic->data[1] = NULL;
- pic->data[2] = NULL;
- pic->data[3] = NULL;
-#endif
-}
VideoDecoderFfmpeg::VideoDecoderFfmpeg(videoCodecType format, int width, int
height)
:
@@ -557,6 +446,138 @@
}
}
+namespace {
+
+inline VaapiContextFfmpeg*
+get_vaapi_context(AVCodecContext* avctx)
+{
+#if USE_VAAPI
+ return static_cast<VaapiContextFfmpeg *>(avctx->hwaccel_context);
+#else
+ UNUSED(avctx);
+ return 0;
+#endif
+}
+
+inline void
+set_vaapi_context(AVCodecContext* avctx, VaapiContextFfmpeg* vactx)
+{
+#if USE_VAAPI
+ avctx->hwaccel_context = vactx;
+#else
+ UNUSED(avctx), UNUSED(vactx);
+#endif
+
+}
+
+inline void
+clear_vaapi_context(AVCodecContext* avctx)
+{
+#if USE_VAAPI
+ VaapiContextFfmpeg* const vactx = get_vaapi_context(avctx);
+ if (!vactx) return;
+
+ delete vactx;
+ set_vaapi_context(avctx, NULL);
+#else
+ UNUSED(avctx);
+#endif
+}
+
+/// (Re)set AVCodecContext to sane values
+void
+reset_context(AVCodecContext* avctx, VaapiContextFfmpeg* vactx)
+{
+ clear_vaapi_context(avctx);
+ set_vaapi_context(avctx, vactx);
+
+ avctx->thread_count = 1;
+ avctx->draw_horiz_band = 0;
+ if (vactx) {
+ avctx->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
+ }
+ else avctx->slice_flags = 0;
+}
+
+/// AVCodecContext.get_format() implementation
+PixelFormat
+get_format(AVCodecContext* avctx, const PixelFormat* fmt)
+{
+#if USE_VAAPI
+ VaapiContextFfmpeg* const vactx = get_vaapi_context(avctx);
+
+ if (vactx) {
+ for (int i = 0; fmt[i] != PIX_FMT_NONE; i++) {
+ if (fmt[i] != PIX_FMT_VAAPI_VLD) continue;
+
+ if (vactx->initDecoder(avctx->width, avctx->height)) {
+ return fmt[i];
+ }
+ }
+ }
+#endif
+
+ reset_context(avctx);
+ return avcodec_default_get_format(avctx, fmt);
+}
+
+/// AVCodecContext.get_buffer() implementation
+int
+get_buffer(AVCodecContext* avctx, AVFrame* pic)
+{
+ VaapiContextFfmpeg* const vactx = get_vaapi_context(avctx);
+ if (!vactx) return avcodec_default_get_buffer(avctx, pic);
+
+#if USE_VAAPI
+ if (!vactx->initDecoder(avctx->width, avctx->height)) return -1;
+
+ VaapiSurfaceFfmpeg * const surface = vactx->getSurface();
+ if (!surface) return -1;
+
+ vaapi_set_surface(pic, surface);
+
+ static unsigned int pic_num = 0;
+ pic->type = FF_BUFFER_TYPE_USER;
+ pic->age = ++pic_num - surface->getPicNum();
+ surface->setPicNum(pic_num);
+ return 0;
+#endif
+ return -1;
+}
+
+/// AVCodecContext.reget_buffer() implementation
+int
+reget_buffer(AVCodecContext* avctx, AVFrame* pic)
+{
+ VaapiContextFfmpeg* const vactx = get_vaapi_context(avctx);
+
+ if (!vactx) return avcodec_default_reget_buffer(avctx, pic);
+
+ return get_buffer(avctx, pic);
+}
+
+/// AVCodecContext.release_buffer() implementation
+void
+release_buffer(AVCodecContext *avctx, AVFrame *pic)
+{
+ VaapiContextFfmpeg* const vactx = get_vaapi_context(avctx);
+ if (!vactx) {
+ avcodec_default_release_buffer(avctx, pic);
+ return;
+ }
+
+#if USE_VAAPI
+ VaapiSurfaceFfmpeg* const surface = vaapi_get_surface(pic);
+ delete surface;
+
+ pic->data[0] = NULL;
+ pic->data[1] = NULL;
+ pic->data[2] = NULL;
+ pic->data[3] = NULL;
+#endif
+}
+
+}
} // gnash.media.ffmpeg namespace
} // gnash.media namespace
=== modified file 'librender/PathParser.cpp'
--- a/librender/PathParser.cpp 2010-01-11 06:41:38 +0000
+++ b/librender/PathParser.cpp 2010-03-31 16:24:43 +0000
@@ -21,6 +21,7 @@
#include "PathParser.h"
#include <map>
#include <boost/bind.hpp>
+#include "log.h"
namespace gnash
{
@@ -45,7 +46,7 @@
{}
void
-PathParser::run(const cxform& cx, const SWFMatrix& mat)
+PathParser::run(const cxform& cx, const SWFMatrix& /*mat*/)
{
// Since we frequently remove an element from the front or the back, we use
// a double ended queue here.
@@ -86,7 +87,7 @@
if (it == path_list.end()) {
if (!closed_shape()) {
- std::cout << "error: path not closed!" << std::endl;
+ log_error("path not closed!");
_cur_endpoint = _shape_origin;
}
} else {
=== modified file 'librender/Renderer_cairo.cpp'
--- a/librender/Renderer_cairo.cpp 2010-03-14 23:13:09 +0000
+++ b/librender/Renderer_cairo.cpp 2010-03-31 16:27:41 +0000
@@ -90,22 +90,6 @@
static void
-snap_to_pixel(cairo_t* cr, double& x, double& y, bool up)
-{
- cairo_user_to_device(cr, &x, &y);
-
- if (up) {
- x = std::ceil(x);
- y = std::ceil(y);
- } else {
- x = std::floor(x);
- y = std::floor(y);
- }
-
- cairo_device_to_user(cr, &x, &y);
-}
-
-static void
snap_to_half_pixel(cairo_t* cr, double& x, double& y)
{
cairo_user_to_device(cr, &x, &y);
@@ -129,7 +113,7 @@
pattern_add_color_stops(const fill_style& style, cairo_pattern_t* pattern,
const cxform& cx)
{
- for (int index = 0; index < style.get_color_stop_count(); ++index) {
+ for (size_t index = 0; index < style.get_color_stop_count(); ++index) {
const gradient_record& grad = style.get_color_stop(index);
rgba c = cx.transform(grad.m_color);
@@ -793,10 +777,10 @@
void
Renderer_cairo::apply_line_style(const LineStyle& style, const cxform& cx,
- const SWFMatrix& mat)
+ const SWFMatrix& /*mat*/)
{
cairo_line_join_t join_style = CAIRO_LINE_JOIN_MITER;
- switch(style.joinStyle()) {
+ switch (style.joinStyle()) {
case JOIN_ROUND:
join_style = CAIRO_LINE_JOIN_ROUND;
break;
=== modified file 'librender/Renderer_ogl.cpp'
--- a/librender/Renderer_ogl.cpp 2010-03-14 06:02:38 +0000
+++ b/librender/Renderer_ogl.cpp 2010-03-31 16:30:28 +0000
@@ -732,13 +732,16 @@
frame->height(),
frame->type()));
break;
-#if USE_VAAPI_GLX
case GNASH_IMAGE_GPU:
+ // This case should never be reached if vaapi is not
+ // enabled; but has to be handled to keep the compiler
+ // happy.
+#if USE_VAAPI_GLX
texture.reset(new GnashVaapiTexture(frame->width(),
frame->height(),
frame->type()));
+#endif
break;
-#endif
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12122: Fix compiler warnings. Try to make new code adhere to guidelines.,
Benjamin Wolsey <=