[Bf-blender-cvs] [64b4b719ebd] master: Cleanup: style, use braces for imbuf

Campbell Barton noreply at git.blender.org
Tue Apr 23 07:19:31 CEST 2019


Commit: 64b4b719ebd5201d27aa25d7fa2d765eabded9b0
Author: Campbell Barton
Date:   Tue Apr 23 11:01:30 2019 +1000
Branches: master
https://developer.blender.org/rB64b4b719ebd5201d27aa25d7fa2d765eabded9b0

Cleanup: style, use braces for imbuf

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

M	source/blender/imbuf/intern/allocimbuf.c
M	source/blender/imbuf/intern/anim_movie.c
M	source/blender/imbuf/intern/bmp.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/dpxlib.c
M	source/blender/imbuf/intern/cineon/logImageCore.c
M	source/blender/imbuf/intern/cineon/logImageCore.h
M	source/blender/imbuf/intern/cineon/logmemfile.c
M	source/blender/imbuf/intern/colormanagement.c
M	source/blender/imbuf/intern/dds/BlockDXT.cpp
M	source/blender/imbuf/intern/dds/ColorBlock.cpp
M	source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
M	source/blender/imbuf/intern/dds/FlipDXT.cpp
M	source/blender/imbuf/intern/dds/Image.cpp
M	source/blender/imbuf/intern/dds/Image.h
M	source/blender/imbuf/intern/dds/PixelFormat.h
M	source/blender/imbuf/intern/dds/dds_api.cpp
M	source/blender/imbuf/intern/divers.c
M	source/blender/imbuf/intern/filetype.c
M	source/blender/imbuf/intern/filter.c
M	source/blender/imbuf/intern/imageprocess.c
M	source/blender/imbuf/intern/indexer.c
M	source/blender/imbuf/intern/iris.c
M	source/blender/imbuf/intern/jp2.c
M	source/blender/imbuf/intern/jpeg.c
M	source/blender/imbuf/intern/moviecache.c
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/tiff.c
M	source/blender/imbuf/intern/util.c
M	source/blender/imbuf/intern/writeimage.c

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

diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index ae8ddce0338..76304b33a6f 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -597,8 +597,9 @@ ImBuf *IMB_dupImBuf(const ImBuf *ibuf1)
   tbuf.encodedbuffer = ibuf2->encodedbuffer;
   tbuf.zbuf = ibuf2->zbuf;
   tbuf.zbuf_float = ibuf2->zbuf_float;
