[Bf-blender-cvs] [6ce67a8] master: For increased type safety, ANIM_animdata_filter() now specifies the enums its arguments can use

Joshua Leung noreply at git.blender.org
Thu May 22 05:47:53 CEST 2014


Commit: 6ce67a8eab884c69837381fb55f6ec86d5614cef
Author: Joshua Leung
Date:   Thu May 22 15:46:51 2014 +1200
https://developer.blender.org/rB6ce67a8eab884c69837381fb55f6ec86d5614cef

For increased type safety, ANIM_animdata_filter() now specifies the enums its arguments can use

Hopefully this should help prevent bugs lik T40304 from occurring again.

===================================================================

M	source/blender/editors/animation/anim_filter.c
M	source/blender/editors/include/ED_anim_api.h

===================================================================

diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 6c28d05..b80e29b 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -2619,7 +2619,7 @@ static size_t animdata_filter_remove_duplis(ListBase *anim_data)
  *		will be placed for use.
  *	filter_mode: how should the data be filtered - bitmapping accessed flags
  */
-size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mode, void *data, short datatype)
+size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_Flags filter_mode, void *data, eAnimCont_Types datatype)
 {
 	size_t items = 0;
 	
@@ -2712,6 +2712,13 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
 				items = animdata_filter_animchan(ac, anim_data, ads, data, filter_mode);
 				break;
 			}
+			
+			/* unhandled */
+			default:
+			{
+				printf("ANIM_animdata_filter() - Invalid datatype argument %d\n", datatype);
+				break;
+			}
 		}
 
 		/* remove any 'weedy' entries */
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 37c9e0b..02cc86e 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -111,12 +111,12 @@ typedef struct bAnimListElem {
 	struct bAnimListElem *next, *prev;
 	
 	void    *data;          /* source data this elem represents */
-	int     type;           /* one of the ANIMTYPE_* values */
+	int     type;           /* (eAnim_ChannelType) one of the ANIMTYPE_* values */
 	int     flag;           /* copy of elem's flags for quick access */
-	int     index;          /* for un-named data, the index of the data in it's collection */
+	int     index;          /* for un-named data, the index of the data in its collection */
 	
-	short   update;         /* tag the element for updating (eAnim_Update_Flags) */
-	short   datatype;       /* type of motion data to expect */
+	short   update;         /* (eAnim_Update_Flags)  tag the element for updating */
+	short   datatype;       /* (eAnim_KeyType) type of motion data to expect */
 	void   *key_data;       /* motion data - mostly F-Curves, but can be other types too */
 	
 	
@@ -358,7 +358,7 @@ typedef enum eAnimFilter_Flags {
 /* Obtain list of filtered Animation channels to operate on.
  * Returns the number of channels in the list
  */
-size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mode, void *data, short datatype);
+size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_Flags filter_mode, void *data, eAnimCont_Types datatype);
 
 /* Obtain current anim-data context from Blender Context info.
  * Returns whether the operation was successful.




More information about the Bf-blender-cvs mailing list