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-10-11 00:22:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-10-11 00:22:17 +0400
commitafab39b9d6a4b3283c42c5b6d7d787fda56327de (patch)
treefc58fee1db5ed21160a63be7c4f6716a67cee026 /source/blender
parent35bb5465ae7f7fbd234b4b3c650902bc42f3d3f1 (diff)
code cleanup: use const's for static arrays
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c13
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c2
-rw-r--r--source/blender/blenlib/intern/noise.c20
-rw-r--r--source/blender/blenlib/intern/smallhash.c2
-rw-r--r--source/blender/bmesh/operators/bmo_primitive.c12
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cpp2
-rw-r--r--source/blender/editors/curve/editcurve_add.c2
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c16
-rw-r--r--source/blender/editors/transform/transform_ops.c2
-rw-r--r--source/blender/imbuf/intern/indexer.c8
-rw-r--r--source/blender/render/intern/source/imagetexture.c2
-rw-r--r--source/blender/render/intern/source/pixelshading.c8
-rw-r--r--source/blender/render/intern/source/rendercore.c5
13 files changed, 50 insertions, 44 deletions
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 580172bcccd..fe9a96d60cf 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -98,12 +98,13 @@
#endif
/* precalculated gaussian factors for 5x super sampling */
-static float gaussianFactors[5] = {0.996849f,
- 0.596145f,
- 0.596145f,
- 0.596145f,
- 0.524141f};
-static float gaussianTotal = 3.309425f;
+static const float gaussianFactors[5] = {
+ 0.996849f,
+ 0.596145f,
+ 0.596145f,
+ 0.596145f,
+ 0.524141f};
+static const float gaussianTotal = 3.309425f;
/* UV Image neighboring pixel table x and y list */
static int neighX[8] = {1, 1, 0, -1, -1, -1, 0, 1};
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 80483fbfa38..7c1cdd593c3 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -117,7 +117,7 @@ typedef struct BVHRayCastData {
* Notes: You can choose the tree type --> binary, quad, octree, choose below
*/
-static float KDOP_AXES[13][3] = {
+static const float KDOP_AXES[13][3] = {
{1.0, 0, 0}, {0, 1.0, 0}, {0, 0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0},
{1.0, -1.0, -1.0}, {1.0, 1.0, 0}, {1.0, 0, 1.0}, {0, 1.0, 1.0}, {1.0, -1.0, 0}, {1.0, 0, -1.0},
{0, 1.0, -1.0}
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 2f94e833e9d..9ba5124264f 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -50,7 +50,7 @@ static float noise3_perlin(float vec[3]);
/* needed for voronoi */
#define HASHPNT(x, y, z) hashpntf + 3 * hash[(hash[(hash[(z) & 255] + (y)) & 255] + (x)) & 255]
-static float hashpntf[768] = {
+static const float hashpntf[768] = {
0.536902, 0.020915, 0.501445, 0.216316, 0.517036, 0.822466, 0.965315,
0.377313, 0.678764, 0.744545, 0.097731, 0.396357, 0.247202, 0.520897,
0.613396, 0.542124, 0.146813, 0.255489, 0.810868, 0.638641, 0.980742,
@@ -163,7 +163,7 @@ static float hashpntf[768] = {
0.114246, 0.905043, 0.713870, 0.555261, 0.951333
};
-unsigned char hash[512] = {
+const unsigned char hash[512] = {
0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0, 0xDE, 0x95, 0x2E, 0xDC,
0x3F, 0x3A, 0x82, 0x35, 0x4D, 0x6C, 0xBA, 0x36, 0xD0, 0xF6, 0xC, 0x79, 0x32, 0xD1, 0x59, 0xF4, 0x8, 0x8B, 0x63,
0x89, 0x2F, 0xB8, 0xB4, 0x97, 0x83, 0xF2, 0x8F, 0x18, 0xC7, 0x51, 0x14, 0x65, 0x87, 0x48, 0x20, 0x42, 0xA8, 0x80,
@@ -194,7 +194,7 @@ unsigned char hash[512] = {
};
-float hashvectf[768] = {
+const float hashvectf[768] = {
0.33783, 0.715698, -0.611206, -0.944031, -0.326599, -0.045624, -0.101074, -0.416443, -0.903503, 0.799286, 0.49411,
-0.341949, -0.854645, 0.518036, 0.033936, 0.42514, -0.437866, -0.792114, -0.358948, 0.597046, 0.717377, -0.985413,
0.144714, 0.089294, -0.601776, -0.33728, -0.723907, -0.449921, 0.594513, 0.666382, 0.208313, -0.10791, 0.972076,
@@ -327,7 +327,8 @@ static float newPerlinU(float x, float y, float z)
/* Was BLI_hnoise(), removed noisesize, so other functions can call it without scaling. */
static float orgBlenderNoise(float x, float y, float z)
{
- register float cn1, cn2, cn3, cn4, cn5, cn6, i, *h;
+ register float cn1, cn2, cn3, cn4, cn5, cn6, i;
+ register const float *h;
float fx, fy, fz, ox, oy, oz, jx, jy, jz;
float n = 0.5;
int ix, iy, iz, b00, b01, b10, b11, b20, b21;
@@ -504,7 +505,7 @@ static const char p[512 + 2] = {
};
-static float g[512 + 2][3] = {
+static const float g[512 + 2][3] = {
{0.33783, 0.715698, -0.611206},
{-0.944031, -0.326599, -0.045624},
{-0.101074, -0.416443, -0.903503},
@@ -1034,7 +1035,8 @@ static float g[512 + 2][3] = {
static float noise3_perlin(float vec[3])
{
int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
- float rx0, rx1, ry0, ry1, rz0, rz1, *q, sx, sy, sz, a, b, c, d, t, u, v;
+ float rx0, rx1, ry0, ry1, rz0, rz1, sx, sy, sz, a, b, c, d, t, u, v;
+ const float *q;
register int i, j;
@@ -1227,7 +1229,7 @@ static float dist_Minkovsky(float x, float y, float z, float e)
void voronoi(float x, float y, float z, float *da, float *pa, float me, int dtype)
{
int xx, yy, zz, xi, yi, zi;
- float xd, yd, zd, d, *p;
+ float xd, yd, zd, d;
float (*distfunc)(float, float, float, float);
switch (dtype) {
@@ -1262,7 +1264,7 @@ void voronoi(float x, float y, float z, float *da, float *pa, float me, int dtyp
for (xx = xi - 1; xx <= xi + 1; xx++) {
for (yy = yi - 1; yy <= yi + 1; yy++) {
for (zz = zi - 1; zz <= zi + 1; zz++) {
- p = HASHPNT(xx, yy, zz);
+ const float *p = HASHPNT(xx, yy, zz);
xd = x - (p[0] + xx);
yd = y - (p[1] + yy);
zd = z - (p[2] + zz);
@@ -1416,7 +1418,7 @@ void cellNoiseV(float x, float y, float z, float *ca)
int xi = (int)(floor(x));
int yi = (int)(floor(y));
int zi = (int)(floor(z));
- float *p = HASHPNT(xi, yi, zi);
+ const float *p = HASHPNT(xi, yi, zi);
ca[0] = p[0];
ca[1] = p[1];
ca[2] = p[2];
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c
index 19eb88f9e15..9790ce1f0b4 100644
--- a/source/blender/blenlib/intern/smallhash.c
+++ b/source/blender/blenlib/intern/smallhash.c
@@ -55,7 +55,7 @@
((h) + (((hoff) = ((hoff) * 2) + 1), (hoff))) \
)
-extern unsigned int hashsizes[];
+extern const unsigned int hashsizes[];
void BLI_smallhash_init(SmallHash *hash)
{
diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c
index 45653f3411f..6a540928d43 100644
--- a/source/blender/bmesh/operators/bmo_primitive.c
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -36,7 +36,7 @@
/* ************************ primitives ******************* */
-static float icovert[12][3] = {
+static const float icovert[12][3] = {
{0.0f, 0.0f, -200.0f},
{144.72f, -105.144f, -89.443f},
{-55.277f, -170.128, -89.443f},
@@ -51,7 +51,7 @@ static float icovert[12][3] = {
{0.0f, 0.0f, 200.0f}
};
-static short icoface[20][3] = {
+static const short icoface[20][3] = {
{0, 1, 2},
{1, 0, 5},
{0, 2, 3},
@@ -78,10 +78,10 @@ static short icoface[20][3] = {
* this hack is only used so that scons & mingw + split-sources hack works
* ------------------------------- start copied code */
/* these are not the monkeys you are looking for */
-static int monkeyo = 4;
-static int monkeynv = 271;
-static int monkeynf = 250;
-static signed char monkeyv[271][3] = {
+static const int monkeyo = 4;
+static const int monkeynv = 271;
+static const int monkeynf = 250;
+static const signed char monkeyv[271][3] = {
{-71, 21, 98}, {-63, 12, 88}, {-57, 7, 74}, {-82, -3, 79}, {-82, 4, 92},
{-82, 17, 100}, {-92, 21, 102}, {-101, 12, 95}, {-107, 7, 83},
{-117, 31, 84}, {-109, 31, 95}, {-96, 31, 102}, {-92, 42, 102},
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index 4bebf004a89..f10e6696c6a 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -179,7 +179,7 @@ void MemoryBuffer::addPixel(int x, int y, const float color[4])
// table of (exp(ar) - exp(a)) / (1 - exp(a)) for r in range [0, 1] and a = -2
// used instead of actual gaussian, otherwise at high texture magnifications circular artifacts are visible
#define EWA_MAXIDX 255
-static float EWA_WTS[EWA_MAXIDX + 1] = {
+static const float EWA_WTS[EWA_MAXIDX + 1] = {
1.f, 0.990965f, 0.982f, 0.973105f, 0.96428f, 0.955524f, 0.946836f, 0.938216f, 0.929664f,
0.921178f, 0.912759f, 0.904405f, 0.896117f, 0.887893f, 0.879734f, 0.871638f, 0.863605f,
0.855636f, 0.847728f, 0.839883f, 0.832098f, 0.824375f, 0.816712f, 0.809108f, 0.801564f,
diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c
index 0bcb550b930..9b858a2c4e9 100644
--- a/source/blender/editors/curve/editcurve_add.c
+++ b/source/blender/editors/curve/editcurve_add.c
@@ -58,7 +58,7 @@
#include "curve_intern.h"
-static float nurbcircle[8][2] = {
+static const float nurbcircle[8][2] = {
{0.0, -1.0}, {-1.0, -1.0}, {-1.0, 0.0}, {-1.0, 1.0},
{0.0, 1.0}, { 1.0, 1.0}, { 1.0, 0.0}, { 1.0, -1.0}
};
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 2634dd3ec08..de6fafb2cd8 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -304,7 +304,7 @@ static void set_ebone_glColor(const unsigned int boneflag)
/* *************** Armature drawing, helper calls for parts ******************* */
/* half the cube, in Y */
-static float cube[8][3] = {
+static const float cube[8][3] = {
{-1.0, 0.0, -1.0},
{-1.0, 0.0, 1.0},
{-1.0, 1.0, 1.0},
@@ -440,7 +440,7 @@ static void draw_bonevert_solid(void)
glCallList(displist);
}
-static float bone_octahedral_verts[6][3] = {
+static const float bone_octahedral_verts[6][3] = {
{ 0.0f, 0.0f, 0.0f},
{ 0.1f, 0.1f, 0.1f},
{ 0.1f, 0.1f, -0.1f},
@@ -449,10 +449,10 @@ static float bone_octahedral_verts[6][3] = {
{ 0.0f, 1.0f, 0.0f}
};
-static unsigned int bone_octahedral_wire_sides[8] = {0, 1, 5, 3, 0, 4, 5, 2};
-static unsigned int bone_octahedral_wire_square[8] = {1, 2, 3, 4, 1};
+static const unsigned int bone_octahedral_wire_sides[8] = {0, 1, 5, 3, 0, 4, 5, 2};
+static const unsigned int bone_octahedral_wire_square[8] = {1, 2, 3, 4, 1};
-static unsigned int bone_octahedral_solid_tris[8][3] = {
+static const unsigned int bone_octahedral_solid_tris[8][3] = {
{2, 1, 0}, /* bottom */
{3, 2, 0},
{4, 3, 0},
@@ -465,7 +465,7 @@ static unsigned int bone_octahedral_solid_tris[8][3] = {
};
/* aligned with bone_octahedral_solid_tris */
-static float bone_octahedral_solid_normals[8][3] = {
+static const float bone_octahedral_solid_normals[8][3] = {
{ 0.70710683f, -0.70710683f, 0.00000000f},
{-0.00000000f, -0.70710683f, -0.70710683f},
{-0.70710683f, -0.70710683f, 0.00000000f},
@@ -599,7 +599,7 @@ static void draw_bone_points(const short dt, int armflag, unsigned int boneflag,
}
/* 16 values of sin function (still same result!) */
-static float si[16] = {
+static const float si[16] = {
0.00000000f,
0.20129852f, 0.39435585f,
0.57126821f, 0.72479278f,
@@ -611,7 +611,7 @@ static float si[16] = {
0.10116832f
};
/* 16 values of cos function (still same result!) */
-static float co[16] = {
+static const float co[16] = {
1.00000000f,
0.97952994f, 0.91895781f,
0.82076344f, 0.68896691f,
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index e7c22fc0899..2904b37c2e5 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -60,7 +60,7 @@ typedef struct TransformModeItem {
void (*opfunc)(wmOperatorType *);
} TransformModeItem;
-static float VecOne[3] = {1, 1, 1};
+static const float VecOne[3] = {1, 1, 1};
static char OP_TRANSLATION[] = "TRANSFORM_OT_translate";
static char OP_ROTATION[] = "TRANSFORM_OT_rotate";
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index dd0970a71f2..93324b94cdc 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -55,12 +55,12 @@
#endif
-static char magic[] = "BlenMIdx";
-static char temp_ext[] = "_part";
+static const char magic[] = "BlenMIdx";
+static const char temp_ext[] = "_part";
-static int proxy_sizes[] = { IMB_PROXY_25, IMB_PROXY_50, IMB_PROXY_75,
+static const int proxy_sizes[] = { IMB_PROXY_25, IMB_PROXY_50, IMB_PROXY_75,
IMB_PROXY_100 };
-static float proxy_fac[] = { 0.25, 0.50, 0.75, 1.00 };
+static const float proxy_fac[] = { 0.25, 0.50, 0.75, 1.00 };
#ifdef WITH_FFMPEG
static int tc_types[] = {IMB_TC_RECORD_RUN,
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index c5e4f97c6bc..bfc13bf6151 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -799,7 +799,7 @@ static void area_sample(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata
/* table of (exp(ar) - exp(a)) / (1 - exp(a)) for r in range [0, 1] and a = -2
* used instead of actual gaussian, otherwise at high texture magnifications circular artifacts are visible */
#define EWA_MAXIDX 255
-static float EWA_WTS[EWA_MAXIDX + 1] = {
+static const float EWA_WTS[EWA_MAXIDX + 1] = {
1.f, 0.990965f, 0.982f, 0.973105f, 0.96428f, 0.955524f, 0.946836f, 0.938216f, 0.929664f,
0.921178f, 0.912759f, 0.904405f, 0.896117f, 0.887893f, 0.879734f, 0.871638f, 0.863605f,
0.855636f, 0.847728f, 0.839883f, 0.832098f, 0.824375f, 0.816712f, 0.809108f, 0.801564f,
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 8a023a2c009..43e052a6efc 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -73,7 +73,7 @@ extern struct Render R;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-extern float hashvectf[];
+extern const float hashvectf[];
static void render_lighting_halo(HaloRen *har, float col_r[3])
{
@@ -341,7 +341,8 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz,
if (flarec) har->pixels+= (int)(har->rad-radist);
if (har->ringc) {
- float *rc, fac;
+ const float *rc;
+ float fac;
int ofs;
/* per ring an antialised circle */
@@ -393,7 +394,8 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz,
dist= 0.0f;
if (har->linec) {
- float *rc, fac;
+ const float *rc;
+ float fac;
int ofs;
/* per starpoint an antialiased line */
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 982e9b1a410..89d8345a0d7 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -1875,10 +1875,11 @@ static void renderhalo_post(RenderResult *rr, float *rectf, HaloRen *har) /* pos
static void renderflare(RenderResult *rr, float *rectf, HaloRen *har)
{
- extern float hashvectf[];
+ extern const float hashvectf[];
HaloRen fla;
Material *ma;
- float *rc, rad, alfa, visifac, vec[3];
+ const float *rc;
+ float rad, alfa, visifac, vec[3];
int b, type;
fla= *har;