[Bf-blender-cvs] [924c626] master: DNA: remove 'long' type

Campbell Barton noreply at git.blender.org
Sun Jan 10 23:31:04 CET 2016


Commit: 924c6268952defd87156b8ba674c4275a29ba5df
Author: Campbell Barton
Date:   Mon Jan 11 09:18:46 2016 +1100
Branches: master
https://developer.blender.org/rB924c6268952defd87156b8ba674c4275a29ba5df

DNA: remove 'long' type

Turns out even in files this was used, it was only for runtime members that are now ignored.

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

M	source/blender/makesdna/DNA_genfile.h
M	source/blender/makesdna/intern/dna_genfile.c
M	source/blender/makesdna/intern/makesdna.c

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

diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h
index 0af26fb..0448266 100644
--- a/source/blender/makesdna/DNA_genfile.h
+++ b/source/blender/makesdna/DNA_genfile.h
@@ -48,17 +48,15 @@ typedef enum eSDNA_Type {
 	SDNA_TYPE_SHORT    = 2,
 	SDNA_TYPE_USHORT   = 3,
 	SDNA_TYPE_INT      = 4,
-	SDNA_TYPE_LONG     = 5,  /* deprecated (use as int) */
-	SDNA_TYPE_ULONG    = 6,  /* deprecated (use as int) */
-	SDNA_TYPE_FLOAT    = 7,
-	SDNA_TYPE_DOUBLE   = 8,
-	/* ,SDNA_TYPE_VOID = 9 */
-	SDNA_TYPE_INT64    = 10,
-	SDNA_TYPE_UINT64   = 11
+	SDNA_TYPE_FLOAT    = 5,
+	SDNA_TYPE_DOUBLE   = 6,
+	/* ,SDNA_TYPE_VOID = 7 */
+/* define so switch statements don't complain */
+#define SDNA_TYPE_VOID 7
+	SDNA_TYPE_INT64    = 8,
+	SDNA_TYPE_UINT64   = 9,
 } eSDNA_Type;
 
-/* define so switch statements don't complain */
-#define SDNA_TYPE_VOID 9
 
 struct SDNA *DNA_sdna_from_data(const void *data, const int datalen, bool do_endian_swap);
 void DNA_sdna_free(struct SDNA *sdna);
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index f50e38d..f3c9915 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -705,8 +705,6 @@ static eSDNA_Type sdna_type_nr(const char *dna_type)
 	else if ( strcmp(dna_type, "short") == 0)                                                  return SDNA_TYPE_SHORT;
 	else if ((strcmp(dna_type, "ushort") == 0) || (strcmp(dna_type, "unsigned short") == 0))   return SDNA_TYPE_USHORT;
 	else if ( strcmp(dna_type, "int") == 0)                                                    return SDNA_TYPE_INT;
-	else if ( strcmp(dna_type, "long") == 0)                                                   return SDNA_TYPE_LONG;
-	else if ((strcmp(dna_type, "ulong") == 0) || (strcmp(dna_type, "unsigned long") == 0))     return SDNA_TYPE_ULONG;
 	else if ( strcmp(dna_type, "float") == 0)                                                  return SDNA_TYPE_FLOAT;
 	else if ( strcmp(dna_type, "double") == 0)                                                 return SDNA_TYPE_DOUBLE;
 	else if ( strcmp(dna_type, "int64_t") == 0)                                                return SDNA_TYPE_INT64;
