diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-01 15:26:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-01 15:42:28 +0300 |
commit | aab4f2b76253936d1ba09562f1b1a21661860bf7 (patch) | |
tree | e558b355cd2fc153c8e5d1ef94963eb1f18454f7 /source/blender/blenlib | |
parent | 4bdd4aa63371bdd73f3a9484f92348f1bf13b4e5 (diff) |
cleanup: redundant casts & const cast correctness
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/boxpack2d.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/hash_mm2a.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/scanfill_utils.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string_utf8.c | 6 |
5 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index 91495ce3c9c..bae56444f37 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -236,8 +236,8 @@ static int vertex_sort(const void *p1, const void *p2) BoxVert *v1, *v2; float a1, a2; - v1 = vertarray + ((int *)p1)[0]; - v2 = vertarray + ((int *)p2)[0]; + v1 = vertarray + ((const int *)p1)[0]; + v2 = vertarray + ((const int *)p2)[0]; #ifdef USE_FREE_STRIP /* push free verts to the end so we can strip */ diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index f6bbd3273f9..99b9f7931d8 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -896,7 +896,7 @@ int BLI_move(const char *file, const char *to) } #endif -static char *check_destination(const char *file, const char *to) +static const char *check_destination(const char *file, const char *to) { struct stat st; @@ -927,18 +927,18 @@ static char *check_destination(const char *file, const char *to) } } - return (char *)to; + return to; } int BLI_copy(const char *file, const char *to) { - char *actual_to = check_destination(file, to); + const char *actual_to = check_destination(file, to); int ret; ret = recursive_operation(file, actual_to, copy_callback_pre, copy_single_file, NULL); if (actual_to != to) - MEM_freeN(actual_to); + MEM_freeN((void *)actual_to); return ret; } diff --git a/source/blender/blenlib/intern/hash_mm2a.c b/source/blender/blenlib/intern/hash_mm2a.c index 8b4242fa5be..bae098ae96b 100644 --- a/source/blender/blenlib/intern/hash_mm2a.c +++ b/source/blender/blenlib/intern/hash_mm2a.c @@ -81,7 +81,7 @@ void BLI_hash_mm2a_add(BLI_HashMurmur2A *mm2, const unsigned char *data, size_t mm2a_mix_tail(mm2, &data, &len); for (; len >= 4; data += 4, len -= 4) { - uint32_t k = *(uint32_t *)data; + uint32_t k = *(const uint32_t *)data; MM2A_MIX(mm2->hash, k); } diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c index 6ddea300404..a606ac41aa1 100644 --- a/source/blender/blenlib/intern/scanfill_utils.c +++ b/source/blender/blenlib/intern/scanfill_utils.c @@ -136,8 +136,8 @@ static int edge_isect_ls_sort_cb(void *thunk, const void *def_a_ptr, const void { const float *co = thunk; - const ScanFillIsect *i_a = ((LinkData *)def_a_ptr)->data; - const ScanFillIsect *i_b = ((LinkData *)def_b_ptr)->data; + const ScanFillIsect *i_a = ((const LinkData *)def_a_ptr)->data; + const ScanFillIsect *i_b = ((const LinkData *)def_b_ptr)->data; const float a = len_squared_v2v2(co, i_a->co); const float b = len_squared_v2v2(co, i_b->co); diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index ef0fcc7f1e3..f2930044204 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -69,11 +69,11 @@ static const char trailingBytesForUTF8[256] = { int BLI_utf8_invalid_byte(const char *str, int length) { - const unsigned char *p, *pend = (unsigned char *)str + length; + const unsigned char *p, *pend = (const unsigned char *)str + length; unsigned char c; int ab; - for (p = (unsigned char *)str; p < pend; p++) { + for (p = (const unsigned char *)str; p < pend; p++) { c = *p; if (c < 128) continue; @@ -130,7 +130,7 @@ int BLI_utf8_invalid_byte(const char *str, int length) utf8_error: - return (int)((char *)p - (char *)str) - 1; + return (int)((const char *)p - (const char *)str) - 1; } int BLI_utf8_invalid_strip(char *str, int length) |