From 725973485a909c2b732c58bd49d06a75edd52f7e Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 13 Jul 2020 11:27:09 +0200 Subject: Clang Tidy: enable readability-non-const-parameter warning Clang Tidy reported a couple of false positives. I disabled those `NOLINTNEXTLINE`. Differential Revision: https://developer.blender.org/D8199 --- source/blender/imbuf/IMB_imbuf.h | 4 ++-- source/blender/imbuf/intern/colormanagement.c | 2 +- source/blender/imbuf/intern/dds/BlockDXT.cpp | 4 ++-- source/blender/imbuf/intern/dds/BlockDXT.h | 4 ++-- source/blender/imbuf/intern/filter.c | 2 +- source/blender/imbuf/intern/imageprocess.c | 2 +- source/blender/imbuf/intern/indexer.c | 4 ++-- source/blender/imbuf/intern/iris.c | 4 ++-- source/blender/imbuf/intern/radiance_hdr.c | 5 +++-- source/blender/imbuf/intern/tiff.c | 14 ++++++++++++-- 10 files changed, 28 insertions(+), 17 deletions(-) (limited to 'source/blender/imbuf') diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 83ef910d0bb..8fb6c1ba1e1 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -411,7 +411,7 @@ void IMB_free_anim(struct anim *anim); void IMB_filter(struct ImBuf *ibuf); void IMB_mask_filter_extend(char *mask, int width, int height); -void IMB_mask_clear(struct ImBuf *ibuf, char *mask, int val); +void IMB_mask_clear(struct ImBuf *ibuf, const char *mask, int val); void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter); void IMB_makemipmap(struct ImBuf *ibuf, int use_filter); void IMB_remakemipmap(struct ImBuf *ibuf, int use_filter); @@ -599,7 +599,7 @@ void bilinear_interpolation_color_wrap( struct ImBuf *in, unsigned char col[4], float col_float[4], float u, float v); void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[3]); -void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, float backcol[3]); +void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3]); void IMB_sampleImageAtLocation( struct ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4]); diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 6341706bede..5c9ebbaba21 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -1723,7 +1723,7 @@ static void *do_display_buffer_apply_thread(void *handle_v) } static void display_buffer_apply_threaded(ImBuf *ibuf, - float *buffer, + const float *buffer, unsigned char *byte_buffer, float *display_buffer, unsigned char *display_buffer_byte, diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp index 4397c1febab..9fd6d71e091 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.cpp +++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp @@ -241,7 +241,7 @@ void BlockDXT1::decodeBlockNV5x(ColorBlock *block) const } } -void BlockDXT1::setIndices(int *idx) +void BlockDXT1::setIndices(const int *idx) { indices = 0; for (uint i = 0; i < 16; i++) { @@ -580,7 +580,7 @@ void BlockCTX1::decodeBlock(ColorBlock *block) const } } -void BlockCTX1::setIndices(int *idx) +void BlockCTX1::setIndices(const int *idx) { indices = 0; for (uint i = 0; i < 16; i++) { diff --git a/source/blender/imbuf/intern/dds/BlockDXT.h b/source/blender/imbuf/intern/dds/BlockDXT.h index 16937bce042..57430dbaea2 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.h +++ b/source/blender/imbuf/intern/dds/BlockDXT.h @@ -76,7 +76,7 @@ struct BlockDXT1 { void decodeBlock(ColorBlock *block) const; void decodeBlockNV5x(ColorBlock *block) const; - void setIndices(int *idx); + void setIndices(const int *idx); void flip4(); void flip2(); @@ -289,7 +289,7 @@ struct BlockCTX1 { }; void evaluatePalette(Color32 color_array[4]) const; - void setIndices(int *idx); + void setIndices(const int *idx); void decodeBlock(ColorBlock *block) const; diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index e36088f8eac..d8a5096af71 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -363,7 +363,7 @@ void IMB_mask_filter_extend(char *mask, int width, int height) MEM_freeN(temprect); } -void IMB_mask_clear(ImBuf *ibuf, char *mask, int val) +void IMB_mask_clear(ImBuf *ibuf, const char *mask, int val) { int x, y; if (ibuf->rect_float) { diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index 7ebbd1a7409..bf58f047773 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -456,7 +456,7 @@ void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[ } } -void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, float backcol[3]) +void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3]) { size_t a = ((size_t)x) * y; unsigned char *cp = rect; diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 985a8e977ca..7cc31b99077 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -894,7 +894,7 @@ static void index_rebuild_ffmpeg_proc_decoded_frame(FFmpegIndexBuilderContext *c } static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context, - short *stop, + const short *stop, short *do_update, float *progress) { @@ -1090,7 +1090,7 @@ static void index_rebuild_fallback_finish(FallbackIndexBuilderContext *context, } static void index_rebuild_fallback(FallbackIndexBuilderContext *context, - short *stop, + const short *stop, short *do_update, float *progress) { diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index bfcd1ec2cee..2516df22151 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -122,7 +122,7 @@ static int expandrow2( static void interleaverow(uchar *lptr, const uchar *cptr, int z, int n); static void interleaverow2(float *lptr, const uchar *cptr, int z, int n); static int compressrow(uchar *lbuf, uchar *rlebuf, int z, int cnt); -static void lumrow(uchar *rgbptr, uchar *lumptr, int n); +static void lumrow(const uchar *rgbptr, uchar *lumptr, int n); /* * byte order independent read/write of shorts and ints. @@ -900,7 +900,7 @@ static int output_iris(uint *lptr, int xsize, int ysize, int zsize, const char * /* static utility functions for output_iris */ -static void lumrow(uchar *rgbptr, uchar *lumptr, int n) +static void lumrow(const uchar *rgbptr, uchar *lumptr, int n) { lumptr += CHANOFFSET(0); while (n--) { diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 46d07e74ce3..6ed01c73f04 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -176,7 +176,7 @@ static void RGBE2FLOAT(RGBE rgbe, fCOLOR fcol) } /* float color -> rgbe */ -static void FLOAT2RGBE(fCOLOR fcol, RGBE rgbe) +static void FLOAT2RGBE(const fCOLOR fcol, RGBE rgbe) { int e; float d = (fcol[RED] > fcol[GRN]) ? fcol[RED] : fcol[GRN]; @@ -308,7 +308,8 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem, } /* ImBuf write */ -static int fwritecolrs(FILE *file, int width, int channels, unsigned char *ibufscan, float *fpscan) +static int fwritecolrs( + FILE *file, int width, int channels, const unsigned char *ibufscan, const float *fpscan) { int beg, c2, cnt = 0; fCOLOR fcol; diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 309de25db03..20e894fa942 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -81,14 +81,24 @@ typedef struct ImbTIFFMemFile { * Function implementations. * *****************************/ -static void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size) +static void imb_tiff_DummyUnmapProc( + thandle_t fd, + tdata_t base, + /* Cannot be const, because this function implemements TIFFUnmapFileProc. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + toff_t size) { (void)fd; (void)base; (void)size; } -static int imb_tiff_DummyMapProc(thandle_t fd, tdata_t *pbase, toff_t *psize) +static int imb_tiff_DummyMapProc( + thandle_t fd, + tdata_t *pbase, + /* Cannot be const, because this function implemements TIFFMapFileProc. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + toff_t *psize) { (void)fd; (void)pbase; -- cgit v1.2.3