[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46681] trunk/blender/source/blender/imbuf /intern: style cleanup: imbuf

Campbell Barton ideasman42 at gmail.com
Wed May 16 09:38:24 CEST 2012


Revision: 46681
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46681
Author:   campbellbarton
Date:     2012-05-16 07:38:23 +0000 (Wed, 16 May 2012)
Log Message:
-----------
style cleanup: imbuf

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/intern/filetype.c
    trunk/blender/source/blender/imbuf/intern/jpeg.c
    trunk/blender/source/blender/imbuf/intern/metadata.c
    trunk/blender/source/blender/imbuf/intern/readimage.c
    trunk/blender/source/blender/imbuf/intern/targa.c
    trunk/blender/source/blender/imbuf/intern/util.c

Modified: trunk/blender/source/blender/imbuf/intern/filetype.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/filetype.c	2012-05-16 05:16:34 UTC (rev 46680)
+++ trunk/blender/source/blender/imbuf/intern/filetype.c	2012-05-16 07:38:23 UTC (rev 46681)
@@ -44,13 +44,26 @@
 
 #include "imbuf.h"
 
-static int imb_ftype_default(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftype & type->filetype); }
+static int imb_ftype_default(ImFileType *type, ImBuf *ibuf)
+{
+	return (ibuf->ftype & type->filetype);
+}
 #if defined(__APPLE__) && defined(IMBUF_COCOA)
-static int imb_ftype_cocoa(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftype & TIF); }
+static int imb_ftype_cocoa(ImFileType *type, ImBuf *ibuf)
+{
+	return (ibuf->ftype & TIF);
+}
 #endif
-static int imb_ftype_iris(ImFileType *type, ImBuf *ibuf) { (void)type; return (ibuf->ftype == IMAGIC); }
+static int imb_ftype_iris(ImFileType *type, ImBuf *ibuf)
+{
+	(void)type;
+	return (ibuf->ftype == IMAGIC);
+}
 #ifdef WITH_QUICKTIME
-static int imb_ftype_quicktime(ImFileType *type, ImBuf *ibuf) { return 0; } // XXX
+static int imb_ftype_quicktime(ImFileType *type, ImBuf *ibuf)
+{
+	return 0; /* XXX */
+}
 #endif
 
 #ifdef WITH_QUICKTIME
@@ -58,7 +71,7 @@
 void quicktime_exit(void);
 #endif
 
-ImFileType IMB_FILE_TYPES[]= {
+ImFileType IMB_FILE_TYPES[] = {
 	{NULL, NULL, imb_is_a_jpeg, imb_ftype_default, imb_load_jpeg, imb_savejpeg, NULL, 0, JPG},
 	{NULL, NULL, imb_is_a_png, imb_ftype_default, imb_loadpng, imb_savepng, NULL, 0, PNG},
 	{NULL, NULL, imb_is_a_bmp, imb_ftype_default, imb_bmp_decode, imb_savebmp, NULL, 0, BMP},
@@ -88,13 +101,14 @@
 #ifdef WITH_QUICKTIME
 	{quicktime_init, quicktime_exit, imb_is_a_quicktime, imb_ftype_quicktime, imb_quicktime_decode, NULL, NULL, 0, QUICKTIME},
 #endif	
-	{NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0}};
+	{NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0}
+};
 	
 void imb_filetypes_init(void)
 {
 	ImFileType *type;
 
-	for (type=IMB_FILE_TYPES; type->is_a; type++)
+	for (type = IMB_FILE_TYPES; type->is_a; type++)
 		if (type->init)
 			type->init();
 }
@@ -103,7 +117,7 @@
 {
 	ImFileType *type;
 
-	for (type=IMB_FILE_TYPES; type->is_a; type++)
+	for (type = IMB_FILE_TYPES; type->is_a; type++)
 		if (type->exit)
 			type->exit();
 }

Modified: trunk/blender/source/blender/imbuf/intern/jpeg.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/jpeg.c	2012-05-16 05:16:34 UTC (rev 46680)
+++ trunk/blender/source/blender/imbuf/intern/jpeg.c	2012-05-16 07:38:23 UTC (rev 46681)
@@ -47,21 +47,21 @@
 #include "jpeglib.h" 
 #include "jerror.h"
 
-#define IS_jpg(x)		(x->ftype & JPG)
-#define IS_stdjpg(x)	((x->ftype & JPG_MSK) == JPG_STD)
-#define IS_vidjpg(x)	((x->ftype & JPG_MSK) == JPG_VID)
-#define IS_jstjpg(x)	((x->ftype & JPG_MSK) == JPG_JST)
-#define IS_maxjpg(x)	((x->ftype & JPG_MSK) == JPG_MAX)
+#define IS_jpg(x)       (x->ftype & JPG)
+#define IS_stdjpg(x)    ((x->ftype & JPG_MSK) == JPG_STD)
+#define IS_vidjpg(x)    ((x->ftype & JPG_MSK) == JPG_VID)
+#define IS_jstjpg(x)    ((x->ftype & JPG_MSK) == JPG_JST)
+#define IS_maxjpg(x)    ((x->ftype & JPG_MSK) == JPG_MAX)
 
 /* the types are from the jpeg lib */
