[Bf-blender-cvs] [8a92489] master: Byte swap doubles on file read

Campbell Barton noreply at git.blender.org
Sat Jan 9 19:07:46 CET 2016


Commit: 8a924899a9e95e33ccdf1568a7b38d355bb91a38
Author: Campbell Barton
Date:   Sun Jan 10 04:53:59 2016 +1100
Branches: master
https://developer.blender.org/rB8a924899a9e95e33ccdf1568a7b38d355bb91a38

Byte swap doubles on file read

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

M	source/blender/blenloader/intern/versioning_legacy.c
M	source/blender/makesdna/intern/dna_genfile.c

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

diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index ff39080..f2d4284 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -1787,14 +1787,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
 			ma = ma->id.next;
 		}
 
-		/* this should have been done loooong before! */
-#if 0   /* deprecated in 2.5+ */
-		while (ob) {
-			if (ob->ipowin == 0)
-				ob->ipowin = ID_OB;
-			ob = ob->id.next;
-		}
-#endif
 		for (sc = main->screen.first; sc; sc = sc->id.next) {
 			ScrArea *sa;
 			for (sa = sc->areabase.first; sa; sa = sa->next) {
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 16fbcbe..cea6165 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -1168,10 +1168,10 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 			}
 		}
 		else {
-		  /* non-struct field type */
+			/* non-struct field type */
 			if (ispointer(name)) {
 				if (oldsdna->pointerlen == 8) {
-					
+
 					mul = DNA_elem_array_size(name);
 					cpo = cur;
 					while (mul--) {
@@ -1186,20 +1186,14 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 				}
 			}
 			else {
-				
-				if (spc[0] == SDNA_TYPE_SHORT ||
-				    spc[0] == SDNA_TYPE_USHORT)
-				{
-					
-					/* exception: variable called blocktype/ipowin: derived from ID_  */
+				if (ELEM(spc[0], SDNA_TYPE_SHORT, SDNA_TYPE_USHORT)) {
+
+					/* exception: variable called blocktype: derived from ID_  */
 					bool skip = false;
 					if (name[0] == 'b' && name[1] == 'l') {
 						if (strcmp(name, "blocktype") == 0) skip = true;
 					}
-					else if (name[0] == 'i' && name[1] == 'p') {
-						if (strcmp(name, "ipowin") == 0) skip = true;
-					}
-					
+
 					if (skip == false) {
 						mul = DNA_elem_array_size(name);
 						cpo = cur;
@@ -1211,11 +1205,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 						}
 					}
 				}
-				else if ( (spc[0] == SDNA_TYPE_INT    ||
-				           spc[0] == SDNA_TYPE_LONG   ||
-				           spc[0] == SDNA_TYPE_ULONG  ||
-				           spc[0] == SDNA_TYPE_FLOAT))
-				{
+				else if (ELEM(spc[0], SDNA_TYPE_INT, SDNA_TYPE_FLOAT, SDNA_TYPE_LONG, SDNA_TYPE_ULONG)) {
 
 					mul = DNA_elem_array_size(name);
 					cpo = cur;
@@ -1229,9 +1219,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 						cpo += 4;
 					}
 				}
-				else if ( (spc[0] == SDNA_TYPE_INT64) ||
-				          (spc[0] == SDNA_TYPE_UINT64))
-				{
+				else if (ELEM(spc[0], SDNA_TYPE_INT64, SDNA_TYPE_UINT64, SDNA_TYPE_DOUBLE)) {
 					mul = DNA_elem_array_size(name);
 					cpo = cur;
 					while (mul--) {
@@ -1243,7 +1231,6 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 						cpo += 8;
 					}
 				}
-				/* FIXME: no conversion for SDNA_TYPE_DOUBLE? */
 			}
 		}
 		cur += elen;




More information about the Bf-blender-cvs mailing list