changeset 19773:3fa35defe495

Adjust spacing of static_cast<> calls to follow Octave coding conventions. * __init_qt__.cc, file-editor.cc, main-window.cc, bsxfun.cc, data.cc, filter.cc, gammainc.cc, ls-hdf5.cc, mex.cc, oct-stream.cc, lo-mappers.cc, lo-specfun.cc, data-conv.cc, lo-regexp.cc, oct-inttypes.h: Adjust spacing of static_cast<> calls to follow Octave coding conventions.
author Rik <rik@octave.org>
date Tue, 17 Feb 2015 13:34:32 -0800
parents 9155bab86647
children ca6fc882177d
files libgui/graphics/__init_qt__.cc libgui/src/m-editor/file-editor.cc libgui/src/main-window.cc libinterp/corefcn/bsxfun.cc libinterp/corefcn/data.cc libinterp/corefcn/filter.cc libinterp/corefcn/gammainc.cc libinterp/corefcn/ls-hdf5.cc libinterp/corefcn/mex.cc libinterp/corefcn/oct-stream.cc liboctave/numeric/lo-mappers.cc liboctave/numeric/lo-specfun.cc liboctave/util/data-conv.cc liboctave/util/lo-regexp.cc liboctave/util/oct-inttypes.h
diffstat 15 files changed, 35 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/__init_qt__.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/libgui/graphics/__init_qt__.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -199,7 +199,7 @@
   else
     retval(0) = "";
   retval(1) = "";
-  retval(2) = static_cast<double> (0);
+  retval(2) = 0.0;
 
   if (defaultFileName.isEmpty ())
     defaultFileName = defaultDirectory;
@@ -277,7 +277,7 @@
 
   retval(0) = "";
   retval(1) = "";
-  retval(2) = static_cast<double> (0);
+  retval(2) = 0.0;
 
   if (defaultFileName.isEmpty ())
     defaultFileName = defaultDirectory;
--- a/libgui/src/m-editor/file-editor.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/libgui/src/m-editor/file-editor.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -937,7 +937,7 @@
 file_editor::request_close_file (bool)
 {
   file_editor_tab *editor_tab =
-      static_cast <file_editor_tab *> (_tab_widget->currentWidget ());
+      static_cast<file_editor_tab *> (_tab_widget->currentWidget ());
   editor_tab->conditional_close ();
 }
 
@@ -949,7 +949,7 @@
   // loop over all tabs starting from last one otherwise deletion changes index
   for (int index = _tab_widget->count ()-1; index >= 0; index--)
     {
-      editor_tab = static_cast <file_editor_tab *> (_tab_widget->widget (index));
+      editor_tab = static_cast<file_editor_tab *> (_tab_widget->widget (index));
       editor_tab->conditional_close ();
     }
 }
@@ -966,7 +966,7 @@
       if (tabID != _tab_widget->widget (index))
         {
           editor_tab =
-              static_cast <file_editor_tab *> (_tab_widget->widget (index));
+              static_cast<file_editor_tab *> (_tab_widget->widget (index));
           editor_tab->conditional_close ();
         }
     }
@@ -977,7 +977,7 @@
 file_editor::handle_tab_close_request (int index)
 {
   file_editor_tab *editor_tab =
-       static_cast <file_editor_tab *> (_tab_widget->widget (index));
+       static_cast<file_editor_tab *> (_tab_widget->widget (index));
   editor_tab->conditional_close ();
 }
 
--- a/libgui/src/main-window.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/libgui/src/main-window.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -183,7 +183,7 @@
 #ifdef HAVE_QSCINTILLA
       if (qobject_cast <octave_qscintilla *> (w_new))
         {
-          dock = static_cast <octave_dock_widget *> (editor_window);
+          dock = static_cast<octave_dock_widget *> (editor_window);
           break; // it is the editor window ==> exit loop
         }
 #endif
@@ -197,7 +197,7 @@
 
   // editor needs extra handling
   octave_dock_widget *edit_dock_widget =
-                        static_cast <octave_dock_widget *> (editor_window);
+                        static_cast<octave_dock_widget *> (editor_window);
   // if new dock has focus, emit signal and store active focus
   // except editor changes to a dialog (dock=0)
   if ((dock || _active_dock != edit_dock_widget) && (dock != _active_dock))
--- a/libinterp/corefcn/bsxfun.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/libinterp/corefcn/bsxfun.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -287,7 +287,7 @@
   if (i == 0)
     {
       for (octave_idx_type j = nd - 1; j > 0; j--)
-        idx(j) = octave_value (static_cast<double>(1));
+        idx(j) = octave_value (1.0);
       idx(0) = octave_value (':');
     }
   else