-  for (a = 0; a < IMB_MIPMAP_LEVELS; a++)
+  for (a = 0; a < IMB_MIPMAP_LEVELS; a++) {
     tbuf.mipmap[a] = NULL;
+  }
   tbuf.dds_data.data = NULL;
 
   /* set malloc flag */
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index aa1d63394ff..4ef4e15d1c9 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -124,8 +124,9 @@ static int an_stringdec(const char *string, char *head, char *tail, unsigned sho
   nume = len;
 
   for (i = len - 1; i >= 0; i--) {
-    if (string[i] == PATHSEPARATOR)
+    if (string[i] == PATHSEPARATOR) {
       break;
+    }
     if (isdigit(string[i])) {
       if (found) {
         nums = i;
@@ -137,8 +138,9 @@ static int an_stringdec(const char *string, char *head, char *tail, unsigned sho
       }
     }
     else {
-      if (found)
+      if (found) {
         break;
+      }
     }
   }
   if (found) {
@@ -167,10 +169,12 @@ static void free_anim_avi(struct anim *anim)
   int i;
 #  endif
 
-  if (anim == NULL)
+  if (anim == NULL) {
     return;
-  if (anim->avi == NULL)
+  }
+  if (anim->avi == NULL) {
     return;
+  }
 
   AVI_close(anim->avi);
   MEM_freeN(anim->avi);
@@ -227,16 +231,18 @@ void IMB_free_anim(struct anim *anim)
 
 void IMB_close_anim(struct anim *anim)
 {
-  if (anim == NULL)
+  if (anim == NULL) {
     return;
+  }
 
   IMB_free_anim(anim);
 }
 
 void IMB_close_anim_proxies(struct anim *anim)
 {
-  if (anim == NULL)
+  if (anim == NULL) {
     return;
+  }
 
   IMB_free_indices(anim);
 }
@@ -253,8 +259,9 @@ struct IDProperty *IMB_anim_load_metadata(struct anim *anim)
 
       while (true) {
         entry = av_dict_get(anim->pFormatCtx->metadata, "", entry, AV_DICT_IGNORE_SUFFIX);
-        if (entry == NULL)
+        if (entry == NULL) {
           break;
+        }
 
         /* Delay creation of the property group until there is actual metadata to put in there. */
         IMB_metadata_ensure(&anim->metadata);
@@ -503,8 +510,9 @@ static int startffmpeg(struct anim *anim)
   const int *inv_table;
 #  endif
 
-  if (anim == NULL)
+  if (anim == NULL) {
     return (-1);
+  }
 
   streamcount = anim->streamindex;
 
@@ -971,14 +979,16 @@ static int match_format(const char *name, AVFormatContext *pFormatCtx)
 
   const char *names = pFormatCtx->iformat->name;
 
-  if (!name || !names)
+  if (!name || !names) {
     return 0;
+  }
 
   namelen = strlen(name);
   while ((p = strchr(names, ','))) {
     len = MAX2(p - names, namelen);
-    if (!BLI_strncasecmp(name, names, len))
+    if (!BLI_strncasecmp(name, names, len)) {
       return 1;
+    }
     names = p + 1;
   }
   return !BLI_strcasecmp(name, names);
@@ -1015,8 +1025,9 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, IMB_Timecode_Typ
   int new_frame_index = 0; /* To quiet gcc barking... */
   int old_frame_index = 0; /* To quiet gcc barking... */
 
-  if (anim == NULL)
+  if (anim == NULL) {
     return (0);
+  }
 
   av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: pos=%d\n", position);
 
@@ -1178,8 +1189,9 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, IMB_Timecode_Typ
 
 static void free_anim_ffmpeg(struct anim *anim)
 {
-  if (anim == NULL)
+  if (anim == NULL) {
     return;
+  }
 
   if (anim->pCodecCtx) {
     avcodec_close(anim->pCodecCtx);
@@ -1222,8 +1234,9 @@ static ImBuf *anim_getnew(struct anim *anim)
 {
   struct ImBuf *ibuf = NULL;
 
-  if (anim == NULL)
+  if (anim == NULL) {
     return (NULL);
+  }
 
   free_anim_movie(anim);
 
@@ -1235,8 +1248,9 @@ static ImBuf *anim_getnew(struct anim *anim)
   free_anim_ffmpeg(anim);
 #endif
 
-  if (anim->curtype != 0)
+  if (anim->curtype != 0) {
     return (NULL);
+  }
   anim->curtype = imb_get_anim_type(anim->name);
 
   switch (anim->curtype) {
@@ -1248,8 +1262,9 @@ static ImBuf *anim_getnew(struct anim *anim)
       }
       break;
     case ANIM_MOVIE:
-      if (startmovie(anim))
+      if (startmovie(anim)) {
         return (NULL);
+      }
       ibuf = IMB_allocImBuf(anim->x, anim->y, 24, 0); /* fake */
       break;
 #ifdef WITH_AVI
@@ -1263,8 +1278,9 @@ static ImBuf *anim_getnew(struct anim *anim)
 #endif
 #ifdef WITH_FFMPEG
     case ANIM_FFMPEG:
-      if (startffmpeg(anim))
+      if (startffmpeg(anim)) {
         return (0);
+      }
       ibuf = IMB_allocImBuf(anim->x, anim->y, 24, 0);
       break;
 #endif
@@ -1296,8 +1312,9 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim,
   unsigned short digits;
   int pic;
   int filter_y;
-  if (anim == NULL)
+  if (anim == NULL) {
     return (NULL);
+  }
 
   filter_y = (anim->ib_flags & IB_animdeinterlace);
 
@@ -1312,10 +1329,12 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim,
       ibuf = NULL;
     }
 
-    if (position < 0)
+    if (position < 0) {
       return (NULL);
-    if (position >= anim->duration)
+    }
+    if (position >= anim->duration) {
       return (NULL);
+    }
   }
   else {
     struct anim *proxy = IMB_anim_open_proxy(anim, preview_size);
@@ -1347,23 +1366,26 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim,
 #ifdef WITH_AVI
     case ANIM_AVI:
       ibuf = avi_fetchibuf(anim, position);
-      if (ibuf)
+      if (ibuf) {
         anim->curposition = position;
+      }
       break;
 #endif
 #ifdef WITH_FFMPEG
     case ANIM_FFMPEG:
       ibuf = ffmpeg_fetchibuf(anim, position, tc);
-      if (ibuf)
+      if (ibuf) {
         anim->curposition = position;
+      }
       filter_y = 0; /* done internally */
       break;
 #endif
   }
 
   if (ibuf) {
-    if (filter_y)
+    if (filter_y) {
       IMB_filtery(ibuf);
+    }
     BLI_snprintf(ibuf->name, sizeof(ibuf->name), "%s.%04d", anim->name, anim->curposition + 1);
   }
   return (ibuf);
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c
index b43b13ff282..ae3ac624e3b 100644
--- a/source/blender/imbuf/intern/bmp.c
+++ b/source/blender/imbuf/intern/bmp.c
@@ -125,8 +125,9 @@ struct ImBuf *imb_bmp_decode(const unsigned char *mem,
 
   (void)size; /* unused */
 
-  if (checkbmp(mem) == 0)
+  if (checkbmp(mem) == 0) {
     return (NULL);
+  }
 
   colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE);
 
@@ -310,8 +311,9 @@ int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags)
 
   data = (uchar *)ibuf->rect;
   ofile = BLI_fopen(name, "wb");
-  if (!ofile)
+  if (!ofile) {
     return 0;
+  }
 
   putShortLSB(19778, ofile);                                             /* "BM" */
   putIntLSB(bytesize + BMP_FILEHEADER_SIZE + sizeof(infoheader), ofile); /* Total file size */
@@ -335,17 +337,21 @@ int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags)
   for (size_t y = 0; y < ibuf->y; y++) {
     for (size_t x = 0; x < ibuf->x; x++) {
       ptr = (x + y * ibuf->x) * 4;
-      if (putc(data[ptr + 2], ofile) == EOF)
+      if (putc(data[ptr + 2], ofile) == EOF) {
         return 0;
-      if (putc(data[ptr + 1], ofile) == EOF)
+      }
+      if (putc(data[ptr + 1], ofile) == EOF) {
         return 0;
-      if (putc(data[ptr], ofile) == EOF)
+      }
+      if (putc(data[ptr], ofile) == EOF) {
         return 0;
+      }
     }
     /* add padding here */
     for (size_t t = 0; t < extrabytes; t++) {
-      if (putc(0, ofile) == EOF)
+      if (putc(0, ofile) == EOF) {
         return 0;
+      }
     }
   }
   if (ofile) {
diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c
index e6244364ba8..01c588daedd 100644
--- a/source/blender/imbuf/intern/cache.c
+++ b/source/blender/imbuf/intern/cache.c
@@ -155,8 +155,9 @@ void imb_tile_cache_tile_free(ImBuf *ibuf, int tx, int ty)
 
   if (gtile) {
     /* in case another thread is loading this */
-    while (gtile->loading)
+    while (gtile->loading) {
       ;
+    }
 
     BLI_ghash_remove(GLOBAL_CACHE.tilehash, gtile, NULL, NULL);
     BLI_remlink(&GLOBAL_CACHE.tiles, gtile);
@@ -209,17 +210,21 @@ void imb_tile_cache_exit(void)
   int a;
 
   if (GLOBAL_CACHE.initialized) {
-    for (gtile = GLOBAL_CACHE.tiles.first; gtile; gtile = gtile->next)
+    for (gtile = GLOBAL_CACHE.tiles.first; gtile; gtile = gtile->next) {
       imb_global_cache_tile_unload(gtile);
+    }
 
-    for (a = 0; a < GLOBAL_CACHE.totthread; a++)
+    for (a = 0; a < GLOBAL_CACHE.totthread; a++) {
       imb_thread_cache_exit(&GLOBAL_CACHE.thread_cache[a]);
+    }
 
-    if (GLOBAL_CACHE.memarena)
+    if (GLOBAL_CACHE.memarena) {
       BLI_memarena_free(GLOBAL_CACHE.memarena);
+    }
 
-    if (GLOBAL_CACHE.tilehash)
+    if (GLOBAL_CACHE.tilehash) {
       BLI_ghash_free(GLOBAL_CACHE.tilehash, NULL, NULL);
+    }
 
     BLI_mutex_end(&GLOBAL_CACHE.mutex);
 
@@ -236,8 +241,9 @@ void IMB_tile_cache_params(int totthread, int maxmem)
   totthread++;
 
   /* lazy initialize cache */
-  if (GLOBAL_CACHE.totthread == totthread && GLOBAL_CACHE.maxmem == maxmem)
+  if (GLOBAL_CACHE.totthread == totthread && GLOBAL_CACHE.maxmem == maxmem) {
     return;
+  }
 
   imb_tile_cache_exit();
 
@@ -252,8 +258,9 @@ void IMB_tile_cache_params(int totthread, int maxmem)
   GLOBAL_CACHE.maxmem = maxmem * 1024 * 1024;
 
   GLOBAL_CACHE.totthread = totthread;
-  for (a = 0; a < totthread; a++)
+  for (a = 0; a < totthread; a++) {
     imb_thread_cache_init(&GLOBAL_CACHE.thread_cache[a]);
+  }
 
   BLI_mutex_init(&GLOBAL_CACHE.mutex);
 }
@@ -269,8 +276,9 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf,
 
   BLI_mutex_lock(&GLOBAL_CACHE.mutex);
 
-  if (replacetile)
+  if (replacetile) {
     replacetile->refcount--;
+  }
 
   /* find tile in global cache */
   lookuptile.ibuf = ibuf;
@@ -286,8 +294,9 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf,
 
     BLI_mutex_unlock(&GLOBAL_CACHE.mutex);
 
-    while (gtile->loading)
+    while (gtile->loading) {
       ;
+ 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list