[cluttermm] Fix issue with last commit where returned vectors were 2x intended size.



commit 03288a2f159c1ad0d9afac990173478f81b1b262
Author: Chris Kühl <chrisk openismus com>
Date:   Tue Sep 7 23:07:52 2010 +0200

    Fix issue with last commit where returned vectors were 2x intended size.
    
    	* clutter/src/behaviour.ccg: Fixed vector size issue.
    	* clutter/src/container.ccg: Fixed vector size issue.
    	* clutter/src/score.ccg: Fixed vector size issue.
    	* clutter/src/script.ccg: Fixed vector size issue.
    	* clutter/src/timeline.ccg: Fixed vector size issue.

 ChangeLog                 |   34 ++++++++++++++++++++++------------
 clutter/src/behaviour.ccg |   10 ++++++----
 clutter/src/container.ccg |   10 ++++++----
 clutter/src/score.ccg     |   10 ++++++----
 clutter/src/script.ccg    |   10 ++++++----
 clutter/src/timeline.ccg  |    3 ++-
 6 files changed, 48 insertions(+), 29 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e90bc61..bd4730b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,20 +1,30 @@
 2010-09-07  Chris Kühl  <chrisk openismus com>
 
+	Fix issue with last commit where returned vectors were 2x intended size.
+
+	* clutter/src/behaviour.ccg: Fixed vector size issue.
+	* clutter/src/container.ccg: Fixed vector size issue.
+	* clutter/src/score.ccg: Fixed vector size issue.
+	* clutter/src/script.ccg: Fixed vector size issue.
+	* clutter/src/timeline.ccg: Fixed vector size issue.
+
+2010-09-07  Chris Kühl  <chrisk openismus com>
+
 	Replaced use of Glib::*Handle containers with std::vector.
 
-	* clutter/src/behaviour-path.[hg|ccg]: create_with_knots takes std::vector
-					       instead of Glib::ArrayHandle.
-	* clutter/src/behaviour.[hg|ccg]: get_actor returns std::vector instead of
-	                                  Glib::SListHandle.
-	* clutter/src/container.[hg|ccg]: get_children returns std::vector instead of
-	                                  Glib::ListHandle.
-	* clutter/src/score.[hg|ccg]: list_timelines returns std::vector instead of
-	                              Glib::ListHandle.
-	* clutter/src/script.[hg|ccg]: add_search_path takes std::vector
-				       instead of Glib::ArrayHandle.
+	* clutter/src/behaviour-path.[hg|ccg]: create_with_knots takes
+	std::vector instead of Glib::ArrayHandle.
+	* clutter/src/behaviour.[hg|ccg]: get_actor returns std::vector instead
+	of Glib::SListHandle.
+	* clutter/src/container.[hg|ccg]: get_children returns std::vector
+	instead of Glib::ListHandle.
+	* clutter/src/score.[hg|ccg]: list_timelines returns std::vector instead
+	of Glib::ListHandle.
+	* clutter/src/script.[hg|ccg]: add_search_path takes std::vector instead
+	of Glib::ArrayHandle.
 	* clutter/src/stage.[hg|ccg]: Removed trailing whitespace.
-	* clutter/src/timeline.[hg|ccg]: list_markers returns std::vector instead of
-	                                 Glib::StringArrayHandle.
+	* clutter/src/timeline.[hg|ccg]: list_markers returns std::vector instead
+	of Glib::StringArrayHandle.
 
 2010-09-02   Luca Wehrstedt  <lerks users sourceforge net>
 
