changeset 21661:1b9a36a66b01

maint: Octave coding convention cleanups. * Backend.cc, main-window.cc, graphics.cc, ov-java.cc, CSparse.cc, lo-specfun.cc, randmtzig.c, data-conv.cc, oct-shlib.cc: 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).
author Rik <rik@octave.org>
date Mon, 02 May 2016 11:12:16 -0700
parents 53728df3e4c9
children 5b9868c2e212
files libgui/graphics/Backend.cc libgui/src/main-window.cc libinterp/corefcn/graphics.cc libinterp/octave-value/ov-java.cc liboctave/array/CSparse.cc liboctave/numeric/randmtzig.c liboctave/util/data-conv.cc liboctave/util/oct-shlib.cc
diffstat 8 files changed, 32 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/Backend.cc	Mon May 02 08:53:18 2016 -0700
+++ b/libgui/graphics/Backend.cc	Mon May 02 11:12:16 2016 -0700
@@ -99,7 +99,7 @@
       ObjectProxy* proxy = new ObjectProxy ();
       graphics_object gObj (go);
 
-      OCTAVE_PTR_TYPE tmp (reinterpret_cast <OCTAVE_INTPTR_TYPE> (proxy));
+      OCTAVE_PTR_TYPE tmp (reinterpret_cast<OCTAVE_INTPTR_TYPE> (proxy));
       gObj.get_properties ().set(toolkitObjectProperty (go), tmp);
 
       emit createObject (go.get_handle ().value ());
--- a/libgui/src/main-window.cc	Mon May 02 08:53:18 2016 -0700
+++ b/libgui/src/main-window.cc	Mon May 02 11:12:16 2016 -0700
@@ -170,19 +170,19 @@
 
   while (w_new && w_new != _main_tool_bar && count < 100)
     {
-      dock = qobject_cast <octave_dock_widget *> (w_new);
+      dock = qobject_cast<octave_dock_widget *> (w_new);
       if (dock)
         break; // it is a QDockWidget ==> exit loop
 
 #ifdef HAVE_QSCINTILLA
-      if (qobject_cast <octave_qscintilla *> (w_new))
+      if (qobject_cast<octave_qscintilla *> (w_new))
         {
           dock = static_cast<octave_dock_widget *> (editor_window);
           break; // it is the editor window ==> exit loop
         }
 #endif
 
-      w_new = qobject_cast <QWidget *> (w_new->previousInFocusChain ());
+      w_new = qobject_cast<QWidget *> (w_new->previousInFocusChain ());
       if (w_new == start)
         break; // we have arrived where we began ==> exit loop
 
--- a/libinterp/corefcn/graphics.cc	Mon May 02 08:53:18 2016 -0700
+++ b/libinterp/corefcn/graphics.cc	Mon May 02 11:12:16 2016 -0700
@@ -10746,7 +10746,7 @@
                 {
                   graphics_object go = gh_manager::get_object (h);
                   figure::properties& fprops
-                    = dynamic_cast <figure::properties&> (go.get_properties ());
+                    = dynamic_cast<figure::properties&> (go.get_properties ());
 
                   if (fprops.is_modified ())
                     {
--- a/libinterp/octave-value/ov-java.cc	Mon May 02 08:53:18 2016 -0700
+++ b/libinterp/octave-value/ov-java.cc	Mon May 02 11:12:16 2016 -0700
@@ -1570,7 +1570,7 @@
           int8NDArray m = val.int8_array_value ();
           jbyteArray_ref bv (jni_env, jni_env->NewByteArray (m.numel ()));
           jni_env->SetByteArrayRegion (jbyteArray (bv), 0, m.numel (),
-                                       reinterpret_cast <jbyte *> (m.fortran_vec ()));
+                                       reinterpret_cast<jbyte *> (m.fortran_vec ()));
           jmethodID mID = jni_env->GetMethodID (mcls, "<init>", "([B[I)V");
           jobj = jni_env->NewObject (jclass (mcls), mID, jbyteArray (bv), jintArray (iv));
           jcls = jni_env->GetObjectClass (jobj);
@@ -1918,8 +1918,8 @@
 
 octave_value
 octave_java::subsasgn (const std::string& type,
-                       const std::list<octave_value_list>&idx,
-                       const octave_value &rhs)
+                       const std::list<octave_value_list>& idx,
+                       const octave_value& rhs)
 {
 #if defined (HAVE_JAVA)
 
--- a/liboctave/array/CSparse.cc	Mon May 02 08:53:18 2016 -0700
+++ b/liboctave/array/CSparse.cc	Mon May 02 11:12:16 2016 -0700
@@ -7498,7 +7498,7 @@
   return do_add_sm_dm<SparseComplexMatrix> (a, d);
 }
 SparseComplexMatrix
-operator + (const SparseComplexMatrix&a, const ComplexDiagMatrix& d)
+operator + (const SparseComplexMatrix& a, const ComplexDiagMatrix& d)
 {
   return do_add_sm_dm<SparseComplexMatrix> (a, d);
 }
@@ -7529,7 +7529,7 @@
   return do_sub_sm_dm<SparseComplexMatrix> (a, d);
 }
 SparseComplexMatrix
