diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-08 10:40:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-08 10:40:03 +0400 |
commit | a9f10b6bc2fb55be26ae3a7e8b1467213678a0f6 (patch) | |
tree | 12ac3a6320add8687c455cc7065b6eef0a73de7d /source/blender | |
parent | c95d4f68b863c851d0b8bddef8092fdc0932610e (diff) |
style cleanup
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/implicit.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_base.h | 5 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 5 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_core.c | 3 | ||||
-rw-r--r-- | source/blender/compositor/intern/COM_OpenCLDevice.cpp | 10 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_rip.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 3 | ||||
-rw-r--r-- | source/blender/python/generic/bgl.c | 2 |
8 files changed, 26 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 616214c21ff..1c6974b2615 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -193,7 +193,7 @@ DO_INLINE lfVector *create_lfvector(unsigned int verts) DO_INLINE void del_lfvector(float (*fLongVector)[3]) { if (fLongVector != NULL) { - MEM_freeN (fLongVector); + MEM_freeN(fLongVector); // cloth_aligned_free(&MEMORY_BASE, fLongVector); } } @@ -523,7 +523,7 @@ DO_INLINE fmatrix3x3 *create_bfmatrix(unsigned int verts, unsigned int springs) DO_INLINE void del_bfmatrix(fmatrix3x3 *matrix) { if (matrix != NULL) { - MEM_freeN (matrix); + MEM_freeN(matrix); } } diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 4a89776a52e..886ed6f495d 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -164,7 +164,10 @@ #endif #ifndef CLAMP -# define CLAMP(a, b, c) if ((a) < (b)) (a) = (b); else if ((a) > (c)) (a) = (c) +# define CLAMP(a, b, c) { \ + if ((a) < (b)) (a) = (b); \ + else if ((a) > (c)) (a) = (c); \ +} (void)0 #endif #ifdef __BLI_MATH_INLINE_H__ diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index c11d8ed55be..29097a4c6c3 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -198,7 +198,10 @@ #define INPR(v1, v2) ( (v1)[0] * (v2)[0] + (v1)[1] * (v2)[1] + (v1)[2] * (v2)[2]) /* some misc stuff.... */ -#define CLAMP(a, b, c) if ((a) < (b)) (a) = (b); else if ((a) > (c)) (a) = (c) +#define CLAMP(a, b, c) { \ + if ((a) < (b)) (a) = (b); \ + else if ((a) > (c)) (a) = (c); \ +} (void)0 #define CLAMPIS(a, b, c) ((a) < (b) ? (b) : (a) > (c) ? (c) : (a)) #define CLAMPTEST(a, b, c) \ diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index c449dec1b6c..48bacce9b25 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -86,8 +86,9 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example) /* exception: don't copy the original shapekey index */ keyi = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_SHAPE_KEYINDEX); - if(keyi) + if (keyi) { *keyi = ORIGINDEX_NONE; + } } BM_CHECK_ELEMENT(v); diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp index be5936b495e..d23ed245844 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp @@ -110,7 +110,7 @@ void OpenCLDevice::COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offse { if (offsetIndex != -1) { cl_int error; - cl_int2 offset = {operation->getWidth(), operation->getHeight()}; + cl_int2 offset = {(cl_int)operation->getWidth(), (cl_int)operation->getHeight()}; error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } @@ -127,7 +127,7 @@ void OpenCLDevice::COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel ker void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemoryBuffer) { cl_int error; - const size_t size[] = {outputMemoryBuffer->getWidth(), outputMemoryBuffer->getHeight()}; + const size_t size[] = {(size_t)outputMemoryBuffer->getWidth(), (size_t)outputMemoryBuffer->getHeight()}; error = clEnqueueNDRangeKernel(this->m_queue, kernel, 2, NULL, size, 0, 0, 0, NULL); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } @@ -144,7 +144,10 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo size_t size[2]; cl_int2 offset; - if (this->m_vendorID == NVIDIA) {localSize = 32;} + if (this->m_vendorID == NVIDIA) { + localSize = 32; + } + bool breaked = false; for (offsety = 0; offsety < height && (!breaked); offsety += localSize) { offset[1] = offsety; @@ -154,6 +157,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo else { size[1] = height - offsety; } + for (offsetx = 0; offsetx < width && (!breaked); offsetx += localSize) { if (offsetx + localSize < width) { size[0] = localSize; diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index d2806233fa9..4d4a890300f 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -464,6 +464,8 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event) dist = FLT_MAX; + /* in the loop below we find the best vertex to drag based on its connected geometry, + * either by its face corner, or connected edge (when no faces are attached) */ for (i = 0; i < vout_len; i++) { if (BM_vert_is_wire(vout[i]) == FALSE) { @@ -473,7 +475,8 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event) float l_mid_co[3]; BM_loop_calc_face_tangent(l, l_mid_co); - /* scale to average of surrounding edge size, only needs to be approx */ + /* scale to average of surrounding edge size, only needs to be approx, but should + * be roughly equivalent to the check below which uses the middle of the edge. */ mul_v3_fl(l_mid_co, (BM_edge_calc_length(l->e) + BM_edge_calc_length(l->prev->e)) / 2.0f); add_v3_v3(l_mid_co, v->co); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index d3db1b58b2d..ceb39c12c0e 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1326,8 +1326,9 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE); uiItemR(layout, ptr, "projection", 0, "", ICON_NONE); - if(RNA_enum_get(ptr, "projection") == SHD_PROJ_BOX) + if (RNA_enum_get(ptr, "projection") == SHD_PROJ_BOX) { uiItemR(layout, ptr, "projection_blend", 0, "Blend", ICON_NONE); + } /* note: image user properties used directly here, unlike compositor image node, * which redefines them in the node struct RNA to get proper updates. diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index ce11545c90d..45b767c6eda 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -44,7 +44,7 @@ #include "BLI_utildefines.h" static PyObject *Buffer_new(PyTypeObject *type, PyObject *args, PyObject *kwds); -static PyObject *Method_ShaderSource (PyObject *self, PyObject *args); +static PyObject *Method_ShaderSource(PyObject *self, PyObject *args); /* Buffer sequence methods */ |