-static void jpeg_error (j_common_ptr cinfo);
+static void jpeg_error(j_common_ptr cinfo);
 static void init_source(j_decompress_ptr cinfo);
 static boolean fill_input_buffer(j_decompress_ptr cinfo);
 static void skip_input_data(j_decompress_ptr cinfo, long num_bytes);
 static void term_source(j_decompress_ptr cinfo);
 static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t size);
-static boolean handle_app1 (j_decompress_ptr cinfo);
-static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int flags);
+static boolean handle_app1(j_decompress_ptr cinfo);
+static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int flags);
 
 
 /*
@@ -82,7 +82,7 @@
 
 int imb_is_a_jpeg(unsigned char *mem)
 {
-	if ((mem[0]== 0xFF) && (mem[1] == 0xD8))return 1;
+	if ((mem[0] == 0xFF) && (mem[1] == 0xD8)) return 1;
 	return 0;
 }
 
@@ -91,19 +91,19 @@
 //----------------------------------------------------------
 
 typedef struct my_error_mgr {
-	struct jpeg_error_mgr pub;	/* "public" fields */
+	struct jpeg_error_mgr pub;  /* "public" fields */
 
-	jmp_buf setjmp_buffer;	/* for return to caller */
+	jmp_buf setjmp_buffer;  /* for return to caller */
 } my_error_mgr;
 
-typedef my_error_mgr * my_error_ptr;
+typedef my_error_mgr *my_error_ptr;
 
-static void jpeg_error (j_common_ptr cinfo)
+static void jpeg_error(j_common_ptr cinfo)
 {
 	my_error_ptr err = (my_error_ptr)cinfo->err;
 
 	/* Always display the message */
-	(*cinfo->err->output_message) (cinfo);
+	(*cinfo->err->output_message)(cinfo);
 
 	/* Let the memory manager delete any temp files before we die */
 	jpeg_destroy(cinfo);
@@ -117,19 +117,19 @@
 //----------------------------------------------------------
 
 typedef struct {
-	unsigned char	*buffer;
-	int		filled;
+	unsigned char  *buffer;
+	int             filled;
 } buffer_struct;
 
 typedef struct {
-	struct jpeg_source_mgr pub;	/* public fields */
+	struct jpeg_source_mgr pub; /* public fields */
 
-	unsigned char	*buffer;
-	int				size;
-	JOCTET			terminal[2];
+	unsigned char  *buffer;
+	int             size;
+	JOCTET          terminal[2];
 } my_source_mgr;
 
-typedef my_source_mgr * my_src_ptr;
+typedef my_source_mgr *my_src_ptr;
 
 static void init_source(j_decompress_ptr cinfo)
 {
@@ -179,25 +179,25 @@
 
 	if (cinfo->src == NULL) { /* first time for this JPEG object? */
 		cinfo->src = (struct jpeg_source_mgr *)(*cinfo->mem->alloc_small)
-			((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(my_source_mgr));
+		                 ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(my_source_mgr));
 	}
 
 	src = (my_src_ptr) cinfo->src;
-	src->pub.init_source		= init_source;
-	src->pub.fill_input_buffer	= fill_input_buffer;
-	src->pub.skip_input_data	= skip_input_data;
-	src->pub.resync_to_restart	= jpeg_resync_to_restart;
-	src->pub.term_source		= term_source;
+	src->pub.init_source        = init_source;
+	src->pub.fill_input_buffer  = fill_input_buffer;
+	src->pub.skip_input_data    = skip_input_data;
+	src->pub.resync_to_restart  = jpeg_resync_to_restart;
+	src->pub.term_source        = term_source;
 
-	src->pub.bytes_in_buffer	= size;
-	src->pub.next_input_byte	= buffer;
+	src->pub.bytes_in_buffer    = size;
+	src->pub.next_input_byte    = buffer;
 
 	src->buffer = buffer;
 	src->size = size;
 }
 
 
-#define MAKESTMT(stuff)		do { stuff } while (0)
+#define MAKESTMT(stuff)     do { stuff } while (0)
 
 #define INPUT_VARS(cinfo)  \
 	struct jpeg_source_mgr * datasrc = (cinfo)->src;  \
@@ -229,7 +229,7 @@
 /* Read a byte into variable V.
  * If must suspend, take the specified action (typically "return FALSE").
  */
-#define INPUT_BYTE(cinfo,V,action)  \
+#define INPUT_BYTE(cinfo, V, action)  \
 	MAKESTMT(MAKE_BYTE_AVAIL(cinfo,action); \
 		  bytes_in_buffer--; \
 		  V = GETJOCTET(*next_input_byte++); )
@@ -237,17 +237,17 @@
 /* As above, but read two bytes interpreted as an unsigned 16-bit integer.
  * V should be declared unsigned int or perhaps INT32.
  */
-#define INPUT_2BYTES(cinfo,V,action)  \
+#define INPUT_2BYTES(cinfo, V, action)  \
 	MAKESTMT(MAKE_BYTE_AVAIL(cinfo,action); \
 		  bytes_in_buffer--; \
 		  V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \
-		  MAKE_BYTE_AVAIL(cinfo,action); \
+		  MAKE_BYTE_AVAIL(cinfo, action); \
 		  bytes_in_buffer--; \
 		  V += GETJOCTET(*next_input_byte++); )
 
 
 static boolean
-handle_app1 (j_decompress_ptr cinfo)
+handle_app1(j_decompress_ptr cinfo)
 {
 	INT32 length; /* initialized by the macro */
 	INT32 i;
@@ -264,20 +264,20 @@
 		if (strncmp(neogeo, "NeoGeo", 6) == 0) memcpy(&ibuf_ftype, neogeo + 6, 4);
 		ibuf_ftype = BIG_LONG(ibuf_ftype);
 	}
-	INPUT_SYNC(cinfo);		/* do before skip_input_data */
-	if (length > 0) (*cinfo->src->skip_input_data) (cinfo, length);
+	INPUT_SYNC(cinfo);  /* do before skip_input_data */
+	if (length > 0) (*cinfo->src->skip_input_data)(cinfo, length);
 	return TRUE;
 }
 
 
