# HG changeset patch # User Rik # Date 1424208872 28800 # Node ID 3fa35defe495fe8daf6216bac5dcfa1dcac357bc # Parent 9155bab86647ac9d2e617d2b4e1c65deddd882e7 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. diff -r 9155bab86647 -r 3fa35defe495 libgui/graphics/__init_qt__.cc --- 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 (0); + retval(2) = 0.0; if (defaultFileName.isEmpty ()) defaultFileName = defaultDirectory; @@ -277,7 +277,7 @@ retval(0) = ""; retval(1) = ""; - retval(2) = static_cast (0); + retval(2) = 0.0; if (defaultFileName.isEmpty ()) defaultFileName = defaultDirectory; diff -r 9155bab86647 -r 3fa35defe495 libgui/src/m-editor/file-editor.cc --- 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 (_tab_widget->currentWidget ()); + static_cast (_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 (_tab_widget->widget (index)); + editor_tab = static_cast (_tab_widget->widget (index)); editor_tab->conditional_close (); } } @@ -966,7 +966,7 @@ if (tabID != _tab_widget->widget (index)) { editor_tab = - static_cast (_tab_widget->widget (index)); + static_cast (_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 (_tab_widget->widget (index)); + static_cast (_tab_widget->widget (index)); editor_tab->conditional_close (); } diff -r 9155bab86647 -r 3fa35defe495 libgui/src/main-window.cc --- 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 (w_new)) { - dock = static_cast (editor_window); + dock = static_cast (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 (editor_window); + static_cast (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)) diff -r 9155bab86647 -r 3fa35defe495 libinterp/corefcn/bsxfun.cc --- 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(1)); + idx(j) = octave_value (1.0); idx(0) = octave_value (':'); } else diff -r 9155bab86647 -r 3fa35defe495 libinterp/corefcn/data.cc --- 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 (val)); + retval = FloatNDArray (dims, static_cast (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 (expon - 24)); + static_cast (expon - 24)); } } retval = epsval; @@ -4694,8 +4694,8 @@ { int expon; gnulib::frexp (val, &expon); - epsval(i) = std::pow (static_cast (2.0), - static_cast (expon - 53)); + epsval(i) = std::pow (2.0, + static_cast (expon - 53)); } retval = epsval; } diff -r 9155bab86647 -r 3fa35defe495 libinterp/corefcn/filter.cc --- 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(0.0)) + if (norm == static_cast (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(1.0)) + if (norm != static_cast (1.0)) { a = a / norm; b = b / norm; diff -r 9155bab86647 -r 3fa35defe495 libinterp/corefcn/gammainc.cc --- 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(1) - - gammainc (x, a); + : 1.0f - gammainc (x, a); } else { @@ -126,8 +125,7 @@ if (! error_state) retval = lower ? gammainc (x, a) - : static_cast(1) - - gammainc (x, a); + : 1.0f - gammainc (x, a); } } } @@ -143,8 +141,7 @@ if (! error_state) retval = lower ? gammainc (x, a) - : static_cast(1) - - gammainc (x, a); + : 1.0f - gammainc (x, a); } else { @@ -152,8 +149,7 @@ if (! error_state) retval = lower ? gammainc (x, a) - : static_cast(1) - - gammainc (x, a); + : 1.0f - gammainc (x, a); } } } diff -r 9155bab86647 -r 3fa35defe495 libinterp/corefcn/ls-hdf5.cc --- 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 (dv); + hdf5_callback_data *d = static_cast (dv); hid_t type_id = -1; hid_t type_class_id = -1; hid_t data_id = -1; diff -r 9155bab86647 -r 3fa35defe495 libinterp/corefcn/mex.cc --- 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 (maybe_unmark (ir))); + ptr->set_ir (static_cast (maybe_unmark (ir))); } void diff -r 9155bab86647 -r 3fa35defe495 libinterp/corefcn/oct-stream.cc --- 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 (conv_data); + val_type *vt_data = static_cast (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 (conv_data); + float *vt_data = static_cast (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 (conv_data); + double *vt_data = static_cast (conv_data); for (octave_idx_type i = 0; i < n_elts; i++) { diff -r 9155bab86647 -r 3fa35defe495 liboctave/numeric/lo-mappers.cc --- 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 (1.0) - x)) / 2.0f; + return log ((1.0f + x) / (1.0f - x)) / 2.0f; } // complex -> bool mappers. diff -r 9155bab86647 -r 3fa35defe495 liboctave/numeric/lo-specfun.cc --- 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 (alpha)) & 1) + if ((static_cast (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 (alpha - 0.5)) & 1) + if ((static_cast (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 (alpha)) & 1) + if ((static_cast (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 (alpha - 0.5)) & 1) + if ((static_cast (alpha - 0.5)) & 1) tmp = - tmp; retval = bessel_return_value (tmp, ierr); } @@ -2130,7 +2130,7 @@ if (! scaled) { - FloatComplex expz = exp (- static_cast (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 (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); diff -r 9155bab86647 -r 3fa35defe495 liboctave/util/data-conv.cc --- 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 (data[i]); \ + ptr[i] = static_cast (data[i]); \ std::streamsize n_bytes = size * static_cast (len); \ stream.write (reinterpret_cast (ptr), n_bytes); \ } \ diff -r 9155bab86647 -r 3fa35defe495 liboctave/util/lo-regexp.cc --- 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 (data); + pcre *re = static_cast (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 (&pe.match_limit)); + static_cast (&pe.match_limit)); pe.flags = PCRE_EXTRA_MATCH_LIMIT; diff -r 9155bab86647 -r 3fa35defe495 liboctave/util/oct-inttypes.h --- 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(1) - (std::numeric_limits::epsilon () / 2)); + val *= (static_cast (1) - (std::numeric_limits::epsilon () / 2)); return val; }