diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-12 09:54:33 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-12 09:54:33 +0400 |
commit | 7b707fff56209d8997a2d52dde6f38e67be56c31 (patch) | |
tree | 748df8091f8c8f32634f3ff17f44e10ac58fc260 | |
parent | b6345616a7a450c88d3e0eed4f953fbcc225597e (diff) |
correct assert for driver evaluation,
also add asserts for listbase functions when the list is NULL, and use noreturn attribute for jpeg_error.
-rw-r--r-- | intern/guardedalloc/MEM_guardedalloc.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/listbase.c | 19 | ||||
-rw-r--r-- | source/blender/imbuf/intern/jpeg.c | 6 |
4 files changed, 26 insertions, 3 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index dd22cf7c484..a3988bef92a 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -84,10 +84,12 @@ extern "C" { */ short MEM_freeN(void *vmemh); +#if 0 /* UNUSED */ /** * Return zero if memory is not in allocated list */ short MEM_testN(void *vmemh); +#endif /** * Duplicates a block of memory, and returns a pointer to the diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index c86ee11985a..8d3d503a33c 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1248,7 +1248,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar) float tmp_loc[3]; /* after the checks above, the targets should be valid here... */ - BLI_assert((ob != NULL) && (GS(ob->id.name) != ID_OB)); + BLI_assert((ob != NULL) && (GS(ob->id.name) == ID_OB)); /* try to get posechannel */ pchan = BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index f5f67ba3645..c5b10de3ff2 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -71,6 +71,7 @@ void BLI_addhead(ListBase *listbase, void *vlink) Link *link = vlink; if (link == NULL) return; + BLI_assert(listbase != NULL); if (listbase == NULL) return; link->next = listbase->first; @@ -90,6 +91,7 @@ void BLI_addtail(ListBase *listbase, void *vlink) Link *link = vlink; if (link == NULL) return; + BLI_assert(listbase != NULL); if (listbase == NULL) return; link->next = NULL; @@ -109,6 +111,7 @@ void BLI_remlink(ListBase *listbase, void *vlink) Link *link = vlink; if (link == NULL) return; + BLI_assert(listbase != NULL); if (listbase == NULL) return; if (link->next) link->next->prev = link->prev; @@ -141,6 +144,7 @@ void BLI_freelinkN(ListBase *listbase, void *vlink) Link *link = vlink; if (link == NULL) return; + BLI_assert(listbase != NULL); if (listbase == NULL) return; BLI_remlink(listbase, link); @@ -160,6 +164,7 @@ void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *)) Link *next = NULL; if (cmp == NULL) return; + BLI_assert(listbase != NULL); if (listbase == NULL) return; if (listbase->first != listbase->last) { @@ -189,6 +194,7 @@ void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) /* newlink before nextlink */ if (newlink == NULL) return; + BLI_assert(listbase != NULL); if (listbase == NULL) return; /* empty list */ @@ -231,6 +237,7 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) /* newlink before nextlink */ if (newlink == NULL) return; + BLI_assert(listbase != NULL); if (listbase == NULL) return; /* empty list */ @@ -270,6 +277,7 @@ void BLI_freelist(ListBase *listbase) { Link *link, *next; + BLI_assert(listbase != NULL); if (listbase == NULL) return; @@ -291,6 +299,7 @@ void BLI_freelistN(ListBase *listbase) { Link *link, *next; + BLI_assert(listbase != NULL); if (listbase == NULL) return; link = listbase->first; @@ -367,6 +376,7 @@ int BLI_findindex(const ListBase *listbase, const void *vlink) Link *link = NULL; int number = 0; + BLI_assert(listbase != NULL); if (listbase == NULL) return -1; if (vlink == NULL) return -1; @@ -391,6 +401,7 @@ void *BLI_findstring(const ListBase *listbase, const char *id, const int offset) Link *link = NULL; const char *id_iter; + BLI_assert(listbase != NULL); if (listbase == NULL) return NULL; for (link = listbase->first; link; link = link->next) { @@ -413,6 +424,7 @@ void *BLI_rfindstring(const ListBase *listbase, const char *id, const int offset Link *link = NULL; const char *id_iter; + BLI_assert(listbase != NULL); if (listbase == NULL) return NULL; for (link = listbase->last; link; link = link->prev) { @@ -435,6 +447,7 @@ void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int off Link *link = NULL; const char *id_iter; + BLI_assert(listbase != NULL); if (listbase == NULL) return NULL; for (link = listbase->first; link; link = link->next) { @@ -458,6 +471,7 @@ void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int of Link *link = NULL; const char *id_iter; + BLI_assert(listbase != NULL); if (listbase == NULL) return NULL; for (link = listbase->last; link; link = link->prev) { @@ -481,6 +495,7 @@ void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset) Link *link = NULL; const void *ptr_iter; + BLI_assert(listbase != NULL); if (listbase == NULL) return NULL; for (link = listbase->first; link; link = link->next) { @@ -504,6 +519,7 @@ void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset) Link *link = NULL; const void *ptr_iter; + BLI_assert(listbase != NULL); if (listbase == NULL) return NULL; for (link = listbase->last; link; link = link->prev) { @@ -528,6 +544,7 @@ int BLI_findstringindex(const ListBase *listbase, const char *id, const int offs const char *id_iter; int i = 0; + BLI_assert(listbase != NULL); if (listbase == NULL) return -1; link = listbase->first; @@ -607,7 +624,7 @@ LinkData *BLI_genericNodeN(void *data) return NULL; /* create new link, and make it hold the given data */ - ld = MEM_callocN(sizeof(LinkData), "BLI_genericNodeN()"); + ld = MEM_callocN(sizeof(LinkData), __func__); ld->data = data; return ld; diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 1ace364482f..9bb625a64b0 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -59,7 +59,11 @@ #define IS_maxjpg(x) ((x->ftype & JPG_MSK) == JPG_MAX) /* the types are from the jpeg lib */ -static void jpeg_error(j_common_ptr cinfo); +static void jpeg_error(j_common_ptr cinfo) +#ifdef __GNUC__ +__attribute__((noreturn)); +#endif +; static void init_source(j_decompress_ptr cinfo); static boolean fill_input_buffer(j_decompress_ptr cinfo); static void skip_input_data(j_decompress_ptr cinfo, long num_bytes); |