[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/array.cpp server/as_valu...
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog server/array.cpp server/as_valu... |
Date: |
Mon, 19 May 2008 13:03:56 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/05/19 13:03:56
Modified files:
. : ChangeLog
server : array.cpp as_value.h character.h cxform.cpp
edit_text_character.cpp impl.h
movie_instance.cpp movie_root.cpp rect.cpp
sprite_instance.cpp
server/asobj : ContextMenu.cpp NetStreamFfmpeg.cpp string.cpp
server/parser : bitmap_character_def.h shape_character_def.cpp
libbase : FLVParser.cpp container.h smart_ptr.h
tu_file.cpp utility.h zlib_adapter.cpp
gui : gnash.cpp gui.cpp
libmedia : AudioDecoderSimple.cpp
libgeometry : snappingrange.h
Log message:
* libbase/utility.h: use std::min / std::max, drop custom
fmin/fmax,
imin/imax functions, replace iclamp/fclamp with templated
clamp<>
using std::min/max.
* server/array.cpp, server/as_value.h, server/character.h,
server/cxform.cpp, server/edit_text_character.cpp,
server/impl.h,
server/movie_instance.cpp, server/movie_root.cpp,
server/rect.cpp,
server/sprite_instance.cpp, server/asobj/ContextMenu.cpp,
server/asobj/NetStreamFfmpeg.cpp, server/asobj/string.cpp,
server/parser/bitmap_character_def.h, gui/gnash.cpp,
gui/gui.cpp, libbase/FLVParser.cpp, libbase/container.h,
libbase/smart_ptr.h, libbase/tu_file.cpp,
libbase/zlib_adapter.cpp,
libgeometry/snappingrange.h, libmedia/AudioDecoderSimple.cpp,
server/parser/shape_character_def.cpp: replace iclamp with
clamp<T> as appropriate, replace custom min/max methods with
std methods. Add / remove utility.h include as necessary.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6645&r2=1.6646
http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.cpp?cvsroot=gnash&r1=1.107&r2=1.108
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.h?cvsroot=gnash&r1=1.92&r2=1.93
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.143&r2=1.144
http://cvs.savannah.gnu.org/viewcvs/gnash/server/cxform.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.185&r2=1.186
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.h?cvsroot=gnash&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_instance.cpp?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.193&r2=1.194
http://cvs.savannah.gnu.org/viewcvs/gnash/server/rect.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.537&r2=1.538
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/ContextMenu.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.125&r2=1.126
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/string.cpp?cvsroot=gnash&r1=1.68&r2=1.69
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/bitmap_character_def.h?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.71&r2=1.72
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/FLVParser.cpp?cvsroot=gnash&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/container.h?cvsroot=gnash&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/smart_ptr.h?cvsroot=gnash&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/tu_file.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/utility.h?cvsroot=gnash&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/zlib_adapter.cpp?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gnash.cpp?cvsroot=gnash&r1=1.120&r2=1.121
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.167&r2=1.168
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/AudioDecoderSimple.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/libgeometry/snappingrange.h?cvsroot=gnash&r1=1.35&r2=1.36
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6645
retrieving revision 1.6646
diff -u -b -r1.6645 -r1.6646
--- ChangeLog 19 May 2008 12:29:57 -0000 1.6645
+++ ChangeLog 19 May 2008 13:03:52 -0000 1.6646
@@ -1,3 +1,21 @@
+2008-05-19 Benjamin Wolsey <address@hidden>
+
+ * libbase/utility.h: use std::min / std::max, drop custom fmin/fmax,
+ imin/imax functions, replace iclamp/fclamp with templated clamp<>
+ using std::min/max.
+ * server/array.cpp, server/as_value.h, server/character.h,
+ server/cxform.cpp, server/edit_text_character.cpp, server/impl.h,
+ server/movie_instance.cpp, server/movie_root.cpp, server/rect.cpp,
+ server/sprite_instance.cpp, server/asobj/ContextMenu.cpp,
+ server/asobj/NetStreamFfmpeg.cpp, server/asobj/string.cpp,
+ server/parser/bitmap_character_def.h, gui/gnash.cpp,
+ gui/gui.cpp, libbase/FLVParser.cpp, libbase/container.h,
+ libbase/smart_ptr.h, libbase/tu_file.cpp, libbase/zlib_adapter.cpp,
+ libgeometry/snappingrange.h, libmedia/AudioDecoderSimple.cpp,
+ server/parser/shape_character_def.cpp: replace iclamp with
+ clamp<T> as appropriate, replace custom min/max methods with
+ std methods. Add / remove utility.h include as necessary.
+
2008-05-19 Sandro Santilli <address@hidden>
* testsuite/swfdec/REALTIME: movieclip-version-*.swf must run in
Index: server/array.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/array.cpp,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -b -r1.107 -r1.108
--- server/array.cpp 18 May 2008 20:36:11 -0000 1.107
+++ server/array.cpp 19 May 2008 13:03:53 -0000 1.108
@@ -924,7 +924,7 @@
unsigned startoffset;
int start = fn.arg(0).to_number<int>();
if ( start < 0 ) start = array->size()+start; // start is negative, so
+ means -abs()
- startoffset = utility::iclamp(start, 0, origlen);
+ startoffset = utility::clamp<int>(start, 0, origlen);
#ifdef GNASH_DEBUG
if ( startoffset != start )
log_debug(_("Array.splice: start:%d became %u"), start,
startoffset);
@@ -945,7 +945,7 @@
);
return as_value();
}
- len = utility::iclamp(lenval, 0, origlen-startoffset);
+ len = utility::clamp<int>(lenval, 0, origlen-startoffset);
}
//----------------
Index: server/as_value.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.h,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -b -r1.92 -r1.93
--- server/as_value.h 17 May 2008 10:47:09 -0000 1.92
+++ server/as_value.h 19 May 2008 13:03:53 -0000 1.93
@@ -35,6 +35,7 @@
#include <boost/utility/enable_if.hpp>
#include <boost/static_assert.hpp>
+#include "utility.h" // UNUSED
#include "string_table.h"
namespace gnash {
Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -b -r1.143 -r1.144
--- server/character.h 5 May 2008 18:50:06 -0000 1.143
+++ server/character.h 19 May 2008 13:03:53 -0000 1.144
@@ -26,7 +26,6 @@
#include "smart_ptr.h" // GNASH_USE_GC
#include "gnash.h"
#include "types.h"
-#include "utility.h"
#include "event_id.h" // for inlines
#include "as_object.h" // for inheritance
#include "rect.h" // for composition (invalidated bounds)
Index: server/cxform.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/cxform.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/cxform.cpp 19 May 2008 07:15:49 -0000 1.14
+++ server/cxform.cpp 19 May 2008 13:03:53 -0000 1.15
@@ -26,7 +26,7 @@
#include "types.h" // for rgba type :(
#include "stream.h" // for reading from SWF
#include "log.h"
-#include "utility.h" // for fclamp
+#include "utility.h" // for utility::clamp
namespace gnash {
@@ -75,10 +75,11 @@
void cxform::transform(boost::uint8_t& r, boost::uint8_t& g,
boost::uint8_t& b, boost::uint8_t& a) const
// Faster transform() method for loops (avoids creation of rgba object)
{
- r = (boost::uint8_t) utility::fclamp(r * m_[0][0] + m_[0][1], 0, 255);
- g = (boost::uint8_t) utility::fclamp(g * m_[1][0] + m_[1][1], 0, 255);
- b = (boost::uint8_t) utility::fclamp(b * m_[2][0] + m_[2][1], 0, 255);
- a = (boost::uint8_t) utility::fclamp(a * m_[3][0] + m_[3][1], 0, 255);
+ using utility::clamp;
+ r = static_cast<boost::uint8_t>(clamp<float>(r * m_[0][0] + m_[0][1], 0,
255));
+ g = static_cast<boost::uint8_t>(clamp<float>(g * m_[1][0] + m_[1][1], 0,
255));
+ b = static_cast<boost::uint8_t>(clamp<float>(b * m_[2][0] + m_[2][1], 0,
255));
+ a = static_cast<boost::uint8_t>(clamp<float>(a * m_[3][0] + m_[3][1], 0,
255));
}
void cxform::read_rgb(stream& in)
@@ -162,15 +163,16 @@
/// Force component values to be in legal range.
void cxform::clamp()
{
- m_[0][0] = utility::fclamp(m_[0][0], 0, 1);
- m_[1][0] = utility::fclamp(m_[1][0], 0, 1);
- m_[2][0] = utility::fclamp(m_[2][0], 0, 1);
- m_[3][0] = utility::fclamp(m_[3][0], 0, 1);
-
- m_[0][1] = utility::fclamp(m_[0][1], -255.0f, 255.0f);
- m_[1][1] = utility::fclamp(m_[1][1], -255.0f, 255.0f);
- m_[2][1] = utility::fclamp(m_[2][1], -255.0f, 255.0f);
- m_[3][1] = utility::fclamp(m_[3][1], -255.0f, 255.0f);
+ using utility::clamp;
+ m_[0][0] = clamp<float>(m_[0][0], 0, 1);
+ m_[1][0] = clamp<float>(m_[1][0], 0, 1);
+ m_[2][0] = clamp<float>(m_[2][0], 0, 1);
+ m_[3][0] = clamp<float>(m_[3][0], 0, 1);
+
+ m_[0][1] = clamp<float>(m_[0][1], -255.0f, 255.0f);
+ m_[1][1] = clamp<float>(m_[1][1], -255.0f, 255.0f);
+ m_[2][1] = clamp<float>(m_[2][1], -255.0f, 255.0f);
+ m_[3][1] = clamp<float>(m_[3][1], -255.0f, 255.0f);
}
void cxform::print() const
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -b -r1.185 -r1.186
--- server/edit_text_character.cpp 18 May 2008 20:36:11 -0000 1.185
+++ server/edit_text_character.cpp 19 May 2008 13:03:53 -0000 1.186
@@ -42,7 +42,7 @@
#include "StringPredicates.h"
#include "TextFormat.h" // for getTextFormat/setTextFormat
-#include <algorithm>
+#include <algorithm> // std::min
#include <string>
#include <boost/algorithm/string/case_conv.hpp>
@@ -718,7 +718,7 @@
gnash::key::code c = id.keyCode;
// maybe _text is changed in ActionScript
- m_cursor = utility::imin(m_cursor, _text.size());
+ m_cursor = std::min<size_t>(m_cursor, _text.size());
switch (c)
{
@@ -1075,7 +1075,7 @@
// @@ TODO this should be generic to class character!
// Arg is in percent.
cxform cx = get_cxform();
- cx.m_[3][0] =
utility::fclamp(utility::infinite_to_fzero(val.to_number()) / 100.f, 0, 1);
+ cx.m_[3][0] =
utility::clamp<float>(utility::infinite_to_fzero(val.to_number()) / 100.f, 0,
1);
set_cxform(cx);
return true;
}
Index: server/impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/impl.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- server/impl.h 27 Mar 2008 10:50:14 -0000 1.54
+++ server/impl.h 19 May 2008 13:03:53 -0000 1.55
@@ -23,7 +23,6 @@
#include "gnash.h"
#include "types.h"
-#include "utility.h"
#include "smart_ptr.h"
#include "swf/TagLoadersTable.h"
Index: server/movie_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_instance.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/movie_instance.cpp 21 Apr 2008 11:27:43 -0000 1.26
+++ server/movie_instance.cpp 19 May 2008 13:03:54 -0000 1.27
@@ -28,7 +28,7 @@
#include <cmath>
#include <functional> // for mem_fun, bind1st
-#include <algorithm> // for for_each
+#include <algorithm> // for for_each, std::min
using namespace std;
@@ -77,7 +77,7 @@
// We do this inside advance_root to make sure
// it's only for a root sprite (not a sprite defined
// by DefineSprite!)
- size_t nextframe = min(get_current_frame()+2, get_frame_count());
+ size_t nextframe = std::min<size_t>(get_current_frame()+2,
get_frame_count());
if ( !_def->ensure_frame_loaded(nextframe) )
{
IF_VERBOSE_MALFORMED_SWF(
Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -b -r1.193 -r1.194
--- server/movie_root.cpp 18 May 2008 20:36:12 -0000 1.193
+++ server/movie_root.cpp 19 May 2008 13:03:54 -0000 1.194
@@ -1979,7 +1979,7 @@
{
//GNASH_REPORT_FUNCTION;
- boost::uint8_t newAlpha = utility::iclamp(utility::frnd(alpha *
255.0f), 0, 255);
+ boost::uint8_t newAlpha = utility::clamp<int>(utility::frnd(alpha *
255.0f), 0, 255);
if ( m_background_color.m_a != newAlpha )
{
Index: server/rect.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/rect.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/rect.cpp 18 May 2008 20:36:12 -0000 1.18
+++ server/rect.cpp 19 May 2008 13:03:54 -0000 1.19
@@ -15,15 +15,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-//
-//
-
#include "rect.h"
#include "log.h"
#include "stream.h"
#include "matrix.h"
#include "types.h" // for TWIPS_TO_PIXELS
-#include "utility.h" // for flerp, fclamp...
+#include "utility.h" // for flerp, clamp...
#include <sstream> // for ::print and ::toString
@@ -164,8 +161,8 @@
// nothing to do, point is surely inside
if ( _range.isWorld() ) return;
- p.x = utility::fclamp(p.x, _range.getMinX(), _range.getMaxX());
- p.y = utility::fclamp(p.y, _range.getMinY(), _range.getMaxY());
+ p.x = utility::clamp<float>(p.x, _range.getMinX(), _range.getMaxX());
+ p.y = utility::clamp<float>(p.y, _range.getMinY(), _range.getMaxY());
}
std::string
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.537
retrieving revision 1.538
diff -u -b -r1.537 -r1.538
--- server/sprite_instance.cpp 18 May 2008 20:36:12 -0000 1.537
+++ server/sprite_instance.cpp 19 May 2008 13:03:54 -0000 1.538
@@ -1364,7 +1364,7 @@
return as_value();
}
- thickness =
boost::uint16_t(PIXELS_TO_TWIPS(boost::uint16_t(utility::fclamp(fn.arg(0).to_number(),
0, 255))));
+ thickness =
boost::uint16_t(PIXELS_TO_TWIPS(boost::uint16_t(utility::clamp<float>(fn.arg(0).to_number(),
0, 255))));
bool scaleThicknessVertically = true;
bool scaleThicknessHorizontally = true;
bool pixelHinting = false;
@@ -1376,14 +1376,14 @@
if ( fn.nargs > 1 )
{
// 2^24 is the max here
- boost::uint32_t rgbval =
boost::uint32_t(utility::fclamp(fn.arg(1).to_number(), 0, 16777216));
+ boost::uint32_t rgbval =
boost::uint32_t(utility::clamp<float>(fn.arg(1).to_number(), 0, 16777216));
r = boost::uint8_t( (rgbval&0xFF0000) >> 16);
g = boost::uint8_t( (rgbval&0x00FF00) >> 8);
b = boost::uint8_t( (rgbval&0x0000FF) );
if ( fn.nargs > 2 )
{
- float alphaval = utility::fclamp(fn.arg(2).to_number(), 0, 100);
+ float alphaval = utility::clamp<float>(fn.arg(2).to_number(), 0, 100);
a = boost::uint8_t( 255 * (alphaval/100) );
if ( fn.nargs > 3 )
@@ -1480,7 +1480,7 @@
}
if ( fn.nargs > 7 )
{
- miterLimitFactor = utility::iclamp(fn.arg(7).to_int(), 1, 255);
+ miterLimitFactor = utility::clamp<int>(fn.arg(7).to_int(), 1, 255);
}
IF_VERBOSE_ASCODING_ERRORS(
@@ -1622,14 +1622,14 @@
if ( fn.nargs > 0 )
{
// 2^24 is the max here
- boost::uint32_t rgbval =
boost::uint32_t(utility::fclamp(fn.arg(0).to_number(), 0, 16777216));
+ boost::uint32_t rgbval =
boost::uint32_t(utility::clamp<float>(fn.arg(0).to_number(), 0, 16777216));
r = boost::uint8_t( (rgbval&0xFF0000) >> 16);
g = boost::uint8_t( (rgbval&0x00FF00) >> 8);
b = boost::uint8_t( (rgbval&0x0000FF) );
if ( fn.nargs > 1 )
{
- a = 255 * utility::iclamp(fn.arg(1).to_int(), 0, 100) / 100;
+ a = 255 * utility::clamp<int>(fn.arg(1).to_int(), 0, 100) / 100;
IF_VERBOSE_ASCODING_ERRORS(
if ( fn.nargs > 2 )
{
@@ -1889,10 +1889,10 @@
boost::uint32_t col = colVal.is_number() ? colVal.to_int() : 0;
as_value alpVal = alphas->getMember(key);
- boost::uint8_t alp = alpVal.is_number() ? utility::iclamp(alpVal.to_int(),
0, 255) : 0;
+ boost::uint8_t alp = alpVal.is_number() ?
utility::clamp<int>(alpVal.to_int(), 0, 255) : 0;
as_value ratVal = ratios->getMember(key);
- boost::uint8_t rat = ratVal.is_number() ? utility::iclamp(ratVal.to_int(),
0, 255) : 0;
+ boost::uint8_t rat = ratVal.is_number() ?
utility::clamp<int>(ratVal.to_int(), 0, 255) : 0;
rgba color;
color.parseRGB(col);
Index: server/asobj/ContextMenu.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/ContextMenu.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/asobj/ContextMenu.cpp 21 Jan 2008 20:55:54 -0000 1.19
+++ server/asobj/ContextMenu.cpp 19 May 2008 13:03:54 -0000 1.20
@@ -30,6 +30,7 @@
#include "GnashException.h"
#include "Object.h" // for getObjectInterface
#include "namedStrings.h"
+#include "utility.h" // UNUSED
namespace gnash {
Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -b -r1.125 -r1.126
--- server/asobj/NetStreamFfmpeg.cpp 12 May 2008 14:00:55 -0000 1.125
+++ server/asobj/NetStreamFfmpeg.cpp 19 May 2008 13:03:54 -0000 1.126
@@ -37,6 +37,7 @@
#include "FLVParser.h"
#include <boost/scoped_array.hpp>
+#include <algorithm> // std::min
#if defined(_WIN32) || defined(WIN32)
@@ -768,7 +769,7 @@
media::raw_mediadata_t* samples = ns->m_qaudio.front();
- int n = imin(samples->m_size, len);
+ int n = std::min<int>(samples->m_size, len);
memcpy(stream, samples->m_ptr, n);
stream += n;
samples->m_ptr += n;
Index: server/asobj/string.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/string.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- server/asobj/string.cpp 18 May 2008 20:36:13 -0000 1.68
+++ server/asobj/string.cpp 19 May 2008 13:03:54 -0000 1.69
@@ -210,7 +210,7 @@
index = subject.size() + index;
}
- index = utility::iclamp(index, 0, subject.size());
+ index = utility::clamp<int>(index, 0, subject.size());
return index;
}
@@ -295,7 +295,7 @@
{
return as_value(array.get());
}
- max = utility::iclamp((size_t)max_in, 0, wstr.size());
+ max = utility::clamp<size_t>(max_in, 0, wstr.size());
}
if ( wstr.empty() )
Index: server/parser/bitmap_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/bitmap_character_def.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- server/parser/bitmap_character_def.h 21 Apr 2008 11:27:45 -0000
1.22
+++ server/parser/bitmap_character_def.h 19 May 2008 13:03:54 -0000
1.23
@@ -22,7 +22,6 @@
#include "gnash.h" // for bitmap_info definition
#include "ref_counted.h" // for character_def inheritance
#include "types.h"
-#include "utility.h"
#include "smart_ptr.h"
#include "bitmap_info.h" // for dtor visibility by intrusive_ptr
#include "GC.h" // for GcResource (markReachableResources)
Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -b -r1.71 -r1.72
--- server/parser/shape_character_def.cpp 18 May 2008 20:36:13 -0000
1.71
+++ server/parser/shape_character_def.cpp 19 May 2008 13:03:54 -0000
1.72
@@ -62,7 +62,7 @@
void set_curve_max_pixel_error(float pixel_error)
{
- s_curve_max_pixel_error = utility::fclamp(pixel_error, 1e-6f, 1e6f);
+ s_curve_max_pixel_error = utility::clamp<float>(pixel_error, 1e-6f,
1e6f);
}
float get_curve_max_pixel_error()
Index: libbase/FLVParser.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/FLVParser.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- libbase/FLVParser.cpp 18 May 2008 20:36:13 -0000 1.36
+++ libbase/FLVParser.cpp 19 May 2008 13:03:55 -0000 1.37
@@ -349,7 +349,7 @@
size_t guess = size_t(time / tpf);
// Here we test if the guess was ok, and adjust if needed.
- size_t bestFrame = utility::iclamp(guess, 0, _audioFrames.size()-1);
+ size_t bestFrame = utility::clamp<size_t>(guess, 0,
_audioFrames.size()-1);
// Here we test if the guess was ok, and adjust if needed.
long diff = _audioFrames[bestFrame]->timestamp - time;
@@ -410,7 +410,7 @@
double tpf = lastFrame->timestamp / numFrames; // time per frame
size_t guess = size_t(time / tpf);
- size_t bestFrame = utility::iclamp(guess, 0, _videoFrames.size()-1);
+ size_t bestFrame = utility::clamp<size_t>(guess, 0,
_videoFrames.size()-1);
// Here we test if the guess was ok, and adjust if needed.
long diff = _videoFrames[bestFrame]->timestamp - time;
Index: libbase/container.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/container.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- libbase/container.h 28 Mar 2008 10:32:27 -0000 1.63
+++ libbase/container.h 19 May 2008 13:03:55 -0000 1.64
@@ -55,7 +55,6 @@
#endif // ! HAVE_WINSOCK_H
-#include "utility.h"
#include <cstddef>
#include <cstring> // for strcmp and friends
//#include <new> // for placement new
Index: libbase/smart_ptr.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/smart_ptr.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- libbase/smart_ptr.h 10 Apr 2008 00:41:07 -0000 1.28
+++ libbase/smart_ptr.h 19 May 2008 13:03:55 -0000 1.29
@@ -25,8 +25,6 @@
#ifndef SMART_PTR_H
#define SMART_PTR_H
-#include "utility.h"
-
// Define the following macro to use garbage collecting rather
// then ref-counting. Currenlty this would make ref_counted
// derive from GcResource and intrusive_ptr never really messing
Index: libbase/tu_file.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/tu_file.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- libbase/tu_file.cpp 18 May 2008 20:36:13 -0000 1.27
+++ libbase/tu_file.cpp 19 May 2008 13:03:55 -0000 1.28
@@ -263,7 +263,7 @@
int bytes_left = byte_count;
while (bytes_left) {
- int to_copy = utility::imin(bytes_left, BUFSIZE);
+ int to_copy = std::min<int>(bytes_left, BUFSIZE);
int read_count = src->read_bytes(buffer, to_copy);
int write_count = write_bytes(buffer, read_count);
Index: libbase/utility.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/utility.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- libbase/utility.h 18 May 2008 20:36:13 -0000 1.53
+++ libbase/utility.h 19 May 2008 13:03:55 -0000 1.54
@@ -29,6 +29,7 @@
#include <typeinfo>
#include <cmath>
#include <boost/cstdint.hpp>
+#include <algorithm> // std::min, std::max
#if defined(__GNUC__) && __GNUC__ > 2
# include <cxxabi.h>
@@ -115,41 +116,10 @@
else return i;
}
-/* fmax()/fmin() is C99 */
-inline float fmax(float a, float b)
-{
- if (a < b) return b;
- else return a;
-}
-
-inline float fmin(float a, float b)
-{
- if (a < b) return a;
- else return b;
-}
-
-inline int imax(int a, int b)
-{
- if (a < b) return b;
- else return a;
-}
-
-inline int imin(int a, int b)
-{
- if (a < b) return a;
- else return b;
-}
-
-inline int iclamp(int i, int min, int max)
+template <typename T> inline T clamp(T i, T min, T max)
{
assert( min <= max );
- return imax(min, imin(i, max));
-}
-
-inline float fclamp(float f, float xmin, float xmax)
-{
- assert( xmin <= xmax );
- return fmax(xmin, fmin(f, xmax));
+ return std::max<T>(min, std::min<T>(i, max));
}
inline float flerp(float a, float b, float f)
Index: libbase/zlib_adapter.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/zlib_adapter.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- libbase/zlib_adapter.cpp 18 May 2008 20:36:13 -0000 1.22
+++ libbase/zlib_adapter.cpp 19 May 2008 13:03:55 -0000 1.23
@@ -9,9 +9,9 @@
#include "zlib_adapter.h"
#include "tu_file.h"
-#include "utility.h"
#include "log.h"
#include "GnashException.h"
+#include <algorithm> // std::min
#include <memory>
@@ -280,7 +280,7 @@
{
int to_read = pos - inf->m_logical_stream_pos;
assert(to_read > 0);
- int to_read_this_time = utility::imin(to_read,
ZBUF_SIZE);
+ int to_read_this_time = std::min<int>(to_read,
ZBUF_SIZE);
assert(to_read_this_time > 0);
int bytes_read = inf->inflate_from_stream(temp,
to_read_this_time);
Index: gui/gnash.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gnash.cpp,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -b -r1.120 -r1.121
--- gui/gnash.cpp 18 May 2008 20:36:14 -0000 1.120
+++ gui/gnash.cpp 19 May 2008 13:03:55 -0000 1.121
@@ -272,9 +272,9 @@
player.setStartFullscreen(true);
break;
case 's':
- player.setScale( utility::fclamp(
+ player.setScale(utility::clamp<float>(
parser.argument<float>(i),
- 0.01f, 100.f) );
+ 0.01f, 100.f));
break;
case 'd':
player.setDelay( parser.argument<long>(i) );
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -b -r1.167 -r1.168
--- gui/gui.cpp 16 May 2008 16:08:15 -0000 1.167
+++ gui/gui.cpp 19 May 2008 13:03:55 -0000 1.168
@@ -36,6 +36,7 @@
#include <cstdio>
#include <cstring>
+#include <algorithm> // std::max, std::min
#ifdef SKIP_RENDERING_IF_LATE
#include "WallClockTimer.h"
@@ -1185,8 +1186,8 @@
fps_rate_min = rate;
fps_rate_max = rate;
} else {
- fps_rate_min = fmin(fps_rate_min, rate);
- fps_rate_max = fmax(fps_rate_max, rate);
+ fps_rate_min = std::max<float>(fps_rate_min, rate);
+ fps_rate_max = std::max<float>(fps_rate_max, rate);
}
float avg = fps_counter_total / secs_total;
Index: libmedia/AudioDecoderSimple.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/AudioDecoderSimple.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- libmedia/AudioDecoderSimple.cpp 18 May 2008 20:36:14 -0000 1.16
+++ libmedia/AudioDecoderSimple.cpp 19 May 2008 13:03:56 -0000 1.17
@@ -82,11 +82,11 @@
if (code_sign_bit) delta = -delta;
sample += delta;
- sample = utility::iclamp(sample, -32768, 32767);
+ sample = utility::clamp<int>(sample, -32768, 32767);
/* Update our stepsize index. Use a lookup table. */
stepsize_index += index_update_table[code_mag];
- stepsize_index = utility::iclamp(stepsize_index, 0, STEPSIZE_CT
- 1);
+ stepsize_index = utility::clamp<int>(stepsize_index, 0,
STEPSIZE_CT - 1);
}
/* Uncompress 4096 mono samples of ADPCM. */
Index: libgeometry/snappingrange.h
===================================================================
RCS file: /sources/gnash/gnash/libgeometry/snappingrange.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- libgeometry/snappingrange.h 27 Mar 2008 16:35:04 -0000 1.35
+++ libgeometry/snappingrange.h 19 May 2008 13:03:56 -0000 1.36
@@ -596,9 +596,10 @@
private:
+ // Unused...
inline T absmin(T a, T b) {
if (b<0) b*=-1;
- return min(a,b);
+ return std::min<T>(a,b);
}
void finalize() const {