[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58833] branches/ soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c : UV transfer through faces: memory reallocation fix

Walid Shouman eng.walidshouman at gmail.com
Fri Aug 2 20:19:09 CEST 2013


Revision: 58833
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58833
Author:   walid
Date:     2013-08-02 18:19:08 +0000 (Fri, 02 Aug 2013)
Log Message:
-----------
UV transfer through faces: memory reallocation fix

Modified Paths:
--------------
    branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c

Modified: branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c
===================================================================
--- branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c	2013-08-02 18:14:44 UTC (rev 58832)
+++ branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c	2013-08-02 18:19:08 UTC (rev 58833)
@@ -1633,12 +1633,16 @@
 			if (fl_table[f_src->head.index].f == NULL) {	//if the face source reperesnts a new entry
 				f_src_table[f_src_count] = f_src;
 				f_src_count++;
+				fl_table[f_src->head.index].l = MEM_mallocN(sizeof(*(fl_table[f_src->head.index].l)) * (f_dst->len), "fl_table.l bmesh_data_transfer.c");
 			}
 
+			else {
+				fl_table[f_src->head.index].l = MEM_reallocN(fl_table[f_src->head.index].l,
+				        sizeof(*(fl_table[f_src->head.index].l)) * (fl_table[f_src->head.index].count + f_dst->len));
+			}
+
 			fl_table[f_src->head.index].f = f_src;
 			fl_table[f_src->head.index].count += f_dst->len;	//we need count to be init with zero (calloc) in adv
-			///check the type inside sizeof
-			fl_table[f_src->head.index].l = MEM_mallocN(sizeof(*(fl_table[f_src->head.index].l)) * (fl_table[f_src->head.index].count), "fl_table.l bmesh_data_transfer.c");
 
 			//get a coordinate list of the f verts
 			BM_ITER_ELEM_INDEX (v2, &iter2, f_src, BM_VERTS_OF_FACE, v_src_count) {
@@ -1690,7 +1694,7 @@
 			//within it search for the neighboring faces
 			BM_ITER_ELEM (e, &eiter, f_src, BM_EDGES_OF_FACE) {
 
-				if (BM_edge_face_pair (e, &fa, &fb) == true) {
+				if (BM_edge_face_pair(e, &fa, &fb) == true) {
 
 					f_n = (fa->head.index == f_src->head.index) ? fb: fa;
 					//if any of them was found in our src tables




More information about the Bf-blender-cvs mailing list