[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. c56b63ed2d5ebcdbb133
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. c56b63ed2d5ebcdbb133fc86540b8612e5aa28cd |
Date: |
Fri, 19 Nov 2010 11:37:03 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via c56b63ed2d5ebcdbb133fc86540b8612e5aa28cd (commit)
via 89d884d8ecae8ee7be6c135b1d45564796ec5f8b (commit)
from ec2ca403acda9b1fce5fcba5a69e1eb2e9b0bb08 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=c56b63ed2d5ebcdbb133fc86540b8612e5aa28cd
commit c56b63ed2d5ebcdbb133fc86540b8612e5aa28cd
Author: Benjamin Wolsey <address@hidden>
Date: Fri Nov 19 12:21:39 2010 +0100
Simplify PropFlags and add better tests.
diff --git a/libcore/PropFlags.h b/libcore/PropFlags.h
index 774c236..739c268 100644
--- a/libcore/PropFlags.h
+++ b/libcore/PropFlags.h
@@ -90,64 +90,30 @@ public:
return !(*this == o);
}
- /// Get "read-only" flag
- bool get_read_only() const {
- return (_flags & readOnly);
- }
-
- /// Set "read-only" flag
- void set_read_only() { _flags |= readOnly; }
-
- /// Clear "read-only" flag
- void clear_read_only() { _flags &= ~readOnly; }
-
- /// Get "don't delete" flag
- bool get_dont_delete() const
- {
- return (_flags & dontDelete);
- }
-
- /// Set "don't delete" flag
- void set_dont_delete() { _flags |= dontDelete; }
-
- /// Clear "don't delete" flag
- void clear_dont_delete() { _flags &= ~dontDelete; }
-
- /// Get "don't enum" flag
- bool get_dont_enum() const {
- return (_flags & dontEnum);
- }
-
- /// Set "don't enum" flag
- void set_dont_enum() { _flags |= dontEnum; }
-
- /// Clear "don't enum" flag
- void clear_dont_enum() { _flags &= ~dontEnum; }
+ template<Flags f>
+ bool test() const {
+ return (_flags & f);
+ }
/// Get version-based visibility
- bool get_visible(int swfVersion) const
- {
- if ( _flags & onlySWF6Up && swfVersion < 6 ) return false;
- if ( _flags & ignoreSWF6 && swfVersion == 6 ) return false;
- if ( _flags & onlySWF7Up && swfVersion < 7 ) return false;
- if ( _flags & onlySWF8Up && swfVersion < 8 ) return false;
- if ( _flags & onlySWF9Up && swfVersion < 9 ) return false;
+ bool get_visible(int swfVersion) const {
+ if (test<onlySWF6Up>() && swfVersion < 6) return false;
+ if (test<ignoreSWF6>() && swfVersion == 6) return false;
+ if (test<onlySWF7Up>() && swfVersion < 7) return false;
+ if (test<onlySWF8Up>() && swfVersion < 8) return false;
+ if (test<onlySWF9Up>() && swfVersion < 9) return false;
return true;
}
- void clear_visible(int swfVersion)
- {
- if ( swfVersion == 6)
- {
+ void clear_visible(int swfVersion) {
+ if (swfVersion == 6) {
// version 6, so let's forget onlySWF7Up flag!
// we will still set the value though, even if that
flag is set
_flags &=
~(onlySWF6Up|ignoreSWF6|onlySWF8Up|onlySWF9Up);
}
- else
- {
+ else {
_flags &=
~(onlySWF6Up|ignoreSWF6|onlySWF7Up|onlySWF8Up|onlySWF9Up);
}
-
}
/// accessor to the numerical flags value
@@ -158,16 +124,10 @@ public:
/// you cannot un-protect from deletion and you cannot
/// un-hide from the for..in loop construct
///
- /// @param setTrue
- /// the set of flags to set
- ///
- /// @param setFalse
- /// the set of flags to clear
- ///
- /// @return true on success, false on failure (is protected)
- ///
- bool set_flags(boost::uint16_t setTrue, boost::uint16_t setFalse = 0)
- {
+ /// @param setTrue the set of flags to set
+ /// @param setFalse the set of flags to clear
+ /// @return true on success, false on failure (is protected)
+ bool set_flags(boost::uint16_t setTrue, boost::uint16_t setFalse = 0) {
_flags &= ~setFalse;
_flags |= setTrue;
return true;
@@ -181,14 +141,13 @@ private:
};
inline std::ostream&
-operator << (std::ostream& os, const PropFlags& fl)
+operator<<(std::ostream& os, const PropFlags& fl)
{
os << "(";
- if ( fl.get_read_only() ) os << " readonly";
- if ( fl.get_dont_delete() ) os << " nodelete";
- if ( fl.get_dont_enum() ) os << " noenum";
+ if (fl.test<PropFlags::readOnly>()) os << " readonly";
+ if (fl.test<PropFlags::dontDelete>()) os << " nodelete";
+ if (fl.test<PropFlags::dontEnum>()) os << " noenum";
os << " )";
- // TODO: visibility flags
return os;
}
diff --git a/libcore/Property.h b/libcore/Property.h
index f5eead3..f51f667 100644
--- a/libcore/Property.h
+++ b/libcore/Property.h
@@ -421,7 +421,7 @@ private:
/// is this a read-only member ?
inline bool
readOnly(const Property& prop) {
- return prop.getFlags().get_read_only();
+ return prop.getFlags().test<PropFlags::readOnly>();
}
/// Is this member supposed to be visible by a VM of given version ?
diff --git a/libcore/PropertyList.cpp b/libcore/PropertyList.cpp
index fbbc7a5..b15ec3a 100644
--- a/libcore/PropertyList.cpp
+++ b/libcore/PropertyList.cpp
@@ -168,7 +168,7 @@ PropertyList::delProperty(const ObjectURI& uri)
}
// check if member is protected from deletion
- if (found->getFlags().get_dont_delete()) {
+ if (found->getFlags().test<PropFlags::dontDelete>()) {
return std::make_pair(true, false);
}
@@ -184,7 +184,7 @@ PropertyList::visitKeys(KeyVisitor& visitor,
PropertyTracker& donelist)
for (const_iterator i = _props.begin(),
ie = _props.end(); i != ie; ++i) {
- if (i->getFlags().get_dont_enum()) continue;
+ if (i->getFlags().test<PropFlags::dontEnum>()) continue;
const ObjectURI& uri = i->uri();
diff --git a/libcore/as_object.h b/libcore/as_object.h
index a7ad034..f281309 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -811,7 +811,7 @@ class IsEnumerable
public:
IsEnumerable() {}
bool operator()(const Property& p) const {
- return !p.getFlags().get_dont_enum();
+ return !p.getFlags().test<PropFlags::dontEnum>();
}
};
diff --git a/libcore/asobj/Object.cpp b/libcore/asobj/Object.cpp
index c68e0d8..d9b0e82 100644
--- a/libcore/asobj/Object.cpp
+++ b/libcore/asobj/Object.cpp
@@ -391,7 +391,7 @@ object_isPropertyEnumerable(const fn_call& fn)
return as_value(false);
}
- return as_value(!prop->getFlags().get_dont_enum());
+ return as_value(!prop->getFlags().test<PropFlags::dontEnum>());
}
diff --git a/testsuite/libcore.all/PropFlagsTest.cpp
b/testsuite/libcore.all/PropFlagsTest.cpp
index add577a..b7507e4 100644
--- a/testsuite/libcore.all/PropFlagsTest.cpp
+++ b/testsuite/libcore.all/PropFlagsTest.cpp
@@ -39,31 +39,65 @@ main(int /*argc*/, char** /*argv*/)
PropFlags flags;
// Check initial state
- check(!flags.get_read_only());
- check(!flags.get_dont_enum());
- check(!flags.get_dont_delete());
+ check(!flags.test<PropFlags::readOnly>());
+ check(!flags.test<PropFlags::dontEnum>());
+ check(!flags.test<PropFlags::dontDelete>());
check_equals(flags.get_flags(), 0);
- // Now set some flags and check result
-
- flags.set_read_only();
- check(flags.get_read_only());
-
- flags.set_dont_enum();
- check(flags.get_dont_enum());
-
- flags.set_dont_delete();
- check(flags.get_dont_delete());
-
- // Now clear the flags and check result
-
- flags.clear_read_only();
- check(!flags.get_read_only());
-
- flags.clear_dont_enum();
- check(!flags.get_dont_enum());
-
- flags.clear_dont_delete();
- check(!flags.get_dont_delete());
+ PropFlags flags2(PropFlags::dontDelete | PropFlags::dontEnum);
+ check(flags2.test<PropFlags::dontEnum>());
+ check(flags2.test<PropFlags::dontDelete>());
+ check(!flags2.test<PropFlags::readOnly>());
+
+ PropFlags i;
+ check(i.get_visible(5));
+ check(i.get_visible(6));
+ check(i.get_visible(7));
+ check(i.get_visible(8));
+ check(i.get_visible(9));
+
+ i.set_flags(PropFlags::onlySWF6Up);
+ check(!i.get_visible(5));
+ check(i.get_visible(6));
+ check(i.get_visible(7));
+ check(i.get_visible(8));
+ check(i.get_visible(9));
+
+ i.set_flags(PropFlags::onlySWF7Up);
+ check(!i.get_visible(5));
+ check(!i.get_visible(6));
+ check(i.get_visible(7));
+ check(i.get_visible(8));
+ check(i.get_visible(9));
+
+ i.set_flags(PropFlags::onlySWF8Up);
+ check(!i.get_visible(5));
+ check(!i.get_visible(6));
+ check(!i.get_visible(7));
+ check(i.get_visible(8));
+ check(i.get_visible(9));
+
+ i.set_flags(PropFlags::onlySWF9Up);
+ check(!i.get_visible(5));
+ check(!i.get_visible(6));
+ check(!i.get_visible(7));
+ check(!i.get_visible(8));
+ check(i.get_visible(9));
+
+ PropFlags i2;
+ i2.set_flags(PropFlags::onlySWF8Up);
+ check(!i2.get_visible(5));
+ check(!i2.get_visible(6));
+ check(!i2.get_visible(7));
+ check(i2.get_visible(8));
+ check(i2.get_visible(9));
+
+ PropFlags i3;
+ i3.set_flags(PropFlags::ignoreSWF6);
+ check(i3.get_visible(5));
+ check(!i3.get_visible(6));
+ check(i3.get_visible(7));
+ check(i3.get_visible(8));
+ check(i3.get_visible(9));
}
http://git.savannah.gnu.org/cgit//commit/?id=89d884d8ecae8ee7be6c135b1d45564796ec5f8b
commit 89d884d8ecae8ee7be6c135b1d45564796ec5f8b
Author: Benjamin Wolsey <address@hidden>
Date: Fri Nov 19 12:21:27 2010 +0100
Fix compiler warnings.
diff --git a/librender/agg/Renderer_agg.cpp b/librender/agg/Renderer_agg.cpp
index fc5a234..211899f 100644
--- a/librender/agg/Renderer_agg.cpp
+++ b/librender/agg/Renderer_agg.cpp
@@ -822,7 +822,7 @@ public:
/// remain the same.
/// rowstride is the size, in bytes, of one row.
/// This method *must* be called prior to any other method of the class!
- void init_buffer(unsigned char *mem, int size, int x, int y, int rowstride)
+ void init_buffer(unsigned char *mem, int /*size*/, int x, int y, int
rowstride)
{
assert(x > 0);
assert(y > 0);
@@ -880,6 +880,8 @@ public:
case image::TYPE_RGBA:
in.reset(new Renderer_agg<typename RGBA::PixelFormat>(32));
break;
+ default:
+ std::abort();
}
const size_t width = im.width();
-----------------------------------------------------------------------
Summary of changes:
libcore/PropFlags.h | 83 ++++++++-----------------------
libcore/Property.h | 2 +-
libcore/PropertyList.cpp | 4 +-
libcore/as_object.h | 2 +-
libcore/asobj/Object.cpp | 2 +-
librender/agg/Renderer_agg.cpp | 4 +-
testsuite/libcore.all/PropFlagsTest.cpp | 82 +++++++++++++++++++++---------
7 files changed, 87 insertions(+), 92 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. c56b63ed2d5ebcdbb133fc86540b8612e5aa28cd,
Benjamin Wolsey <=