-static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int flags)
+static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int flags)
 {
 	JSAMPARRAY row_pointer;
-	JSAMPLE * buffer = NULL;
+	JSAMPLE *buffer = NULL;
 	int row_stride;
 	int x, y, depth, r, g, b, k;
-	struct ImBuf * ibuf = NULL;
-	uchar * rect;
+	struct ImBuf *ibuf = NULL;
+	uchar *rect;
 	jpeg_saved_marker_ptr marker;
 	char *str, *key, *value;
 
@@ -314,7 +314,7 @@
 		else {
 			row_stride = cinfo->output_width * depth;
 
-			row_pointer = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, row_stride, 1);
+			row_pointer = (*cinfo->mem->alloc_sarray)((j_common_ptr) cinfo, JPOOL_IMAGE, row_stride, 1);
 			
 			for (y = ibuf->y - 1; y >= 0; y--) {
 				jpeg_read_scanlines(cinfo, row_pointer, 1);
@@ -323,14 +323,14 @@
 				
 				switch (depth) {
 					case 1:
-						for (x=ibuf->x; x >0; x--) {
+						for (x = ibuf->x; x > 0; x--) {
 							rect[3] = 255;
 							rect[0] = rect[1] = rect[2] = *buffer++;
 							rect += 4;
 						}
 						break;
 					case 3:
-						for (x=ibuf->x; x >0; x--) {
+						for (x = ibuf->x; x > 0; x--) {
 							rect[3] = 255;
 							rect[0] = *buffer++;
 							rect[1] = *buffer++;
@@ -339,7 +339,7 @@
 						}
 						break;
 					case 4:
-						for (x=ibuf->x; x >0; x--) {
+						for (x = ibuf->x; x > 0; x--) {
 							r = *buffer++;
 							g = *buffer++;
 							b = *buffer++;
@@ -371,7 +371,7 @@
 				}
 			}
 
-			marker= cinfo->marker_list;
+			marker = cinfo->marker_list;
 			while (marker) {
 				if (marker->marker != JPEG_COM)
 					goto next_stamp_marker;
@@ -400,8 +400,8 @@
 					goto next_stamp_marker;
 				}
 
-				str = BLI_strdup ((char *) marker->data);
-				key = strchr (str, ':');
+				str = BLI_strdup((char *) marker->data);
+				key = strchr(str, ':');
 				/*
 				 * A little paranoid, but the file maybe
 				 * is broken... and a "extra" check is better
@@ -413,7 +413,7 @@
 				}
 
 				key++;
-				value = strchr (key, ':');
+				value = strchr(key, ':');
 				if (!value) {
 					MEM_freeN(str);
 					goto next_stamp_marker;
@@ -425,7 +425,7 @@
 				ibuf->flags |= IB_metadata;
 				MEM_freeN(str);
 next_stamp_marker:
-				marker= marker->next;
+				marker = marker->next;
 			}
 
 			jpeg_finish_decompress(cinfo);
@@ -441,11 +441,11 @@
 	return(ibuf);
 }
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list