-operator - (const SparseComplexMatrix&a, const ComplexDiagMatrix& d)
+operator - (const SparseComplexMatrix& a, const ComplexDiagMatrix& d)
 {
   return do_sub_sm_dm<SparseComplexMatrix> (a, d);
 }
--- a/liboctave/numeric/randmtzig.c	Mon May 02 08:53:18 2016 -0700
+++ b/liboctave/numeric/randmtzig.c	Mon May 02 11:12:16 2016 -0700
@@ -361,7 +361,7 @@
 randi53 (void)
 {
   const uint32_t lo = randi32 ();
-  const uint32_t hi = randi32 ()&0x1FFFFF;
+  const uint32_t hi = randi32 () & 0x1FFFFF;
 #ifdef HAVE_X86_32
   uint64_t u;
   uint32_t *p = (uint32_t *)&u;
@@ -369,7 +369,7 @@
   p[1] = hi;
   return u;
 #else
-  return (((uint64_t)hi<<32)|lo);
+  return (( (uint64_t)hi << 32) | lo);
 #endif
 }
 
@@ -377,7 +377,7 @@
 randi54 (void)
 {
   const uint32_t lo = randi32 ();
-  const uint32_t hi = randi32 ()&0x3FFFFF;
+  const uint32_t hi = randi32 () & 0x3FFFFF;
 #ifdef HAVE_X86_32
   uint64_t u;
   uint32_t *p = (uint32_t *)&u;
@@ -385,7 +385,7 @@
   p[1] = hi;
   return u;
 #else
-  return (((uint64_t)hi<<32)|lo);
+  return (( (uint64_t)hi << 32 ) | lo);
 #endif
 }
 
@@ -401,8 +401,8 @@
 static double
 randu53 (void)
 {
-  const uint32_t a = randi32 ()>>5;
-  const uint32_t b = randi32 ()>>6;
+  const uint32_t a = randi32 () >> 5;
+  const uint32_t b = randi32 () >> 6;
   return (a*67108864.0+b+0.4) * (1.0/9007199254740992.0);
 }
 
@@ -585,18 +585,18 @@
       int64_t rabs;
       uint32_t *p = (uint32_t *)&rabs;
       lo = randi32 ();
-      idx = lo&0xFF;
+      idx = lo & 0xFF;
       hi = randi32 ();
-      si = hi&UMASK;
+      si = hi & UMASK;
       p[0] = lo;
-      p[1] = hi&0x1FFFFF;
+      p[1] = hi & 0x1FFFFF;
       x = ( si ? -rabs : rabs ) * wi[idx];
 # else /* ! HAVE_X86_32 */
       /* arbitrary mantissa (selected by NRANDI, with 1 bit for sign) */
       const uint64_t r = NRANDI;
