[Bf-blender-cvs] [05dddb71b09] master: Revert "Info Editor: move to c++"

Ray Molenkamp noreply at git.blender.org
Sun Apr 25 02:14:21 CEST 2021


Commit: 05dddb71b098027cb36657120b946ff178ae0549
Author: Ray Molenkamp
Date:   Sat Apr 24 18:14:15 2021 -0600
Branches: master
https://developer.blender.org/rB05dddb71b098027cb36657120b946ff178ae0549

Revert "Info Editor: move to c++"

This reverts commit 9cce18a5858cb93da626f5f0fd7e09cd66637e05.

rB9cce18a5858c broke the build in unforeseen ways, not easily fixable.
revert for now, so master will at least build again.

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

M	source/blender/blenkernel/BKE_layer.h
M	source/blender/editors/space_info/CMakeLists.txt
R088	source/blender/editors/space_info/info_draw.cc	source/blender/editors/space_info/info_draw.c
R100	source/blender/editors/space_info/info_intern.hh	source/blender/editors/space_info/info_intern.h
R093	source/blender/editors/space_info/info_ops.cc	source/blender/editors/space_info/info_ops.c
R090	source/blender/editors/space_info/info_report.cc	source/blender/editors/space_info/info_report.c
R091	source/blender/editors/space_info/info_stats.cc	source/blender/editors/space_info/info_stats.c
R092	source/blender/editors/space_info/space_info.cc	source/blender/editors/space_info/space_info.c
R095	source/blender/editors/space_info/textview.cc	source/blender/editors/space_info/textview.c
M	source/blender/editors/space_info/textview.h
M	source/blender/windowmanager/message_bus/wm_message_bus.h

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

diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index a89ece567a2..240d6cb18ec 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -325,7 +325,7 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter);
   { \
     Object *_instance; \
     Base *_base; \
-    for (_base = (Base *)(view_layer)->object_bases.first; _base; _base = _base->next) { \
+    for (_base = (view_layer)->object_bases.first; _base; _base = _base->next) { \
       _instance = _base->object;
 
 #define FOREACH_OBJECT_END \
diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt
index 15194082376..b6df07eec4e 100644
--- a/source/blender/editors/space_info/CMakeLists.txt
+++ b/source/blender/editors/space_info/CMakeLists.txt
@@ -34,14 +34,14 @@ set(INC
 )
 
 set(SRC
-  info_draw.cc
-  info_ops.cc
-  info_report.cc
-  info_stats.cc
-  space_info.cc
-  textview.cc
+  info_draw.c
+  info_ops.c
+  info_report.c
+  info_stats.c
+  space_info.c
+  textview.c
 
-  info_intern.hh
+  info_intern.h
   textview.h
 )
 
diff --git a/source/blender/editors/space_info/info_draw.cc b/source/blender/editors/space_info/info_draw.c
similarity index 88%
rename from source/blender/editors/space_info/info_draw.cc
rename to source/blender/editors/space_info/info_draw.c
index 852447372d6..be3b60d581b 100644
--- a/source/blender/editors/space_info/info_draw.cc
+++ b/source/blender/editors/space_info/info_draw.c
@@ -21,8 +21,8 @@
  * \ingroup spinfo
  */
 
-#include <climits>
-#include <cstring>
+#include <limits.h>
+#include <string.h>
 
 #include "BLI_utildefines.h"
 
@@ -35,7 +35,7 @@
 #include "UI_resources.h"
 #include "UI_view2d.h"
 
-#include "info_intern.hh"
+#include "info_intern.h"
 #include "textview.h"
 
 static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc,
@@ -45,7 +45,7 @@ static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc,
                                                        uchar r_icon_fg[4],
                                                        uchar r_icon_bg[4])
 {
-  const Report *report = (const Report *)tvc->iter;
+  const Report *report = tvc->iter;
 
   /* Same text color no matter what type of report. */
   UI_GetThemeColor4ubv((report->flag & SELECT) ? TH_INFO_SELECTED_TEXT : TH_TEXT, fg);
@@ -71,17 +71,16 @@ static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc,
     /* This theme color is RGB only, so set alpha. */
     r_icon_fg[3] = 255;
     UI_GetThemeColor4ubv(icon_bg_id, r_icon_bg);
-    return (enum eTextViewContext_LineFlag)(TVC_LINE_FG | TVC_LINE_BG | TVC_LINE_ICON |
-                                            TVC_LINE_ICON_FG | TVC_LINE_ICON_BG);
+    return TVC_LINE_FG | TVC_LINE_BG | TVC_LINE_ICON | TVC_LINE_ICON_FG | TVC_LINE_ICON_BG;
   }
 
-  return (enum eTextViewContext_LineFlag)(TVC_LINE_FG | TVC_LINE_BG);
+  return TVC_LINE_FG | TVC_LINE_BG;
 }
 
 /* reports! */
 static void report_textview_init__internal(TextViewContext *tvc)
 {
-  const Report *report = (const Report *)tvc->iter;
+  const Report *report = tvc->iter;
   const char *str = report->message;
   for (int i = tvc->iter_char_end - 1; i >= 0; i -= 1) {
     if (str[i] == '\n') {
@@ -94,17 +93,17 @@ static void report_textview_init__internal(TextViewContext *tvc)
 
 static int report_textview_skip__internal(TextViewContext *tvc)
 {
-  const SpaceInfo *sinfo = (const SpaceInfo *)tvc->arg1;
+  const SpaceInfo *sinfo = tvc->arg1;
   const int report_mask = info_report_mask(sinfo);
   while (tvc->iter && (((const Report *)tvc->iter)->type & report_mask) == 0) {
     tvc->iter = (void *)((Link *)tvc->iter)->prev;
   }
-  return (tvc->iter != nullptr);
+  return (tvc->iter != NULL);
 }
 
 static int report_textview_begin(TextViewContext *tvc)
 {
-  const ReportList *reports = (const ReportList *)tvc->arg2;
+  const ReportList *reports = tvc->arg2;
 
   tvc->sel_start = 0;
   tvc->sel_end = 0;
@@ -117,7 +116,7 @@ static int report_textview_begin(TextViewContext *tvc)
   tvc->iter_tmp = 0;
   if (tvc->iter && report_textview_skip__internal(tvc)) {
     /* init the newline iterator */
-    const Report *report = (const Report *)tvc->iter;
+    const Report *report = tvc->iter;
     tvc->iter_char_end = report->len;
     report_textview_init__internal(tvc);
 
@@ -135,14 +134,14 @@ static void report_textview_end(TextViewContext *UNUSED(tvc))
 static int report_textview_step(TextViewContext *tvc)
 {
   /* simple case, but no newline support */
-  const Report *report = (const Report *)tvc->iter;
+  const Report *report = tvc->iter;
 
   if (tvc->iter_char_begin <= 0) {
     tvc->iter = (void *)((Link *)tvc->iter)->prev;
     if (tvc->iter && report_textview_skip__internal(tvc)) {
       tvc->iter_tmp++;
 
-      report = (const Report *)tvc->iter;
+      report = tvc->iter;
       tvc->iter_char_end = report->len; /* reset start */
       report_textview_init__internal(tvc);
 
@@ -160,7 +159,7 @@ static int report_textview_step(TextViewContext *tvc)
 
 static void report_textview_line_get(TextViewContext *tvc, const char **r_line, int *r_len)
 {
-  const Report *report = (const Report *)tvc->iter;
+  const Report *report = tvc->iter;
   *r_line = report->message + tvc->iter_char_begin;
   *r_len = tvc->iter_char_end - tvc->iter_char_begin;
 }
@@ -201,7 +200,7 @@ static int info_textview_main__internal(const SpaceInfo *sinfo,
   tvc.step = report_textview_step;
   tvc.line_get = report_textview_line_get;
   tvc.line_data = report_line_data;
-  tvc.const_colors = nullptr;
+  tvc.const_colors = NULL;
 
   tvc.arg1 = sinfo;
   tvc.arg2 = reports;
@@ -226,21 +225,21 @@ void *info_text_pick(const SpaceInfo *sinfo,
                      const ReportList *reports,
                      int mouse_y)
 {
-  void *mval_pick_item = nullptr;
+  void *mval_pick_item = NULL;
   const int mval[2] = {0, mouse_y};
 
-  info_textview_main__internal(sinfo, region, reports, false, mval, &mval_pick_item, nullptr);
+  info_textview_main__internal(sinfo, region, reports, false, mval, &mval_pick_item, NULL);
   return (void *)mval_pick_item;
 }
 
 int info_textview_height(const SpaceInfo *sinfo, const ARegion *region, const ReportList *reports)
 {
   const int mval[2] = {INT_MAX, INT_MAX};
-  return info_textview_main__internal(sinfo, region, reports, false, mval, nullptr, nullptr);
+  return info_textview_main__internal(sinfo, region, reports, false, mval, NULL, NULL);
 }
 
 void info_textview_main(const SpaceInfo *sinfo, const ARegion *region, const ReportList *reports)
 {
   const int mval[2] = {INT_MAX, INT_MAX};
-  info_textview_main__internal(sinfo, region, reports, true, mval, nullptr, nullptr);
+  info_textview_main__internal(sinfo, region, reports, true, mval, NULL, NULL);
 }
diff --git a/source/blender/editors/space_info/info_intern.hh b/source/blender/editors/space_info/info_intern.h
similarity index 100%
rename from source/blender/editors/space_info/info_intern.hh
rename to source/blender/editors/space_info/info_intern.h
diff --git a/source/blender/editors/space_info/info_ops.cc b/source/blender/editors/space_info/info_ops.c
similarity index 93%
rename from source/blender/editors/space_info/info_ops.cc
rename to source/blender/editors/space_info/info_ops.c
index e7a4e18c789..0583628be43 100644
--- a/source/blender/editors/space_info/info_ops.cc
+++ b/source/blender/editors/space_info/info_ops.c
@@ -21,8 +21,8 @@
  * \ingroup spinfo
  */
 
-#include <cstdio>
-#include <cstring>
+#include <stdio.h>
+#include <string.h>
 
 #include "DNA_space_types.h"
 #include "DNA_windowmanager_types.h"
@@ -54,7 +54,7 @@
 #include "RNA_access.h"
 #include "RNA_define.h"
 
-#include "info_intern.hh"
+#include "info_intern.h"
 
 /********************* pack blend file libraries operator *********************/
 
@@ -159,7 +159,7 @@ static int pack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev
   Image *ima;
 
   /* First check for dirty images. */
-  for (ima = (Image *)bmain->images.first; ima; ima = (Image *)ima->id.next) {
+  for (ima = bmain->images.first; ima; ima = ima->id.next) {
     if (BKE_image_is_dirty(ima)) {
       break;
     }
@@ -210,7 +210,7 @@ static const EnumPropertyItem unpack_all_method_items[] = {
     {PF_KEEP, "KEEP", 0, "Disable auto-pack, keep all packed files", ""},
     {PF_REMOVE, "REMOVE", 0, "Remove Pack", ""},
     /* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */
-    {0, nullptr, 0, nullptr, nullptr},
+    {0, NULL, 0, NULL, NULL},
 };
 
 static int unpack_all_exec(bContext *C, wmOperator *op)
@@ -219,8 +219,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op)
   int method = RNA_enum_get(op->ptr, "method");
 
   if (method != PF_KEEP) {
-    BKE_packedfile_unpack_all(
-        bmain, op->reports, (enum ePF_FileStatus)method); /* XXX PF_ASK can't work here */
+    BKE_packedfile_unpack_all(bmain, op->reports, method); /* XXX PF_ASK can't work here */
   }
   G.fileflags &= ~G_FILE_AUTOPACK;
 
@@ -300,7 +299,7 @@ static const EnumPropertyItem unpack_item_method_items[] = {
      "Write file to original location (overwrite existing file)",
      ""},
     /* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */
-    {0, nullptr, 0, nullptr, nullptr},
+    {0, NULL, 0, NULL, NULL},
 };
 
 static int unpack_item_exec(bContext *C, wmOperator *op)
@@ -314,14 +313,13 @@ static int unpack_item_exec(bContext *C, wmOperator *op)
   RNA_string_get(op->ptr, "id_name", idname);
   id = BKE_libblock_find_name(bmain, type, idname);
 
-  if (id == nullptr) {
+  if (id == NULL) {
     BKE_report(op->reports, RPT_WARNING, "No packed file");
     return OPERATOR_CANCELLED;
   }
 
   if (method != PF_KEEP) {
-    BKE_packedfile_id_unpack(
-        bmain, id, op->reports, (enum ePF_FileStatus)method); /* XXX PF_ASK can't work here */
+    BKE_packedfile_id_unpack(bmain, id, op->reports, method); /* XXX PF_ASK can't work here */
   }
 
   G.fileflags &= ~G_FILE_AUTOPACK;
@@ -338,8 +336,7 @@ static int unpack_item_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED
   layout = UI_popup_menu_layout(pup);
 
   uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
-  uiIt

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list