diff --git a/clutter/src/behaviour.ccg b/clutter/src/behaviour.ccg
index 5341a86..a438e57 100644
--- a/clutter/src/behaviour.ccg
+++ b/clutter/src/behaviour.ccg
@@ -50,8 +50,9 @@ std::vector<Glib::RefPtr<Actor> > Behaviour::get_actors()
 {
   GSList* actorList = clutter_behaviour_get_actors(gobj());
 
-  uint actorCount = g_slist_length(actorList);
-  std::vector<Glib::RefPtr<Actor> > actorVec(actorCount);
+  const uint actorCount = g_slist_length(actorList);
+  std::vector<Glib::RefPtr<Actor> > actorVec;
+  actorVec.reserve(actorCount);
 
   for(GSList* actorNode = actorList; actorNode->next != NULL; actorNode = actorList->next)
   {
@@ -65,8 +66,9 @@ std::vector<Glib::RefPtr<const Actor> > Behaviour::get_actors() const
 {
   GSList* actorList = clutter_behaviour_get_actors(const_cast<ClutterBehaviour*>(gobj()));
 
-  uint actorCount = g_slist_length(actorList);
-  std::vector<Glib::RefPtr<const Actor> > actorVec(actorCount);
+  const uint actorCount = g_slist_length(actorList);
+  std::vector<Glib::RefPtr<const Actor> > actorVec;
+  actorVec.reserve(actorCount);
 
   for(GSList* actorNode = actorList; actorNode->next != NULL; actorNode = actorList->next)
   {
diff --git a/clutter/src/container.ccg b/clutter/src/container.ccg
index fc83eb8..c33b02c 100644
--- a/clutter/src/container.ccg
+++ b/clutter/src/container.ccg
@@ -82,8 +82,9 @@ void Container::actor_removed(const Glib::RefPtr<Actor>& actor)
 std::vector<Glib::RefPtr<Actor> > Container::get_children()
 {
   GList* actorList = clutter_container_get_children(gobj());
-  uint actorCount = g_list_length(actorList);
-  std::vector<Glib::RefPtr<Actor> > actorVec(actorCount);
+  const uint actorCount = g_list_length(actorList);
+  std::vector<Glib::RefPtr<Actor> > actorVec;
+  actorVec.reserve(actorCount);
 
   for(GList* actorNode = actorList; actorNode->next != NULL; actorNode = actorList->next)
   {
@@ -96,8 +97,9 @@ std::vector<Glib::RefPtr<Actor> > Container::get_children()
 std::vector<Glib::RefPtr<const Actor> > Container::get_children() const
 {
   GList* actorList = clutter_container_get_children(const_cast<ClutterContainer*>(gobj()));
-  uint actorCount = g_list_length(actorList);
-  std::vector<Glib::RefPtr<const Actor> > actorVec(actorCount);
+  const uint actorCount = g_list_length(actorList);
+  std::vector<Glib::RefPtr<const Actor> > actorVec;
+  actorVec.reserve(actorCount);
 
   for(GList* actorNode = actorList; actorNode->next != NULL; actorNode = actorList->next)
   {
diff --git a/clutter/src/score.ccg b/clutter/src/score.ccg
index 2ca69dd..f05a5b1 100644
--- a/clutter/src/score.ccg
+++ b/clutter/src/score.ccg
@@ -28,8 +28,9 @@ gulong Score::append(const Glib::RefPtr<Timeline>& timeline)
 std::vector<Glib::RefPtr<Timeline> > Score::list_timelines()
 {
   GSList* timelineList = clutter_score_list_timelines(gobj());
-  uint timelineCount = g_slist_length(timelineList);
-  std::vector<Glib::RefPtr<Timeline> > timelineVec(timelineCount);
+  const uint timelineCount = g_slist_length(timelineList);
+  std::vector<Glib::RefPtr<Timeline> > timelineVec;
+  timelineVec.reserve(timelineCount);
 
   for(GSList* timelineNode = timelineList; timelineNode->next != NULL; timelineNode = timelineList->next)
   {
@@ -42,8 +43,9 @@ std::vector<Glib::RefPtr<Timeline> > Score::list_timelines()
     std::vector<Glib::RefPtr<const Timeline> > Score::list_timelines() const
 {
   GSList* timelineList = clutter_score_list_timelines(const_cast<ClutterScore*>(gobj()));
-  uint timelineCount = g_slist_length(timelineList);
-  std::vector<Glib::RefPtr<const Timeline> > timelineVec(timelineCount);
+  const uint timelineCount = g_slist_length(timelineList);
+  std::vector<Glib::RefPtr<const Timeline> > timelineVec;
+  timelineVec.reserve(timelineCount);
 
   for(GSList* timelineNode = timelineList; timelineNode->next != NULL; timelineNode = timelineList->next)
   {
diff --git a/clutter/src/script.ccg b/clutter/src/script.ccg
index 5712e05..85482b9 100644
--- a/clutter/src/script.ccg
+++ b/clutter/src/script.ccg
@@ -56,8 +56,9 @@ std::vector<Glib::RefPtr<Glib::Object> > Script::list_objects()
 {
   GList* objectList = clutter_script_list_objects(gobj());
 
-  uint objectCount = g_list_length(objectList);
-  std::vector<Glib::RefPtr<Glib::Object> > objectVec(objectCount);
+  const uint objectCount = g_list_length(objectList);
+  std::vector<Glib::RefPtr<Glib::Object> > objectVec;
+  objectVec.reserve(objectCount);
 
   for(GList* objectNode = objectList; objectNode->next != NULL; objectNode = objectList->next)
   {
@@ -71,8 +72,9 @@ std::vector<Glib::RefPtr<const Glib::Object> > Script::list_objects() const
 {
   GList* objectList = clutter_script_list_objects(const_cast<ClutterScript*>(gobj()));
 
-  uint objectCount = g_list_length(objectList);
-  std::vector<Glib::RefPtr<const Glib::Object> > objectVec(objectCount);
+  const uint objectCount = g_list_length(objectList);
+  std::vector<Glib::RefPtr<const Glib::Object> > objectVec;
+  objectVec.reserve(objectCount);
 
   for(GList* objectNode = objectList; objectNode->next != NULL; objectNode = objectList->next)
   {
diff --git a/clutter/src/timeline.ccg b/clutter/src/timeline.ccg
index 3ba5c1e..b4927e3 100644
--- a/clutter/src/timeline.ccg
+++ b/clutter/src/timeline.ccg
@@ -30,7 +30,8 @@ std::vector<Glib::ustring> Timeline::list_markers(gint frame_num) const
   gsize n_markers = 0;
   gchar** const markers = clutter_timeline_list_markers(const_cast<ClutterTimeline*>(gobj()),
                                                         frame_num, &n_markers);
-  std::vector<Glib::ustring> markerVec(n_markers);
+  std::vector<Glib::ustring> markerVec;
+  markerVec.reserve(n_markers);
 
   for (int i = 0; i < n_markers; ++i)
   {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]