forked from bartvdbraak/blender
Cleanup: use const qualifier for arguments & variables
This commit is contained in:
parent
0dfeccfc6b
commit
35389e8b35
@ -238,7 +238,7 @@ extern bool GHOST_ValidWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandl
|
||||
* This window is invalid after full screen has been ended.
|
||||
*/
|
||||
extern GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
|
||||
GHOST_DisplaySetting *setting,
|
||||
const GHOST_DisplaySetting *setting,
|
||||
const bool stereoVisual);
|
||||
|
||||
/**
|
||||
@ -429,7 +429,7 @@ void GHOST_GetCursorGrabState(GHOST_WindowHandle windowhandle,
|
||||
extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
|
||||
GHOST_TGrabCursorMode mode,
|
||||
GHOST_TAxisFlag wrap_axis,
|
||||
int bounds[4],
|
||||
const int bounds[4],
|
||||
const int mouse_ungrab_xy[2]);
|
||||
|
||||
/***************************************************************************************
|
||||
|
@ -216,7 +216,7 @@ bool GHOST_ValidWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windo
|
||||
}
|
||||
|
||||
GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
|
||||
GHOST_DisplaySetting *setting,
|
||||
const GHOST_DisplaySetting *setting,
|
||||
const bool stereoVisual)
|
||||
{
|
||||
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
||||
@ -409,7 +409,7 @@ GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
|
||||
GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
|
||||
GHOST_TGrabCursorMode mode,
|
||||
GHOST_TAxisFlag wrap_axis,
|
||||
int bounds[4],
|
||||
const int bounds[4],
|
||||
const int mouse_ungrab_xy[2])
|
||||
{
|
||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||
@ -781,7 +781,7 @@ int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
|
||||
void GHOST_GetRectangle(
|
||||
GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b)
|
||||
{
|
||||
GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle;
|
||||
const GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle;
|
||||
|
||||
*l = rect->m_l;
|
||||
*t = rect->m_t;
|
||||
|
@ -67,7 +67,7 @@ GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplaySettings(uint8_t display,
|
||||
|
||||
/* from SDL2 */
|
||||
#ifdef WITH_X11_XF86VMODE
|
||||
static int calculate_rate(XF86VidModeModeInfo *info)
|
||||
static int calculate_rate(const XF86VidModeModeInfo *info)
|
||||
{
|
||||
return (info->htotal && info->vtotal) ? (1000 * info->dotclock / (info->htotal * info->vtotal)) :
|
||||
0;
|
||||
|
@ -527,14 +527,14 @@ void GHOST_NDOFManager::setDeadZone(float dz)
|
||||
CLOG_INFO(LOG, 2, "dead zone set to %.2f%s", dz, (dz > 0.5f) ? " (unexpectedly high)" : "");
|
||||
}
|
||||
|
||||
static bool atHomePosition(GHOST_TEventNDOFMotionData *ndof)
|
||||
static bool atHomePosition(const GHOST_TEventNDOFMotionData *ndof)
|
||||
{
|
||||
#define HOME(foo) (ndof->foo == 0.0f)
|
||||
return HOME(tx) && HOME(ty) && HOME(tz) && HOME(rx) && HOME(ry) && HOME(rz);
|
||||
#undef HOME
|
||||
}
|
||||
|
||||
static bool nearHomePosition(GHOST_TEventNDOFMotionData *ndof, float threshold)
|
||||
static bool nearHomePosition(const GHOST_TEventNDOFMotionData *ndof, float threshold)
|
||||
{
|
||||
if (threshold == 0.0f) {
|
||||
return atHomePosition(ndof);
|
||||
|
@ -461,7 +461,7 @@ void BKE_gpencil_layer_mask_cleanup_all_layers(struct bGPdata *gpd);
|
||||
void BKE_gpencil_layer_frames_sort(struct bGPDlayer *gpl, bool *r_has_duplicate_frames);
|
||||
|
||||
struct bGPDlayer *BKE_gpencil_layer_get_by_name(struct bGPdata *gpd,
|
||||
char *name,
|
||||
const char *name,
|
||||
int first_if_not_found);
|
||||
|
||||
/* Brush */
|
||||
|
@ -193,11 +193,11 @@ typedef struct LibraryForeachIDData LibraryForeachIDData;
|
||||
* Check whether current iteration over ID usages should be stopped or not.
|
||||
* \return true if the iteration should be stopped, false otherwise.
|
||||
*/
|
||||
bool BKE_lib_query_foreachid_iter_stop(struct LibraryForeachIDData *data);
|
||||
bool BKE_lib_query_foreachid_iter_stop(const struct LibraryForeachIDData *data);
|
||||
void BKE_lib_query_foreachid_process(struct LibraryForeachIDData *data,
|
||||
struct ID **id_pp,
|
||||
int cb_flag);
|
||||
int BKE_lib_query_foreachid_process_flags_get(struct LibraryForeachIDData *data);
|
||||
int BKE_lib_query_foreachid_process_flags_get(const struct LibraryForeachIDData *data);
|
||||
int BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeachIDData *data,
|
||||
int cb_flag,
|
||||
bool do_replace);
|
||||
|
@ -89,7 +89,7 @@ static bool calc_curve_deform(
|
||||
}
|
||||
}
|
||||
else {
|
||||
CurveCache *cc = ob_curve->runtime.curve_cache;
|
||||
const CurveCache *cc = ob_curve->runtime.curve_cache;
|
||||
float totdist = BKE_anim_path_get_length(cc);
|
||||
if (LIKELY(totdist > FLT_EPSILON)) {
|
||||
fac = -(co[index] - cd->dmax[index]) / totdist;
|
||||
@ -111,7 +111,7 @@ static bool calc_curve_deform(
|
||||
}
|
||||
}
|
||||
else {
|
||||
CurveCache *cc = ob_curve->runtime.curve_cache;
|
||||
const CurveCache *cc = ob_curve->runtime.curve_cache;
|
||||
float totdist = BKE_anim_path_get_length(cc);
|
||||
if (LIKELY(totdist > FLT_EPSILON)) {
|
||||
fac = +(co[index] - cd->dmin[index]) / totdist;
|
||||
|
@ -1573,7 +1573,7 @@ bGPDlayer *BKE_gpencil_layer_active_get(bGPdata *gpd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bGPDlayer *BKE_gpencil_layer_get_by_name(bGPdata *gpd, char *name, int first_if_not_found)
|
||||
bGPDlayer *BKE_gpencil_layer_get_by_name(bGPdata *gpd, const char *name, int first_if_not_found)
|
||||
{
|
||||
bGPDlayer *gpl;
|
||||
|
||||
|
@ -61,7 +61,7 @@ typedef struct LibraryForeachIDData {
|
||||
BLI_LINKSTACK_DECLARE(ids_todo, ID *);
|
||||
} LibraryForeachIDData;
|
||||
|
||||
bool BKE_lib_query_foreachid_iter_stop(LibraryForeachIDData *data)
|
||||
bool BKE_lib_query_foreachid_iter_stop(const LibraryForeachIDData *data)
|
||||
{
|
||||
return (data->status & IDWALK_STOP) != 0;
|
||||
}
|
||||
@ -107,7 +107,7 @@ void BKE_lib_query_foreachid_process(LibraryForeachIDData *data, ID **id_pp, int
|
||||
}
|
||||
}
|
||||
|
||||
int BKE_lib_query_foreachid_process_flags_get(LibraryForeachIDData *data)
|
||||
int BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
|
||||
{
|
||||
return data->flag;
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ static float do_clump_level(float result[3],
|
||||
float clumpfac,
|
||||
float clumppow,
|
||||
float pa_clump,
|
||||
CurveMapping *clumpcurve)
|
||||
const CurveMapping *clumpcurve)
|
||||
{
|
||||
float clump = 0.0f;
|
||||
|
||||
@ -610,7 +610,7 @@ float do_clump(ParticleKey *state,
|
||||
float pa_clump,
|
||||
bool use_clump_noise,
|
||||
float clump_noise_size,
|
||||
CurveMapping *clumpcurve)
|
||||
const CurveMapping *clumpcurve)
|
||||
{
|
||||
float clump;
|
||||
|
||||
@ -726,7 +726,7 @@ static void twist_get_axis(const ParticleChildModifierContext *modifier_ctx,
|
||||
}
|
||||
}
|
||||
|
||||
static float BKE_curvemapping_integrate_clamped(CurveMapping *curve,
|
||||
static float BKE_curvemapping_integrate_clamped(const CurveMapping *curve,
|
||||
float start,
|
||||
float end,
|
||||
float step)
|
||||
|
@ -49,7 +49,7 @@ float do_clump(ParticleKey *state,
|
||||
float pa_clump,
|
||||
bool use_clump_noise,
|
||||
float clump_noise_size,
|
||||
struct CurveMapping *clumpcurve);
|
||||
const struct CurveMapping *clumpcurve);
|
||||
void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx,
|
||||
float mat[4][4],
|
||||
ParticleKey *state,
|
||||
|
@ -26,7 +26,7 @@ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock);
|
||||
*/
|
||||
int BLI_hash_md5_stream(FILE *stream, void *resblock);
|
||||
|
||||
char *BLI_hash_md5_to_hexdigest(void *resblock, char r_hex_digest[33]);
|
||||
char *BLI_hash_md5_to_hexdigest(const void *resblock, char r_hex_digest[33]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst,
|
||||
size_t dst_maxncpy) ATTR_NONNULL(1, 2);
|
||||
size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w,
|
||||
const char *__restrict src_c,
|
||||
size_t dst_maxncpy) ATTR_NONNULL(1, 2);
|
||||
size_t dst_w_maxncpy) ATTR_NONNULL(1, 2);
|
||||
|
||||
/**
|
||||
* Count columns that character/string occupies (based on `wcwidth.co`).
|
||||
|
@ -379,7 +379,7 @@ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock)
|
||||
return md5_read_ctx(&ctx, resblock);
|
||||
}
|
||||
|
||||
char *BLI_hash_md5_to_hexdigest(void *resblock, char r_hex_digest[33])
|
||||
char *BLI_hash_md5_to_hexdigest(const void *resblock, char r_hex_digest[33])
|
||||
{
|
||||
static const char hex_map[17] = "0123456789abcdef";
|
||||
const unsigned char *p;
|
||||
|
@ -144,7 +144,7 @@ typedef struct PolyIndex {
|
||||
|
||||
/* based on libgdx 2013-11-28, apache 2.0 licensed */
|
||||
|
||||
static void pf_coord_sign_calc(PolyFill *pf, PolyIndex *pi);
|
||||
static void pf_coord_sign_calc(const PolyFill *pf, PolyIndex *pi);
|
||||
|
||||
static PolyIndex *pf_ear_tip_find(PolyFill *pf
|
||||
#ifdef USE_CLIP_EVEN
|
||||
@ -576,7 +576,7 @@ static void pf_triangulate(PolyFill *pf)
|
||||
/**
|
||||
* \return CONCAVE, TANGENTIAL or CONVEX
|
||||
*/
|
||||
static void pf_coord_sign_calc(PolyFill *pf, PolyIndex *pi)
|
||||
static void pf_coord_sign_calc(const PolyFill *pf, PolyIndex *pi)
|
||||
{
|
||||
/* localize */
|
||||
const float(*coords)[2] = pf->coords;
|
||||
|
@ -108,7 +108,7 @@ static eV3DProjStatus ed_view3d_project__internal(const ARegion *region,
|
||||
BLI_assert((flag & V3D_PROJ_TEST_ALL) == flag);
|
||||
|
||||
if (flag & V3D_PROJ_TEST_CLIP_BB) {
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
const RegionView3D *rv3d = region->regiondata;
|
||||
if (rv3d->rflag & RV3D_CLIPPING) {
|
||||
if (ED_view3d_clipping_test(rv3d, co, is_local)) {
|
||||
return V3D_PROJ_RET_CLIP_BB;
|
||||
@ -326,7 +326,7 @@ static void view3d_win_to_ray_segment(const struct Depsgraph *depsgraph,
|
||||
float r_ray_start[3],
|
||||
float r_ray_end[3])
|
||||
{
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
const RegionView3D *rv3d = region->regiondata;
|
||||
float _ray_co[3], _ray_dir[3], start_offset, end_offset;
|
||||
|
||||
if (!r_ray_co) {
|
||||
|
@ -141,7 +141,7 @@ bool is_stroke_affected_by_modifier(Object *ob,
|
||||
return true;
|
||||
}
|
||||
|
||||
float get_modifier_point_weight(MDeformVert *dvert, bool inverse, int def_nr)
|
||||
float get_modifier_point_weight(const MDeformVert *dvert, bool inverse, int def_nr)
|
||||
{
|
||||
float weight = 1.0f;
|
||||
|
||||
|
@ -36,7 +36,7 @@ bool is_stroke_affected_by_modifier(struct Object *ob,
|
||||
/**
|
||||
* Verify if valid vertex group *and return weight.
|
||||
*/
|
||||
float get_modifier_point_weight(struct MDeformVert *dvert, bool inverse, int def_nr);
|
||||
float get_modifier_point_weight(const struct MDeformVert *dvert, bool inverse, int def_nr);
|
||||
/**
|
||||
* Generic bake function for deformStroke.
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@
|
||||
static void imb_handle_alpha(ImBuf *ibuf,
|
||||
int flags,
|
||||
char colorspace[IM_MAX_SPACE],
|
||||
char effective_colorspace[IM_MAX_SPACE])
|
||||
const char effective_colorspace[IM_MAX_SPACE])
|
||||
{
|
||||
if (colorspace) {
|
||||
if (ibuf->byte_buffer.data != nullptr && ibuf->float_buffer.data == nullptr) {
|
||||
|
@ -677,7 +677,7 @@ static void rna_def_depsgraph(BlenderRNA *brna)
|
||||
PropertyRNA *parm;
|
||||
PropertyRNA *prop;
|
||||
|
||||
static EnumPropertyItem enum_depsgraph_mode_items[] = {
|
||||
static const EnumPropertyItem enum_depsgraph_mode_items[] = {
|
||||
{DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Viewport non-rendered mode"},
|
||||
{DAG_EVAL_RENDER, "RENDER", 0, "Render", "Render"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
|
@ -107,7 +107,7 @@ static void rna_def_light(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
static float default_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
static const float default_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
srna = RNA_def_struct(brna, "Light", "ID");
|
||||
RNA_def_struct_sdna(srna, "Light");
|
||||
|
@ -224,7 +224,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject *UNUSED(self), PyObject *args
|
||||
IS_PERSISTENT = (1 << 0),
|
||||
};
|
||||
PyObject *py_options = NULL;
|
||||
EnumPropertyItem py_options_enum[] = {
|
||||
const EnumPropertyItem py_options_enum[] = {
|
||||
{IS_PERSISTENT, "PERSISTENT", 0, ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
@ -407,7 +407,7 @@ static void clipy_rctf_swap(rctf *stack, short *count, float y1, float y2)
|
||||
}
|
||||
}
|
||||
|
||||
static float square_rctf(rctf *rf)
|
||||
static float square_rctf(const rctf *rf)
|
||||
{
|
||||
float x, y;
|
||||
|
||||
@ -461,7 +461,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
static void boxsampleclip(ImBuf *ibuf, rctf *rf, TexResult *texres)
|
||||
static void boxsampleclip(ImBuf *ibuf, const rctf *rf, TexResult *texres)
|
||||
{
|
||||
/* Sample box, is clipped already, and minx etc. have been set at ibuf size.
|
||||
* Enlarge with anti-aliased edges of the pixels. */
|
||||
@ -881,8 +881,13 @@ static void feline_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata
|
||||
}
|
||||
#undef EWA_MAXIDX
|
||||
|
||||
static void alpha_clip_aniso(
|
||||
ImBuf *ibuf, float minx, float miny, float maxx, float maxy, int extflag, TexResult *texres)
|
||||
static void alpha_clip_aniso(const ImBuf *ibuf,
|
||||
float minx,
|
||||
float miny,
|
||||
float maxx,
|
||||
float maxy,
|
||||
int extflag,
|
||||
TexResult *texres)
|
||||
{
|
||||
float alphaclip;
|
||||
rctf rf;
|
||||
|
Loading…
Reference in New Issue
Block a user