--- a/libinterp/corefcn/data.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/libinterp/corefcn/data.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -4219,7 +4219,7 @@
           switch (dt)
             {
             case oct_data_conv::dt_single:
-              retval = FloatNDArray (dims, static_cast <float> (val));
+              retval = FloatNDArray (dims, static_cast<float> (val));
               break;
 
             case oct_data_conv::dt_double:
@@ -4669,7 +4669,7 @@
                       int expon;
                       gnulib::frexpf (val, &expon);
                       epsval(i) = std::pow (2.0f,
-                                            static_cast <float> (expon - 24));
+                                            static_cast<float> (expon - 24));
                     }
                 }
               retval = epsval;
@@ -4694,8 +4694,8 @@
                     {
                       int expon;
                       gnulib::frexp (val, &expon);
-                      epsval(i) = std::pow (static_cast <double> (2.0),
-                                            static_cast <double> (expon - 53));
+                      epsval(i) = std::pow (2.0,
+                                            static_cast<double> (expon - 53));
                     }
                   retval = epsval;
                 }
--- a/libinterp/corefcn/filter.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/libinterp/corefcn/filter.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -75,7 +75,7 @@
 
   T norm = a (0);
 
-  if (norm == static_cast<T>(0.0))
+  if (norm == static_cast<T> (0.0))
     {
       error ("filter: the first element of A must be nonzero");
       return y;
@@ -125,7 +125,7 @@
   if (x_len == 0)
     return x;
 
-  if (norm != static_cast<T>(1.0))
+  if (norm != static_cast<T> (1.0))
     {
       a = a / norm;
       b = b / norm;
--- a/libinterp/corefcn/gammainc.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/libinterp/corefcn/gammainc.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -117,8 +117,7 @@
 
                       if (! error_state)
                         retval = lower ? gammainc (x, a)
-                                       : static_cast<float>(1)
-                                         - gammainc (x, a);
+                                       : 1.0f - gammainc (x, a);
                     }
                   else
                     {
@@ -126,8 +125,7 @@
 
                       if (! error_state)
                         retval = lower ? gammainc (x, a)
-                                       : static_cast<float>(1)
-                                         - gammainc (x, a);
+                                       : 1.0f - gammainc (x, a);
                     }
                 }
             }
@@ -143,8 +141,7 @@
 
                       if (! error_state)
                         retval = lower ? gammainc (x, a)
-                                       : static_cast<float>(1)
-                                         - gammainc (x, a);
+                                       : 1.0f - gammainc (x, a);
                     }
                   else
                     {
@@ -152,8 +149,7 @@
 
                       if (! error_state)
                         retval = lower ? gammainc (x, a)
-                                       : static_cast<float>(1)
-                                         - gammainc (x, a);
+                                       : 1.0f - gammainc (x, a);
                     }
                 }
             }
