From 4e7b18876c3e995f030f865072cdad0e0ca6ea94 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 30 Jan 2013 21:17:38 +0000 Subject: [PATCH] style cleanup --- source/blender/blenlib/BLI_mempool.h | 7 +++++ .../blender/bmesh/tools/bmesh_triangulate.h | 2 +- .../operations/COM_DilateErodeOperation.cpp | 16 +++++------ source/blender/makesrna/intern/rna_particle.c | 27 +++++++++++-------- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index 20ea89f3abf..a1cbad73239 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -92,6 +92,13 @@ __attribute__((nonnull(1))) #endif ; +void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr) +#ifdef __GNUC__ +__attribute__((warn_unused_result)) +__attribute__((nonnull(1, 2))) +#endif +; + /** iteration stuff. note: this may easy to produce bugs with **/ /* private structure */ typedef struct BLI_mempool_iter { diff --git a/source/blender/bmesh/tools/bmesh_triangulate.h b/source/blender/bmesh/tools/bmesh_triangulate.h index 9632ab5957f..ea271c98acb 100644 --- a/source/blender/bmesh/tools/bmesh_triangulate.h +++ b/source/blender/bmesh/tools/bmesh_triangulate.h @@ -20,7 +20,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/bmesh/tools/bmesh_triangulate.c +/** \file blender/bmesh/tools/bmesh_triangulate.h * \ingroup bmesh * * Triangulate. diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp index ecb4ef93e9b..b54e47c136d 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp @@ -383,7 +383,7 @@ void *DilateStepOperation::initializeTileData(rcti *rect) buf[x] = -MAXFLOAT; } for (x = xmin; x < xmax; ++x) { - buf[x - rect->xmin + window - 1] = buffer[4*(y * width + x)]; + buf[x - rect->xmin + window - 1] = buffer[4 * (y * width + x)]; } for (i = 0; i < (bwidth + 3 * half_window) / window; i++) { @@ -397,7 +397,7 @@ void *DilateStepOperation::initializeTileData(rcti *rect) start = half_window + (i - 1) * window + 1; for (x = -min(0, start); x < window - max(0, start + window - bwidth); x++) { - rectf[bwidth * (y-ymin) + (start + x)] = max(temp[x], temp[x + window - 1]); + rectf[bwidth * (y - ymin) + (start + x)] = max(temp[x], temp[x + window - 1]); } } } @@ -408,7 +408,7 @@ void *DilateStepOperation::initializeTileData(rcti *rect) buf[y] = -MAXFLOAT; } for (y = ymin; y < ymax; y++) { - buf[y - rect->ymin + window - 1] = rectf[(y-ymin) * bwidth + x]; + buf[y - rect->ymin + window - 1] = rectf[(y - ymin) * bwidth + x]; } for (i = 0; i < (bheight + 3 * half_window) / window; i++) { @@ -422,7 +422,7 @@ void *DilateStepOperation::initializeTileData(rcti *rect) start = half_window + (i - 1) * window + 1; for (y = -min(0, start); y < window - max(0, start + window - bheight); y++) { - rectf[bwidth * (y + start + (rect->ymin-ymin)) + x] = max(temp[y], temp[y + window - 1]); + rectf[bwidth * (y + start + (rect->ymin - ymin)) + x] = max(temp[y], temp[y + window - 1]); } } } @@ -510,7 +510,7 @@ void *ErodeStepOperation::initializeTileData(rcti *rect) buf[x] = MAXFLOAT; } for (x = xmin; x < xmax; ++x) { - buf[x - rect->xmin + window - 1] = buffer[4*(y * width + x)]; + buf[x - rect->xmin + window - 1] = buffer[4 * (y * width + x)]; } for (i = 0; i < (bwidth + 3 * half_window) / window; i++) { @@ -524,7 +524,7 @@ void *ErodeStepOperation::initializeTileData(rcti *rect) start = half_window + (i - 1) * window + 1; for (x = -min(0, start); x < window - max(0, start + window - bwidth); x++) { - rectf[bwidth * (y-ymin) + (start + x)] = min(temp[x], temp[x + window - 1]); + rectf[bwidth * (y - ymin) + (start + x)] = min(temp[x], temp[x + window - 1]); } } } @@ -535,7 +535,7 @@ void *ErodeStepOperation::initializeTileData(rcti *rect) buf[y] = MAXFLOAT; } for (y = ymin; y < ymax; y++) { - buf[y - rect->ymin + window - 1] = rectf[(y-ymin) * bwidth + x]; + buf[y - rect->ymin + window - 1] = rectf[(y - ymin) * bwidth + x]; } for (i = 0; i < (bheight + 3 * half_window) / window; i++) { @@ -549,7 +549,7 @@ void *ErodeStepOperation::initializeTileData(rcti *rect) start = half_window + (i - 1) * window + 1; for (y = -min(0, start); y < window - max(0, start + window - bheight); y++) { - rectf[bwidth * (y + start + (rect->ymin-ymin)) + x] = min(temp[y], temp[y + window - 1]); + rectf[bwidth * (y + start + (rect->ymin - ymin)) + x] = min(temp[y], temp[y + window - 1]); } } } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index a872ace6ae3..0107cd8b51e 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -289,8 +289,8 @@ static void rna_Particle_uv_on_emitter(ParticleData *particle, ParticleSystemMod } } -static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *object, ParticleSystemModifierData *modifier, int particle_no, int step, - float n_co[3]) +static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *object, ParticleSystemModifierData *modifier, + int particle_no, int step, float n_co[3]) { ParticleSettings *part = 0; ParticleData *pars = 0; @@ -307,7 +307,7 @@ static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *o part = particlesystem->part; pars = particlesystem->particles; - if(particlesystem->renderdata) { + if (particlesystem->renderdata) { step_nbr = part->ren_step; totchild = particlesystem->totchild; } @@ -381,10 +381,12 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, Par part = particlesystem->part; - if(particlesystem->renderdata) + if (particlesystem->renderdata) { totchild = particlesystem->totchild; - else + } + else { totchild = (int)((float)particlesystem->totchild * (float)(part->disp) / 100.0f); + } /* can happen for disconnected/global hair */ if (part->type == PART_HAIR && !particlesystem->childcache) @@ -466,10 +468,11 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, Par } } -static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, ParticleSystemModifierData *modifier, ParticleData *particle, int particle_no, int vcol_no, - float n_mcol[3]) +static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, ParticleSystemModifierData *modifier, + ParticleData *particle, int particle_no, int vcol_no, + float n_mcol[3]) { - ParticleSettings *part = 0; + ParticleSettings *part; int totpart; int totchild = 0; int num; @@ -481,10 +484,12 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, P part = particlesystem->part; - if(particlesystem->renderdata) + if (particlesystem->renderdata) { totchild = particlesystem->totchild; - else + } + else { totchild = (int)((float)particlesystem->totchild * (float)(part->disp) / 100.0f); + } /* can happen for disconnected/global hair */ if (part->type == PART_HAIR && !particlesystem->childcache) @@ -495,7 +500,7 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, P if (particle_no >= totpart + totchild) return; -/* 3. start creating renderable things */ + /* 3. start creating renderable things */ /* setup per particle individual stuff */ if (particle_no < totpart) {