From 09c41019a8ecb259b2376b5c22c99f54b59f8f24 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Mar 2013 19:13:04 +0000 Subject: use const pointers for file loading and booleans for animation system return values passed as pointers. --- source/blender/blenkernel/intern/blender.c | 6 +++--- source/blender/blenkernel/intern/fcurve.c | 26 +++++++++++++------------- source/blender/blenkernel/intern/fmodifier.c | 10 +++++----- 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 82b3b4f5618..fa6aafabe05 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -461,7 +461,7 @@ int BKE_read_file(bContext *C, const char *filepath, ReportList *reports) return (bfd ? retval : BKE_READ_FILE_FAIL); } -int BKE_read_file_from_memory(bContext *C, char *filebuf, int filelength, ReportList *reports) +int BKE_read_file_from_memory(bContext *C, const void *filebuf, int filelength, ReportList *reports) { BlendFileData *bfd; @@ -906,7 +906,7 @@ static void copybuffer_doit(void *UNUSED(handle), Main *UNUSED(bmain), void *vid } /* frees main in end */ -int BKE_copybuffer_save(char *filename, ReportList *reports) +int BKE_copybuffer_save(const char *filename, ReportList *reports) { Main *mainb = MEM_callocN(sizeof(Main), "copybuffer"); ListBase *lbarray[MAX_LIBARRAY], *fromarray[MAX_LIBARRAY]; @@ -959,7 +959,7 @@ int BKE_copybuffer_save(char *filename, ReportList *reports) } /* return success (1) */ -int BKE_copybuffer_paste(bContext *C, char *libname, ReportList *reports) +int BKE_copybuffer_paste(bContext *C, const char *libname, ReportList *reports) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index bc396d218df..594b887d361 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -169,7 +169,7 @@ void copy_fcurves(ListBase *dst, ListBase *src) /* ----------------- Finding F-Curves -------------------------- */ /* high level function to get an fcurve from C without having the rna */ -FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index, char *driven) +FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index, bool *r_driven) { /* anim vars */ AnimData *adt = BKE_animdata_from_id(id); @@ -180,8 +180,8 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro PropertyRNA *prop; char *path; - if (driven) - *driven = FALSE; + if (r_driven) + *r_driven = false; /* only use the current action ??? */ if (ELEM(NULL, adt, adt->action)) @@ -201,8 +201,8 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro /* if not animated, check if driven */ if ((fcu == NULL) && (adt->drivers.first)) { fcu = list_find_fcurve(&adt->drivers, path, index); - if (fcu && driven) - *driven = TRUE; + if (fcu && r_driven) + *r_driven = true; fcu = NULL; } @@ -305,11 +305,11 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, return matches; } -FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, int *driven) +FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, bool *r_driven) { FCurve *fcu = NULL; - *driven = 0; + *r_driven = false; /* there must be some RNA-pointer + property combon */ if (prop && ptr->id.data && RNA_property_animateable(ptr, prop)) { @@ -331,7 +331,7 @@ FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction fcu = list_find_fcurve(&adt->drivers, path, rnaindex); if (fcu) - *driven = 1; + *r_driven = true; } if (fcu && action) @@ -354,13 +354,13 @@ FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction /* Binary search algorithm for finding where to insert BezTriple. (for use by insert_bezt_fcurve) * Returns the index to insert at (data already at that index will be offset if replace is 0) */ -int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short *replace) +int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, bool *r_replace) { int start = 0, end = arraylen; int loopbreaker = 0, maxloop = arraylen * 2; /* initialize replace-flag first */ - *replace = 0; + *r_replace = false; /* sneaky optimizations (don't go through searching process if...): * - keyframe to be added is to be added out of current bounds @@ -377,7 +377,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short /* 'First' Keyframe (when only one keyframe, this case is used) */ framenum = array[0].vec[1][0]; if (IS_EQT(frame, framenum, BEZT_BINARYSEARCH_THRESH)) { - *replace = 1; + *r_replace = true; return 0; } else if (frame < framenum) @@ -386,7 +386,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short /* 'Last' Keyframe */ framenum = array[(arraylen - 1)].vec[1][0]; if (IS_EQT(frame, framenum, BEZT_BINARYSEARCH_THRESH)) { - *replace = 1; + *r_replace = true; return (arraylen - 1); } else if (frame > framenum) @@ -404,7 +404,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short /* check if exactly equal to midpoint */ if (IS_EQT(frame, midfra, BEZT_BINARYSEARCH_THRESH)) { - *replace = 1; + *r_replace = true; return mid; } diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index c3fc659137d..19912a19d94 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -487,13 +487,13 @@ static FModifierTypeInfo FMI_ENVELOPE = { */ #define BINARYSEARCH_FRAMEEQ_THRESH 0.0001f -int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int arraylen, short *exists) +int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int arraylen, bool *r_exists) { int start = 0, end = arraylen; int loopbreaker = 0, maxloop = arraylen * 2; /* initialize exists-flag first */ - *exists = 0; + *r_exists = false; /* sneaky optimizations (don't go through searching process if...): * - keyframe to be added is to be added out of current bounds @@ -510,7 +510,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array /* 'First' Point (when only one point, this case is used) */ framenum = array[0].time; if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) { - *exists = 1; + *r_exists = true; return 0; } else if (frame < framenum) { @@ -520,7 +520,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array /* 'Last' Point */ framenum = array[(arraylen - 1)].time; if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) { - *exists = 1; + *r_exists = true; return (arraylen - 1); } else if (frame > framenum) { @@ -539,7 +539,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array /* check if exactly equal to midpoint */ if (IS_EQT(frame, midfra, BINARYSEARCH_FRAMEEQ_THRESH)) { - *exists = 1; + *r_exists = true; return mid; } -- cgit v1.2.3