changeset 25951:7a507e71d922 stable

style fixes * Canvas.cc, Figure.cc, dialog.cc, octave-qscintilla.cc, tab-bar.cc, variable-editor.cc, gl-render.cc, graphics.cc, load-path.cc, oct-stream.cc, variables.cc, jit-typeinfo.cc: Break long lines before && and || operators.
author John W. Eaton <jwe@octave.org>
date Fri, 19 Oct 2018 12:38:01 -0400
parents c2bf210ac94f
children 12d4271aed87 7a7c31b93216
files libgui/graphics/Canvas.cc libgui/graphics/Figure.cc libgui/src/dialog.cc libgui/src/m-editor/octave-qscintilla.cc libgui/src/tab-bar.cc libgui/src/variable-editor.cc libinterp/corefcn/gl-render.cc libinterp/corefcn/graphics.cc libinterp/corefcn/load-path.cc libinterp/corefcn/oct-stream.cc libinterp/corefcn/variables.cc libinterp/parse-tree/jit-typeinfo.cc
diffstat 12 files changed, 52 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/Canvas.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libgui/graphics/Canvas.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -523,8 +523,8 @@
           {
             graphics_object figObj (obj.get_ancestor ("figure"));
 
-            if (figObj.valid_object () &&
-                ! figObj.get ("windowbuttonmotionfcn").isempty ())
+            if (figObj.valid_object ()
+                && ! figObj.get ("windowbuttonmotionfcn").isempty ())
               {
                 updateCurrentPoint (figObj, obj, event);
                 gh_manager::post_callback (figObj.get_handle (),
--- a/libgui/graphics/Figure.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libgui/graphics/Figure.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -93,8 +93,8 @@
       {
         graphics_object go (gh_manager::get_object (kids(i)));
 
-        if (go && go.isa ("uimenu") &&
-            go.get ("visible").string_value () == "on")
+        if (go && go.isa ("uimenu")
+            && go.get ("visible").string_value () == "on")
           return true;
       }
 
@@ -141,9 +141,9 @@
     createFigureToolBarAndMenuBar ();
     int toffset = 0;
 
-    if (fp.toolbar_is ("figure") ||
-        (fp.toolbar_is ("auto") && fp.menubar_is ("figure") &&
-         ! hasUiControlChildren (fp)))
+    if (fp.toolbar_is ("figure")
+        || (fp.toolbar_is ("auto") && fp.menubar_is ("figure")
+            && ! hasUiControlChildren (fp)))
       {
         toffset += m_figureToolBar->sizeHint ().height ();
         boffset += m_statusBar->sizeHint ().height ();
@@ -491,8 +491,8 @@
         else if (fp.toolbar_is ("figure"))
           showFigureToolBar (true);
         else // "auto"
-          showFigureToolBar (! hasUiControlChildren (fp) &&
-                             fp.menubar_is ("figure"));
+          showFigureToolBar (! hasUiControlChildren (fp)
+                             && fp.menubar_is ("figure"));
         break;
 
       case figure::properties::ID_MENUBAR:
--- a/libgui/src/dialog.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libgui/src/dialog.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -513,15 +513,10 @@
 
     string_result = selectedFiles ();
 
-    if (testOption (QFileDialog::ShowDirsOnly)  == true &&
-        string_result.size () > 0)
-      {
-        path = string_result[0];
-      }
+    if (testOption (QFileDialog::ShowDirsOnly) && string_result.size () > 0)
+      path = string_result[0];
     else
-      {
-        path = directory ().absolutePath ();
-      }
+      path = directory ().absolutePath ();
 
     // Matlab expects just the filename, whereas the file dialog gave us
     // full path names, so fix it.
--- a/libgui/src/m-editor/octave-qscintilla.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libgui/src/m-editor/octave-qscintilla.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -186,8 +186,8 @@
         // Primary key
         int key = cmd_list_mac.at (i)->key ();
 
-        if (static_cast<int> (key | Qt::META) == key &&
-            static_cast<int> (key | Qt::CTRL) != key)
+        if (static_cast<int> (key | Qt::META) == key
+            && static_cast<int> (key | Qt::CTRL) != key)
           key = (key ^ Qt::META) | Qt::CTRL;
         else if (static_cast<int> (key | Qt::CTRL) == key)
           key = (key ^ Qt::CTRL) | Qt::META;
@@ -197,8 +197,8 @@
         // Alternate key
         key = cmd_list_mac.at (i)->alternateKey ();
 
-        if (static_cast<int> (key | Qt::META) == key &&
-            static_cast<int> (key | Qt::CTRL) != key)
+        if (static_cast<int> (key | Qt::META) == key
+            && static_cast<int> (key | Qt::CTRL) != key)
           key = (key ^ Qt::META) | Qt::CTRL;
         else if (static_cast<int> (key | Qt::CTRL) == key)
           key = (key ^ Qt::CTRL) | Qt::META;
--- a/libgui/src/tab-bar.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libgui/src/tab-bar.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -112,10 +112,10 @@
       {
         int current_idx = currentIndex ();
         // detect the mouse click
-        if ((me->type () == QEvent::MouseButtonDblClick &&
-             me->button() == Qt::LeftButton) ||
-            (me->type () != QEvent::MouseButtonDblClick &&
-             me->button() == Qt::MidButton))
+        if ((me->type () == QEvent::MouseButtonDblClick
+             && me->button() == Qt::LeftButton)
+            || (me->type () != QEvent::MouseButtonDblClick
+                && me->button() == Qt::MidButton))
           {
             // Middle click or double click -> close the tab
             // Make the clicked tab the current one and close it
@@ -128,8 +128,8 @@
             else if (current_idx - clicked_idx < 0)
               setCurrentIndex (current_idx);
           }
-        else if (me->type () != QEvent::MouseButtonDblClick &&
-                 me->button() == Qt::RightButton)
+        else if (me->type () != QEvent::MouseButtonDblClick
+                 && me->button() == Qt::RightButton)
           {
             // Right click, show context menu
             setCurrentIndex (clicked_idx);
--- a/libgui/src/variable-editor.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libgui/src/variable-editor.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -927,8 +927,8 @@
   {
     if (ev->type () == QEvent::HoverEnter)
       emit hovered_signal ();
-    else if (ev->type () == QEvent::MouseButtonPress ||
-             ev->type () == QEvent::MouseButtonPress)
+    else if (ev->type () == QEvent::MouseButtonPress
+             || ev->type () == QEvent::MouseButtonPress)
       emit popup_shown_signal ();
 
     return QToolButton::eventFilter (obj, ev);
--- a/libinterp/corefcn/gl-render.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libinterp/corefcn/gl-render.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -3462,9 +3462,9 @@
     Matrix pos = xform.scale (props.get_data_position ());
 
     // Handle clipping manually when drawing text background
-    if (! props.is_clipping () ||
-        (clip_code (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0) ==
-         octave_uint8 (0x40)))
+    if (! props.is_clipping ()
+        || (clip_code (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0)
+            == octave_uint8 (0x40)))
       {
         set_clipping (false);
         draw_text_background (props);
--- a/libinterp/corefcn/graphics.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libinterp/corefcn/graphics.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -1084,8 +1084,8 @@
                                 {
                                   pfx = name.substr (0, 13);
 
-                                  if (pfx.compare ("uicontextmenu") ||
-                                      pfx.compare ("uibuttongroup"))
+                                  if (pfx.compare ("uicontextmenu")
+                                      || pfx.compare ("uibuttongroup"))
                                     offset = 13;
                                 }
                             }
@@ -5886,9 +5886,9 @@
   if (xstate == AXE_HORZ_DIR && ystate == AXE_VERT_DIR)
     {
       Matrix ylimits = get_ylim ().matrix_value ();
-      if (xaxislocation_is ("top") ||
-          (yscale_is ("log") && xaxislocation_is ("origin")
-           && (ylimits(1) < 0.)))
+      if (xaxislocation_is ("top")
+          || (yscale_is ("log") && xaxislocation_is ("origin")
+              && (ylimits(1) < 0.)))
         {
           std::swap (yPlane, yPlaneN);
           x2Dtop = true;
@@ -5896,9 +5896,9 @@
       ypTick = yPlaneN;
       ypTickN = yPlane;
       Matrix xlimits = get_xlim ().matrix_value ();
-      if (yaxislocation_is ("right") ||
-          (xscale_is ("log") && yaxislocation_is ("origin")
-           && (xlimits(1) < 0.)))
+      if (yaxislocation_is ("right")
+          || (xscale_is ("log") && yaxislocation_is ("origin")
+              && (xlimits(1) < 0.)))
         {
           std::swap (xPlane, xPlaneN);
           y2Dright = true;
@@ -7201,8 +7201,8 @@
   bool have_children_limits = false;
 
   // check whether we need to get children limits
-  if (! octave::math::isfinite (limits(0)) ||
-      ! octave::math::isfinite (limits(1)))
+  if (! octave::math::isfinite (limits(0))
+      || ! octave::math::isfinite (limits(1)))
     {
       get_children_limits (min_val, max_val, min_pos, max_neg, kids,
                            update_type);
@@ -9412,8 +9412,8 @@
     {
       graphics_object go = gh_manager::get_object (*it);
 
-      if (go.valid_object () &&
-          go.get ("uicontextmenu") == xproperties.get___myhandle__ ())
+      if (go.valid_object ()
+          && go.get ("uicontextmenu") == xproperties.get___myhandle__ ())
         go.set ("uicontextmenu", Matrix ());
     }
 }
--- a/libinterp/corefcn/load-path.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libinterp/corefcn/load-path.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -2444,12 +2444,12 @@
           // In Windows, start check at second character (for UNC paths).
           it_start++;
 #endif
-          dir.erase (std::unique (it_start, dir.end (),
-                                  [](char l, char r)
-                                  {
-                                    return l == r &&
-                                           octave::sys::file_ops::is_dir_sep (l);
-                                  }),
+          dir.erase (std::unique
+                     (it_start, dir.end (),
+                      [] (char l, char r)
+                      {
+                        return l == r && octave::sys::file_ops::is_dir_sep (l);
+                      }),
                      dir.end ());
 
           auto pos = dir.find_last_of (octave::sys::file_ops::dir_sep_chars ());
--- a/libinterp/corefcn/oct-stream.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libinterp/corefcn/oct-stream.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -3758,9 +3758,9 @@
 
             std::string tmp (comment_len, '\0');
             char *look = is.read (&tmp[0], comment_len-1, pos); // already read first char
-            if (is && comment_style.numel () > 0 &&
-                ! strncmp (comment_style(0).string_value ().substr (1).c_str (),
-                           look, comment_len-1))
+            if (is && comment_style.numel () > 0
+                && ! strncmp (comment_style(0).string_value ().substr (1).c_str (),
+                              look, comment_len-1))
               {
                 found_comment = true;
 
--- a/libinterp/corefcn/variables.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libinterp/corefcn/variables.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -381,8 +381,8 @@
   bool search_builtin = type == "builtin";
   bool search_class = type == "class";
 
-  if (! (search_any || search_var || search_dir || search_file ||
-         search_builtin || search_class))
+  if (! (search_any || search_var || search_dir || search_file
+         || search_builtin || search_class))
     error (R"(exist: unrecognized type argument "%s")", type.c_str ());
 
   octave::symbol_table& symtab = interp.get_symbol_table ();
--- a/libinterp/parse-tree/jit-typeinfo.cc	Fri Oct 19 12:28:06 2018 -0400
+++ b/libinterp/parse-tree/jit-typeinfo.cc	Fri Oct 19 12:38:01 2018 -0400
@@ -2019,8 +2019,8 @@
                                       bool skip_paren)
   {
     // FIXME: Currently our types do *not* form a lattice
-    assert ((name == "any") || (name == "any_ptr") ||
-            (name == "scalar_ptr") || (parent != nullptr));
+    assert ((name == "any") || (name == "any_ptr")
+            || (name == "scalar_ptr") || (parent != nullptr));
 
     jit_type *ret = new jit_type (name, parent, llvm_type, skip_paren,
                                   m_next_id++);