From cda5770160e11c2d3c7ab7d20e24a7a8f3b28f1f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Jun 2013 11:59:28 +0000 Subject: code cleanup: also fix crash in GPU_state_print(). and confine to debug mode builds. --- source/blender/blenkernel/intern/writeffmpeg.c | 2 +- source/blender/bmesh/intern/bmesh_interp.c | 2 +- source/blender/collada/TransformWriter.cpp | 2 +- source/blender/collada/collada_utils.cpp | 2 +- source/blender/editors/transform/transform_generics.c | 2 +- source/blender/gpu/intern/gpu_draw.c | 7 ++++--- source/blender/gpu/intern/gpu_extensions.c | 4 ++-- 7 files changed, 11 insertions(+), 10 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 6f806903554..f08a51e602c 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -747,7 +747,7 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex #endif if (c->frame_size == 0) - // used to be if((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD)) + // used to be if ((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD)) // not sure if that is needed anymore, so let's try out if there are any // complaints regarding some ffmpeg versions users might have audio_input_samples = FF_MIN_BUFFER_SIZE * 8 / c->bits_per_coded_sample / c->channels; diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 9c85a4fc4e5..454eb201b78 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -465,7 +465,7 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source) res = (int)sqrt(mdisps->totdisp); d = 1.0f / (float)(res - 1); - #pragma omp parallel for if(res > 3) +#pragma omp parallel for if (res > 3) for (ix = 0; ix < res; ix++) { float x = d * ix, y; int iy; diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index efefca86d3e..d4db42da35b 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -103,7 +103,7 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob, B if (ob->parent) { // If parentinv is identity don't add it. bool add_parinv = false; - + for (int i = 0; i < 16; ++i) { float f = (i % 4 == i / 4) ? 1.0f : 0.0f; add_parinv |= (ob->parentinv[i % 4][i / 4] != f); diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 7e9ecb95f7a..41f48a757c0 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -311,7 +311,7 @@ std::string bc_replace_string(std::string data, const std::string& pattern, const std::string& replacement) { size_t pos = 0; - while((pos = data.find(pattern, pos)) != std::string::npos) { + while ((pos = data.find(pattern, pos)) != std::string::npos) { data.replace(pos, pattern.length(), replacement); pos += replacement.length(); } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 9e075c9e8e0..fa9196c3119 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -909,7 +909,7 @@ static void recalcData_view3d(TransInfo *t) */ DAG_id_tag_update(&ob->id, OB_RECALC_OB); - if(t->flag & T_TEXTURE) + if (t->flag & T_TEXTURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } } diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index e72b5bd8961..a96796b95a3 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -1794,17 +1794,18 @@ void GPU_state_init(void) // glDisable(GL_MULTISAMPLE); } +#ifdef DEBUG /* debugging aid */ static void gpu_get_print(const char *name, GLenum type) { - float value[16]; + float value[32]; int a; memset(value, 0, sizeof(value)); glGetFloatv(type, value); printf("%s: ", name); - for (a=0; a<16; a++) + for (a = 0; a < 32; a++) printf("%.2f ", value[a]); printf("\n"); } @@ -2156,4 +2157,4 @@ void GPU_state_print(void) gpu_get_print("GL_ZOOM_X", GL_ZOOM_X); gpu_get_print("GL_ZOOM_Y", GL_ZOOM_Y); } - +#endif diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 75041055c41..ffd3bba5493 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -1159,9 +1159,9 @@ static const char *gpu_shader_standard_defines(void) /* some useful defines to detect GPU type */ if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) return "#define GPU_ATI\n"; - else if(GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY)) + else if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY)) return "#define GPU_NVIDIA\n"; - else if(GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY)) + else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY)) return "#define GPU_INTEL\n"; return ""; -- cgit v1.2.3