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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-09-10 23:23:39 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-09-10 23:23:39 +0400
commit92d94ccb084df36ab7fd39f0258a7189356d9966 (patch)
tree0cc07aae4dd1b24f2412b289d8dc5d4cff22bf01
parentba13c1606510a5bc92504698f3c4edad53d4480b (diff)
misc minor changes
- make cmake osx use of -ftemplate-depth match scons. - use array size within sizeof(), more compact. - replace AT with __func__ where the function is unique enough. - BLI_box_pack_2D -> 2d to match other functions. - rename new mesh normal calculation to mesh.calc_normals_split()
-rw-r--r--CMakeLists.txt10
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.c15
-rw-r--r--source/blender/blenlib/BLI_boxpack2d.h2
-rw-r--r--source/blender/blenlib/intern/boxpack2d.c2
-rw-r--r--source/blender/bmesh/operators/bmo_hull.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c2
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c6
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c2
8 files changed, 24 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 96853353dbe..caaf913f163 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1784,8 +1784,14 @@ elseif(APPLE)
set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
endif()
- # Xcode 5 has too low template depth of 128 for libmv
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
+ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ if(${CMAKE_GENERATOR} MATCHES "Xcode")
+ if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
+ # Xcode 5 has too low template depth of 128 for libmv
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
+ endif()
+ endif()
+ endif()
endif()
#-----------------------------------------------------------------------------
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index a295beab804..07dfae2f28a 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -118,8 +118,8 @@ void BKE_mesh_calc_normals_mapping_ex(
return;
}
- if (!pnors) pnors = MEM_callocN(sizeof(float) * 3 * (size_t)numPolys, __func__);
- /* if (!fnors) fnors = MEM_callocN(sizeof(float) * 3 * numFaces, "face nors mesh.c"); */ /* NO NEED TO ALLOC YET */
+ if (!pnors) pnors = MEM_callocN(sizeof(float[3]) * (size_t)numPolys, __func__);
+ /* if (!fnors) fnors = MEM_callocN(sizeof(float[3]) * numFaces, "face nors mesh.c"); */ /* NO NEED TO ALLOC YET */
if (only_face_normals == FALSE) {
@@ -334,7 +334,7 @@ void BKE_mesh_normals_loop_split(MVert *mverts, int UNUSED(numVerts), MEdge *med
* unset: INDEX_UNSET
* Note that currently we only have two values for second loop of sharp edges. However, if needed, we can
* store the negated value of loop index instead of INDEX_INVALID to retrieve th real value later in code).
- * Note also that lose edges always have the value 0!
+ * Note also that lose edges always have both values set to 0!
*/
int (*edge_to_loops)[2] = MEM_callocN(sizeof(int[2]) * (size_t)numEdges, __func__);
@@ -1109,7 +1109,7 @@ void BKE_mesh_vert_edge_map_create(MeshElemMap **r_map, int **r_mem,
const MEdge *medge, int totvert, int totedge)
{
MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * (size_t)totvert, "vert-edge map");
- int *indices = MEM_mallocN(sizeof(int) * (size_t)totedge * 2, "vert-edge map mem");
+ int *indices = MEM_mallocN(sizeof(int[2]) * (size_t)totedge, "vert-edge map mem");
int *i_pt = indices;
int i;
@@ -1732,6 +1732,7 @@ static void bm_corners_to_loops_ex(ID *id, CustomData *fdata, CustomData *ldata,
else {
const int side = (int)sqrtf((float)(fd->totdisp / corners));
const int side_sq = side * side;
+ const size_t disps_size = sizeof(float[3]) * (size_t)side_sq;
for (i = 0; i < tot; i++, disps += side_sq, ld++) {
ld->totdisp = side_sq;
@@ -1740,12 +1741,12 @@ static void bm_corners_to_loops_ex(ID *id, CustomData *fdata, CustomData *ldata,
if (ld->disps)
MEM_freeN(ld->disps);
- ld->disps = MEM_mallocN(sizeof(float) * (size_t)(3 * side_sq), "converted loop mdisps");
+ ld->disps = MEM_mallocN(disps_size, "converted loop mdisps");
if (fd->disps) {
- memcpy(ld->disps, disps, sizeof(float) * (size_t)(3 * side_sq));
+ memcpy(ld->disps, disps, disps_size);
}
else {
- memset(ld->disps, 0, sizeof(float) * (size_t)(3 * side_sq));
+ memset(ld->disps, 0, disps_size);
}
}
}
diff --git a/source/blender/blenlib/BLI_boxpack2d.h b/source/blender/blenlib/BLI_boxpack2d.h
index 3bc486054f5..8316987dfcd 100644
--- a/source/blender/blenlib/BLI_boxpack2d.h
+++ b/source/blender/blenlib/BLI_boxpack2d.h
@@ -46,7 +46,7 @@ typedef struct BoxPack {
struct BoxVert *v[4];
} BoxPack;
-void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float *tot_height);
+void BLI_box_pack_2d(BoxPack *boxarray, const int len, float *tot_width, float *tot_height);
#endif
diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c
index 1087b02b3bb..8707be46196 100644
--- a/source/blender/blenlib/intern/boxpack2d.c
+++ b/source/blender/blenlib/intern/boxpack2d.c
@@ -156,7 +156,7 @@ static int vertex_sort(const void *p1, const void *p2)
* len - the number of boxes in the array.
* tot_width and tot_height are set so you can normalize the data.
* */
-void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float *tot_height)
+void BLI_box_pack_2d(BoxPack *boxarray, const int len, float *tot_width, float *tot_height)
{
BoxVert *vert; /* the current vert */
int box_index, verts_pack_len, i, j, k, isect;
diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c
index f0ec45b624f..1737e27c84a 100644
--- a/source/blender/bmesh/operators/bmo_hull.c
+++ b/source/blender/bmesh/operators/bmo_hull.c
@@ -444,7 +444,7 @@ static BMVert **hull_input_verts_copy(BMOperator *op,
static float (*hull_verts_for_bullet(BMVert **input_verts,
const int num_input_verts))[3]
{
- float (*coords)[3] = MEM_callocN(sizeof(*coords) * num_input_verts, AT);
+ float (*coords)[3] = MEM_callocN(sizeof(*coords) * num_input_verts, __func__);
int i;
for (i = 0; i < num_input_verts; i++) {
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 7851eebe269..b6fe60a8db7 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4513,7 +4513,7 @@ void param_pack(ParamHandle *handle, float margin)
}
}
- BLI_box_pack_2D(boxarray, phandle->ncharts - unpacked, &tot_width, &tot_height);
+ BLI_box_pack_2d(boxarray, phandle->ncharts - unpacked, &tot_width, &tot_height);
if (tot_height > tot_width)
scale = 1.0f / tot_height;
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index e1a0a2b428b..e3ef3d5f6cf 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -58,7 +58,7 @@ static const char *rna_Mesh_unit_test_compare(struct Mesh *mesh, bContext *C, st
return ret;
}
-static void rna_Mesh_calc_split_normals(Mesh *mesh, float min_angle)
+static void rna_Mesh_calc_normals_split(Mesh *mesh, float min_angle)
{
float (*r_loopnors)[3];
float (*polynors)[3];
@@ -78,7 +78,7 @@ static void rna_Mesh_calc_split_normals(Mesh *mesh, float min_angle)
polynors = CustomData_get_layer(&mesh->pdata, CD_NORMAL);
}
else {
- polynors = MEM_mallocN(sizeof(float [3]) * mesh->totpoly, AT);
+ polynors = MEM_mallocN(sizeof(float[3]) * mesh->totpoly, __func__);
BKE_mesh_calc_normals_poly(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
polynors, false);
free_polynors = true;
@@ -124,7 +124,7 @@ void RNA_api_mesh(StructRNA *srna)
func = RNA_def_function(srna, "calc_normals", "BKE_mesh_calc_normals");
RNA_def_function_ui_description(func, "Calculate vertex normals");
- func = RNA_def_function(srna, "calc_split_normals", "rna_Mesh_calc_split_normals");
+ func = RNA_def_function(srna, "calc_normals_split", "rna_Mesh_calc_normals_split");
RNA_def_function_ui_description(func, "Calculate split vertex normals, which preserve sharp edges");
parm = RNA_def_float(func, "split_angle", M_PI, 0.0f, M_PI, "",
"Angle between polys' normals above which an edge is always sharp (180° to disable)",
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index 0113efb8dc2..a8c23d3b0f4 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -1493,7 +1493,7 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis
}
/* Non Python function */
- BLI_box_pack_2D(boxarray, len, &tot_width, &tot_height);
+ BLI_box_pack_2d(boxarray, len, &tot_width, &tot_height);
boxPack_ToPyObject(boxlist, &boxarray);
}