[Bf-blender-cvs] [4d69b6f525a] master: Cleanup: use u-prefixed integer types (for brevity)

Campbell Barton noreply at git.blender.org
Tue Sep 13 08:36:03 CEST 2022


Commit: 4d69b6f525a4f02a24141e61f16e90455f3f0a30
Author: Campbell Barton
Date:   Tue Sep 13 16:29:06 2022 +1000
Branches: master
https://developer.blender.org/rB4d69b6f525a4f02a24141e61f16e90455f3f0a30

Cleanup: use u-prefixed integer types (for brevity)

===================================================================

M	source/blender/imbuf/intern/allocimbuf.c
M	source/blender/imbuf/intern/anim_movie.c
M	source/blender/imbuf/intern/cache.c
M	source/blender/imbuf/intern/cineon/cineon_dpx.c
M	source/blender/imbuf/intern/cineon/cineonlib.c
M	source/blender/imbuf/intern/cineon/cineonlib.h
M	source/blender/imbuf/intern/cineon/dpxlib.c
M	source/blender/imbuf/intern/cineon/logImageCore.c
M	source/blender/imbuf/intern/cineon/logmemfile.c
M	source/blender/imbuf/intern/colormanagement.c
M	source/blender/imbuf/intern/colormanagement_inline.c
M	source/blender/imbuf/intern/dds/BlockDXT.cpp
M	source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
M	source/blender/imbuf/intern/dds/FlipDXT.cpp
M	source/blender/imbuf/intern/dds/Stream.cpp
M	source/blender/imbuf/intern/dds/dds_api.cpp
M	source/blender/imbuf/intern/divers.c
M	source/blender/imbuf/intern/filter.c
M	source/blender/imbuf/intern/imageprocess.c
M	source/blender/imbuf/intern/jp2.c
M	source/blender/imbuf/intern/jpeg.c
M	source/blender/imbuf/intern/moviecache.cc
M	source/blender/imbuf/intern/oiio/openimageio_api.cpp
M	source/blender/imbuf/intern/openexr/openexr_api.cpp
M	source/blender/imbuf/intern/png.c
M	source/blender/imbuf/intern/radiance_hdr.c
M	source/blender/imbuf/intern/readimage.c
M	source/blender/imbuf/intern/rectop.c
M	source/blender/imbuf/intern/rotate.c
M	source/blender/imbuf/intern/scaling.c
M	source/blender/imbuf/intern/stereoimbuf.c
M	source/blender/imbuf/intern/targa.c
M	source/blender/imbuf/intern/thumbs.c
M	source/blender/imbuf/intern/thumbs_font.c
M	source/blender/imbuf/intern/tiff.c
M	source/blender/imbuf/intern/transform.cc
M	source/blender/imbuf/intern/util.c
M	source/blender/imbuf/intern/webp.c

===================================================================

diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index 868040dc17a..42b587c3c81 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -258,7 +258,7 @@ bool addzbufImBuf(ImBuf *ibuf)
 
   IMB_freezbufImBuf(ibuf);
 
