Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-02-05 18:02:22 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-05 18:03:02 +0400
commit41d23116aa4ed36aec8b480ce2fc207d72ad88ce (patch)
treebc1b759e677ffa16ed7222a71e9b6cf3caa25936 /source
parent1687023776a3ce0de41a4cfe0ebc72a5ebadabe4 (diff)
Scanfill: malloc arrays and zero init members
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_lattice.h9
-rw-r--r--source/blender/blenlib/BLI_kdopbvh.h2
-rw-r--r--source/blender/blenlib/intern/scanfill.c13
3 files changed, 10 insertions, 14 deletions
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index c7e9fe54814..d4d765d591e 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -50,11 +50,7 @@ void BKE_lattice_make_local(struct Lattice *lt);
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du);
struct LatticeDeformData;
-struct LatticeDeformData *init_latt_deform(struct Object *oblatt, struct Object *ob)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-#endif
-;
+struct LatticeDeformData *init_latt_deform(struct Object *oblatt, struct Object *ob) ATTR_WARN_UNUSED_RESULT;
void calc_latt_deform(struct LatticeDeformData *lattice_deform_data, float co[3], float weight);
void end_latt_deform(struct LatticeDeformData *lattice_deform_data);
@@ -94,5 +90,4 @@ int BKE_lattice_index_flip(struct Lattice *lt, const int index,
void BKE_lattice_bitmap_from_flag(struct Lattice *lt, unsigned int *bitmap, const short flag,
const bool clear, const bool respecthide);
-#endif
-
+#endif /* __BKE_LATTICE_H__ */
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index bf7bd3d99b2..7b00fd90bf6 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -39,8 +39,6 @@
extern "C" {
#endif
-#include <float.h>
-
struct BVHTree;
typedef struct BVHTree BVHTree;
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 5ef8f334dba..2f4c97e89c5 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -471,7 +471,7 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl
/* STEP 1: make using FillVert and FillEdge lists a sorted
* ScanFillVertLink list
*/
- sc = scdata = (ScanFillVertLink *)MEM_callocN(pf->verts * sizeof(ScanFillVertLink), "Scanfill1");
+ sc = scdata = MEM_mallocN(sizeof(*scdata) * pf->verts, "Scanfill1");
verts = 0;
for (eve = sf_ctx->fillvertbase.first; eve; eve = eve->next) {
if (eve->poly_nr == nr) {
@@ -479,6 +479,7 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl
verts++;
eve->f = 0; /* flag for connectedges later on */
sc->vert = eve;
+ sc->edge_first = sc->edge_last = NULL;
/* if (even->tmp.v == NULL) eve->tmp.u = verts; */ /* Note, debug print only will work for curve polyfill, union is in use for mesh */
sc++;
}
@@ -1014,12 +1015,14 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const
/* STEP 3: MAKE POLYFILL STRUCT */
- pflist = (PolyFill *)MEM_callocN((size_t)poly * sizeof(PolyFill), "edgefill");
+ pflist = MEM_mallocN(sizeof(*pflist) * (size_t)poly, "edgefill");
pf = pflist;
for (a = 1; a <= poly; a++) {
- pf->nr = a;
+ pf->edges = pf->verts = 0;
pf->min_xy[0] = pf->min_xy[1] = 1.0e20f;
pf->max_xy[0] = pf->max_xy[1] = -1.0e20f;
+ pf->f = 0;
+ pf->nr = a;
pf++;
}
for (eed = sf_ctx->filledgebase.first; eed; eed = eed->next) {
@@ -1057,8 +1060,8 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const
pf++;
}
#endif
-
- polycache = pc = MEM_callocN(sizeof(short) * (size_t)poly, "polycache");
+
+ polycache = pc = MEM_callocN(sizeof(*polycache) * (size_t)poly, "polycache");
pf = pflist;
for (a = 0; a < poly; a++, pf++) {
for (c = (unsigned short)(a + 1); c < poly; c++) {