--- a/libinterp/corefcn/ls-hdf5.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/libinterp/corefcn/ls-hdf5.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -247,7 +247,7 @@
 herr_t
 hdf5_read_next_data (hid_t group_id, const char *name, void *dv)
 {
-  hdf5_callback_data *d = static_cast <hdf5_callback_data *> (dv);
+  hdf5_callback_data *d = static_cast<hdf5_callback_data *> (dv);
   hid_t type_id = -1;
   hid_t type_class_id = -1;
   hid_t data_id = -1;
--- a/libinterp/corefcn/mex.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/libinterp/corefcn/mex.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -2896,7 +2896,7 @@
 void
 mxSetIr (mxArray *ptr, mwIndex *ir)
 {
-  ptr->set_ir (static_cast <mwIndex *> (maybe_unmark (ir)));
+  ptr->set_ir (static_cast<mwIndex *> (maybe_unmark (ir)));
 }
 
 void
--- a/libinterp/corefcn/oct-stream.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/libinterp/corefcn/oct-stream.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -3590,7 +3590,7 @@
 {
   typedef typename V::val_type val_type;
 
-  val_type *vt_data = static_cast <val_type *> (conv_data);
+  val_type *vt_data = static_cast<val_type *> (conv_data);
 
   for (octave_idx_type i = 0; i < n_elts; i++)
     {
@@ -3685,7 +3685,7 @@
 
     case oct_data_conv::dt_single:
       {
-        float *vt_data = static_cast <float *> (conv_data);
+        float *vt_data = static_cast<float *> (conv_data);
 
         for (octave_idx_type i = 0; i < n_elts; i++)
           {
@@ -3699,7 +3699,7 @@
 
     case oct_data_conv::dt_double:
       {
-        double *vt_data = static_cast <double *> (conv_data);
+        double *vt_data = static_cast<double *> (conv_data);
 
         for (octave_idx_type i = 0; i < n_elts; i++)
           {
--- a/liboctave/numeric/lo-mappers.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/liboctave/numeric/lo-mappers.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -475,7 +475,7 @@
 FloatComplex
 atanh (const FloatComplex& x)
 {
-  return log ((1.0f + x) / (static_cast<float> (1.0) - x)) / 2.0f;
+  return log ((1.0f + x) / (1.0f - x)) / 2.0f;
 }
 
 // complex -> bool mappers.
--- a/liboctave/numeric/lo-specfun.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/liboctave/numeric/lo-specfun.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -818,7 +818,7 @@
       // zbesy can overflow as z->0, and cause troubles for generic case below
       alpha = -alpha;
       Complex tmp = zbesj (z, alpha, kode, ierr);
-      if ((static_cast <long> (alpha)) & 1)
+      if ((static_cast<long> (alpha)) & 1)
         tmp = - tmp;
       retval = bessel_return_value (tmp, ierr);
     }
@@ -888,7 +888,7 @@
       // zbesy can overflow as z->0, and cause troubles for generic case below
       alpha = -alpha;
       Complex tmp = zbesj (z, alpha, kode, ierr);
-      if ((static_cast <long> (alpha - 0.5)) & 1)
+      if ((static_cast<long> (alpha - 0.5)) & 1)
         tmp = - tmp;
       retval = bessel_return_value (tmp, ierr);
     }
@@ -1450,7 +1450,7 @@
       // zbesy can overflow as z->0, and cause troubles for generic case below
       alpha = -alpha;
       FloatComplex tmp = cbesj (z, alpha, kode, ierr);
-      if ((static_cast <long> (alpha)) & 1)
+      if ((static_cast<long> (alpha)) & 1)
         tmp = - tmp;
       retval = bessel_return_value (tmp, ierr);
     }
@@ -1515,7 +1515,7 @@
       // zbesy can overflow as z->0, and cause troubles for generic case below
       alpha = -alpha;
       FloatComplex tmp = cbesj (z, alpha, kode, ierr);
-      if ((static_cast <long> (alpha - 0.5)) & 1)
+      if ((static_cast<long> (alpha - 0.5)) & 1)
         tmp = - tmp;
       retval = bessel_return_value (tmp, ierr);
     }
@@ -2130,7 +2130,7 @@
 
   if (! scaled)
     {
-      FloatComplex expz = exp (- static_cast<float> (2.0 / 3.0) * z * sqrt (z));
+      FloatComplex expz = exp (- 2.0f / 3.0f * z * sqrt (z));
 
       float rexpz = real (expz);
       float iexpz = imag (expz);
@@ -2162,8 +2162,7 @@
 
   if (! scaled)
     {
-      FloatComplex expz = exp (std::abs (real (static_cast<float> (2.0 / 3.0)
-                          * z * sqrt (z))));
+      FloatComplex expz = exp (std::abs (real (2.0f / 3.0f * z * sqrt (z))));
 
       float rexpz = real (expz);
       float iexpz = imag (expz);
--- a/liboctave/util/data-conv.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/liboctave/util/data-conv.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -608,7 +608,7 @@
           stream.write (&tmp_type, 1); \
           OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \
           for (octave_idx_type i = 0; i < len; i++) \
-            ptr[i] = static_cast <TYPE> (data[i]);         \
+            ptr[i] = static_cast<TYPE> (data[i]);         \
           std::streamsize n_bytes = size * static_cast<std::streamsize> (len); \
           stream.write (reinterpret_cast<char *> (ptr), n_bytes); \
         } \
--- a/liboctave/util/lo-regexp.cc	Tue Feb 17 16:30:52 2015 -0500
+++ b/liboctave/util/lo-regexp.cc	Tue Feb 17 13:34:32 2015 -0800
@@ -252,7 +252,7 @@
   char *nametable;
   size_t idx = 0;
 
-  pcre *re = static_cast <pcre *> (data);
+  pcre *re = static_cast<pcre *> (data);
 
   pcre_fullinfo (re, 0, PCRE_INFO_CAPTURECOUNT,  &subpatterns);
   pcre_fullinfo (re, 0, PCRE_INFO_NAMECOUNT, &namecount);
@@ -290,7 +290,7 @@
           pcre_extra pe;
 
           pcre_config (PCRE_CONFIG_MATCH_LIMIT,
-                       static_cast <void *> (&pe.match_limit));
+                       static_cast<void *> (&pe.match_limit));
 
           pe.flags = PCRE_EXTRA_MATCH_LIMIT;
 
--- a/liboctave/util/oct-inttypes.h	Tue Feb 17 16:30:52 2015 -0500
+++ b/liboctave/util/oct-inttypes.h	Tue Feb 17 13:34:32 2015 -0800
@@ -310,7 +310,7 @@
     // If val is even, but orig_val is odd, we're one unit off.
     if (orig_val % 2 && val / 2 == xround (val / 2))
       // FIXME: is this always correct?
-      val *= (static_cast<S>(1) - (std::numeric_limits<S>::epsilon () / 2));
+      val *= (static_cast<S> (1) - (std::numeric_limits<S>::epsilon () / 2));
     return val;
   }