-  if ((ibuf->zbuf = imb_alloc_pixels(ibuf->x, ibuf->y, 1, sizeof(unsigned int), __func__))) {
+  if ((ibuf->zbuf = imb_alloc_pixels(ibuf->x, ibuf->y, 1, sizeof(uint), __func__))) {
     ibuf->mall |= IB_zbuf;
     ibuf->flags |= IB_zbuf;
     return true;
@@ -309,7 +309,7 @@ bool imb_addencodedbufferImBuf(ImBuf *ibuf)
 
 bool imb_enlargeencodedbufferImBuf(ImBuf *ibuf)
 {
-  unsigned int newsize, encodedsize;
+  uint newsize, encodedsize;
   void *newbuffer;
 
   if (ibuf == NULL) {
@@ -351,8 +351,7 @@ bool imb_enlargeencodedbufferImBuf(ImBuf *ibuf)
   return true;
 }
 
-void *imb_alloc_pixels(
-    unsigned int x, unsigned int y, unsigned int channels, size_t typesize, const char *name)
+void *imb_alloc_pixels(uint x, uint y, uint channels, size_t typesize, const char *name)
 {
   /* Protect against buffer overflow vulnerabilities from files specifying
    * a width and height that overflow and alloc too little memory. */
@@ -364,7 +363,7 @@ void *imb_alloc_pixels(
   return MEM_callocN(size, name);
 }
 
-bool imb_addrectfloatImBuf(ImBuf *ibuf, const unsigned int channels)
+bool imb_addrectfloatImBuf(ImBuf *ibuf, const uint channels)
 {
   if (ibuf == NULL) {
     return false;
@@ -399,7 +398,7 @@ bool imb_addrectImBuf(ImBuf *ibuf)
   }
   ibuf->rect = NULL;
 
-  if ((ibuf->rect = imb_alloc_pixels(ibuf->x, ibuf->y, 4, sizeof(unsigned char), __func__))) {
+  if ((ibuf->rect = imb_alloc_pixels(ibuf->x, ibuf->y, 4, sizeof(uchar), __func__))) {
     ibuf->mall |= IB_rect;
     ibuf->flags |= IB_rect;
     if (ibuf->planes > 32) {
@@ -412,8 +411,7 @@ bool imb_addrectImBuf(ImBuf *ibuf)
   return false;
 }
 
-struct ImBuf *IMB_allocFromBufferOwn(
-    unsigned int *rect, float *rectf, unsigned int w, unsigned int h, unsigned int channels)
+struct ImBuf *IMB_allocFromBufferOwn(uint *rect, float *rectf, uint w, uint h, uint channels)
 {
   ImBuf *ibuf = NULL;
 
@@ -444,11 +442,8 @@ struct ImBuf *IMB_allocFromBufferOwn(
   return ibuf;
 }
 
-struct ImBuf *IMB_allocFromBuffer(const unsigned int *rect,
-                                  const float *rectf,
-                                  unsigned int w,
-                                  unsigned int h,
-                                  unsigned int channels)
+struct ImBuf *IMB_allocFromBuffer(
+    const uint *rect, const float *rectf, uint w, uint h, uint channels)
 {
   ImBuf *ibuf = NULL;
 
@@ -488,8 +483,7 @@ bool imb_addtilesImBuf(ImBuf *ibuf)
   }
 
   if (!ibuf->tiles) {
-    if ((ibuf->tiles = MEM_callocN(sizeof(unsigned int *) * ibuf->xtiles * ibuf->ytiles,
-                                   "imb_tiles"))) {
+    if ((ibuf->tiles = MEM_callocN(sizeof(uint *) * ibuf->xtiles * ibuf->ytiles, "imb_tiles"))) {
       ibuf->mall |= IB_tiles;
     }
   }
@@ -497,7 +491,7 @@ bool imb_addtilesImBuf(ImBuf *ibuf)
   return (ibuf->tiles != NULL);
 }
 
-ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int flags)
+ImBuf *IMB_allocImBuf(uint x, uint y, uchar planes, uint flags)
 {
   ImBuf *ibuf;
 
@@ -513,8 +507,7 @@ ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int
   return ibuf;
 }
 
-bool IMB_initImBuf(
-    struct ImBuf *ibuf, unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
+bool IMB_initImBuf(struct ImBuf *ibuf, uint x, uint y, uchar planes, uint flags)
 {
   memset(ibuf, 0, sizeof(ImBuf));
 
@@ -678,7 +671,7 @@ size_t IMB_get_size_in_memory(ImBuf *ibuf)
   }
 
   if (ibuf->tiles) {
-    size += sizeof(unsigned int) * ibuf->ytiles * ibuf->xtiles;
+    size += sizeof(uint) * ibuf->ytiles * ibuf->xtiles;
   }
 
   return size;
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 52ed68a1ff3..4e6a52f8464 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -97,9 +97,9 @@ static void free_anim_movie(struct anim *UNUSED(anim))
 #  define PATHSEPARATOR '/'
 #endif
 
-static int an_stringdec(const char *string, char *head, char *tail, unsigned short *numlen)
+static int an_stringdec(const char *string, char *head, char *tail, ushort *numlen)
 {
-  unsigned short len, nume, nums = 0;
+  ushort len, nume, nums = 0;
   short i;
   bool found = false;
 
@@ -139,8 +139,7 @@ static int an_stringdec(const char *string, char *head, char *tail, unsigned sho
   return true;
 }
 
-static void an_stringenc(
-    char *string, const char *head, const char *tail, unsigned short numlen, int pic)
+static void an_stringenc(char *string, const char *head, const char *tail, ushort numlen, int pic)
 {
   BLI_path_sequence_encode(string, head, tail, numlen, pic);
 }
@@ -454,7 +453,7 @@ static ImBuf *avi_fetchibuf(struct anim *anim, int position)
       lpbi = AVIStreamGetFrame(anim->pgf, position + AVIStreamStart(anim->pavi[anim->firstvideo]));
       if (lpbi) {
         ibuf = IMB_ibImageFromMemory(
-            (const unsigned char *)lpbi, 100, IB_rect, anim->colorspace, "<avi_fetchibuf>");
+            (const uchar *)lpbi, 100, IB_rect, anim->colorspace, "<avi_fetchibuf>");
         /* Oh brother... */
       }
     }
@@ -1568,7 +1567,7 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim,
 {
   struct ImBuf *ibuf = NULL;
   char head[256], tail[256];
-  unsigned short digits;
+  ushort digits;
   int pic;
   int filter_y;
   if (anim == NULL) {
diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c
index 51f7dbdf41a..4e1563c62ab 100644
--- a/source/blender/imbuf/intern/cache.c
+++ b/source/blender/imbuf/intern/cache.c
@@ -81,11 +81,11 @@ static ImGlobalTileCache GLOBAL_CACHE;
 /** \name Hash Functions
  * \{ */
 
-static unsigned int imb_global_tile_hash(const void *gtile_p)
+static uint imb_global_tile_hash(const void *gtile_p)
 {
   const ImGlobalTile *gtile = gtile_p;
 
-  return ((unsigned int)(intptr_t)gtile->ibuf) * 769 + gtile->tx * 53 + gtile->ty * 97;
+  return ((uint)(intptr_t)gtile->ibuf) * 769 + gtile->tx * 53 + gtile->ty * 97;
 }
 
 static bool imb_global_tile_cmp(const void *a_p, const void *b_p)
@@ -96,11 +96,11 @@ static bool imb_global_tile_cmp(const void *a_p, const void *b_p)
   return ((a->ibuf != b->ibuf) || (a->tx != b->tx) || (a->ty != b->ty));
 }
 
-static unsigned int imb_thread_tile_hash(const void *ttile_p)
+static uint imb_thread_tile_hash(const void *ttile_p)
 {
   const ImThreadTile *ttile = ttile_p;
 
-  return ((unsigned int)(intptr_t)ttile->ibuf) * 769 + ttile->tx * 53 + ttile->ty * 97;
+  return ((uint)(intptr_t)ttile->ibuf) * 769 + ttile->tx * 53 + ttile->ty * 97;
 }
 
 static bool imb_thread_tile_cmp(const void *a_p, const void *b_p)
@@ -121,9 +121,9 @@ static void imb_global_cache_tile_load(ImGlobalTile *gtile)
 {
   ImBuf *ibuf = gtile->ibuf;
   int toffs = ibuf->xtiles * gtile->ty + gtile->tx;
-  unsigned int *rect;
+  uint *rect;
 
-  rect = MEM_callocN(sizeof(unsigned int) * ibuf->tilex * ibuf->tiley, "imb_tile");
+  rect = MEM_callocN(sizeof(uint) * ibuf->tilex * ibuf->tiley, "imb_tile");
   imb_loadtile(ibuf, gtile->tx, gtile->ty, rect);
   ibuf->tiles[toffs] = rect;
 }
@@ -136,7 +136,7 @@ static void imb_global_cache_tile_unload(ImGlobalTile *gtile)
   MEM_freeN(ibuf->tiles[toffs]);
   ibuf->tiles[toffs] = NULL;
 
-  GLOBAL_CACHE.totmem -= sizeof(unsigned int) * ibuf->tilex * ibuf->tiley;
+  GLOBAL_CACHE.totmem -= sizeof(uint) * ibuf->tilex * ibuf->tiley;
 }
 
 void imb_tile_cache_tile_free(ImBuf *ibuf, int tx, int ty)
@@ -343,7 +343,7 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf,
     BLI_addhead(&GLOBAL_CACHE.tiles, gtile);
 
     /* mark as being loaded and unlock to allow other threads to load too */
-    GLOBAL_CACHE.totmem += sizeof(unsigned int) * ibuf->tilex * ibuf->tiley;
+    GLOBAL_CACHE.totmem += sizeof(uint) * ibuf->tilex * ibuf->tiley;
 
     BLI_mutex_unlock(&GLOBAL_CACHE.mutex);
 
@@ -363,10 +363,7 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf,
 /** \name Per-Thread Cache
  * \{ */
 
-static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache,
-                                               ImBuf *ibuf,
-                                               int tx,
-                                               int ty)
+static uint *imb_thread_cache_get_tile(ImThreadTileCache *cache, ImBuf *ibuf, int tx, int ty)
 {
   ImThreadTile *ttile, lookuptile;
   ImGlobalTile *gtile, *replacetile;
@@ -418,7 +415,7 @@ static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache,
   return ibuf->tiles[toffs];
 }
 
-unsigned int *IMB_gettile(ImBuf *ibuf, int tx, int ty, int thread)
+uint *IMB_gettile(ImBuf *ibuf, int tx, int ty, int thread)
 {
   return imb_thread_cache_get_tile(&GLOBAL_CACHE.thread_cache[thread + 1], ibuf, tx, ty);
 }
@@ -427,7 +424,7 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
 {
   ImBuf *mipbuf;
   ImGlobalTile *gtile;
-  unsigned int *to, *from;
+  uint *to, *from;
   int a, tx, ty, y, w, h;
 
   for (a = 0; a < ibuf->miptot; a++) {
@@ -435,8 +432,7 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
 
     /* don't call imb_addrectImBuf, it frees all mipmaps */
     if (!mipbuf->rect) {
-      if ((mipbuf->rect = MEM_callocN(ibuf->x * ibuf->y * sizeof(unsigned int),
-                                      "imb_addrectImBuf"))) {
+      if ((mipbuf->rect = MEM_callocN(ibuf->x * ibuf->y * sizeof(uint), "imb_addrectImBuf"))) {
         mipbuf->mall |= IB_rect;
         mipbuf->flags |= IB_rect;
       }
@@ -460,7 +456,7 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
         h = (ty == mipbuf->ytiles - 1) ? mipbuf->y - ty * mipbuf->tiley : mipbuf->tiley;
 
         for (y = 0; y < h; y++) {
-          memcpy(to, from, sizeof(unsigned int) * w);
+          memcpy(to, from, sizeof(uint) * w);
           from += mipbuf->tilex;
           to += mipbuf->x;
         }
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index 1a99d2a34d9..3bff8184b19 100644
---

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list