@@ -758,10 +756,6 @@ static void cast_elem(
 				val = *( (unsigned short *)olddata); break;
 			case SDNA_TYPE_INT:
 				val = *( (int *)olddata); break;
-			case SDNA_TYPE_LONG:
-				val = *( (int *)olddata); break;
-			case SDNA_TYPE_ULONG:
-				val = *( (unsigned int *)olddata); break;
 			case SDNA_TYPE_FLOAT:
 				val = *( (float *)olddata); break;
 			case SDNA_TYPE_DOUBLE:
@@ -783,10 +777,6 @@ static void cast_elem(
 				*( (unsigned short *)curdata) = val; break;
 			case SDNA_TYPE_INT:
 				*( (int *)curdata) = val; break;
-			case SDNA_TYPE_LONG:
-				*( (int *)curdata) = val; break;
-			case SDNA_TYPE_ULONG:
-				*( (unsigned int *)curdata) = val; break;
 			case SDNA_TYPE_FLOAT:
 				if (otypenr < 2) val /= 255;
 				*( (float *)curdata) = val; break;
@@ -1330,8 +1320,6 @@ int DNA_elem_type_size(const eSDNA_Type elem_nr)
 		case SDNA_TYPE_USHORT:
 			return 2;
 		case SDNA_TYPE_INT:
-		case SDNA_TYPE_LONG:
-		case SDNA_TYPE_ULONG:
 		case SDNA_TYPE_FLOAT:
 			return 4;
 		case SDNA_TYPE_DOUBLE:
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 685cde6..d1744c6 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -65,7 +65,6 @@ static const char *includefiles[] = {
 
 	/* if you add files here, please add them at the end
 	 * of makesdna.c (this file) as well */
-
 	"DNA_listBase.h",
 	"DNA_vec_types.h",
 	"DNA_ID.h",
@@ -80,8 +79,6 @@ static const char *includefiles[] = {
 	"DNA_lamp_types.h",
 	"DNA_material_types.h",
 	"DNA_vfont_types.h",
-	/* if you add files here, please add them at the end
-	 * of makesdna.c (this file) as well */
 	"DNA_meta_types.h",
 	"DNA_curve_types.h",
 	"DNA_mesh_types.h",
@@ -99,8 +96,6 @@ static const char *includefiles[] = {
 	"DNA_userdef_types.h",
 	"DNA_screen_types.h",
 	"DNA_sdna_types.h",
-	// if you add files here, please add them at the end
-	// of makesdna.c (this file) as well
 	"DNA_fileglobal_types.h",
 	"DNA_sequence_types.h",
 	"DNA_effect_types.h",
@@ -122,8 +117,6 @@ static const char *includefiles[] = {
 	"DNA_particle_types.h",
 	"DNA_cloth_types.h",
 	"DNA_gpencil_types.h",
-	/* if you add files here, please add them at the end
-	 * of makesdna.c (this file) as well */
 	"DNA_windowmanager_types.h",
 	"DNA_anim_types.h",
 	"DNA_boid_types.h",
@@ -136,6 +129,7 @@ static const char *includefiles[] = {
 	"DNA_rigidbody_types.h",
 	"DNA_freestyle_types.h",
 	"DNA_linestyle_types.h",
+	/* see comment above before editing! */
 
 	/* empty string to indicate end of includefiles */
 	""
@@ -988,16 +982,18 @@ static int make_structDNA(const char *baseDirectory, FILE *file)
 	typelens_64 = MEM_callocN(sizeof(short) * maxnr, "typelens_64");
 	structs = MEM_callocN(sizeof(short *) * maxnr, "structs");
 
-	/* insertion of all known types */
-	/* watch it: uint is not allowed! use in structs an unsigned int */
-	/* watch it: sizes must match DNA_elem_type_size() */
+	/**
+	 * Insertion of all known types.
+	 *
+	 * \warning Order of function calls here must be aligned with #eSDNA_Type.
+	 * \warning uint is not allowed! use in structs an unsigned int.
+	 * \warning sizes must match #DNA_elem_type_size().
+	 */
 	add_type("char", 1);     /* SDNA_TYPE_CHAR */
 	add_type("uchar", 1);    /* SDNA_TYPE_UCHAR */
 	add_type("short", 2);    /* SDNA_TYPE_SHORT */
 	add_type("ushort", 2);   /* SDNA_TYPE_USHORT */
 	add_type("int", 4);      /* SDNA_TYPE_INT */
-	add_type("long", 4);     /* SDNA_TYPE_LONG */  /* maybe 4 or 8 bytes depending on platform, disallowed for now */
-	add_type("ulong", 4);    /* SDNA_TYPE_ULONG */
 	add_type("float", 4);    /* SDNA_TYPE_FLOAT */
 	add_type("double", 8);   /* SDNA_TYPE_DOUBLE */
 	add_type("int64_t", 8);  /* SDNA_TYPE_INT64 */




More information about the Bf-blender-cvs mailing list