changeset 21662:5b9868c2e212

maint: Octave coding convention cleanups. * Figure.cc, QtHandlesUtils.cc, files-dock-widget.cc, find-files-dialog.cc, debug.cc, ls-hdf5.h, oct-fstrm.h, oct-iostrm.h, oct-stdstrm.h, oct-stream.h, pr-output.cc, sysdep.cc, zfstream.h, pt-cbinop.cc, f77-fcn.h, DASPK.cc, DASSL.cc, cmd-hist.cc, glob-match.h: Cuddle angle bracket '<' next to C++ cast operator. Space between variable reference and variable name (int& a). Space between bitwise operators and their operands (A & B). Create typedef tree_expression_ptr_t to avoid "tree_expression *&a" which is unclear.
author Rik <rik@octave.org>
date Mon, 02 May 2016 11:13:50 -0700
parents 1b9a36a66b01
children 79414f8e6f24
files libgui/graphics/Figure.cc libgui/graphics/QtHandlesUtils.cc libgui/src/files-dock-widget.cc libgui/src/find-files-dialog.cc libinterp/corefcn/debug.cc libinterp/corefcn/ls-hdf5.h libinterp/corefcn/oct-fstrm.h libinterp/corefcn/oct-iostrm.h libinterp/corefcn/oct-stdstrm.h libinterp/corefcn/oct-stream.h libinterp/corefcn/pr-output.cc libinterp/corefcn/sysdep.cc libinterp/corefcn/zfstream.h libinterp/parse-tree/pt-cbinop.cc liboctave/cruft/misc/f77-fcn.h liboctave/numeric/DASPK.cc liboctave/numeric/DASSL.cc liboctave/util/cmd-hist.cc liboctave/util/glob-match.h
diffstat 19 files changed, 39 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/Figure.cc	Mon May 02 11:12:16 2016 -0700
+++ b/libgui/graphics/Figure.cc	Mon May 02 11:13:50 2016 -0700
@@ -324,12 +324,12 @@
   fileMenu->addAction (tr ("Save &As"), this, SLOT (fileSaveFigureAs (void)));
   fileMenu->addSeparator ();
   fileMenu->addAction (tr ("&Close Figure"), this,
-                       SLOT (fileCloseFigure (void)), Qt::CTRL|Qt::Key_W);
+                       SLOT (fileCloseFigure (void)), Qt::CTRL | Qt::Key_W);
 
   QMenu* editMenu = m_menuBar->addMenu (tr ("&Edit"));
   editMenu->menuAction ()->setObjectName ("builtinMenu");
   editMenu->addAction (tr ("Cop&y"), this, SLOT (editCopy (bool)),
-                       Qt::CTRL|Qt::Key_C);
+                       Qt::CTRL | Qt::Key_C);
   editMenu->addSeparator ();
   editMenu->addActions (m_mouseModeGroup->actions ());
 
--- a/libgui/graphics/QtHandlesUtils.cc	Mon May 02 11:12:16 2016 -0700
+++ b/libgui/graphics/QtHandlesUtils.cc	Mon May 02 11:13:50 2016 -0700
@@ -178,7 +178,7 @@
           else if (buttons == Qt::RightButton)
             return std::string ("alt");
 #if defined (Q_WS_WIN)
-          else if (buttons == (Qt::LeftButton|Qt::RightButton))
+          else if (buttons == (Qt::LeftButton | Qt::RightButton))
             return std::string ("extend");
 #elif defined (Q_WS_X11)
           else if (buttons == Qt::MidButton)
