[Bf-blender-cvs] [28316493bd8] blender2.8: Cleanup: style

Campbell Barton noreply at git.blender.org
Fri Nov 30 04:57:53 CET 2018


Commit: 28316493bd82f5e5d2be40effdad4431f9c49c6e
Author: Campbell Barton
Date:   Fri Nov 30 14:51:16 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB28316493bd82f5e5d2be40effdad4431f9c49c6e

Cleanup: style

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

M	source/blender/blenloader/intern/readblenentry.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/undofile.c
M	source/blender/blenloader/intern/versioning_250.c
M	source/blender/blenloader/intern/versioning_260.c
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/blenloader/intern/versioning_legacy.c
M	source/blender/blenloader/intern/writefile.c

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

diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 4d294870fb1..6bf0e7bf809 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -106,7 +106,7 @@ BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize)
 
 void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
 {
-	FileData *fd = (FileData *) bh;
+	FileData *fd = (FileData *)bh;
 	BHead *bhead;
 
 	fprintf(fp, "[\n");
@@ -144,7 +144,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
  */
 LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, int *tot_names)
 {
-	FileData *fd = (FileData *) bh;
+	FileData *fd = (FileData *)bh;
 	LinkNode *names = NULL;
 	BHead *bhead;
 	int tot = 0;
@@ -174,7 +174,7 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype,
  */
 LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *tot_prev)
 {
-	FileData *fd = (FileData *) bh;
+	FileData *fd = (FileData *)bh;
 	LinkNode *previews = NULL;
 	BHead *bhead;
 	int looking = 0;
@@ -210,11 +210,11 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
 					if (prv) {
 						memcpy(new_prv, prv, sizeof(PreviewImage));
 						if (prv->rect[0] && prv->w[0] && prv->h[0]) {
-							unsigned int *rect = NULL;
-							size_t len = new_prv->w[0] * new_prv->h[0] * sizeof(unsigned int);
+							uint *rect = NULL;
+							size_t len = new_prv->w[0] * new_prv->h[0] * sizeof(uint);
 							new_prv->rect[0] = MEM_callocN(len, __func__);
 							bhead = blo_nextbhead(fd, bhead);
-							rect = (unsigned int *)(bhead + 1);
+							rect = (uint *)(bhead + 1);
 							BLI_assert(len == bhead->len);
 							memcpy(new_prv->rect[0], rect, len);
 						}
@@ -227,11 +227,11 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
 						}
 
 						if (prv->rect[1] && prv->w[1] && prv->h[1]) {
-							unsigned int *rect = NULL;
-							size_t len = new_prv->w[1] * new_prv->h[1] * sizeof(unsigned int);
+							uint *rect = NULL;
+							size_t len = new_prv->w[1] * new_prv->h[1] * sizeof(uint);
 							new_prv->rect[1] = MEM_callocN(len, __func__);
 							bhead = blo_nextbhead(fd, bhead);
-							rect = (unsigned int *)(bhead + 1);
+							rect = (uint *)(bhead + 1);
 							BLI_assert(len == bhead->len);
 							memcpy(new_prv->rect[1], rect, len);
 						}
@@ -270,7 +270,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
  */
 LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
 {
-	FileData *fd = (FileData *) bh;
+	FileData *fd = (FileData *)bh;
 	GSet *gathered = BLI_gset_ptr_new("linkable_groups gh");
 	LinkNode *names = NULL;
 	BHead *bhead;
@@ -302,7 +302,7 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
  */
 void BLO_blendhandle_close(BlendHandle *bh)
 {
-	FileData *fd = (FileData *) bh;
+	FileData *fd = (FileData *)bh;
 
 	blo_freefiledata(fd);
 }
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 42b672d47b5..e61cfbf2aac 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -308,7 +308,7 @@ static const char *library_parent_filepath(Library *lib)
 
 static OldNewMap *oldnewmap_new(void)
 {
-	OldNewMap *onm= MEM_callocN(sizeof(*onm), "OldNewMap");
+	OldNewMap *onm = MEM_callocN(sizeof(*onm), "OldNewMap");
 
 	onm->entriessize = 1024;
 	onm->entries = MEM_malloc_arrayN(onm->entriessize, sizeof(*onm->entries), "OldNewMap.entries");
@@ -318,7 +318,7 @@ static OldNewMap *oldnewmap_new(void)
 
 static int verg_oldnewmap(const void *v1, const void *v2)
 {
-	const struct OldNew *x1=v1, *x2=v2;
+	const struct OldNew *x1 = v1, *x2 = v2;
 
 	if (x1->old > x2->old) return 1;
 	else if (x1->old < x2->old) return -1;
@@ -338,7 +338,7 @@ static void oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void *newaddr,
 {
 	OldNew *entry;
 
-	if (oldaddr==NULL || newaddr==NULL) return;
+	if (oldaddr == NULL || newaddr == NULL) return;
 
 	if (UNLIKELY(onm->nentries == onm->entriessize)) {
 		onm->entriessize *= 2;
@@ -412,7 +412,7 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, const void *addr, bool inc
 
 	if (addr == NULL) return NULL;
 
-	if (onm->lasthit < onm->nentries-1) {
+	if (onm->lasthit < onm->nentries - 1) {
 		OldNew *entry = &onm->entries[++onm->lasthit];
 
 		if (entry->old == addr) {
@@ -525,13 +525,13 @@ void blo_join_main(ListBase *mainlist)
 	}
 }
 
-static void split_libdata(ListBase *lb_src, Main **lib_main_array, const unsigned int lib_main_array_len)
+static void split_libdata(ListBase *lb_src, Main **lib_main_array, const uint lib_main_array_len)
 {
 	for (ID *id = lb_src->first, *idnext; id; id = idnext) {
 		idnext = id->next;
 
 		if (id->lib) {
-			if (((unsigned int)id->lib->temp_index < lib_main_array_len) &&
+			if (((uint)id->lib->temp_index < lib_main_array_len) &&
 			    /* this check should never fail, just incase 'id->lib' is a dangling pointer. */
 			    (lib_main_array[id->lib->temp_index]->curlib == id->lib))
 			{
@@ -557,8 +557,8 @@ void blo_split_main(ListBase *mainlist, Main *main)
 		return;
 
 	/* (Library.temp_index -> Main), lookup table */
-	const unsigned int lib_main_array_len = BLI_listbase_count(&main->library);
-	Main             **lib_main_array     = MEM_malloc_arrayN(lib_main_array_len, sizeof(*lib_main_array), __func__);
+	const uint lib_main_array_len = BLI_listbase_count(&main->library);
+	Main     **lib_main_array     = MEM_malloc_arrayN(lib_main_array_len, sizeof(*lib_main_array), __func__);
 
 	int i = 0;
 	for (Library *lib = main->library.first; lib; lib = lib->id.next, i++) {
@@ -588,13 +588,13 @@ static void read_file_version(FileData *fd, Main *main)
 {
 	BHead *bhead;
 
-	for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
+	for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
 		if (bhead->code == GLOB) {
-			FileGlobal *fg= read_struct(fd, bhead, "Global");
+			FileGlobal *fg = read_struct(fd, bhead, "Global");
 			if (fg) {
-				main->subversionfile= fg->subversion;
-				main->minversionfile= fg->minversion;
-				main->minsubversionfile= fg->minsubversion;
+				main->subversionfile = fg->subversion;
+				main->minversionfile = fg->minversion;
+				main->minsubversionfile = fg->minsubversion;
 				MEM_freeN(fg);
 			}
 			else if (bhead->code == ENDB)
@@ -615,7 +615,7 @@ static void read_file_bhead_idname_map_create(FileData *fd)
 	/* dummy values */
 	bool is_link = false;
 	int code_prev = ENDB;
-	unsigned int reserve = 0;
+	uint reserve = 0;
 
 	for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
 		if (code_prev != bhead->code) {
@@ -693,7 +693,7 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab
 static void switch_endian_bh4(BHead4 *bhead)
 {
 	/* the ID_.. codes */
-	if ((bhead->code & 0xFFFF)==0) bhead->code >>= 16;
+	if ((bhead->code & 0xFFFF) == 0) bhead->code >>= 16;
 
 	if (bhead->code != ENDB) {
 		BLI_endian_switch_int32(&bhead->len);
@@ -705,7 +705,7 @@ static void switch_endian_bh4(BHead4 *bhead)
 static void switch_endian_bh8(BHead8 *bhead)
 {
 	/* the ID_.. codes */
-	if ((bhead->code & 0xFFFF)==0) bhead->code >>= 16;
+	if ((bhead->code & 0xFFFF) == 0) bhead->code >>= 16;
 
 	if (bhead->code != ENDB) {
 		BLI_endian_switch_int32(&bhead->len);
@@ -716,7 +716,7 @@ static void switch_endian_bh8(BHead8 *bhead)
 
 static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap)
 {
-	BHead4 *bhead4 = (BHead4 *) bhead;
+	BHead4 *bhead4 = (BHead4 *)bhead;
 	int64_t old;
 
 	bhead4->code = bhead8->code;
@@ -733,7 +733,7 @@ static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap)
 		/* this patch is to avoid a long long being read from not-eight aligned positions
 		 * is necessary on any modern 64bit architecture) */
 		memcpy(&old, &bhead8->old, 8);
-		bhead4->old = (int) (old >> 3);
+		bhead4->old = (int)(old >> 3);
 
 		bhead4->SDNAnr = bhead8->SDNAnr;
 		bhead4->nr = bhead8->nr;
@@ -742,7 +742,7 @@ static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap)
 
 static void bh8_from_bh4(BHead *bhead, BHead4 *bhead4)
 {
-	BHead8 *bhead8 = (BHead8 *) bhead;
+	BHead8 *bhead8 = (BHead8 *)bhead;
 
 	bhead8->code = bhead4->code;
 	bhead8->len = bhead4->len;
@@ -750,7 +750,7 @@ static void bh8_from_bh4(BHead *bhead, BHead4 *bhead4)
 	if (bhead8->code != ENDB) {
 		bhead8->old = bhead4->old;
 		bhead8->SDNAnr = bhead4->SDNAnr;
-		bhead8->nr= bhead4->nr;
+		bhead8->nr = bhead4->nr;
 	}
 }
 
@@ -765,7 +765,7 @@ static BHeadN *get_bhead(FileData *fd)
 			 * since uninitialized memory gets compared */
 			BHead8 bhead8 = {0};
 			BHead4 bhead4 = {0};
-			BHead  bhead = {0};
+			BHead bhead = {0};
 
 			/* First read the bhead structure.
 			 * Depending on the platform the file was written on this can
@@ -794,7 +794,7 @@ static BHeadN *get_bhead(FileData *fd)
 				}
 				else {
 					fd->eof = 1;
-					bhead.len= 0;
+					bhead.len = 0;
 				}
 			}
 			else {
@@ -817,7 +817,7 @@ static BHeadN *get_bhead(FileData *fd)
 				}
 				else {
 					fd->eof = 1;
-					bhead.len= 0;
+					bhead.len = 0;
 				}
 			}
 
@@ -1034,7 +1034,7 @@ static int *read_file_thumbnail(FileData *fd)
 	return blend_thumb;
 }
 
-static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int size)
+static int fd_read_gzip_from_file(FileData *filedata, void *buffer, uint size)
 {
 	int readsize = gzread(filedata->gzfiledes, buffer, size);
 
@@ -1048,10 +1048,10 @@ static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int
 	return (readsize);
 }
 
-static int fd_read_from_memory(FileData *filedata, void *buffer, unsigned int size)
+static int fd_read_from_memory(FileData *filedata, void *buffer, uint size)
 {
 	/* don't read more bytes then there are available in the buffer */
-	int readsize = (int)MIN2(size, (unsigned int)(filedata->buffersize - filedata->seek));
+	int readsize = (int)MIN2(size, (uint)(filedata->buffersize - filedata->seek));

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list