annotate liboctave/util/file-info.cc @ 29572:aef11bb4e6d1

use std::size_t and std::ptrdiff_t in C++ code (bug #60471) Files affected: make_int.cc, file-editor-tab.cc, octave-qscintilla.cc, Cell.cc, Cell.h, call-stack.cc, call-stack.h, cellfun.cc, data.cc, debug.cc, dlmread.cc, error.cc, event-queue.h, fcn-info.cc, fcn-info.h, file-io.cc, ft-text-renderer.cc, gl2ps-print.cc, graphics.cc, graphics.in.h, help.cc, hex2num.cc, input.cc, latex-text-renderer.cc, load-path.cc, load-save.cc, load-save.h, ls-hdf5.cc, ls-mat-ascii.cc, ls-mat5.cc, ls-oct-text.cc, mex.cc, mexproto.h, mxarray.h, oct-map.cc, oct-stream.cc, oct-stream.h, pager.cc, pager.h, pr-output.cc, regexp.cc, settings.h, stack-frame.cc, stack-frame.h, strfns.cc, syminfo.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, sysdep.cc, toplev.cc, utils.cc, utils.h, variables.cc, __fltk_uigetfile__.cc, __init_fltk__.cc, audioread.cc, gzip.cc, cdef-class.cc, cdef-manager.cc, cdef-method.cc, cdef-object.cc, cdef-object.h, ov-base-diag.cc, ov-base-diag.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base-scalar.h, ov-base-sparse.h, ov-base.cc, ov-base.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-fcn-handle.cc, ov-java.cc, ov-lazy-idx.h, ov-perm.cc, ov-perm.h, ov-range.h, ov-str-mat.cc, ov-struct.cc, ov-struct.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.cc, octave.cc, bp-table.cc, jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, jit-util.h, lex.h, lex.ll, oct-lvalue.cc, oct-parse.yy, parse.h, profiler.h, pt-eval.cc, pt-eval.h, pt-jit.cc, pt-jit.h, pt-pr-code.cc, pt-tm-const.cc, pt-tm-const.h, Array.h, CMatrix.cc, DiagArray2.h, PermMatrix.h, Sparse.h, dMatrix.cc, fCMatrix.cc, fMatrix.cc, bsxfun-defs.cc, oct-fftw.cc, oct-fftw.h, randpoisson.cc, sparse-chol.cc, mx-inlines.cc, file-ops.cc, lo-sysdep.cc, oct-env.cc, oct-time.cc, action-container.cc, action-container.h, base-list.h, caseless-str.h, cmd-edit.cc, cmd-hist.cc, data-conv.cc, data-conv.h, f77-fcn.h, file-info.cc, file-info.h, kpse.cc, kpse.h, lo-cutils.h, lo-hash.h, lo-regexp.cc, oct-base64.cc, oct-base64.h, oct-binmap.h, oct-glob.cc, oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sparse.h, oct-string.cc, quit.cc, unwind-prot.h, url-transfer.cc, main.in.cc, mkoctfile.in.cc, and shared-fcns.h.
author John W. Eaton <jwe@octave.org>
date Wed, 28 Apr 2021 22:57:42 -0400
parents 0a5b15007766
children 796f54d4ddbf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 28467
diff changeset
3 // Copyright (C) 2001-2021 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if defined (HAVE_CONFIG_H)
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 # include "config.h"
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 #endif
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 #include <deque>
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 #include <fstream>
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 #include "file-info.h"
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 #include "file-stat.h"
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 #include "lo-error.h"
25548
d6050ba12c0c Call get_ASCII_filename for std::ifstream (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25438
diff changeset
36 #include "lo-sysdep.h"
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 namespace octave
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 {
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
40 std::string file_info::get_line (std::size_t line) const
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 {
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 std::string retval;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 if (line == 0)
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 return retval;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 if (line < m_offsets.size ())
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 {
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
49 std::size_t bol = m_offsets[line-1];
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
50 std::size_t eol = m_offsets[line];
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 while (eol > 0 && eol > bol
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 && (m_file_buf[eol-1] == '\n' || m_file_buf[eol-1] == '\r'))
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 eol--;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 retval = m_file_buf.substr (bol, eol - bol);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 }
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 return retval;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 }
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 std::deque<std::string>
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
63 file_info::get_lines (std::size_t line, std::size_t num_lines) const
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 {
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 std::deque<std::string> retval;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
67 for (std::size_t i = line; i < line+num_lines; i++)
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 retval.push_back (get_line (i));
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 return retval;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 }
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 // Read entire file called fname and return the contents as a string
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 std::string file_info::snarf_file (const std::string& fname)
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 {
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 std::string retval;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 sys::file_stat fs (fname);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 if (! fs)
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82 (*current_liboctave_error_handler) ("no such file, '%s'", fname.c_str ());
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
84 std::size_t sz = fs.size ();
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85
28467
159b6a1eb408 Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
86 std::ifstream file = sys::ifstream (fname.c_str (),
159b6a1eb408 Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
87 std::ios::in | std::ios::binary);
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89 if (file)
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90 {
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91 std::string buf (sz+1, 0);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
93 file.read (&buf[0], sz+1);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95 if (! file.eof ())
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96 (*current_liboctave_error_handler)
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97 ("error reading file %s", fname.c_str ());
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99 // Expected to read the entire file.
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100 retval = buf;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
101 }
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
102
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103 return retval;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104 }
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
105
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
106 std::vector<std::size_t> file_info::get_line_offsets (const std::string& buf)
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107 {
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
108 std::deque<std::size_t> tmp_offsets;
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
110 tmp_offsets.push_back (0);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
112 std::size_t len = buf.length ();
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
114 for (std::size_t i = 0; i < len; i++)
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115 {
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
116 char c = buf[i];
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
117
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118 if (c == '\r' && ++i < len)
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119 {
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 c = buf[i];
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
121
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
122 if (c == '\n')
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
123 tmp_offsets.push_back (i+1);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
124 else
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125 tmp_offsets.push_back (i);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126 }
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
127 else if (c == '\n')
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128 tmp_offsets.push_back (i+1);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129 }
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
130
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
131 tmp_offsets.push_back (len-1);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
132
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
133 std::size_t n = tmp_offsets.size ();
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
134
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
135 std::vector<std::size_t> retval (n);
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
136 std::size_t i = 0;
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
137 for (auto& elt : tmp_offsets)
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
138 retval[i++] = elt;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140 return retval;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141 }
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
diff changeset
142 }