-      const int64_t rabs = r>>1;
-      const int idx = (int)(rabs&0xFF);
-      const double x = ( r&1 ? -rabs : rabs) * wi[idx];
+      const int64_t rabs = r >> 1;
+      const int idx = (int)(rabs & 0xFF);
+      const double x = ( (r & 1) ? -rabs : rabs) * wi[idx];
 # endif /* ! HAVE_X86_32 */
       if (rabs < (int64_t)ki[idx])
         return x;        /* 99.3% of the time we return here 1st try */
@@ -619,7 +619,7 @@
               yy = - log (RANDU);
             }
           while ( yy+yy <= xx*xx);
-          return (rabs&0x100 ? -ZIGGURAT_NOR_R-xx : ZIGGURAT_NOR_R+xx);
+          return ((rabs & 0x100) ? -ZIGGURAT_NOR_R-xx : ZIGGURAT_NOR_R+xx);
         }
       else if ((fi[idx-1] - fi[idx]) * RANDU + fi[idx] < exp (-0.5*x*x))
         return x;
@@ -762,8 +762,8 @@
     {
       /* 32-bit mantissa */
       const uint32_t r = randi32 ();
-      const uint32_t rabs = r&LMASK;
-      const int idx = (int)(r&0xFF);
+      const uint32_t rabs = r & LMASK;
+      const int idx = (int)(r & 0xFF);
       const float x = ((int32_t)r) * fwi[idx];
       if (rabs < fki[idx])
         return x;        /* 99.3% of the time we return here 1st try */
@@ -786,7 +786,7 @@
               yy = - log (RANDU);
             }
           while ( yy+yy <= xx*xx);
-          return (rabs&0x100 ? -ZIGGURAT_NOR_R-xx : ZIGGURAT_NOR_R+xx);
+          return ((rabs & 0x100) ? -ZIGGURAT_NOR_R-xx : ZIGGURAT_NOR_R+xx);
         }
       else if ((ffi[idx-1] - ffi[idx]) * RANDU + ffi[idx] < exp (-0.5*x*x))
         return x;
--- a/liboctave/util/data-conv.cc	Mon May 02 08:53:18 2016 -0700
+++ b/liboctave/util/data-conv.cc	Mon May 02 11:12:16 2016 -0700
@@ -821,7 +821,7 @@
       break;
 
     default:
-      is.clear (std::ios::failbit|is.rdstate ());
+      is.clear (std::ios::failbit | is.rdstate ());
       break;
     }
 }
@@ -877,7 +877,7 @@
       break;
 
     default:
-      is.clear (std::ios::failbit|is.rdstate ());
+      is.clear (std::ios::failbit | is.rdstate ());
       break;
     }
 }
@@ -921,7 +921,7 @@
         char tmp_type = static_cast<char> (type);
         os.write (&tmp_type, 1);
         std::streamsize n_bytes = 8 * static_cast<std::streamsize> (len);
-        os.write (reinterpret_cast <const char *> (data), n_bytes);
+        os.write (reinterpret_cast<const char *> (data), n_bytes);
       }
       break;
 
@@ -967,7 +967,7 @@
         char tmp_type = static_cast<char> (type);
         os.write (&tmp_type, 1);
         std::streamsize n_bytes = 4 * static_cast<std::streamsize> (len);
-        os.write (reinterpret_cast <const char *> (data), n_bytes);
+        os.write (reinterpret_cast<const char *> (data), n_bytes);
       }
       break;
 
--- a/liboctave/util/oct-shlib.cc	Mon May 02 08:53:18 2016 -0700
+++ b/liboctave/util/oct-shlib.cc	Mon May 02 11:12:16 2016 -0700
@@ -391,7 +391,8 @@
   if (mangler)
     sym_name = mangler (name);
 
-  function = reinterpret_cast <void *> (GetProcAddress (handle, sym_name.c_str ()));
+  function = reinterpret_cast<void *> (GetProcAddress (handle,
+                                                       sym_name.c_str ()));
 
   return function;
 }