diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 10:04:52 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 11:26:27 +0300 |
commit | 891949cbb47143420f4324cb60efc05ef5d70b39 (patch) | |
tree | fe70a45612ae96f9ce1f37378ef5ff035d3127f5 /source/blender/io/avi | |
parent | c9e35c2ced92082c86f1ecb9ecd16c6230218c7c (diff) |
Cleanup: use 'u' prefixed integer types for brevity & cast style
To use function style cast '(unsigned char)x' can't be replaced by
'unsigned char(x)'.
Diffstat (limited to 'source/blender/io/avi')
-rw-r--r-- | source/blender/io/avi/intern/avi.c | 14 | ||||
-rw-r--r-- | source/blender/io/avi/intern/avi_mjpeg.c | 24 | ||||
-rw-r--r-- | source/blender/io/avi/intern/avi_rgb.c | 25 | ||||
-rw-r--r-- | source/blender/io/avi/intern/avi_rgb32.c | 14 |
4 files changed, 32 insertions, 45 deletions
diff --git a/source/blender/io/avi/intern/avi.c b/source/blender/io/avi/intern/avi.c index 8bf4f8124a3..b4438bfb0a8 100644 --- a/source/blender/io/avi/intern/avi.c +++ b/source/blender/io/avi/intern/avi.c @@ -38,14 +38,14 @@ static char DEBUG_FCC[4]; (void)0 /* local functions */ -char *fcc_to_char(unsigned int fcc); -char *tcc_to_char(unsigned int tcc); +char *fcc_to_char(uint fcc); +char *tcc_to_char(uint tcc); /* implementation */ -unsigned int GET_FCC(FILE *fp) +uint GET_FCC(FILE *fp) { - unsigned char tmp[4]; + uchar tmp[4]; tmp[0] = getc(fp); tmp[1] = getc(fp); @@ -55,7 +55,7 @@ unsigned int GET_FCC(FILE *fp) return FCC(tmp); } -unsigned int GET_TCC(FILE *fp) +uint GET_TCC(FILE *fp) { char tmp[5]; @@ -67,7 +67,7 @@ unsigned int GET_TCC(FILE *fp) return FCC(tmp); } -char *fcc_to_char(unsigned int fcc) +char *fcc_to_char(uint fcc) { DEBUG_FCC[0] = (fcc)&127; DEBUG_FCC[1] = (fcc >> 8) & 127; @@ -77,7 +77,7 @@ char *fcc_to_char(unsigned int fcc) return DEBUG_FCC; } -char *tcc_to_char(unsigned int tcc) +char *tcc_to_char(uint tcc) { DEBUG_FCC[0] = (tcc)&127; DEBUG_FCC[1] = (tcc >> 8) & 127; diff --git a/source/blender/io/avi/intern/avi_mjpeg.c b/source/blender/io/avi/intern/avi_mjpeg.c index fb42274fef2..16417fd12f7 100644 --- a/source/blender/io/avi/intern/avi_mjpeg.c +++ b/source/blender/io/avi/intern/avi_mjpeg.c @@ -22,10 +22,8 @@ #include "avi_mjpeg.h" -static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, size_t bufsize); -static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, - const unsigned char *buffer, - size_t bufsize); +static void jpegmemdestmgr_build(j_compress_ptr cinfo, uchar *buffer, size_t bufsize); +static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, const uchar *buffer, size_t bufsize); static size_t numbytes; @@ -215,11 +213,7 @@ static void std_huff_tables(j_decompress_ptr dinfo) sizeof(val_ac_chrominance)); } -static int Decode_JPEG(unsigned char *inBuffer, - unsigned char *outBuffer, - unsigned int width, - unsigned int height, - size_t bufsize) +static int Decode_JPEG(uchar *inBuffer, uchar *outBuffer, uint width, uint height, size_t bufsize) { struct jpeg_decompress_struct dinfo; struct jpeg_error_mgr jerr; @@ -272,16 +266,12 @@ static int Decode_JPEG(unsigned char *inBuffer, return 1; } -static void Compress_JPEG(int quality, - unsigned char *outbuffer, - const unsigned char *inBuffer, - int width, - int height, - size_t bufsize) +static void Compress_JPEG( + int quality, uchar *outbuffer, const uchar *inBuffer, int width, int height, size_t bufsize) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; - unsigned char marker[60]; + uchar marker[60]; cinfo.err = jpeg_std_error(&jerr); jpeg_create_compress(&cinfo); @@ -339,7 +329,7 @@ static void Compress_JPEG(int quality, jpeg_destroy_compress(&cinfo); } -static void interlace(unsigned char *to, unsigned char *from, int width, int height) +static void interlace(uchar *to, uchar *from, int width, int height) { size_t i, rowstride = width * 3; diff --git a/source/blender/io/avi/intern/avi_rgb.c b/source/blender/io/avi/intern/avi_rgb.c index ffc3d0477fa..71022361df1 100644 --- a/source/blender/io/avi/intern/avi_rgb.c +++ b/source/blender/io/avi/intern/avi_rgb.c @@ -21,12 +21,9 @@ /* implementation */ -void *avi_converter_from_avi_rgb(AviMovie *movie, - int stream, - unsigned char *buffer, - const size_t *size) +void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, uchar *buffer, const size_t *size) { - unsigned char *buf; + uchar *buf; AviBitmapInfoHeader *bi; short bits = 32; @@ -38,24 +35,24 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, } if (bits == 16) { - unsigned short *pxl; - unsigned char *to; + ushort *pxl; + uchar *to; #ifdef __BIG_ENDIAN__ - unsigned char *pxla; + uchar *pxla; #endif buf = imb_alloc_pixels( - movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf"); + movie->header->Height, movie->header->Width, 3, sizeof(uchar), "fromavirgbbuf"); if (buf) { size_t y = movie->header->Height; to = buf; while (y--) { - pxl = (unsigned short *)(buffer + y * movie->header->Width * 2); + pxl = (ushort *)(buffer + y * movie->header->Width * 2); #ifdef __BIG_ENDIAN__ - pxla = (unsigned char *)pxl; + pxla = (uchar *)pxl; #endif size_t x = movie->header->Width; @@ -82,7 +79,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, } buf = imb_alloc_pixels( - movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf"); + movie->header->Height, movie->header->Width, 3, sizeof(uchar), "fromavirgbbuf"); if (buf) { size_t rowstride = movie->header->Width * 3; @@ -110,9 +107,9 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, return buf; } -void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, size_t *size) +void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, uchar *buffer, size_t *size) { - unsigned char *buf; + uchar *buf; (void)stream; /* unused */ diff --git a/source/blender/io/avi/intern/avi_rgb32.c b/source/blender/io/avi/intern/avi_rgb32.c index 84ae023fcdd..fcb83ffe47d 100644 --- a/source/blender/io/avi/intern/avi_rgb32.c +++ b/source/blender/io/avi/intern/avi_rgb32.c @@ -17,15 +17,15 @@ #include "AVI_avi.h" #include "avi_rgb32.h" -void *avi_converter_from_rgb32(AviMovie *movie, int stream, unsigned char *buffer, size_t *size) +void *avi_converter_from_rgb32(AviMovie *movie, int stream, uchar *buffer, size_t *size) { - unsigned char *buf; + uchar *buf; (void)stream; /* unused */ *size = (size_t)movie->header->Height * (size_t)movie->header->Width * 3; buf = imb_alloc_pixels( - movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromrgb32buf"); + movie->header->Height, movie->header->Width, 3, sizeof(uchar), "fromrgb32buf"); if (!buf) { return NULL; } @@ -46,16 +46,16 @@ void *avi_converter_from_rgb32(AviMovie *movie, int stream, unsigned char *buffe return buf; } -void *avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer, size_t *size) +void *avi_converter_to_rgb32(AviMovie *movie, int stream, uchar *buffer, size_t *size) { - unsigned char *buf; - unsigned char *to, *from; + uchar *buf; + uchar *to, *from; (void)stream; /* unused */ *size = (size_t)movie->header->Height * (size_t)movie->header->Width * 4; buf = imb_alloc_pixels( - movie->header->Height, movie->header->Width, 4, sizeof(unsigned char), "torgb32buf"); + movie->header->Height, movie->header->Width, 4, sizeof(uchar), "torgb32buf"); if (!buf) { return NULL; } |