Code cleanup: use 'const' for arrays (blenlib)

This commit is contained in:
2014-04-27 00:20:55 +10:00
parent a2c107aef1
commit 483d8da9bc
5 changed files with 12 additions and 12 deletions

View File

@@ -95,8 +95,8 @@ float normal_quad_v3(float n[3], const float v1[3], const float v2[3], const flo
*/
float normal_poly_v3(float n[3], const float verts[][3], unsigned int nr)
{
float const *v_prev = verts[nr - 1];
float const *v_curr = verts[0];
const float const *v_prev = verts[nr - 1];
const float const *v_curr = verts[0];
unsigned int i;
zero_v3(n);
@@ -2554,7 +2554,7 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
{
const float eps = 0.00001f; /* take care, low values cause [#36105] */
const float eps_sq = eps * eps;
float *v_curr, *v_next;
const float *v_curr, *v_next;
float ht_prev, ht; /* half tangents */
float totweight = 0.0f;
int i = 0;
@@ -2623,7 +2623,7 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
{
const float eps = 0.00001f; /* take care, low values cause [#36105] */
const float eps_sq = eps * eps;
float *v_curr, *v_next;
const float *v_curr, *v_next;
float ht_prev, ht; /* half tangents */
float totweight = 0.0f;
int i = 0;

View File

@@ -646,8 +646,8 @@ void BLI_path_rel(char *file, const char *relfile)
if (lslash) {
/* find the prefix of the filename that is equal for both filenames.
* This is replaced by the two slashes at the beginning */
char *p = temp;
char *q = file;
const char *p = temp;
const char *q = file;
char *r = res;
#ifdef WIN32
@@ -1723,7 +1723,7 @@ bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch)
char pattern[16];
while (ext_step[0]) {
char *ext_next;
const char *ext_next;
int len_ext;
if ((ext_next = strchr(ext_step, ';'))) {
@@ -2057,8 +2057,8 @@ int BLI_rebase_path(char *abs, size_t abs_len,
*/
const char *BLI_first_slash(const char *string)
{
char * const ffslash = strchr(string, '/');
char * const fbslash = strchr(string, '\\');
const char * const ffslash = strchr(string, '/');
const char * const fbslash = strchr(string, '\\');
if (!ffslash) return fbslash;
else if (!fbslash) return ffslash;

View File

@@ -865,7 +865,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const
/* Newell's Method */
/* Similar code used elsewhere, but this checks for double ups
* which historically this function supports so better not change */
float *v_prev;
const float *v_prev;
zero_v3(n);
eve = sf_ctx->fillvertbase.last;

View File

@@ -289,7 +289,7 @@ escape_finish:
char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix)
{
size_t prefixLen = strlen(prefix);
char *startMatch, *endMatch;
const char *startMatch, *endMatch;
/* get the starting point (i.e. where prefix starts, and add prefixLen+1 to it to get be after the first " */
startMatch = strstr(str, prefix) + prefixLen + 1;

View File

@@ -536,7 +536,7 @@ unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__re
if (UNLIKELY(len == -1)) {
/* when called with NULL end, result will never be NULL,
* checks for a NULL character */
char *p_next = BLI_str_find_next_char_utf8(p, NULL);
const char *p_next = BLI_str_find_next_char_utf8(p, NULL);
/* will never return the same pointer unless '\0',
* eternal loop is prevented */
*index += (size_t)(p_next - p);