Cleanup: use const pointer arguments

This commit is contained in:
Campbell Barton
2024-03-28 20:57:47 +11:00
parent 5685481fcb
commit b2e00d1285
44 changed files with 83 additions and 77 deletions

View File

@@ -109,12 +109,12 @@ typedef struct CLG_LogRef {
struct CLG_LogRef *next;
} CLG_LogRef;
void CLG_log_str(CLG_LogType *lg,
void CLG_log_str(const CLG_LogType *lg,
enum CLG_Severity severity,
const char *file_line,
const char *fn,
const char *message) _CLOG_ATTR_NONNULL(1, 3, 4, 5);
void CLG_logf(CLG_LogType *lg,
void CLG_logf(const CLG_LogType *lg,
enum CLG_Severity severity,
const char *file_line,
const char *fn,
@@ -156,7 +156,7 @@ int CLG_color_support_get(CLG_LogRef *clg_ref);
#define CLOG_AT_SEVERITY(clg_ref, severity, verbose_level, ...) \
{ \
CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
const CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || \
(severity >= CLG_SEVERITY_WARN)) \
{ \
@@ -167,7 +167,7 @@ int CLG_color_support_get(CLG_LogRef *clg_ref);
#define CLOG_STR_AT_SEVERITY(clg_ref, severity, verbose_level, str) \
{ \
CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
const CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || \
(severity >= CLG_SEVERITY_WARN)) \
{ \

View File

@@ -429,7 +429,7 @@ static void write_severity(CLogStringBuf *cstr, enum CLG_Severity severity, bool
}
}
static void write_type(CLogStringBuf *cstr, CLG_LogType *lg)
static void write_type(CLogStringBuf *cstr, const CLG_LogType *lg)
{
clg_str_append(cstr, " (");
clg_str_append(cstr, lg->identifier);
@@ -460,7 +460,7 @@ static void write_file_line_fn(CLogStringBuf *cstr,
clg_str_append(cstr, ": ");
}
void CLG_log_str(CLG_LogType *lg,
void CLG_log_str(const CLG_LogType *lg,
enum CLG_Severity severity,
const char *file_line,
const char *fn,
@@ -498,7 +498,7 @@ void CLG_log_str(CLG_LogType *lg,
}
}
void CLG_logf(CLG_LogType *lg,
void CLG_logf(const CLG_LogType *lg,
enum CLG_Severity severity,
const char *file_line,
const char *fn,

View File

@@ -28,13 +28,13 @@ void cdf_free(CDataFile *cdf);
/* File read/write/remove */
bool cdf_read_open(CDataFile *cdf, const char *filepath);
bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay);
bool cdf_read_layer(CDataFile *cdf, const CDataFileLayer *blay);
bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data);
void cdf_read_close(CDataFile *cdf);
bool cdf_write_open(CDataFile *cdf, const char *filepath);
bool cdf_write_layer(CDataFile *cdf, CDataFileLayer *blay);
bool cdf_write_data(CDataFile *cdf, unsigned int size, void *data);
bool cdf_write_data(CDataFile *cdf, unsigned int size, const void *data);
void cdf_write_close(CDataFile *cdf);
void cdf_remove(const char *filepath);

View File

@@ -65,7 +65,7 @@ void txt_clean_text(struct Text *text);
void txt_order_cursors(struct Text *text, bool reverse);
int txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case);
bool txt_has_sel(const struct Text *text);
int txt_get_span(struct TextLine *from, struct TextLine *to);
int txt_get_span(struct TextLine *from, const struct TextLine *to);
void txt_move_up(struct Text *text, bool sel);
void txt_move_down(struct Text *text, bool sel);
void txt_move_left(struct Text *text, bool sel);
@@ -116,8 +116,8 @@ int txt_setcurr_tab_spaces(struct Text *text, int space);
bool txt_cursor_is_line_start(const struct Text *text);
bool txt_cursor_is_line_end(const struct Text *text);
int txt_calc_tab_left(struct TextLine *tl, int ch);
int txt_calc_tab_right(struct TextLine *tl, int ch);
int txt_calc_tab_left(const struct TextLine *tl, int ch);
int txt_calc_tab_right(const struct TextLine *tl, int ch);
/**
* Utility functions, could be moved somewhere more generic but are python/text related.

View File

@@ -111,7 +111,7 @@ bool BKE_vfont_to_curve(Object *ob, eEditFontMode mode);
void BKE_vfont_build_char(Curve *cu,
ListBase *nubase,
unsigned int character,
CharInfo *info,
const CharInfo *info,
float ofsx,
float ofsy,
float rot,

View File

@@ -4799,7 +4799,7 @@ void CustomData_external_read(CustomData *data, ID *id, eCustomDataMask mask, co
/* pass */
}
else if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read) {
CDataFileLayer *blay = cdf_layer_find(cdf, layer->type, layer->name);
const CDataFileLayer *blay = cdf_layer_find(cdf, layer->type, layer->name);
if (blay) {
if (cdf_read_layer(cdf, blay)) {

View File

@@ -295,7 +295,7 @@ bool cdf_read_open(CDataFile *cdf, const char *filepath)
return true;
}
bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay)
bool cdf_read_layer(CDataFile *cdf, const CDataFileLayer *blay)
{
size_t offset;
int a;
@@ -387,7 +387,7 @@ bool cdf_write_layer(CDataFile * /*cdf*/, CDataFileLayer * /*blay*/)
return true;
}
bool cdf_write_data(CDataFile *cdf, uint size, void *data)
bool cdf_write_data(CDataFile *cdf, uint size, const void *data)
{
/* write data */
if (!fwrite(data, size, 1, cdf->writef)) {

View File

@@ -673,7 +673,7 @@ void txt_clean_text(Text *text)
}
}
int txt_get_span(TextLine *from, TextLine *to)
int txt_get_span(TextLine *from, const TextLine *to)
{
int ret = 0;
TextLine *tmp = from;
@@ -825,7 +825,7 @@ void txt_move_down(Text *text, const bool sel)
}
}
int txt_calc_tab_left(TextLine *tl, int ch)
int txt_calc_tab_left(const TextLine *tl, int ch)
{
/* do nice left only if there are only spaces */
@@ -845,7 +845,7 @@ int txt_calc_tab_left(TextLine *tl, int ch)
return tabsize;
}
int txt_calc_tab_right(TextLine *tl, int ch)
int txt_calc_tab_right(const TextLine *tl, int ch)
{
if (tl->line[ch] == ' ') {
int i;

View File

@@ -405,7 +405,7 @@ VFont *BKE_vfont_load_exists(Main *bmain, const char *filepath)
return BKE_vfont_load_exists_ex(bmain, filepath, nullptr);
}
static VFont *which_vfont(Curve *cu, CharInfo *info)
static VFont *which_vfont(Curve *cu, const CharInfo *info)
{
switch (info->flag & (CU_CHINFO_BOLD | CU_CHINFO_ITALIC)) {
case CU_CHINFO_BOLD:
@@ -435,7 +435,7 @@ VFont *BKE_vfont_builtin_get()
return vfont;
}
static VChar *find_vfont_char(VFontData *vfd, uint character)
static VChar *find_vfont_char(const VFontData *vfd, uint character)
{
return static_cast<VChar *>(BLI_ghash_lookup(vfd->characters, POINTER_FROM_UINT(character)));
}
@@ -507,7 +507,7 @@ static void build_underline(Curve *cu,
void BKE_vfont_build_char(Curve *cu,
ListBase *nubase,
uint character,
CharInfo *info,
const CharInfo *info,
float ofsx,
float ofsy,
float rot,
@@ -679,7 +679,7 @@ void BKE_vfont_select_clamp(Object *ob)
CLAMP_MAX(ef->selend, ef->len);
}
static float char_width(Curve *cu, VChar *che, CharInfo *info)
static float char_width(Curve *cu, VChar *che, const CharInfo *info)
{
/* The character wasn't found, probably ascii = 0, then the width shall be 0 as well */
if (che == nullptr) {

View File

@@ -69,7 +69,7 @@ void BLI_args_print_other_doc(struct bArgs *ba);
bool BLI_args_has_other_doc(const struct bArgs *ba);
void BLI_args_print(struct bArgs *ba);
void BLI_args_print(const struct bArgs *ba);
#ifdef __cplusplus
}

View File

@@ -32,7 +32,7 @@ struct RNG *BLI_rng_new(unsigned int seed);
* A version of #BLI_rng_new that hashes the seed.
*/
struct RNG *BLI_rng_new_srandom(unsigned int seed);
struct RNG *BLI_rng_copy(struct RNG *rng) ATTR_NONNULL(1);
struct RNG *BLI_rng_copy(const struct RNG *rng) ATTR_NONNULL(1);
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1);
void BLI_rng_seed(struct RNG *rng, unsigned int seed) ATTR_NONNULL(1);

View File

@@ -152,7 +152,7 @@ void BLI_args_pass_set(bArgs *ba, int current_pass)
ba->current_pass = current_pass;
}
void BLI_args_print(bArgs *ba)
void BLI_args_print(const bArgs *ba)
{
int i;
for (i = 0; i < ba->argc; i++) {

View File

@@ -258,7 +258,7 @@ static void bvh_insertionsort(BVHNode **a, int lo, int hi, int axis)
}
}
static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode *x, int axis)
static int bvh_partition(BVHNode **a, int lo, int hi, const BVHNode *x, int axis)
{
int i = lo, j = hi;
while (1) {

View File

@@ -50,7 +50,7 @@ RNG *BLI_rng_new_srandom(uint seed)
return rng;
}
RNG *BLI_rng_copy(RNG *rng)
RNG *BLI_rng_copy(const RNG *rng)
{
return new RNG(*rng);
}

View File

@@ -155,7 +155,7 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
/** #UserDef.flag */
#define USER_LMOUSESELECT (1 << 14) /* deprecated */
static void do_version_select_mouse(UserDef *userdef, wmKeyMapItem *kmi)
static void do_version_select_mouse(const UserDef *userdef, wmKeyMapItem *kmi)
{
/* Remove select/action mouse from user defined keymaps. */
enum {

View File

@@ -509,7 +509,7 @@ static void draw_marker(const uiFontStyle *fstyle,
draw_marker_name(text_color, fstyle, marker, xpos, xmax, name_y);
}
static void draw_markers_background(rctf *rect)
static void draw_markers_background(const rctf *rect)
{
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);

View File

@@ -1574,7 +1574,7 @@ static bool gpencil_do_curve_circle_sel(bContext *C,
const int my,
const int radius,
const bool select,
rcti *rect,
const rcti *rect,
const float diff_mat[4][4],
const int selectmode)
{

View File

@@ -80,7 +80,7 @@ void initNumInput(NumInput *n);
/**
* \param str: Must be NUM_STR_REP_LEN * (idx_max + 1) length.
*/
void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings);
void outputNumInput(NumInput *n, char *str, const UnitSettings *unit_settings);
bool hasNumInput(const NumInput *n);
/**
* \warning \a vec must be set beforehand otherwise we risk uninitialized vars.

View File

@@ -87,7 +87,7 @@ void ED_slider_status_string_get(const tSlider *slider,
char *status_string,
size_t size_of_status_string);
float ED_slider_factor_get(tSlider *slider);
float ED_slider_factor_get(const tSlider *slider);
void ED_slider_factor_set(tSlider *slider, float factor);
/** One bool value for each side of the slider. Allows to enable overshoot only on one side. */
@@ -98,11 +98,11 @@ void ED_slider_allow_overshoot_set(tSlider *slider, bool lower, bool upper);
*/
void ED_slider_factor_bounds_set(tSlider *slider, float lower_bound, float upper_bound);
bool ED_slider_allow_increments_get(tSlider *slider);
bool ED_slider_allow_increments_get(const tSlider *slider);
void ED_slider_allow_increments_set(tSlider *slider, bool value);
void ED_slider_mode_set(tSlider *slider, SliderMode mode);
SliderMode ED_slider_mode_get(tSlider *slider);
SliderMode ED_slider_mode_get(const tSlider *slider);
void ED_slider_unit_set(tSlider *slider, const char *unit);
/* ************** XXX OLD CRUFT WARNING ************* */

View File

@@ -148,7 +148,7 @@ void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], const
* \param lens: The view lens angle set for cameras and lights, normally from View3D.lens.
*/
void ED_view3d_from_object(
const Object *ob, float ofs[3], float quat[4], float *dist, float *lens);
const Object *ob, float ofs[3], float quat[4], const float *dist, float *lens);
/**
* Set the object transformation from #RegionView3D members.
* \param depsgraph: The depsgraph to get the evaluated object parent

View File

@@ -589,7 +589,7 @@ void ui_draw_but_HISTOGRAM(ARegion * /*region*/,
#undef HISTOGRAM_TOT_GRID_LINES
static void waveform_draw_one(float *waveform, int waveform_num, const float col[3])
static void waveform_draw_one(const float *waveform, int waveform_num, const float col[3])
{
GPUVertFormat format = {0};
const uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -609,7 +609,7 @@ static void waveform_draw_one(float *waveform, int waveform_num, const float col
GPU_batch_discard(batch);
}
static void waveform_draw_rgb(float *waveform, int waveform_num, float *col)
static void waveform_draw_rgb(const float *waveform, int waveform_num, const float *col)
{
GPUVertFormat format = {0};
const uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -629,7 +629,7 @@ static void waveform_draw_rgb(float *waveform, int waveform_num, float *col)
GPU_batch_discard(batch);
}
static void circle_draw_rgb(float *points, int tot_points, float *col, GPUPrimType prim)
static void circle_draw_rgb(float *points, int tot_points, const float *col, GPUPrimType prim)
{
GPUVertFormat format = {0};
const uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);

View File

@@ -144,7 +144,7 @@ static const char *strdup_memarena(MemArena *memarena, const char *str)
return str_dst;
}
static const char *strdup_memarena_from_dynstr(MemArena *memarena, DynStr *dyn_str)
static const char *strdup_memarena_from_dynstr(MemArena *memarena, const DynStr *dyn_str)
{
const uint str_size = BLI_dynstr_get_len(dyn_str) + 1;
char *str_dst = (char *)BLI_memarena_alloc(memarena, str_size);

View File

@@ -643,7 +643,7 @@ static Scene *preview_prepare_scene(
/* new UI convention: draw is in pixel space already. */
/* uses UI_BTYPE_ROUNDBOX button in block to get the rect */
static bool ed_preview_draw_rect(
Scene *scene, ScrArea *area, int split, int first, rcti *rect, rcti *newrect)
Scene *scene, ScrArea *area, int split, int first, const rcti *rect, rcti *newrect)
{
Render *re;
RenderView *rv;

View File

@@ -191,7 +191,7 @@ static void brush_painter_cache_2d_free(BrushPainterCache *cache)
}
}
static void brush_imbuf_tex_co(rctf *mapping, int x, int y, float texco[3])
static void brush_imbuf_tex_co(const rctf *mapping, int x, int y, float texco[3])
{
texco[0] = mapping->xmin + x * mapping->xmax;
texco[1] = mapping->ymin + y * mapping->ymax;

View File

@@ -2025,8 +2025,8 @@ struct tBtwOperatorData {
ListBase anim_data; /* bAnimListElem */
};
static int btw_calculate_sample_count(BezTriple *right_bezt,
BezTriple *left_bezt,
static int btw_calculate_sample_count(const BezTriple *right_bezt,
const BezTriple *left_bezt,
const int filter_order,
const int samples_per_frame)
{

View File

@@ -509,7 +509,7 @@ static size_t label_str_get(const Sequence *seq,
static bool label_rect_get(const bContext *C,
const Sequence *seq,
const SeqRetimingKey *key,
char *label_str,
const char *label_str,
const size_t label_len,
rctf *rect)
{

View File

@@ -37,7 +37,7 @@ struct ThumbnailDrawJob {
SeqRenderData context;
GHash *sequences_ghash;
Scene *scene;
rctf *view_area;
const rctf *view_area;
float pixelx;
float pixely;
float thumb_height;
@@ -59,7 +59,7 @@ static void thumbnail_freejob(void *data)
{
ThumbnailDrawJob *tj = static_cast<ThumbnailDrawJob *>(data);
BLI_ghash_free(tj->sequences_ghash, nullptr, thumbnail_hash_data_free);
MEM_freeN(tj->view_area);
MEM_freeN((void *)tj->view_area);
MEM_freeN(tj);
}
@@ -69,7 +69,7 @@ static void thumbnail_endjob(void *data)
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, tj->scene);
}
static bool check_seq_need_thumbnails(const Scene *scene, Sequence *seq, rctf *view_area)
static bool check_seq_need_thumbnails(const Scene *scene, Sequence *seq, const rctf *view_area)
{
if (!ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) {
return false;

View File

@@ -1013,7 +1013,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *region, rcti *scroll, rcti *b
CLAMP(st->runtime->scroll_region_select.ymax, pix_bottom_margin, region->winy - pix_top_margin);
}
static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back)
static void draw_textscroll(const SpaceText *st, const rcti *scroll, const rcti *back)
{
bTheme *btheme = UI_GetTheme();
uiWidgetColors wcol = btheme->tui.wcol_scroll;

View File

@@ -1572,7 +1572,8 @@ void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], c
sub_v3_v3v3(mat[3], dvec, ofs);
}
void ED_view3d_from_object(const Object *ob, float ofs[3], float quat[4], float *dist, float *lens)
void ED_view3d_from_object(
const Object *ob, float ofs[3], float quat[4], const float *dist, float *lens)
{
ED_view3d_from_m4(ob->object_to_world().ptr(), ofs, quat, dist);

View File

@@ -117,7 +117,7 @@ static void invert_snap(eSnapMode &snap_mode)
/* WORKAROUND: The source position is based on the transformed elements.
* However, at this stage, the transformation has not yet been applied.
* So apply the transformation here. */
static float2 nla_transform_apply(TransInfo *t, float *vec, float2 &ival)
static float2 nla_transform_apply(TransInfo *t, const float *vec, float2 &ival)
{
float4x4 mat = float4x4::identity();

View File

@@ -531,7 +531,7 @@ void ED_slider_destroy(bContext *C, tSlider *slider)
/* Setters & Getters */
float ED_slider_factor_get(tSlider *slider)
float ED_slider_factor_get(const tSlider *slider)
{
return slider->factor;
}
@@ -551,7 +551,7 @@ void ED_slider_allow_overshoot_set(tSlider *slider, const bool lower, const bool
slider->allow_overshoot_upper = upper;
}
bool ED_slider_allow_increments_get(tSlider *slider)
bool ED_slider_allow_increments_get(const tSlider *slider)
{
return slider->allow_increments;
}
@@ -574,7 +574,7 @@ void ED_slider_mode_set(tSlider *slider, SliderMode mode)
slider->slider_mode = mode;
}
SliderMode ED_slider_mode_get(tSlider *slider)
SliderMode ED_slider_mode_get(const tSlider *slider)
{
return slider->slider_mode;
}

View File

@@ -85,7 +85,7 @@ void initNumInput(NumInput *n)
n->str_cur = 0;
}
void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings)
void outputNumInput(NumInput *n, char *str, const UnitSettings *unit_settings)
{
short j;
const int ln = NUM_STR_REP_LEN;

View File

@@ -249,8 +249,11 @@ static uint8_t find_min_value(const uint8_t *arr, uint8_t start_idx, uint8_t len
return min_v;
}
static void select_bidomain(
uint8_t domains[][BDS], int bd_pos, uint8_t *left, int current_matching_size, bool connected)
static void select_bidomain(uint8_t domains[][BDS],
int bd_pos,
const uint8_t *left,
int current_matching_size,
bool connected)
{
int i;
int min_size = INT_MAX;

View File

@@ -2189,7 +2189,7 @@ class OverlapMerger {
}
/** Return a new root of the binary tree, with `a` and `b` as leaves. */
static PackIsland *merge_islands(PackIsland *a, PackIsland *b)
static PackIsland *merge_islands(const PackIsland *a, const PackIsland *b)
{
PackIsland *result = new PackIsland();
result->aspect_y = sqrtf(a->aspect_y * b->aspect_y);

View File

@@ -1234,7 +1234,7 @@ static void p_chart_fill_boundary(ParamHandle *handle, PChart *chart, PEdge *be,
BLI_heap_free(heap, nullptr);
}
static void p_chart_fill_boundaries(ParamHandle *handle, PChart *chart, PEdge *outer)
static void p_chart_fill_boundaries(ParamHandle *handle, PChart *chart, const PEdge *outer)
{
PEdge *e, *be; /* *enext - as yet unused */
int nedges;

View File

@@ -243,7 +243,7 @@ void GPU_batch_elembuf_set(blender::gpu::Batch *batch,
* Returns true if the #GPUbatch has \a vertex_buf in its vertex buffer list.
* \note The search is only conducted on the non-instance rate vertex buffer list.
*/
bool GPU_batch_vertbuf_has(blender::gpu::Batch *batch, blender::gpu::VertBuf *vertex_buf);
bool GPU_batch_vertbuf_has(const blender::gpu::Batch *batch, blender::gpu::VertBuf *vertex_buf);
/**
* Set resource id buffer to bind as instance attribute to workaround the lack of gl_BaseInstance

View File

@@ -204,7 +204,7 @@ int GPU_batch_vertbuf_add(Batch *batch, VertBuf *vertex_buf, bool own_vbo)
return -1;
}
bool GPU_batch_vertbuf_has(Batch *batch, VertBuf *vertex_buf)
bool GPU_batch_vertbuf_has(const Batch *batch, VertBuf *vertex_buf)
{
for (uint v = 0; v < GPU_BATCH_VBO_MAX_LEN; v++) {
if (batch->verts[v] == vertex_buf) {

View File

@@ -1060,7 +1060,9 @@ void IMB_colormanagement_init_default_view_settings(
view_settings->curve_mapping = nullptr;
}
static void curve_mapping_apply_pixel(CurveMapping *curve_mapping, float *pixel, int channels)
static void curve_mapping_apply_pixel(const CurveMapping *curve_mapping,
float *pixel,
int channels)
{
if (channels == 1) {
pixel[0] = BKE_curvemap_evaluateF(curve_mapping, curve_mapping->cm, pixel[0]);

View File

@@ -88,13 +88,13 @@ struct MFileOffset {
/* Functions. */
static void readheader(MFileOffset *inf, IMAGE *image);
static int writeheader(FILE *outf, IMAGE *image);
static int writeheader(FILE *outf, const IMAGE *image);
static ushort getshort(MFileOffset *inf);
static uint getlong(MFileOffset *mofs);
static void putshort(FILE *outf, ushort val);
static int putlong(FILE *outf, uint val);
static int writetab(FILE *outf, uint *tab, int len);
static int writetab(FILE *outf, const uint *tab, int len);
static void readtab(MFileOffset *inf, uint *tab, int len);
static int expandrow(
@@ -161,7 +161,7 @@ static void readheader(MFileOffset *inf, IMAGE *image)
image->zsize = getshort(inf);
}
static int writeheader(FILE *outf, IMAGE *image)
static int writeheader(FILE *outf, const IMAGE *image)
{
IMAGE t = {0};
@@ -179,7 +179,7 @@ static int writeheader(FILE *outf, IMAGE *image)
return fwrite("no name", 8, 1, outf);
}
static int writetab(FILE *outf, uint *tab, int len)
static int writetab(FILE *outf, const uint *tab, int len)
{
int r = 0;

View File

@@ -1027,7 +1027,7 @@ void render_result_exr_file_cache_write(Render *re)
{
RenderResult *rr = re->result;
char str[FILE_CACHE_MAX];
char *root = U.render_cachedir;
const char *root = U.render_cachedir;
render_result_passes_allocated_ensure(rr);
@@ -1041,7 +1041,7 @@ bool render_result_exr_file_cache_read(Render *re)
{
/* File path to cache. */
char filepath[FILE_CACHE_MAX] = "";
char *root = U.render_cachedir;
const char *root = U.render_cachedir;
render_result_exr_file_cache_path(re->scene, root, filepath);
printf("read exr cache file: %s\n", filepath);

View File

@@ -97,7 +97,7 @@ struct DiskCacheFile {
static ThreadMutex cache_create_lock = BLI_MUTEX_INITIALIZER;
static char *seq_disk_cache_base_dir()
static const char *seq_disk_cache_base_dir()
{
return U.sequencer_disk_cache_dir;
}
@@ -152,7 +152,7 @@ static DiskCacheFile *seq_disk_cache_add_file_to_list(SeqDiskCache *disk_cache,
return cache_file;
}
static void seq_disk_cache_get_files(SeqDiskCache *disk_cache, char *dirpath)
static void seq_disk_cache_get_files(SeqDiskCache *disk_cache, const char *dirpath)
{
direntry *filelist, *fl;
uint i;
@@ -329,7 +329,7 @@ static void seq_disk_cache_get_file_path(SeqDiskCache *disk_cache,
BLI_path_append(filepath, filepath_maxncpy, cache_filename);
}
static void seq_disk_cache_create_version_file(char *filepath)
static void seq_disk_cache_create_version_file(const char *filepath)
{
BLI_file_ensure_parent_dir_exists(filepath);
@@ -475,7 +475,7 @@ static bool seq_disk_cache_read_header(FILE *file, DiskCacheHeader *header)
return true;
}
static size_t seq_disk_cache_write_header(FILE *file, DiskCacheHeader *header)
static size_t seq_disk_cache_write_header(FILE *file, const DiskCacheHeader *header)
{
BLI_fseek(file, 0LL, SEEK_SET);
return fwrite(header, sizeof(*header), 1, file);
@@ -531,7 +531,7 @@ static int seq_disk_cache_add_header_entry(SeqCacheKey *key, ImBuf *ibuf, DiskCa
return i;
}
static int seq_disk_cache_get_header_entry(SeqCacheKey *key, DiskCacheHeader *header)
static int seq_disk_cache_get_header_entry(SeqCacheKey *key, const DiskCacheHeader *header)
{
for (int i = 0; i < DCACHE_IMAGES_PER_FILE; i++) {
if (header->entry[i].frameno == key->frame_index) {

View File

@@ -888,7 +888,7 @@ static void apply_blend_function(
}
static void do_blend_effect_float(
float fac, int x, int y, float *rect1, float *rect2, int btype, float *out)
float fac, int x, int y, const float *rect1, float *rect2, int btype, float *out)
{
switch (btype) {
case SEQ_TYPE_ADD:

View File

@@ -257,7 +257,7 @@ static void index_dir_set(Editing *ed, Sequence *seq, StripAnim *sanim)
seq_proxy_index_dir_set(sanim->anim, proxy_dirpath);
}
static bool open_anim_file_multiview(Scene *scene, Sequence *seq, char *filepath)
static bool open_anim_file_multiview(Scene *scene, Sequence *seq, const char *filepath)
{
char prefix[FILE_MAX];
const char *ext = nullptr;

View File

@@ -116,7 +116,7 @@ bool WM_gesture_is_modal_first(const wmGesture *gesture)
/* ******************* gesture draw ******************* */
static void wm_gesture_draw_line_active_side(rcti *rect, const bool flip)
static void wm_gesture_draw_line_active_side(const rcti *rect, const bool flip)
{
GPUVertFormat *format = immVertexFormat();
uint shdr_pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -167,7 +167,7 @@ static void wm_gesture_draw_line_active_side(rcti *rect, const bool flip)
static void wm_gesture_draw_line(wmGesture *gt)
{
rcti *rect = (rcti *)gt->customdata;
const rcti *rect = (rcti *)gt->customdata;
if (gt->draw_active_side) {
wm_gesture_draw_line_active_side(rect, gt->use_flip);