[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50566] trunk/blender: - cmake macro list_insert_after/ list_insert_before now error when the item passed is not found in the list.

Campbell Barton ideasman42 at gmail.com
Thu Sep 13 03:52:58 CEST 2012


Revision: 50566
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50566
Author:   campbellbarton
Date:     2012-09-13 01:52:58 +0000 (Thu, 13 Sep 2012)
Log Message:
-----------
- cmake macro list_insert_after/list_insert_before now error when the item passed is not found in the list.
- BKE_pose_copy_data() check for target pointer is no longer valid and infact comparing against un-initialized memory in some cases.

Modified Paths:
--------------
    trunk/blender/build_files/cmake/macros.cmake
    trunk/blender/source/blender/blenkernel/intern/action.c

Modified: trunk/blender/build_files/cmake/macros.cmake
===================================================================
--- trunk/blender/build_files/cmake/macros.cmake	2012-09-13 01:50:21 UTC (rev 50565)
+++ trunk/blender/build_files/cmake/macros.cmake	2012-09-13 01:52:58 UTC (rev 50566)
@@ -27,7 +27,10 @@
 	list_id item_check item_add
 	)
 	set(_index)
-	list(FIND ${list_id} "${item_check}" _index)
+	list(FIND "${list_id}" "${item_check}" _index)
+	if("${_index}" MATCHES "-1")
+		message(FATAL_ERROR "'${list_id}' doesn't contain '${item_check}'")
+	endif()
 	math(EXPR _index "${_index} + 1")
 	list(INSERT ${list_id} "${_index}" ${item_add})
 	unset(_index)
@@ -37,7 +40,10 @@
 	list_id item_check item_add
 	)
 	set(_index)
-	list(FIND ${list_id} "${item_check}" _index)
+	list(FIND "${list_id}" "${item_check}" _index)
+	if("${_index}" MATCHES "-1")
+		message(FATAL_ERROR "'${list_id}' doesn't contain '${item_check}'")
+	endif()
 	list(INSERT ${list_id} "${_index}" ${item_add})
 	unset(_index)
 endmacro()

Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c	2012-09-13 01:50:21 UTC (rev 50565)
+++ trunk/blender/source/blender/blenkernel/intern/action.c	2012-09-13 01:52:58 UTC (rev 50566)
@@ -526,18 +526,12 @@
 	bPose *outPose;
 	bPoseChannel *pchan;
 	ListBase listb;
-	
+
 	if (!src) {
 		*dst = NULL;
 		return;
 	}
 	
-	if (*dst == src) {
-		printf("BKE_pose_copy_data source and target are the same\n");
-		*dst = NULL;
-		return;
-	}
-	
 	outPose = MEM_callocN(sizeof(bPose), "pose");
 	
 	BLI_duplicatelist(&outPose->chanbase, &src->chanbase);




More information about the Bf-blender-cvs mailing list