[Bf-blender-cvs] [7b28a31f2c3] master: Cleanup: style, use braces in makesrna

Campbell Barton noreply at git.blender.org
Mon Jun 3 16:11:42 CEST 2019


Commit: 7b28a31f2c3a6bd28b465f6a48d9ee064ecb5176
Author: Campbell Barton
Date:   Tue Jun 4 00:10:44 2019 +1000
Branches: master
https://developer.blender.org/rB7b28a31f2c3a6bd28b465f6a48d9ee064ecb5176

Cleanup: style, use braces in makesrna

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

M	source/blender/makesrna/intern/makesrna.c
M	source/blender/makesrna/intern/rna_access.c
M	source/blender/makesrna/intern/rna_define.c

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

diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 7eee3661074..3b9fa40fcae 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -1459,7 +1459,7 @@ static char *rna_def_property_lookup_int_func(FILE *f,
   item_type = (cprop->item_type) ? (const char *)cprop->item_type : "UnknownType";
 
   if (dp->dnalengthname || dp->dnalengthfixed) {
-    if (dp->dnalengthname)
+    if (dp->dnalengthname) {
       fprintf(f,
               "\n    rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), data->%s, "
               "index);\n",
@@ -1467,7 +1467,8 @@ static char *rna_def_property_lookup_int_func(FILE *f,
               dp->dnaname,
               dp->dnaname,
               dp->dnalengthname);
-    else
+    }
+    else {
       fprintf(
           f,
           "\n    rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), %d, index);\n",
@@ -1475,18 +1476,21 @@ static char *rna_def_property_lookup_int_func(FILE *f,
           dp->dnaname,
           dp->dnaname,
           dp->dnalengthfixed);
+    }
   }
   else {
-    if (dp->dnapointerlevel == 0)
+    if (dp->dnapointerlevel == 0) {
       fprintf(f,
               "\n    return rna_listbase_lookup_int(ptr, &RNA_%s, &data->%s, index);\n",
               item_type,
               dp->dnaname);
-    else
+    }
+    else {
       fprintf(f,
               "\n    return rna_listbase_lookup_int(ptr, &RNA_%s, data->%s, index);\n",
               item_type,
               dp->dnaname);
+    }
   }
 #endif
 
@@ -2040,12 +2044,15 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
 
   /* disabled for now to avoid msvc compiler error due to large file size */
 #if 0
-  if (prop->name && prop->description && prop->description[0] != '\0')
+  if (prop->name && prop->description && prop->description[0] != '\0') {
     fprintf(f, "\t/* %s: %s */\n", prop->name, prop->description);
-  else if (prop->name)
+  }
+  else if (prop->name) {
     fprintf(f, "\t/* %s */\n", prop->name);
-  else
+  }
+  else {
     fprintf(f, "\t/* */\n");
+  }
 #endif
 
   switch (prop->type) {
@@ -2234,11 +2241,13 @@ static void rna_def_struct_function_prototype_cpp(FILE *f,
     fprintf(f, "\tinline %s %s(", retval_type, rna_safe_id(func->identifier));
   }
 
-  if (func->flag & FUNC_USE_MAIN)
+  if (func->flag & FUNC_USE_MAIN) {
     WRITE_PARAM("void *main");
+  }
 
-  if (func->flag & FUNC_USE_CONTEXT)
+  if (func->flag & FUNC_USE_CONTEXT) {
     WRITE_PARAM("Context C");
+  }
 
   for (dp = dfunc->cont.properties.first; dp; dp = dp->next) {
     int type, flag, flag_parameter, pout;
@@ -2416,7 +2425,7 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
 #if 0
       CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
 
-      if (cprop->type)
+      if (cprop->type) {
         fprintf(f,
                 "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s)",
                 (const char *)cprop->type,
@@ -2425,7 +2434,8 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
                 (cprop->length ? "true" : "false"),
                 (cprop->lookupint ? "true" : "false"),
                 (cprop->lookupstring ? "true" : "false"));
-      else
+      }
+      else {
         fprintf(f,
                 "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s)",
                 "UnknownType",
@@ -2434,6 +2444,7 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
                 (cprop->length ? "true" : "false"),
                 (cprop->lookupint ? "true" : "false"),
                 (cprop->lookupstring ? "true" : "false"));
+      }
 #endif
       break;
     }
@@ -2458,8 +2469,9 @@ static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, Func
 
   dsrna = rna_find_struct_def(srna);
 
-  if (func->flag & FUNC_USE_SELF_ID)
+  if (func->flag & FUNC_USE_SELF_ID) {
     WRITE_PARAM("(::ID *) ptr.id.data");
+  }
 
   if ((func->flag & FUNC_NO_SELF) == 0) {
     WRITE_COMMA;
@@ -2478,14 +2490,17 @@ static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, Func
     fprintf(f, "this->ptr.type");
   }
 
-  if (func->flag & FUNC_USE_MAIN)
+  if (func->flag & FUNC_USE_MAIN) {
     WRITE_PARAM("(::Main *) main");
+  }
 
-  if (func->flag & FUNC_USE_CONTEXT)
+  if (func->flag & FUNC_USE_CONTEXT) {
     WRITE_PARAM("(::bContext *) C.ptr.data");
+  }
 
-  if (func->flag & FUNC_USE_REPORTS)
+  if (func->flag & FUNC_USE_REPORTS) {
     WRITE_PARAM("NULL");
+  }
 
   dp = dfunc->cont.properties.first;
   for (; dp; dp = dp->next) {
@@ -2630,8 +2645,9 @@ static void rna_def_function_wrapper_funcs(FILE *f, StructDefRNA *dsrna, Functio
 
   first = 1;
 
-  if (func->flag & FUNC_USE_SELF_ID)
+  if (func->flag & FUNC_USE_SELF_ID) {
     WRITE_PARAM("_selfid");
+  }
 
   if ((func->flag & FUNC_NO_SELF) == 0) {
     WRITE_PARAM("_self");
@@ -2640,14 +2656,17 @@ static void rna_def_function_wrapper_funcs(FILE *f, StructDefRNA *dsrna, Functio
     WRITE_PARAM("_type");
   }
 
-  if (func->flag & FUNC_USE_MAIN)
+  if (func->flag & FUNC_USE_MAIN) {
     WRITE_PARAM("bmain");
+  }
 
-  if (func->flag & FUNC_USE_CONTEXT)
+  if (func->flag & FUNC_USE_CONTEXT) {
     WRITE_PARAM("C");
+  }
 
-  if (func->flag & FUNC_USE_REPORTS)
+  if (func->flag & FUNC_USE_REPORTS) {
     WRITE_PARAM("reports");
+  }
 
   dparm = dfunc->cont.properties.first;
   for (; dparm; dparm = dparm->next) {
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 20358ca80fd..a9ba1730216 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -4594,20 +4594,23 @@ static int rna_raw_access(ReportList *reports,
             if (set) {
               switch (itemtype) {
                 case PROP_BOOLEAN: {
-                  for (j = 0; j < itemlen; j++, a++)
+                  for (j = 0; j < itemlen; j++, a++) {
                     RAW_GET(bool, ((bool *)tmparray)[j], in, a);
+                  }
                   RNA_property_boolean_set_array(&itemptr, iprop, tmparray);
                   break;
                 }
                 case PROP_INT: {
-                  for (j = 0; j < itemlen; j++, a++)
+                  for (j = 0; j < itemlen; j++, a++) {
                     RAW_GET(int, ((int *)tmparray)[j], in, a);
+                  }
                   RNA_property_int_set_array(&itemptr, iprop, tmparray);
                   break;
                 }
                 case PROP_FLOAT: {
-                  for (j = 0; j < itemlen; j++, a++)
+                  for (j = 0; j < itemlen; j++, a++) {
                     RAW_GET(float, ((float *)tmparray)[j], in, a);
+                  }
                   RNA_property_float_set_array(&itemptr, iprop, tmparray);
                   break;
                 }
@@ -4619,20 +4622,23 @@ static int rna_raw_access(ReportList *reports,
               switch (itemtype) {
                 case PROP_BOOLEAN: {
                   RNA_property_boolean_get_array(&itemptr, iprop, tmparray);
-                  for (j = 0; j < itemlen; j++, a++)
+                  for (j = 0; j < itemlen; j++, a++) {
                     RAW_SET(int, in, a, ((bool *)tmparray)[j]);
+                  }
                   break;
                 }
                 case PROP_INT: {
                   RNA_property_int_get_array(&itemptr, iprop, tmparray);
-                  for (j = 0; j < itemlen; j++, a++)
+                  for (j = 0; j < itemlen; j++, a++) {
                     RAW_SET(int, in, a, ((int *)tmparray)[j]);
+                  }
                   break;
                 }
                 case PROP_FLOAT: {
                   RNA_property_float_get_array(&itemptr, iprop, tmparray);
-                  for (j = 0; j < itemlen; j++, a++)
+                  for (j = 0; j < itemlen; j++, a++) {
                     RAW_SET(float, in, a, ((float *)tmparray)[j]);
+                  }
                   break;
                 }
                 default:
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index b1818cae62a..2cb7c62b028 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -263,12 +263,14 @@ static PropertyDefRNA *rna_find_property_def(PropertyRNA *prop)
   }
 
   dprop = rna_find_struct_property_def(DefRNA.laststruct, prop);
-  if (dprop)
+  if (dprop) {
     return dprop;
+  }
 
   dprop = rna_find_parameter_def(prop);
-  if (dprop)
+  if (dprop) {
     return dprop;
+  }
 
   return NULL;
 }
@@ -750,8 +752,9 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
 
     RNA_def_property_free_pointers(prop);
 
-    if (prop->flag_internal & PROP_INTERN_RUNTIME)
+    if (prop->flag_internal & PROP_INTERN_RUNTIME) {
       rna_freelinkN(&srna->cont.properties, prop);
+    }
   }
 
   for (func = srna->functions.first; func; func = nextfunc) {
@@ -762,14 +765,16 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
 
       RNA_def_property_free_pointers(parm);
 
-      if (parm->flag_internal & PROP_INTERN_RUNTIME)
+      if (parm->flag_internal & PROP_INTERN_RUNTIME) {
         rna_freelinkN(&func->cont.properties, parm);
+      }
     }
 
     RNA_def_func_free_pointers(func);
 
-    if (func->flag & FUNC_RUNTIME)
+    if (func->flag & FUNC_RUNTIME) {
       rna_freelinkN(&srna->functions, func);
+    }
   }
 
   rna_brna_structs_remove_and_free(brna, srna);
@@ -1408,8 +1413,9 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
     prop->flag |= PROP_IDPROPERTY;
     prop->flag_internal |= PROP_INTERN_RUNTIME;
 #ifdef RNA_RUNTIME
-    if (cont->prophash)
+    if (cont->prophash) {
       BLI_ghash_insert(cont->prophash, (void *)prop->identifier, prop);
+    }
 #endif
   }
 
@@ -3897,15 +3903,17 @@ int rna_parameter_size(PropertyRNA *parm)
         }
       case PROP_POINTER: {
 #ifdef RNA_RUNTIME
-        if (parm->flag_parameter & PARM_RNAPTR)
+        if (parm->flag_parameter & PARM_RNAPTR) {
           if (parm->fla

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list