Mercurial > octave
comparison libinterp/corefcn/data.cc @ 30390:a61e1a0f6024 stable
maint: style check C++ files in libinterp/ ahead of 7.1 release.
* Cell.cc, __eigs__.cc, __ichol__.cc, __ilu__.cc, __magick_read__.cc,
__qp__.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.h, ccolamd.cc, cellfun.cc,
data.cc, debug.cc, defun-int.h, dlmread.cc, event-manager.cc, fftn.cc,
file-io.cc, ft-text-renderer.cc, gl2ps-print.cc, graphics.cc, graphics.in.h,
gzfstream.cc, gzfstream.h, jsondecode.cc, jsonencode.cc,
latex-text-renderer.cc, ls-mat5.cc, lu.cc, mex.cc, oct-stream.cc,
oct-strstrm.cc, ordqz.cc, pager.h, pr-output.cc, qz.cc, schur.cc,
sparse-xdiv.cc, sparse-xpow.cc, sparse.cc, stack-frame.h, strfns.cc, svd.cc,
symrcm.cc, symscope.h, sysdep.cc, text-engine.h, text-renderer.h, tril.cc,
variables.h, xdiv.h, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc,
__voronoi__.cc, audiodevinfo.cc, cdef-class.cc, cdef-class.h, cdef-manager.cc,
cdef-manager.h, cdef-method.cc, cdef-object.cc, ov-base-diag.cc,
ov-base-diag.h, ov-base-int.cc, ov-base-int.h, ov-base-mat.cc, ov-base-mat.h,
ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.h,
ov-bool-mat.cc, ov-cell.cc, ov-cell.h, ov-class.cc, ov-class.h, ov-dld-fcn.cc,
ov-intx.h, ov-lazy-idx.cc, ov-lazy-idx.h, ov-mex-fcn.h, ov-perm.cc, ov-perm.h,
ov-range.cc, ov-re-mat.cc, ov-re-mat.h, ov-str-mat.h, ov-struct.cc,
ov-typeinfo.h, ov-usr-fcn.cc, ov.h, parse.h, pt-cell.cc, pt-stmt.cc,
pt-tm-const.cc, pt-walk.cc:
Style check C++ files in libinterp/ ahead of 7.1 release.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 28 Nov 2021 21:52:08 -0800 |
parents | 26f2daafa270 |
children | fe6d1711feea 796f54d4ddbf |
comparison
equal
deleted
inserted
replaced
30388:bf4cea7b9ba8 | 30390:a61e1a0f6024 |
---|---|
1959 // | 1959 // |
1960 // and then directly resize. However, for some types there might | 1960 // and then directly resize. However, for some types there might |
1961 // be some additional setup needed, and so this should be avoided. | 1961 // be some additional setup needed, and so this should be avoided. |
1962 | 1962 |
1963 octave_value tmp = args(0); | 1963 octave_value tmp = args(0); |
1964 tmp = tmp.resize (dim_vector (0,0)).resize (dv); | 1964 tmp = tmp.resize (dim_vector (0, 0)).resize (dv); |
1965 | 1965 |
1966 int dv_len = dv.ndims (); | 1966 int dv_len = dv.ndims (); |
1967 Array<octave_idx_type> ra_idx (dim_vector (dv_len, 1), 0); | 1967 Array<octave_idx_type> ra_idx (dim_vector (dv_len, 1), 0); |
1968 | 1968 |
1969 for (int j = 0; j < n_args; j++) | 1969 for (int j = 0; j < n_args; j++) |
4464 | 4464 |
4465 bool issparse = false; | 4465 bool issparse = false; |
4466 | 4466 |
4467 if (nargin > 1 && args(nargin-2).is_string () | 4467 if (nargin > 1 && args(nargin-2).is_string () |
4468 && args(nargin-2).string_value () == "like") | 4468 && args(nargin-2).string_value () == "like") |
4469 { | 4469 { |
4470 if (! args(nargin-1).islogical ()) | 4470 if (! args(nargin-1).islogical ()) |
4471 error (R"(%s: input followed by "like" must be logical)", fcn); | 4471 error (R"(%s: input followed by "like" must be logical)", fcn); |
4472 | 4472 |
4473 issparse = args(nargin-1).issparse (); | 4473 issparse = args(nargin-1).issparse (); |
4474 nargin -= 2; | 4474 nargin -= 2; |
4475 } | 4475 } |
4476 | 4476 |
4477 switch (nargin) | 4477 switch (nargin) |
4478 { | 4478 { |
4479 case 0: | 4479 case 0: |
4480 break; | 4480 break; |
5262 if (nr > 0 && nc > 0) | 5262 if (nr > 0 && nc > 0) |
5263 { | 5263 { |
5264 int n = std::min (nr, nc); | 5264 int n = std::min (nr, nc); |
5265 | 5265 |
5266 for (int i = 0; i < n; i++) | 5266 for (int i = 0; i < n; i++) |
5267 m(i,i) = one; | 5267 m(i, i) = one; |
5268 } | 5268 } |
5269 | 5269 |
5270 retval = m; | 5270 retval = m; |
5271 } | 5271 } |
5272 | 5272 |
8310 else if (args(0).is_single_type ()) | 8310 else if (args(0).is_single_type ()) |
8311 { | 8311 { |
8312 const Array<float> in = args(0).float_array_value (); | 8312 const Array<float> in = args(0).float_array_value (); |
8313 std::size_t inlen; | 8313 std::size_t inlen; |
8314 inlen = in.numel () * sizeof (float) / sizeof (char); | 8314 inlen = in.numel () * sizeof (float) / sizeof (char); |
8315 const char* inc; | 8315 const char *inc; |
8316 inc = reinterpret_cast<const char *> (in.data ()); | 8316 inc = reinterpret_cast<const char *> (in.data ()); |
8317 char *out; | 8317 char *out; |
8318 if (base64_encode (inc, inlen, &out)) | 8318 if (base64_encode (inc, inlen, &out)) |
8319 { | 8319 { |
8320 retval(0) = octave_value (out); | 8320 retval(0) = octave_value (out); |
8324 else // double_type | 8324 else // double_type |
8325 { | 8325 { |
8326 const Array<double> in = args(0).array_value (); | 8326 const Array<double> in = args(0).array_value (); |
8327 std::size_t inlen; | 8327 std::size_t inlen; |
8328 inlen = in.numel () * sizeof (double) / sizeof (char); | 8328 inlen = in.numel () * sizeof (double) / sizeof (char); |
8329 const char* inc; | 8329 const char *inc; |
8330 inc = reinterpret_cast<const char *> (in.data ()); | 8330 inc = reinterpret_cast<const char *> (in.data ()); |
8331 char *out; | 8331 char *out; |
8332 if (base64_encode (inc, inlen, &out)) | 8332 if (base64_encode (inc, inlen, &out)) |
8333 { | 8333 { |
8334 retval(0) = octave_value (out); | 8334 retval(0) = octave_value (out); |