forked from bartvdbraak/blender
cleanup: redundant casts & const cast correctness
This commit is contained in:
parent
4bdd4aa633
commit
aab4f2b762
@ -40,7 +40,7 @@ typedef union IDPropertyTemplate {
|
|||||||
float f;
|
float f;
|
||||||
double d;
|
double d;
|
||||||
struct {
|
struct {
|
||||||
char *str;
|
const char *str;
|
||||||
int len;
|
int len;
|
||||||
char subtype;
|
char subtype;
|
||||||
} string;
|
} string;
|
||||||
@ -51,7 +51,7 @@ typedef union IDPropertyTemplate {
|
|||||||
} array;
|
} array;
|
||||||
struct {
|
struct {
|
||||||
int matvec_size;
|
int matvec_size;
|
||||||
float *example;
|
const float *example;
|
||||||
} matrix_or_vector;
|
} matrix_or_vector;
|
||||||
} IDPropertyTemplate;
|
} IDPropertyTemplate;
|
||||||
|
|
||||||
|
@ -450,9 +450,9 @@ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (pose->chanhash)
|
if (pose->chanhash)
|
||||||
return BLI_ghash_lookup(pose->chanhash, (void *)name);
|
return BLI_ghash_lookup(pose->chanhash, (const void *)name);
|
||||||
|
|
||||||
return BLI_findstring(&((bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name));
|
return BLI_findstring(&((const bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1052,7 +1052,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GPUBuffer *buffer = NULL;
|
GPUBuffer *buffer = NULL;
|
||||||
const char *varray = NULL;
|
char *varray = NULL;
|
||||||
int numdata = 0, elementsize = 0, offset;
|
int numdata = 0, elementsize = 0, offset;
|
||||||
int start = 0, numfaces = 0 /* , prevdraw = 0 */ /* UNUSED */, curface = 0;
|
int start = 0, numfaces = 0 /* , prevdraw = 0 */ /* UNUSED */, curface = 0;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1560,7 +1560,8 @@ static void *emDM_getTessFaceDataArray(DerivedMesh *dm, int type)
|
|||||||
if (type == CD_MTFACE || type == CD_MCOL) {
|
if (type == CD_MTFACE || type == CD_MCOL) {
|
||||||
const int type_from = (type == CD_MTFACE) ? CD_MTEXPOLY : CD_MLOOPCOL;
|
const int type_from = (type == CD_MTFACE) ? CD_MTEXPOLY : CD_MLOOPCOL;
|
||||||
int index;
|
int index;
|
||||||
const char *data, *bmdata;
|
const char *bmdata;
|
||||||
|
char *data;
|
||||||
index = CustomData_get_layer_index(&bm->pdata, type_from);
|
index = CustomData_get_layer_index(&bm->pdata, type_from);
|
||||||
|
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
@ -1585,11 +1586,11 @@ static void *emDM_getTessFaceDataArray(DerivedMesh *dm, int type)
|
|||||||
// bmdata = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY);
|
// bmdata = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY);
|
||||||
bmdata = BM_ELEM_CD_GET_VOID_P(efa, cd_poly_tex_offset);
|
bmdata = BM_ELEM_CD_GET_VOID_P(efa, cd_poly_tex_offset);
|
||||||
|
|
||||||
ME_MTEXFACE_CPY(((MTFace *)data), ((MTexPoly *)bmdata));
|
ME_MTEXFACE_CPY(((MTFace *)data), ((const MTexPoly *)bmdata));
|
||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
// bmdata = CustomData_bmesh_get(&bm->ldata, looptris[i][j]->head.data, CD_MLOOPUV);
|
// bmdata = CustomData_bmesh_get(&bm->ldata, looptris[i][j]->head.data, CD_MLOOPUV);
|
||||||
bmdata = BM_ELEM_CD_GET_VOID_P(looptris[i][j], cd_loop_uv_offset);
|
bmdata = BM_ELEM_CD_GET_VOID_P(looptris[i][j], cd_loop_uv_offset);
|
||||||
copy_v2_v2(((MTFace *)data)->uv[j], ((MLoopUV *)bmdata)->uv);
|
copy_v2_v2(((MTFace *)data)->uv[j], ((const MLoopUV *)bmdata)->uv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1599,7 +1600,7 @@ static void *emDM_getTessFaceDataArray(DerivedMesh *dm, int type)
|
|||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
// bmdata = CustomData_bmesh_get(&bm->ldata, looptris[i][j]->head.data, CD_MLOOPCOL);
|
// bmdata = CustomData_bmesh_get(&bm->ldata, looptris[i][j]->head.data, CD_MLOOPCOL);
|
||||||
bmdata = BM_ELEM_CD_GET_VOID_P(looptris[i][j], cd_loop_color_offset);
|
bmdata = BM_ELEM_CD_GET_VOID_P(looptris[i][j], cd_loop_color_offset);
|
||||||
MESH_MLOOPCOL_TO_MCOL(((MLoopCol *)bmdata), (((MCol *)data) + j));
|
MESH_MLOOPCOL_TO_MCOL(((const MLoopCol *)bmdata), (((MCol *)data) + j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,21 +117,21 @@ typedef struct ImageCacheKey {
|
|||||||
|
|
||||||
static unsigned int imagecache_hashhash(const void *key_v)
|
static unsigned int imagecache_hashhash(const void *key_v)
|
||||||
{
|
{
|
||||||
const ImageCacheKey *key = (ImageCacheKey *) key_v;
|
const ImageCacheKey *key = key_v;
|
||||||
return key->index;
|
return key->index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool imagecache_hashcmp(const void *a_v, const void *b_v)
|
static bool imagecache_hashcmp(const void *a_v, const void *b_v)
|
||||||
{
|
{
|
||||||
const ImageCacheKey *a = (ImageCacheKey *) a_v;
|
const ImageCacheKey *a = a_v;
|
||||||
const ImageCacheKey *b = (ImageCacheKey *) b_v;
|
const ImageCacheKey *b = b_v;
|
||||||
|
|
||||||
return (a->index != b->index);
|
return (a->index != b->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void imagecache_keydata(void *userkey, int *framenr, int *proxy, int *render_flags)
|
static void imagecache_keydata(void *userkey, int *framenr, int *proxy, int *render_flags)
|
||||||
{
|
{
|
||||||
ImageCacheKey *key = (ImageCacheKey *)userkey;
|
ImageCacheKey *key = userkey;
|
||||||
|
|
||||||
*framenr = IMA_INDEX_FRAME(key->index);
|
*framenr = IMA_INDEX_FRAME(key->index);
|
||||||
*proxy = IMB_PROXY_NONE;
|
*proxy = IMB_PROXY_NONE;
|
||||||
|
@ -388,7 +388,7 @@ static int user_frame_to_cache_frame(MovieClip *clip, int framenr)
|
|||||||
|
|
||||||
static void moviecache_keydata(void *userkey, int *framenr, int *proxy, int *render_flags)
|
static void moviecache_keydata(void *userkey, int *framenr, int *proxy, int *render_flags)
|
||||||
{
|
{
|
||||||
MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey *)userkey;
|
const MovieClipImBufCacheKey *key = userkey;
|
||||||
|
|
||||||
*framenr = key->framenr;
|
*framenr = key->framenr;
|
||||||
*proxy = key->proxy;
|
*proxy = key->proxy;
|
||||||
@ -397,7 +397,7 @@ static void moviecache_keydata(void *userkey, int *framenr, int *proxy, int *ren
|
|||||||
|
|
||||||
static unsigned int moviecache_hashhash(const void *keyv)
|
static unsigned int moviecache_hashhash(const void *keyv)
|
||||||
{
|
{
|
||||||
MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey *)keyv;
|
const MovieClipImBufCacheKey *key = keyv;
|
||||||
int rval = key->framenr;
|
int rval = key->framenr;
|
||||||
|
|
||||||
return rval;
|
return rval;
|
||||||
@ -405,8 +405,8 @@ static unsigned int moviecache_hashhash(const void *keyv)
|
|||||||
|
|
||||||
static bool moviecache_hashcmp(const void *av, const void *bv)
|
static bool moviecache_hashcmp(const void *av, const void *bv)
|
||||||
{
|
{
|
||||||
const MovieClipImBufCacheKey *a = (MovieClipImBufCacheKey *)av;
|
const MovieClipImBufCacheKey *a = av;
|
||||||
const MovieClipImBufCacheKey *b = (MovieClipImBufCacheKey *)bv;
|
const MovieClipImBufCacheKey *b = bv;
|
||||||
|
|
||||||
return ((a->framenr != b->framenr) ||
|
return ((a->framenr != b->framenr) ||
|
||||||
(a->proxy != b->proxy) ||
|
(a->proxy != b->proxy) ||
|
||||||
|
@ -1326,7 +1326,7 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
|
|||||||
|
|
||||||
static bool nla_editbone_name_check(void *arg, const char *name)
|
static bool nla_editbone_name_check(void *arg, const char *name)
|
||||||
{
|
{
|
||||||
return BLI_ghash_haskey((GHash *)arg, (void *)name);
|
return BLI_ghash_haskey((GHash *)arg, (const void *)name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find (and set) a unique name for a strip from the whole AnimData block
|
/* Find (and set) a unique name for a strip from the whole AnimData block
|
||||||
|
@ -1568,12 +1568,13 @@ void psys_interpolate_uvs(const MTFace *tface, int quad, const float w[4], float
|
|||||||
|
|
||||||
void psys_interpolate_mcol(const MCol *mcol, int quad, const float w[4], MCol *mc)
|
void psys_interpolate_mcol(const MCol *mcol, int quad, const float w[4], MCol *mc)
|
||||||
{
|
{
|
||||||
char *cp, *cp1, *cp2, *cp3, *cp4;
|
const char *cp1, *cp2, *cp3, *cp4;
|
||||||
|
char *cp;
|
||||||
|
|
||||||
cp = (char *)mc;
|
cp = (char *)mc;
|
||||||
cp1 = (char *)&mcol[0];
|
cp1 = (const char *)&mcol[0];
|
||||||
cp2 = (char *)&mcol[1];
|
cp2 = (const char *)&mcol[1];
|
||||||
cp3 = (char *)&mcol[2];
|
cp3 = (const char *)&mcol[2];
|
||||||
|
|
||||||
if (quad) {
|
if (quad) {
|
||||||
cp4 = (char *)&mcol[3];
|
cp4 = (char *)&mcol[3];
|
||||||
|
@ -95,10 +95,10 @@ static unsigned int seq_hash_render_data(const SeqRenderData *a)
|
|||||||
|
|
||||||
static unsigned int seqcache_hashhash(const void *key_)
|
static unsigned int seqcache_hashhash(const void *key_)
|
||||||
{
|
{
|
||||||
const SeqCacheKey *key = (SeqCacheKey *) key_;
|
const SeqCacheKey *key = key_;
|
||||||
unsigned int rval = seq_hash_render_data(&key->context);
|
unsigned int rval = seq_hash_render_data(&key->context);
|
||||||
|
|
||||||
rval ^= *(unsigned int *) &key->cfra;
|
rval ^= *(const unsigned int *) &key->cfra;
|
||||||
rval += key->type;
|
rval += key->type;
|
||||||
rval ^= ((intptr_t) key->seq) << 6;
|
rval ^= ((intptr_t) key->seq) << 6;
|
||||||
|
|
||||||
@ -107,8 +107,8 @@ static unsigned int seqcache_hashhash(const void *key_)
|
|||||||
|
|
||||||
static bool seqcache_hashcmp(const void *a_, const void *b_)
|
static bool seqcache_hashcmp(const void *a_, const void *b_)
|
||||||
{
|
{
|
||||||
const SeqCacheKey *a = (SeqCacheKey *) a_;
|
const SeqCacheKey *a = a_;
|
||||||
const SeqCacheKey *b = (SeqCacheKey *) b_;
|
const SeqCacheKey *b = b_;
|
||||||
|
|
||||||
return ((a->seq != b->seq) ||
|
return ((a->seq != b->seq) ||
|
||||||
(a->cfra != b->cfra) ||
|
(a->cfra != b->cfra) ||
|
||||||
|
@ -236,8 +236,8 @@ static int vertex_sort(const void *p1, const void *p2)
|
|||||||
BoxVert *v1, *v2;
|
BoxVert *v1, *v2;
|
||||||
float a1, a2;
|
float a1, a2;
|
||||||
|
|
||||||
v1 = vertarray + ((int *)p1)[0];
|
v1 = vertarray + ((const int *)p1)[0];
|
||||||
v2 = vertarray + ((int *)p2)[0];
|
v2 = vertarray + ((const int *)p2)[0];
|
||||||
|
|
||||||
#ifdef USE_FREE_STRIP
|
#ifdef USE_FREE_STRIP
|
||||||
/* push free verts to the end so we can strip */
|
/* push free verts to the end so we can strip */
|
||||||
|
@ -896,7 +896,7 @@ int BLI_move(const char *file, const char *to)
|
|||||||
}
|
}
|
||||||
#endif
|
#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;
|
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)
|
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;
|
int ret;
|
||||||
|
|
||||||
ret = recursive_operation(file, actual_to, copy_callback_pre, copy_single_file, NULL);
|
ret = recursive_operation(file, actual_to, copy_callback_pre, copy_single_file, NULL);
|
||||||
|
|
||||||
if (actual_to != to)
|
if (actual_to != to)
|
||||||
MEM_freeN(actual_to);
|
MEM_freeN((void *)actual_to);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ void BLI_hash_mm2a_add(BLI_HashMurmur2A *mm2, const unsigned char *data, size_t
|
|||||||
mm2a_mix_tail(mm2, &data, &len);
|
mm2a_mix_tail(mm2, &data, &len);
|
||||||
|
|
||||||
for (; len >= 4; data += 4, len -= 4) {
|
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);
|
MM2A_MIX(mm2->hash, k);
|
||||||
}
|
}
|
||||||
|
@ -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 float *co = thunk;
|
||||||
|
|
||||||
const ScanFillIsect *i_a = ((LinkData *)def_a_ptr)->data;
|
const ScanFillIsect *i_a = ((const LinkData *)def_a_ptr)->data;
|
||||||
const ScanFillIsect *i_b = ((LinkData *)def_b_ptr)->data;
|
const ScanFillIsect *i_b = ((const LinkData *)def_b_ptr)->data;
|
||||||
const float a = len_squared_v2v2(co, i_a->co);
|
const float a = len_squared_v2v2(co, i_a->co);
|
||||||
const float b = len_squared_v2v2(co, i_b->co);
|
const float b = len_squared_v2v2(co, i_b->co);
|
||||||
|
|
||||||
|
@ -69,11 +69,11 @@ static const char trailingBytesForUTF8[256] = {
|
|||||||
|
|
||||||
int BLI_utf8_invalid_byte(const char *str, int length)
|
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;
|
unsigned char c;
|
||||||
int ab;
|
int ab;
|
||||||
|
|
||||||
for (p = (unsigned char *)str; p < pend; p++) {
|
for (p = (const unsigned char *)str; p < pend; p++) {
|
||||||
c = *p;
|
c = *p;
|
||||||
if (c < 128)
|
if (c < 128)
|
||||||
continue;
|
continue;
|
||||||
@ -130,7 +130,7 @@ int BLI_utf8_invalid_byte(const char *str, int length)
|
|||||||
|
|
||||||
utf8_error:
|
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)
|
int BLI_utf8_invalid_strip(char *str, int length)
|
||||||
|
@ -3123,14 +3123,14 @@ static void lib_link_key(FileData *fd, Main *main)
|
|||||||
static void switch_endian_keyblock(Key *key, KeyBlock *kb)
|
static void switch_endian_keyblock(Key *key, KeyBlock *kb)
|
||||||
{
|
{
|
||||||
int elemsize, a, b;
|
int elemsize, a, b;
|
||||||
const char *data, *poin, *cp;
|
char *data;
|
||||||
|
|
||||||
elemsize = key->elemsize;
|
elemsize = key->elemsize;
|
||||||
data = kb->data;
|
data = kb->data;
|
||||||
|
|
||||||
for (a = 0; a < kb->totelem; a++) {
|
for (a = 0; a < kb->totelem; a++) {
|
||||||
cp = key->elemstr;
|
const char *cp = key->elemstr;
|
||||||
poin = data;
|
char *poin = data;
|
||||||
|
|
||||||
while (cp[0]) { /* cp[0] == amount */
|
while (cp[0]) { /* cp[0] == amount */
|
||||||
switch (cp[1]) { /* cp[1] = type */
|
switch (cp[1]) { /* cp[1] = type */
|
||||||
|
@ -1448,7 +1448,7 @@ static void write_pose(WriteData *wd, bPose *pose)
|
|||||||
|
|
||||||
/* write IK param */
|
/* write IK param */
|
||||||
if (pose->ikparam) {
|
if (pose->ikparam) {
|
||||||
const char *structname = (char *)BKE_pose_ikparam_get_name(pose);
|
const char *structname = BKE_pose_ikparam_get_name(pose);
|
||||||
if (structname)
|
if (structname)
|
||||||
writestruct(wd, DATA, structname, 1, pose->ikparam);
|
writestruct(wd, DATA, structname, 1, pose->ikparam);
|
||||||
}
|
}
|
||||||
|
@ -744,17 +744,17 @@ bool BM_vert_is_edge_pair(BMVert *v)
|
|||||||
/**
|
/**
|
||||||
* Returns the number of edges around this vertex.
|
* Returns the number of edges around this vertex.
|
||||||
*/
|
*/
|
||||||
int BM_vert_edge_count(BMVert *v)
|
int BM_vert_edge_count(const BMVert *v)
|
||||||
{
|
{
|
||||||
return bmesh_disk_count(v);
|
return bmesh_disk_count(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BM_vert_edge_count_nonwire(BMVert *v)
|
int BM_vert_edge_count_nonwire(const BMVert *v)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
BMIter eiter;
|
BMIter eiter;
|
||||||
BMEdge *edge;
|
BMEdge *edge;
|
||||||
BM_ITER_ELEM (edge, &eiter, v, BM_EDGES_OF_VERT) {
|
BM_ITER_ELEM (edge, &eiter, (BMVert *)v, BM_EDGES_OF_VERT) {
|
||||||
if (edge->l) {
|
if (edge->l) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@ -764,7 +764,7 @@ int BM_vert_edge_count_nonwire(BMVert *v)
|
|||||||
/**
|
/**
|
||||||
* Returns the number of faces around this edge
|
* Returns the number of faces around this edge
|
||||||
*/
|
*/
|
||||||
int BM_edge_face_count(BMEdge *e)
|
int BM_edge_face_count(const BMEdge *e)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
@ -786,7 +786,7 @@ int BM_edge_face_count(BMEdge *e)
|
|||||||
* Returns the number of faces around this vert
|
* Returns the number of faces around this vert
|
||||||
* length matches #BM_LOOPS_OF_VERT iterator
|
* length matches #BM_LOOPS_OF_VERT iterator
|
||||||
*/
|
*/
|
||||||
int BM_vert_face_count(BMVert *v)
|
int BM_vert_face_count(const BMVert *v)
|
||||||
{
|
{
|
||||||
return bmesh_disk_facevert_count(v);
|
return bmesh_disk_facevert_count(v);
|
||||||
}
|
}
|
||||||
|
@ -64,10 +64,10 @@ BMFace *BM_vert_pair_share_face_by_angle(
|
|||||||
BMLoop **r_l_a, BMLoop **r_l_b,
|
BMLoop **r_l_a, BMLoop **r_l_b,
|
||||||
const bool allow_adjacent) ATTR_NONNULL();
|
const bool allow_adjacent) ATTR_NONNULL();
|
||||||
|
|
||||||
int BM_vert_edge_count_nonwire(BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
int BM_vert_edge_count_nonwire(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||||
int BM_vert_edge_count(BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
int BM_vert_edge_count(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||||
int BM_edge_face_count(BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
int BM_edge_face_count(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||||
int BM_vert_face_count(BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
int BM_vert_face_count(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||||
BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||||
|
|
||||||
bool BM_vert_is_edge_pair(BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
bool BM_vert_is_edge_pair(BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||||
|
@ -238,7 +238,7 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
|
|||||||
|
|
||||||
static int vergaverco(const void *e1, const void *e2)
|
static int vergaverco(const void *e1, const void *e2)
|
||||||
{
|
{
|
||||||
const BMVert *v1 = *(void **)e1, *v2 = *(void **)e2;
|
const BMVert *v1 = *(const void **)e1, *v2 = *(const void **)e2;
|
||||||
float x1 = v1->co[0] + v1->co[1] + v1->co[2];
|
float x1 = v1->co[0] + v1->co[1] + v1->co[2];
|
||||||
float x2 = v2->co[0] + v2->co[1] + v2->co[2];
|
float x2 = v2->co[0] + v2->co[1] + v2->co[2];
|
||||||
|
|
||||||
|
@ -166,7 +166,8 @@ static bool write_png(const char *name, const unsigned int *pixels,
|
|||||||
/* set the individual row-pointers to point at the correct offsets */
|
/* set the individual row-pointers to point at the correct offsets */
|
||||||
for (i = 0; i < height; i++) {
|
for (i = 0; i < height; i++) {
|
||||||
row_pointers[height - 1 - i] = (png_bytep)
|
row_pointers[height - 1 - i] = (png_bytep)
|
||||||
(((unsigned char *)pixels) + (i * width) * bytesperpixel * sizeof(unsigned char));
|
(((const unsigned char *)pixels) +
|
||||||
|
(i * width) * bytesperpixel * sizeof(unsigned char));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write out the entire image data in one call */
|
/* write out the entire image data in one call */
|
||||||
|
@ -3909,7 +3909,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Draw UI widgets the given channel */
|
/* Draw UI widgets the given channel */
|
||||||
void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc, size_t channel_index)
|
void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc, size_t channel_index)
|
||||||
{
|
{
|
||||||
bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||||
View2D *v2d = &ac->ar->v2d;
|
View2D *v2d = &ac->ar->v2d;
|
||||||
|
@ -365,8 +365,8 @@ typedef struct tSortActionGroup {
|
|||||||
/* compare bone groups by name */
|
/* compare bone groups by name */
|
||||||
static int compare_agroup(const void *sgrp_a_ptr, const void *sgrp_b_ptr)
|
static int compare_agroup(const void *sgrp_a_ptr, const void *sgrp_b_ptr)
|
||||||
{
|
{
|
||||||
tSortActionGroup *sgrp_a = (tSortActionGroup *)sgrp_a_ptr;
|
const tSortActionGroup *sgrp_a = sgrp_a_ptr;
|
||||||
tSortActionGroup *sgrp_b = (tSortActionGroup *)sgrp_b_ptr;
|
const tSortActionGroup *sgrp_b = sgrp_b_ptr;
|
||||||
|
|
||||||
return strcmp(sgrp_a->agrp->name, sgrp_b->agrp->name);
|
return strcmp(sgrp_a->agrp->name, sgrp_b->agrp->name);
|
||||||
}
|
}
|
||||||
|
@ -1884,8 +1884,8 @@ static void undoFont_to_editFont(void *strv, void *ecu, void *UNUSED(obdata))
|
|||||||
EditFont *ef = cu->editfont;
|
EditFont *ef = cu->editfont;
|
||||||
const char *str = strv;
|
const char *str = strv;
|
||||||
|
|
||||||
ef->pos = *((short *)str);
|
ef->pos = *((const short *)str);
|
||||||
ef->len = *((short *)(str + 2));
|
ef->len = *((const short *)(str + 2));
|
||||||
|
|
||||||
memcpy(ef->textbuf, str + 4, (ef->len + 1) * sizeof(wchar_t));
|
memcpy(ef->textbuf, str + 4, (ef->len + 1) * sizeof(wchar_t));
|
||||||
memcpy(ef->textbufinfo, str + 4 + (ef->len + 1) * sizeof(wchar_t), ef->len * sizeof(CharInfo));
|
memcpy(ef->textbufinfo, str + 4 + (ef->len + 1) * sizeof(wchar_t), ef->len * sizeof(CharInfo));
|
||||||
|
@ -458,7 +458,7 @@ void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level);
|
|||||||
/* Draw the given channel */
|
/* Draw the given channel */
|
||||||
void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
|
void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
|
||||||
/* Draw the widgets for the given channel */
|
/* Draw the widgets for the given channel */
|
||||||
void ANIM_channel_draw_widgets(struct bContext *C, bAnimContext *ac, bAnimListElem *ale, struct uiBlock *block, float yminc, float ymaxc, size_t channel_index);
|
void ANIM_channel_draw_widgets(const struct bContext *C, bAnimContext *ac, bAnimListElem *ale, struct uiBlock *block, float yminc, float ymaxc, size_t channel_index);
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------ Editing API -------------------------- */
|
/* ------------------------ Editing API -------------------------- */
|
||||||
|
@ -931,7 +931,7 @@ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size)
|
|||||||
|
|
||||||
/* only called when icon has changed */
|
/* only called when icon has changed */
|
||||||
/* only call with valid pointer from UI_icon_draw */
|
/* only call with valid pointer from UI_icon_draw */
|
||||||
static void icon_set_image(bContext *C, ID *id, PreviewImage *prv_img, enum eIconSizes size)
|
static void icon_set_image(const bContext *C, ID *id, PreviewImage *prv_img, enum eIconSizes size)
|
||||||
{
|
{
|
||||||
if (!prv_img) {
|
if (!prv_img) {
|
||||||
if (G.debug & G_DEBUG)
|
if (G.debug & G_DEBUG)
|
||||||
@ -1149,7 +1149,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_id_preview_image_render_size(bContext *C, ID *id, PreviewImage *pi, int size)
|
static void ui_id_preview_image_render_size(const bContext *C, ID *id, PreviewImage *pi, int size)
|
||||||
{
|
{
|
||||||
if ((pi->changed[size] || !pi->rect[size])) { /* changed only ever set by dynamic icons */
|
if ((pi->changed[size] || !pi->rect[size])) { /* changed only ever set by dynamic icons */
|
||||||
/* create the rect if necessary */
|
/* create the rect if necessary */
|
||||||
@ -1159,7 +1159,7 @@ static void ui_id_preview_image_render_size(bContext *C, ID *id, PreviewImage *p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_id_icon_render(bContext *C, ID *id, const bool big)
|
static void ui_id_icon_render(const bContext *C, ID *id, const bool big)
|
||||||
{
|
{
|
||||||
PreviewImage *pi = BKE_previewimg_get(id);
|
PreviewImage *pi = BKE_previewimg_get(id);
|
||||||
|
|
||||||
@ -1171,7 +1171,7 @@ static void ui_id_icon_render(bContext *C, ID *id, const bool big)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_id_brush_render(bContext *C, ID *id)
|
static void ui_id_brush_render(const bContext *C, ID *id)
|
||||||
{
|
{
|
||||||
PreviewImage *pi = BKE_previewimg_get(id);
|
PreviewImage *pi = BKE_previewimg_get(id);
|
||||||
enum eIconSizes i;
|
enum eIconSizes i;
|
||||||
@ -1190,7 +1190,7 @@ static void ui_id_brush_render(bContext *C, ID *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int ui_id_brush_get_icon(bContext *C, ID *id)
|
static int ui_id_brush_get_icon(const bContext *C, ID *id)
|
||||||
{
|
{
|
||||||
Brush *br = (Brush *)id;
|
Brush *br = (Brush *)id;
|
||||||
|
|
||||||
@ -1243,7 +1243,7 @@ static int ui_id_brush_get_icon(bContext *C, ID *id)
|
|||||||
return id->icon_id;
|
return id->icon_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ui_id_icon_get(bContext *C, ID *id, const bool big)
|
int ui_id_icon_get(const bContext *C, ID *id, const bool big)
|
||||||
{
|
{
|
||||||
int iconid = 0;
|
int iconid = 0;
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *na
|
|||||||
void uiStyleInit(void);
|
void uiStyleInit(void);
|
||||||
|
|
||||||
/* interface_icons.c */
|
/* interface_icons.c */
|
||||||
int ui_id_icon_get(struct bContext *C, struct ID *id, const bool big);
|
int ui_id_icon_get(const struct bContext *C, struct ID *id, const bool big);
|
||||||
|
|
||||||
/* resources.c */
|
/* resources.c */
|
||||||
void init_userdef_do_versions(void);
|
void init_userdef_do_versions(void);
|
||||||
|
@ -1450,8 +1450,8 @@ typedef struct CollItemSearch {
|
|||||||
|
|
||||||
static int sort_search_items_list(const void *a, const void *b)
|
static int sort_search_items_list(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
CollItemSearch *cis1 = (CollItemSearch *)a;
|
const CollItemSearch *cis1 = (CollItemSearch *)a;
|
||||||
CollItemSearch *cis2 = (CollItemSearch *)b;
|
const CollItemSearch *cis2 = (CollItemSearch *)b;
|
||||||
|
|
||||||
if (BLI_strcasecmp(cis1->name, cis2->name) > 0)
|
if (BLI_strcasecmp(cis1->name, cis2->name) > 0)
|
||||||
return 1;
|
return 1;
|
||||||
@ -1492,7 +1492,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
|
|||||||
BLI_strncpy(name_ui, id->name + 2, sizeof(name_ui));
|
BLI_strncpy(name_ui, id->name + 2, sizeof(name_ui));
|
||||||
#endif
|
#endif
|
||||||
name = BLI_strdup(name_ui);
|
name = BLI_strdup(name_ui);
|
||||||
iconid = ui_id_icon_get((bContext *)C, id, false);
|
iconid = ui_id_icon_get(C, id, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */
|
name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */
|
||||||
|
@ -154,7 +154,7 @@ static void id_search_cb(const bContext *C, void *arg_template, const char *str,
|
|||||||
char name_ui[MAX_ID_NAME + 1];
|
char name_ui[MAX_ID_NAME + 1];
|
||||||
name_uiprefix_id(name_ui, id);
|
name_uiprefix_id(name_ui, id);
|
||||||
|
|
||||||
iconid = ui_id_icon_get((bContext *)C, id, template->preview);
|
iconid = ui_id_icon_get(C, id, template->preview);
|
||||||
|
|
||||||
if (false == UI_search_item_add(items, name_ui, id, iconid))
|
if (false == UI_search_item_add(items, name_ui, id, iconid))
|
||||||
break;
|
break;
|
||||||
|
@ -664,7 +664,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (unsigned char *)cp;
|
return (const unsigned char *)cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* use this call to init new bone color sets in Theme */
|
/* use this call to init new bone color sets in Theme */
|
||||||
|
@ -2305,7 +2305,7 @@ void UI_view2d_text_cache_add(View2D *v2d, float x, float y,
|
|||||||
|
|
||||||
BLI_LINKS_PREPEND(g_v2d_strings, v2s);
|
BLI_LINKS_PREPEND(g_v2d_strings, v2s);
|
||||||
|
|
||||||
v2s->col.pack = *((int *)col);
|
v2s->col.pack = *((const int *)col);
|
||||||
|
|
||||||
memset(&v2s->rect, 0, sizeof(v2s->rect));
|
memset(&v2s->rect, 0, sizeof(v2s->rect));
|
||||||
|
|
||||||
@ -2336,7 +2336,7 @@ void UI_view2d_text_cache_add_rectf(View2D *v2d, const rctf *rect_view,
|
|||||||
|
|
||||||
BLI_LINKS_PREPEND(g_v2d_strings, v2s);
|
BLI_LINKS_PREPEND(g_v2d_strings, v2s);
|
||||||
|
|
||||||
v2s->col.pack = *((int *)col);
|
v2s->col.pack = *((const int *)col);
|
||||||
|
|
||||||
v2s->rect = rect;
|
v2s->rect = rect;
|
||||||
|
|
||||||
|
@ -2025,8 +2025,8 @@ static int knife_update_active(KnifeTool_OpData *kcd)
|
|||||||
|
|
||||||
static int sort_verts_by_dist_cb(void *co_p, const void *cur_a_p, const void *cur_b_p)
|
static int sort_verts_by_dist_cb(void *co_p, const void *cur_a_p, const void *cur_b_p)
|
||||||
{
|
{
|
||||||
KnifeVert *cur_a = ((Ref *)cur_a_p)->ref;
|
const KnifeVert *cur_a = ((const Ref *)cur_a_p)->ref;
|
||||||
KnifeVert *cur_b = ((Ref *)cur_b_p)->ref;
|
const KnifeVert *cur_b = ((const Ref *)cur_b_p)->ref;
|
||||||
const float *co = co_p;
|
const float *co = co_p;
|
||||||
const float a_sq = len_squared_v3v3(co, cur_a->co);
|
const float a_sq = len_squared_v3v3(co, cur_a->co);
|
||||||
const float b_sq = len_squared_v3v3(co, cur_b->co);
|
const float b_sq = len_squared_v3v3(co, cur_b->co);
|
||||||
|
@ -3362,8 +3362,8 @@ static int loop_find_region(BMLoop *l, int flag,
|
|||||||
|
|
||||||
static int verg_radial(const void *va, const void *vb)
|
static int verg_radial(const void *va, const void *vb)
|
||||||
{
|
{
|
||||||
BMEdge *e_a = *((BMEdge **)va);
|
const BMEdge *e_a = *((const BMEdge **)va);
|
||||||
BMEdge *e_b = *((BMEdge **)vb);
|
const BMEdge *e_b = *((const BMEdge **)vb);
|
||||||
|
|
||||||
int a, b;
|
int a, b;
|
||||||
a = BM_edge_face_count(e_a);
|
a = BM_edge_face_count(e_a);
|
||||||
|
@ -557,15 +557,15 @@ static int uv_element_offset_from_face_get(UvElementMap *map, BMFace *efa, BMLoo
|
|||||||
|
|
||||||
static unsigned int uv_edge_hash(const void *key)
|
static unsigned int uv_edge_hash(const void *key)
|
||||||
{
|
{
|
||||||
UvEdge *edge = (UvEdge *)key;
|
const UvEdge *edge = key;
|
||||||
return (BLI_ghashutil_uinthash(edge->uv2) +
|
return (BLI_ghashutil_uinthash(edge->uv2) +
|
||||||
BLI_ghashutil_uinthash(edge->uv1));
|
BLI_ghashutil_uinthash(edge->uv1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool uv_edge_compare(const void *a, const void *b)
|
static bool uv_edge_compare(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
UvEdge *edge1 = (UvEdge *)a;
|
const UvEdge *edge1 = a;
|
||||||
UvEdge *edge2 = (UvEdge *)b;
|
const UvEdge *edge2 = b;
|
||||||
|
|
||||||
if ((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)) {
|
if ((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -618,7 +618,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
|
|||||||
/* *********************************************** */
|
/* *********************************************** */
|
||||||
/* Channel List */
|
/* Channel List */
|
||||||
|
|
||||||
void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar)
|
void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *ar)
|
||||||
{
|
{
|
||||||
ListBase anim_data = {NULL, NULL};
|
ListBase anim_data = {NULL, NULL};
|
||||||
bAnimListElem *ale;
|
bAnimListElem *ale;
|
||||||
|
@ -50,7 +50,7 @@ void NLA_OT_properties(wmOperatorType *ot);
|
|||||||
/* nla_draw.c */
|
/* nla_draw.c */
|
||||||
|
|
||||||
void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar);
|
void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar);
|
||||||
void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar);
|
void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *ar);
|
||||||
|
|
||||||
/* **************************************** */
|
/* **************************************** */
|
||||||
/* nla_select.c */
|
/* nla_select.c */
|
||||||
|
@ -236,7 +236,7 @@ static void nla_channel_area_draw(const bContext *C, ARegion *ar)
|
|||||||
|
|
||||||
/* data */
|
/* data */
|
||||||
if (ANIM_animdata_get_context(C, &ac)) {
|
if (ANIM_animdata_get_context(C, &ac)) {
|
||||||
draw_nla_channel_list((bContext *)C, &ac, ar);
|
draw_nla_channel_list(C, &ac, ar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset view matrix */
|
/* reset view matrix */
|
||||||
|
@ -453,8 +453,8 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
|
|||||||
PointerRNA ptr, idptr;
|
PointerRNA ptr, idptr;
|
||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
const char *idname;
|
const char *idname;
|
||||||
char _treename[MAX_ID_NAME - 2];
|
char treename_buf[MAX_ID_NAME - 2];
|
||||||
char *treename = _treename;
|
const char *treename;
|
||||||
|
|
||||||
if (RNA_struct_property_is_set(op->ptr, "type")) {
|
if (RNA_struct_property_is_set(op->ptr, "type")) {
|
||||||
prop = RNA_struct_find_property(op->ptr, "type");
|
prop = RNA_struct_find_property(op->ptr, "type");
|
||||||
@ -466,10 +466,11 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
if (RNA_struct_property_is_set(op->ptr, "name")) {
|
if (RNA_struct_property_is_set(op->ptr, "name")) {
|
||||||
RNA_string_get(op->ptr, "name", treename);
|
RNA_string_get(op->ptr, "name", treename_buf);
|
||||||
|
treename = treename_buf;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
treename = (char *)DATA_("NodeTree");
|
treename = DATA_("NodeTree");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ntreeTypeFind(idname)) {
|
if (!ntreeTypeFind(idname)) {
|
||||||
|
@ -55,7 +55,7 @@ static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3])
|
|||||||
|
|
||||||
static void scope_put_pixel(unsigned char *table, unsigned char *pos)
|
static void scope_put_pixel(unsigned char *table, unsigned char *pos)
|
||||||
{
|
{
|
||||||
char newval = table[*pos];
|
unsigned char newval = table[*pos];
|
||||||
pos[0] = pos[1] = pos[2] = newval;
|
pos[0] = pos[1] = pos[2] = newval;
|
||||||
pos[3] = 255;
|
pos[3] = 255;
|
||||||
}
|
}
|
||||||
@ -148,8 +148,8 @@ static ImBuf *make_waveform_view_from_ibuf_byte(ImBuf *ibuf)
|
|||||||
{
|
{
|
||||||
ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
|
ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
|
||||||
int x, y;
|
int x, y;
|
||||||
unsigned char *src = (unsigned char *) ibuf->rect;
|
const unsigned char *src = (unsigned char *)ibuf->rect;
|
||||||
unsigned char *tgt = (unsigned char *) rval->rect;
|
unsigned char *tgt = (unsigned char *)rval->rect;
|
||||||
int w = ibuf->x + 3;
|
int w = ibuf->x + 3;
|
||||||
int h = 515;
|
int h = 515;
|
||||||
float waveform_gamma = 0.2;
|
float waveform_gamma = 0.2;
|
||||||
@ -166,7 +166,7 @@ static ImBuf *make_waveform_view_from_ibuf_byte(ImBuf *ibuf)
|
|||||||
unsigned char *last_p = NULL;
|
unsigned char *last_p = NULL;
|
||||||
|
|
||||||
for (x = 0; x < ibuf->x; x++) {
|
for (x = 0; x < ibuf->x; x++) {
|
||||||
unsigned char *rgb = src + 4 * (ibuf->x * y + x);
|
const unsigned char *rgb = src + 4 * (ibuf->x * y + x);
|
||||||
float v = (float)rgb_to_luma_byte(rgb) / 255.0f;
|
float v = (float)rgb_to_luma_byte(rgb) / 255.0f;
|
||||||
unsigned char *p = tgt;
|
unsigned char *p = tgt;
|
||||||
p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1);
|
p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1);
|
||||||
@ -189,7 +189,7 @@ static ImBuf *make_waveform_view_from_ibuf_float(ImBuf *ibuf)
|
|||||||
{
|
{
|
||||||
ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
|
ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
|
||||||
int x, y;
|
int x, y;
|
||||||
float *src = ibuf->rect_float;
|
const float *src = ibuf->rect_float;
|
||||||
unsigned char *tgt = (unsigned char *) rval->rect;
|
unsigned char *tgt = (unsigned char *) rval->rect;
|
||||||
int w = ibuf->x + 3;
|
int w = ibuf->x + 3;
|
||||||
int h = 515;
|
int h = 515;
|
||||||
@ -245,8 +245,8 @@ static ImBuf *make_sep_waveform_view_from_ibuf_byte(ImBuf *ibuf)
|
|||||||
{
|
{
|
||||||
ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
|
ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
|
||||||
int x, y;
|
int x, y;
|
||||||
unsigned char *src = (unsigned char *) ibuf->rect;
|
const unsigned char *src = (const unsigned char *)ibuf->rect;
|
||||||
unsigned char *tgt = (unsigned char *) rval->rect;
|
unsigned char *tgt = (unsigned char *)rval->rect;
|
||||||
int w = ibuf->x + 3;
|
int w = ibuf->x + 3;
|
||||||
int sw = ibuf->x / 3;
|
int sw = ibuf->x / 3;
|
||||||
int h = 515;
|
int h = 515;
|
||||||
@ -264,7 +264,7 @@ static ImBuf *make_sep_waveform_view_from_ibuf_byte(ImBuf *ibuf)
|
|||||||
|
|
||||||
for (x = 0; x < ibuf->x; x++) {
|
for (x = 0; x < ibuf->x; x++) {
|
||||||
int c;
|
int c;
|
||||||
unsigned char *rgb = src + 4 * (ibuf->x * y + x);
|
const unsigned char *rgb = src + 4 * (ibuf->x * y + x);
|
||||||
for (c = 0; c < 3; c++) {
|
for (c = 0; c < 3; c++) {
|
||||||
unsigned char *p = tgt;
|
unsigned char *p = tgt;
|
||||||
p += 4 * (w * ((rgb[c] * (h - 3)) / 255 + 1) + c * sw + x / 3 + 1);
|
p += 4 * (w * ((rgb[c] * (h - 3)) / 255 + 1) + c * sw + x / 3 + 1);
|
||||||
@ -290,8 +290,8 @@ static ImBuf *make_sep_waveform_view_from_ibuf_float(ImBuf *ibuf)
|
|||||||
{
|
{
|
||||||
ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
|
ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
|
||||||
int x, y;
|
int x, y;
|
||||||
float *src = ibuf->rect_float;
|
const float *src = ibuf->rect_float;
|
||||||
unsigned char *tgt = (unsigned char *) rval->rect;
|
unsigned char *tgt = (unsigned char *)rval->rect;
|
||||||
int w = ibuf->x + 3;
|
int w = ibuf->x + 3;
|
||||||
int sw = ibuf->x / 3;
|
int sw = ibuf->x / 3;
|
||||||
int h = 515;
|
int h = 515;
|
||||||
@ -455,7 +455,7 @@ static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf)
|
|||||||
ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect);
|
ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect);
|
||||||
int x, y;
|
int x, y;
|
||||||
unsigned int nr, ng, nb;
|
unsigned int nr, ng, nb;
|
||||||
unsigned char *src = (unsigned char *) ibuf->rect;
|
const unsigned char *src = (unsigned char *)ibuf->rect;
|
||||||
|
|
||||||
unsigned int bins[3][HIS_STEPS];
|
unsigned int bins[3][HIS_STEPS];
|
||||||
|
|
||||||
@ -468,7 +468,7 @@ static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf)
|
|||||||
memset(cur_bins, 0, sizeof(cur_bins));
|
memset(cur_bins, 0, sizeof(cur_bins));
|
||||||
|
|
||||||
for (x = 0; x < ibuf->x; x++) {
|
for (x = 0; x < ibuf->x; x++) {
|
||||||
unsigned char *pixel = src + (y * ibuf->x + x) * 4;
|
const unsigned char *pixel = src + (y * ibuf->x + x) * 4;
|
||||||
|
|
||||||
cur_bins[0][pixel[0]]++;
|
cur_bins[0][pixel[0]]++;
|
||||||
cur_bins[1][pixel[1]]++;
|
cur_bins[1][pixel[1]]++;
|
||||||
@ -532,7 +532,7 @@ static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf)
|
|||||||
{
|
{
|
||||||
ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect);
|
ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect);
|
||||||
int nr, ng, nb, x, y;
|
int nr, ng, nb, x, y;
|
||||||
float *src = ibuf->rect_float;
|
const float *src = ibuf->rect_float;
|
||||||
|
|
||||||
unsigned int bins[3][HIS_STEPS];
|
unsigned int bins[3][HIS_STEPS];
|
||||||
|
|
||||||
@ -635,7 +635,7 @@ static ImBuf *make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf)
|
|||||||
{
|
{
|
||||||
ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect);
|
ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect);
|
||||||
int x, y;
|
int x, y;
|
||||||
char *src = (char *) ibuf->rect;
|
const char *src = (const char *) ibuf->rect;
|
||||||
char *tgt = (char *) rval->rect;
|
char *tgt = (char *) rval->rect;
|
||||||
float rgb[3], yuv[3];
|
float rgb[3], yuv[3];
|
||||||
int w = 515;
|
int w = 515;
|
||||||
@ -659,7 +659,7 @@ static ImBuf *make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf)
|
|||||||
for (y = 0; y < ibuf->y; y++) {
|
for (y = 0; y < ibuf->y; y++) {
|
||||||
for (x = 0; x < ibuf->x; x++) {
|
for (x = 0; x < ibuf->x; x++) {
|
||||||
const char *src1 = src + 4 * (ibuf->x * y + x);
|
const char *src1 = src + 4 * (ibuf->x * y + x);
|
||||||
const char *p;
|
char *p;
|
||||||
|
|
||||||
rgb[0] = (float)src1[0] / 255.0f;
|
rgb[0] = (float)src1[0] / 255.0f;
|
||||||
rgb[1] = (float)src1[1] / 255.0f;
|
rgb[1] = (float)src1[1] / 255.0f;
|
||||||
@ -681,7 +681,7 @@ static ImBuf *make_vectorscope_view_from_ibuf_float(ImBuf *ibuf)
|
|||||||
{
|
{
|
||||||
ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect);
|
ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect);
|
||||||
int x, y;
|
int x, y;
|
||||||
float *src = ibuf->rect_float;
|
const float *src = ibuf->rect_float;
|
||||||
char *tgt = (char *) rval->rect;
|
char *tgt = (char *) rval->rect;
|
||||||
float rgb[3], yuv[3];
|
float rgb[3], yuv[3];
|
||||||
int w = 515;
|
int w = 515;
|
||||||
|
@ -3402,8 +3402,8 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
|
|||||||
|
|
||||||
static int p_compare_geometric_uv(const void *a, const void *b)
|
static int p_compare_geometric_uv(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
PVert *v1 = *(PVert **)a;
|
const PVert *v1 = *(const PVert **)a;
|
||||||
PVert *v2 = *(PVert **)b;
|
const PVert *v2 = *(const PVert **)b;
|
||||||
|
|
||||||
if (v1->uv[0] < v2->uv[0])
|
if (v1->uv[0] < v2->uv[0])
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1354,16 +1354,15 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
|
|||||||
/* Stitch hash initialization functions */
|
/* Stitch hash initialization functions */
|
||||||
static unsigned int uv_edge_hash(const void *key)
|
static unsigned int uv_edge_hash(const void *key)
|
||||||
{
|
{
|
||||||
UvEdge *edge = (UvEdge *)key;
|
const UvEdge *edge = key;
|
||||||
return
|
return (BLI_ghashutil_uinthash(edge->uv2) +
|
||||||
BLI_ghashutil_uinthash(edge->uv2) +
|
BLI_ghashutil_uinthash(edge->uv1));
|
||||||
BLI_ghashutil_uinthash(edge->uv1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool uv_edge_compare(const void *a, const void *b)
|
static bool uv_edge_compare(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
UvEdge *edge1 = (UvEdge *)a;
|
const UvEdge *edge1 = a;
|
||||||
UvEdge *edge2 = (UvEdge *)b;
|
const UvEdge *edge2 = b;
|
||||||
|
|
||||||
if ((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)) {
|
if ((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -238,7 +238,7 @@ GPUFunction *GPU_lookup_function(const char *name)
|
|||||||
gpu_parse_functions_string(FUNCTION_HASH, glsl_material_library);
|
gpu_parse_functions_string(FUNCTION_HASH, glsl_material_library);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, (void *)name);
|
return BLI_ghash_lookup(FUNCTION_HASH, (const void *)name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpu_codegen_init(void)
|
void gpu_codegen_init(void)
|
||||||
|
@ -135,7 +135,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
|
|||||||
{
|
{
|
||||||
CineonMainHeader header;
|
CineonMainHeader header;
|
||||||
LogImageFile *cineon = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
|
LogImageFile *cineon = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
|
||||||
char *filename = (char *)byteStuff;
|
const char *filename = (const char *)byteStuff;
|
||||||
int i;
|
int i;
|
||||||
unsigned int dataOffset;
|
unsigned int dataOffset;
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
|
|||||||
{
|
{
|
||||||
DpxMainHeader header;
|
DpxMainHeader header;
|
||||||
LogImageFile *dpx = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
|
LogImageFile *dpx = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
|
||||||
char *filename = (char *)byteStuff;
|
const char *filename = (const char *)byteStuff;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (dpx == NULL) {
|
if (dpx == NULL) {
|
||||||
|
@ -243,7 +243,7 @@ static ColormnaageCacheData *colormanage_cachedata_get(const ImBuf *ibuf)
|
|||||||
|
|
||||||
static unsigned int colormanage_hashhash(const void *key_v)
|
static unsigned int colormanage_hashhash(const void *key_v)
|
||||||
{
|
{
|
||||||
ColormanageCacheKey *key = (ColormanageCacheKey *)key_v;
|
const ColormanageCacheKey *key = key_v;
|
||||||
|
|
||||||
unsigned int rval = (key->display << 16) | (key->view % 0xffff);
|
unsigned int rval = (key->display << 16) | (key->view % 0xffff);
|
||||||
|
|
||||||
@ -252,8 +252,8 @@ static unsigned int colormanage_hashhash(const void *key_v)
|
|||||||
|
|
||||||
static bool colormanage_hashcmp(const void *av, const void *bv)
|
static bool colormanage_hashcmp(const void *av, const void *bv)
|
||||||
{
|
{
|
||||||
const ColormanageCacheKey *a = (ColormanageCacheKey *) av;
|
const ColormanageCacheKey *a = av;
|
||||||
const ColormanageCacheKey *b = (ColormanageCacheKey *) bv;
|
const ColormanageCacheKey *b = bv;
|
||||||
|
|
||||||
return ((a->view != b->view) ||
|
return ((a->view != b->view) ||
|
||||||
(a->display != b->display));
|
(a->display != b->display));
|
||||||
|
@ -99,22 +99,22 @@ typedef struct MovieCacheItem {
|
|||||||
|
|
||||||
static unsigned int moviecache_hashhash(const void *keyv)
|
static unsigned int moviecache_hashhash(const void *keyv)
|
||||||
{
|
{
|
||||||
MovieCacheKey *key = (MovieCacheKey *)keyv;
|
const MovieCacheKey *key = keyv;
|
||||||
|
|
||||||
return key->cache_owner->hashfp(key->userkey);
|
return key->cache_owner->hashfp(key->userkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool moviecache_hashcmp(const void *av, const void *bv)
|
static bool moviecache_hashcmp(const void *av, const void *bv)
|
||||||
{
|
{
|
||||||
const MovieCacheKey *a = (MovieCacheKey *)av;
|
const MovieCacheKey *a = av;
|
||||||
const MovieCacheKey *b = (MovieCacheKey *)bv;
|
const MovieCacheKey *b = bv;
|
||||||
|
|
||||||
return a->cache_owner->cmpfp(a->userkey, b->userkey);
|
return a->cache_owner->cmpfp(a->userkey, b->userkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void moviecache_keyfree(void *val)
|
static void moviecache_keyfree(void *val)
|
||||||
{
|
{
|
||||||
MovieCacheKey *key = (MovieCacheKey *)val;
|
MovieCacheKey *key = val;
|
||||||
|
|
||||||
BLI_mempool_free(key->cache_owner->userkeys_pool, key->userkey);
|
BLI_mempool_free(key->cache_owner->userkeys_pool, key->userkey);
|
||||||
|
|
||||||
@ -167,8 +167,8 @@ static void check_unused_keys(MovieCache *cache)
|
|||||||
|
|
||||||
static int compare_int(const void *av, const void *bv)
|
static int compare_int(const void *av, const void *bv)
|
||||||
{
|
{
|
||||||
const int *a = (int *)av;
|
const int *a = av;
|
||||||
const int *b = (int *)bv;
|
const int *b = bv;
|
||||||
return *a - *b;
|
return *a - *b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -909,7 +909,7 @@ static void dna_write(FILE *file, const void *pntr, const int size)
|
|||||||
int i;
|
int i;
|
||||||
const char *data;
|
const char *data;
|
||||||
|
|
||||||
data = (char *) pntr;
|
data = (const char *)pntr;
|
||||||
|
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
fprintf(file, "%d, ", data[i]);
|
fprintf(file, "%d, ", data[i]);
|
||||||
|
@ -466,7 +466,7 @@ static const char *rna_ensure_property_identifier(const PropertyRNA *prop)
|
|||||||
if (prop->magic == RNA_MAGIC)
|
if (prop->magic == RNA_MAGIC)
|
||||||
return prop->identifier;
|
return prop->identifier;
|
||||||
else
|
else
|
||||||
return ((IDProperty *)prop)->name;
|
return ((const IDProperty *)prop)->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *rna_ensure_property_description(PropertyRNA *prop)
|
static const char *rna_ensure_property_description(PropertyRNA *prop)
|
||||||
@ -499,7 +499,7 @@ static const char *rna_ensure_property_name(const PropertyRNA *prop)
|
|||||||
if (prop->magic == RNA_MAGIC)
|
if (prop->magic == RNA_MAGIC)
|
||||||
name = prop->name;
|
name = prop->name;
|
||||||
else
|
else
|
||||||
name = ((IDProperty *)prop)->name;
|
name = ((const IDProperty *)prop)->name;
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -4284,7 +4284,7 @@ char *RNA_path_append(const char *path, PointerRNA *UNUSED(ptr), PropertyRNA *pr
|
|||||||
|
|
||||||
/* add .identifier */
|
/* add .identifier */
|
||||||
if (path) {
|
if (path) {
|
||||||
BLI_dynstr_append(dynstr, (char *)path);
|
BLI_dynstr_append(dynstr, path);
|
||||||
if (*path)
|
if (*path)
|
||||||
BLI_dynstr_append(dynstr, ".");
|
BLI_dynstr_append(dynstr, ".");
|
||||||
}
|
}
|
||||||
|
@ -777,7 +777,7 @@ static void rna_Object_rotation_axis_angle_set(PointerRNA *ptr, const float *val
|
|||||||
|
|
||||||
/* for now, assume that rotation mode is axis-angle */
|
/* for now, assume that rotation mode is axis-angle */
|
||||||
ob->rotAngle = value[0];
|
ob->rotAngle = value[0];
|
||||||
copy_v3_v3(ob->rotAxis, (float *)&value[1]);
|
copy_v3_v3(ob->rotAxis, &value[1]);
|
||||||
|
|
||||||
/* TODO: validate axis? */
|
/* TODO: validate axis? */
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ static void rna_PoseChannel_rotation_axis_angle_set(PointerRNA *ptr, const float
|
|||||||
|
|
||||||
/* for now, assume that rotation mode is axis-angle */
|
/* for now, assume that rotation mode is axis-angle */
|
||||||
pchan->rotAngle = value[0];
|
pchan->rotAngle = value[0];
|
||||||
copy_v3_v3(pchan->rotAxis, (float *)&value[1]);
|
copy_v3_v3(pchan->rotAxis, &value[1]);
|
||||||
|
|
||||||
/* TODO: validate axis? */
|
/* TODO: validate axis? */
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,8 @@ typedef struct SortVertsElem {
|
|||||||
|
|
||||||
static int svert_sum_cmp(const void *e1, const void *e2)
|
static int svert_sum_cmp(const void *e1, const void *e2)
|
||||||
{
|
{
|
||||||
const SortVertsElem *sv1 = (SortVertsElem *)e1;
|
const SortVertsElem *sv1 = e1;
|
||||||
const SortVertsElem *sv2 = (SortVertsElem *)e2;
|
const SortVertsElem *sv2 = e2;
|
||||||
|
|
||||||
if (sv1->sum_co > sv2->sum_co) return 1;
|
if (sv1->sum_co > sv2->sum_co) return 1;
|
||||||
else if (sv1->sum_co < sv2->sum_co) return -1;
|
else if (sv1->sum_co < sv2->sum_co) return -1;
|
||||||
|
@ -369,7 +369,7 @@ PyObject *BPy_BMVertSkin_CreatePyObject(struct MVertSkin *mvertskin)
|
|||||||
|
|
||||||
static void mloopcol_to_float(const MLoopCol *mloopcol, float r_col[3])
|
static void mloopcol_to_float(const MLoopCol *mloopcol, float r_col[3])
|
||||||
{
|
{
|
||||||
rgb_uchar_to_float(r_col, (unsigned char *)&mloopcol->r);
|
rgb_uchar_to_float(r_col, (const unsigned char *)&mloopcol->r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mloopcol_from_float(MLoopCol *mloopcol, const float col[3])
|
static void mloopcol_from_float(MLoopCol *mloopcol, const float col[3])
|
||||||
|
@ -265,7 +265,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make into a module */
|
/* make into a module */
|
||||||
return PyImport_ExecCodeModule((char *)name, text->compiled);
|
return PyImport_ExecCodeModule(name, text->compiled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty *group,
|
|||||||
else if (PyUnicode_Check(ob)) {
|
else if (PyUnicode_Check(ob)) {
|
||||||
#ifdef USE_STRING_COERCE
|
#ifdef USE_STRING_COERCE
|
||||||
PyObject *value_coerce = NULL;
|
PyObject *value_coerce = NULL;
|
||||||
val.string.str = (char *)PyC_UnicodeAsByte(ob, &value_coerce);
|
val.string.str = PyC_UnicodeAsByte(ob, &value_coerce);
|
||||||
val.string.subtype = IDP_STRING_SUB_UTF8;
|
val.string.subtype = IDP_STRING_SUB_UTF8;
|
||||||
prop = IDP_New(IDP_STRING, &val, name);
|
prop = IDP_New(IDP_STRING, &val, name);
|
||||||
Py_XDECREF(value_coerce);
|
Py_XDECREF(value_coerce);
|
||||||
|
@ -372,8 +372,8 @@ static void bake_displacement(void *handle, ShadeInput *UNUSED(shi), float dist,
|
|||||||
bs->vcol->b = col[2];
|
bs->vcol->b = col[2];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const char *imcol = (char *)(bs->rect + bs->rectx * y + x);
|
char *imcol = (char *)(bs->rect + bs->rectx * y + x);
|
||||||
copy_v4_v4_char((char *)imcol, (char *)col);
|
copy_v4_v4_char(imcol, (char *)col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bs->rect_mask) {
|
if (bs->rect_mask) {
|
||||||
|
@ -299,8 +299,7 @@ void GetSkyXYZRadiancef(struct SunSky *sunsky, const float varg[3], float color_
|
|||||||
float theta, phi;
|
float theta, phi;
|
||||||
float v[3];
|
float v[3];
|
||||||
|
|
||||||
copy_v3_v3(v, (float *)varg);
|
normalize_v3_v3(v, varg);
|
||||||
normalize_v3(v);
|
|
||||||
|
|
||||||
if (v[2] < 0.001f) {
|
if (v[2] < 0.001f) {
|
||||||
v[2] = 0.001f;
|
v[2] = 0.001f;
|
||||||
|
Loading…
Reference in New Issue
Block a user