--- a/libgui/src/files-dock-widget.cc	Mon May 02 11:12:16 2016 -0700
+++ b/libgui/src/files-dock-widget.cc	Mon May 02 11:13:50 2016 -0700
@@ -678,7 +678,7 @@
       if (QMessageBox::question (this, tr ("Delete file/directory"),
                                  tr ("Are you sure you want to delete\n")
                                  + info.filePath (),
-                                 QMessageBox::Yes|QMessageBox::No)
+                                 QMessageBox::Yes | QMessageBox::No)
           == QMessageBox::Yes)
         {
           if (info.isDir ())
--- a/libgui/src/find-files-dialog.cc	Mon May 02 11:12:16 2016 -0700
+++ b/libgui/src/find-files-dialog.cc	Mon May 02 11:13:50 2016 -0700
@@ -255,7 +255,7 @@
   if (_recurse_dirs_check->isChecked ())
     flags |= QDirIterator::Subdirectories;
 
-  QDir::Filters filters = QDir::Dirs|QDir::NoDotAndDotDot|QDir::Files;
+  QDir::Filters filters = QDir::Dirs | QDir::NoDotAndDotDot | QDir::Files;
   if (! _name_case_check->isChecked ())
     filters |= QDir::CaseSensitive;
 
--- a/libinterp/corefcn/debug.cc	Mon May 02 11:12:16 2016 -0700
+++ b/libinterp/corefcn/debug.cc	Mon May 02 11:13:50 2016 -0700
@@ -83,7 +83,7 @@
     {
       size_t sz = fs.size ();
 
-      std::ifstream file (fname.c_str (), std::ios::in|std::ios::binary);
+      std::ifstream file (fname.c_str (), std::ios::in | std::ios::binary);
 
       if (file)
         {
--- a/libinterp/corefcn/ls-hdf5.h	Mon May 02 11:12:16 2016 -0700
+++ b/libinterp/corefcn/ls-hdf5.h	Mon May 02 11:13:50 2016 -0700
@@ -63,11 +63,11 @@
 
   hdf5_ifstream () : hdf5_fstreambase (), std::istream (0) { }
 
-  hdf5_ifstream (const char *name, int mode = std::ios::in|std::ios::binary,
+  hdf5_ifstream (const char *name, int mode = std::ios::in | std::ios::binary,
                  int prot = 0)
     : hdf5_fstreambase (name, mode, prot), std::istream (0) { }
 
-  void open (const char *name, int mode = std::ios::in|std::ios::binary,
+  void open (const char *name, int mode = std::ios::in | std::ios::binary,
              int prot = 0)
   { hdf5_fstreambase::open (name, mode, prot); }
 };
@@ -78,11 +78,11 @@
 
   hdf5_ofstream () : hdf5_fstreambase (), std::ostream (0) { }
 
-  hdf5_ofstream (const char *name, int mode = std::ios::out|std::ios::binary,
+  hdf5_ofstream (const char *name, int mode = std::ios::out | std::ios::binary,
                  int prot = 0)
     : hdf5_fstreambase (name, mode, prot), std::ostream (0) { }
 
-  void open (const char *name, int mode = std::ios::out|std::ios::binary,
+  void open (const char *name, int mode = std::ios::out | std::ios::binary,
              int prot = 0)
   { hdf5_fstreambase::open (name, mode, prot); }
 };
--- a/libinterp/corefcn/oct-fstrm.h	Mon May 02 11:12:16 2016 -0700
+++ b/libinterp/corefcn/oct-fstrm.h	Mon May 02 11:13:50 2016 -0700
@@ -36,13 +36,13 @@
 public:
 
   octave_fstream (const std::string& nm_arg,
-                  std::ios::openmode arg_md = std::ios::in|std::ios::out,
+                  std::ios::openmode arg_md = std::ios::in | std::ios::out,
                   oct_mach_info::float_format flt_fmt
                     = oct_mach_info::native_float_format ());
 
   static octave_stream
   create (const std::string& nm_arg,
-          std::ios::openmode arg_md = std::ios::in|std::ios::out,
+          std::ios::openmode arg_md = std::ios::in | std::ios::out,
           oct_mach_info::float_format flt_fmt
             = oct_mach_info::native_float_format ());
 
--- a/libinterp/corefcn/oct-iostrm.h	Mon May 02 11:12:16 2016 -0700
+++ b/libinterp/corefcn/oct-iostrm.h	Mon May 02 11:13:50 2016 -0700
@@ -35,7 +35,7 @@
 public:
 
   octave_base_iostream (const std::string& n = "",
-                        std::ios::openmode m = std::ios::in|std::ios::out,
+                        std::ios::openmode m = std::ios::in | std::ios::out,
                         oct_mach_info::float_format ff
                           = oct_mach_info::native_float_format ())
     : octave_base_stream (m, ff), nm (n) { }
--- a/libinterp/corefcn/oct-stdstrm.h	Mon May 02 11:12:16 2016 -0700
+++ b/libinterp/corefcn/oct-stdstrm.h	Mon May 02 11:13:50 2016 -0700
@@ -35,7 +35,7 @@
 public:
 
   octave_tstdiostream (const std::string& n, FILE_T f = 0, int fid = 0,
-                       std::ios::openmode m = std::ios::in|std::ios::out,
+                       std::ios::openmode m = std::ios::in | std::ios::out,
                        oct_mach_info::float_format ff
                          = oct_mach_info::native_float_format (),
                        typename BUF_T::close_fcn cf = BUF_T::file_close)
@@ -105,7 +105,7 @@
 public:
 
   octave_stdiostream (const std::string& n, FILE *f = 0,
-                      std::ios::openmode m = std::ios::in|std::ios::out,
+                      std::ios::openmode m = std::ios::in | std::ios::out,
                       oct_mach_info::float_format ff
                         = oct_mach_info::native_float_format (),
                       c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::file_close)
@@ -114,7 +114,7 @@
 
   static octave_stream
   create (const std::string& n, FILE *f = 0,
-          std::ios::openmode m = std::ios::in|std::ios::out,
+          std::ios::openmode m = std::ios::in | std::ios::out,
           oct_mach_info::float_format ff
             = oct_mach_info::native_float_format (),
           c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::file_close)
@@ -144,7 +144,7 @@
 public:
 
   octave_zstdiostream (const std::string& n, gzFile f = 0, int fid = 0,
-                       std::ios::openmode m = std::ios::in|std::ios::out,
+                       std::ios::openmode m = std::ios::in | std::ios::out,
                        oct_mach_info::float_format ff
                          = oct_mach_info::native_float_format (),
                        c_zfile_ptr_buf::close_fcn cf
@@ -154,7 +154,7 @@
 
   static octave_stream
   create (const std::string& n, gzFile f = 0, int fid = 0,
-          std::ios::openmode m = std::ios::in|std::ios::out,
+          std::ios::openmode m = std::ios::in | std::ios::out,
           oct_mach_info::float_format ff
             = oct_mach_info::native_float_format (),
           c_zfile_ptr_buf::close_fcn cf = c_zfile_ptr_buf::file_close)
--- a/libinterp/corefcn/oct-stream.h	Mon May 02 11:12:16 2016 -0700
+++ b/libinterp/corefcn/oct-stream.h	Mon May 02 11:13:50 2016 -0700
@@ -62,7 +62,7 @@
 
 public:
 
-  octave_base_stream (std::ios::openmode arg_md = std::ios::in|std::ios::out,
+  octave_base_stream (std::ios::openmode arg_md = std::ios::in | std::ios::out,
                       oct_mach_info::float_format ff
                         = oct_mach_info::native_float_format ())
     : count (0), md (arg_md), flt_fmt (ff), fail (false), open_state (true),
--- a/libinterp/corefcn/pr-output.cc	Mon May 02 11:12:16 2016 -0700
+++ b/libinterp/corefcn/pr-output.cc	Mon May 02 11:13:50 2016 -0700
@@ -1662,7 +1662,7 @@
 
       os << "  "
          << std::setw (8) << std::setprecision (1)
-         << std::setiosflags (std::ios::scientific|std::ios::left)
+         << std::setiosflags (std::ios::scientific | std::ios::left)
          << scale
          << " *\n";
 
--- a/libinterp/corefcn/sysdep.cc	Mon May 02 11:12:16 2016 -0700
+++ b/libinterp/corefcn/sysdep.cc	Mon May 02 11:13:50 2016 -0700
@@ -382,8 +382,8 @@
 
         // Set the modes to the way we want them.
 
-        s.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL);
-        s.c_oflag |=  (OPOST|ONLCR);
+        s.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL);
+        s.c_oflag |=  (OPOST | ONLCR);
 #if defined (OCRNL)
         s.c_oflag &= ~(OCRNL);
 #endif
@@ -425,8 +425,8 @@
 
         // Set the modes to the way we want them.
 
-        s.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL);
-        s.c_oflag |=  (OPOST|ONLCR);
+        s.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL);
+        s.c_oflag |=  (OPOST | ONLCR);
 #if defined (OCRNL)
         s.c_oflag &= ~(OCRNL);
 #endif
--- a/libinterp/corefcn/zfstream.h	Mon May 02 11:12:16 2016 -0700
+++ b/libinterp/corefcn/zfstream.h	Mon May 02 11:13:50 2016 -0700
@@ -178,7 +178,7 @@
   virtual pos_type
   seekoff (off_type off, std::ios_base::seekdir way,
            std::ios_base::openmode mode =
-             std::ios_base::in|std::ios_base::out);
+             std::ios_base::in | std::ios_base::out);
 
   /**
    *  @brief  Alters the stream positions.
@@ -187,7 +187,7 @@
    */
   virtual pos_type
   seekpos (pos_type sp, std::ios_base::openmode mode =
-             std::ios_base::in|std::ios_base::out);
+             std::ios_base::in | std::ios_base::out);
 
   virtual int_type
   pbackfail (int_type c = traits_type::eof ());
--- a/libinterp/parse-tree/pt-cbinop.cc	Mon May 02 11:12:16 2016 -0700
+++ b/libinterp/parse-tree/pt-cbinop.cc	Mon May 02 11:13:50 2016 -0700
@@ -32,6 +32,8 @@
 #include "pt-unop.h"
 #include "pt-walk.h"
 
+typedef tree_expression* tree_expression_ptr_t;
+
 octave_value_list
 tree_compound_binary_expression::rvalue (int nargout)
 {
@@ -71,7 +73,7 @@
 // the argument and corresponding operator.
 
 static octave_value::unary_op
-strip_trans_herm (tree_expression *&exp)
+strip_trans_herm (tree_expression_ptr_t& exp)
 {
   if (exp->is_unary_expression ())
     {
@@ -93,7 +95,7 @@
 }
 
 static octave_value::unary_op
-strip_not (tree_expression *&exp)
+strip_not (tree_expression_ptr_t& exp)
 {
   if (exp->is_unary_expression ())
     {
@@ -117,7 +119,7 @@
 // or mul_herm.
 
 static octave_value::compound_binary_op
-simplify_mul_op (tree_expression *&a, tree_expression *&b)
+simplify_mul_op (tree_expression_ptr_t& a, tree_expression_ptr_t& b)
 {
   octave_value::compound_binary_op retop
     = octave_value::unknown_compound_binary_op;
@@ -144,7 +146,7 @@
 // Possibly convert left division to trans_ldiv or herm_ldiv.
 
 static octave_value::compound_binary_op
-simplify_ldiv_op (tree_expression *&a, tree_expression *&)
+simplify_ldiv_op (tree_expression_ptr_t& a, tree_expression_ptr_t&)
 {
   octave_value::compound_binary_op retop
     = octave_value::unknown_compound_binary_op;
@@ -162,7 +164,7 @@
 // Possibly contract and/or with negation.
 
 static octave_value::compound_binary_op
-simplify_and_or_op (tree_expression *&a, tree_expression *&b,
+simplify_and_or_op (tree_expression_ptr_t& a, tree_expression_ptr_t& b,
                     octave_value::binary_op op)
 {
   octave_value::compound_binary_op retop
--- a/liboctave/cruft/misc/f77-fcn.h	Mon May 02 11:12:16 2016 -0700
+++ b/liboctave/cruft/misc/f77-fcn.h	Mon May 02 11:13:50 2016 -0700
@@ -156,7 +156,7 @@
 #define F77_CONST_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s
 #define F77_CHAR_ARG_LEN_DEF(len)
 #define F77_CHAR_ARG_USE(s) s.ptr
-#define F77_CHAR_ARG_LEN_USE(s, len) (s.mask.len>>3)
+#define F77_CHAR_ARG_LEN_USE(s, len) (s.mask.len >> 3)
 
 /* Use this macro to declare the return type of a C-language function
    that is supposed to act like a Fortran subroutine.  */
--- a/liboctave/numeric/DASPK.cc	Mon May 02 11:12:16 2016 -0700
+++ b/liboctave/numeric/DASPK.cc	Mon May 02 11:13:50 2016 -0700
@@ -160,7 +160,7 @@
 
   ColumnVector retval;
 
-  if (! initialized || restart || DAEFunc::reset|| DASPK_options::reset)
+  if (! initialized || restart || DAEFunc::reset || DASPK_options::reset)
     {
       integration_error = false;
 
--- a/liboctave/numeric/DASSL.cc	Mon May 02 11:12:16 2016 -0700
+++ b/liboctave/numeric/DASSL.cc	Mon May 02 11:13:50 2016 -0700
@@ -131,7 +131,7 @@
 {
   ColumnVector retval;
 
-  if (! initialized || restart || DAEFunc::reset|| DASSL_options::reset)
+  if (! initialized || restart || DAEFunc::reset || DASSL_options::reset)
     {
       integration_error = false;
 
--- a/liboctave/util/cmd-hist.cc	Mon May 02 11:12:16 2016 -0700
+++ b/liboctave/util/cmd-hist.cc	Mon May 02 11:13:50 2016 -0700
@@ -139,7 +139,7 @@
           if (tmp == "erasedups")
             history_control |= HC_ERASEDUPS;
           else if (tmp == "ignoreboth")
-            history_control |= HC_IGNDUPS|HC_IGNSPACE;
+            history_control |= (HC_IGNDUPS | HC_IGNSPACE);
           else if (tmp == "ignoredups")
             history_control |= HC_IGNDUPS;
           else if (tmp == "ignorespace")
--- a/liboctave/util/glob-match.h	Mon May 02 11:12:16 2016 -0700
+++ b/liboctave/util/glob-match.h	Mon May 02 11:13:50 2016 -0700
@@ -44,11 +44,11 @@
   };
 
   glob_match (const std::string& p,
-              unsigned int xopts = pathname|noescape|period)
+              unsigned int xopts = pathname | noescape | period)
     : pat (p), fnmatch_flags (opts_to_fnmatch_flags (xopts)) { }
 
   glob_match (const string_vector& p = string_vector (),
-              unsigned int xopts = pathname|noescape|period)
+              unsigned int xopts = pathname | noescape | period)
     : pat (p), fnmatch_flags (opts_to_fnmatch_flags (xopts)) { }
 
   glob_match (const glob_match& gm)