diff libinterp/parse-tree/pt-eval.cc @ 29654:d13d090cb03a stable

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. (grafted from aef11bb4e6d1f303ad9de5688fcb7244ef48867e)
author John W. Eaton <jwe@octave.org>
date Wed, 28 Apr 2021 22:57:42 -0400
parents 34d06c73b48d
children 32f4357ac8d9 7f5bd197fea6
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.cc	Wed Apr 28 22:23:39 2021 -0400
+++ b/libinterp/parse-tree/pt-eval.cc	Wed Apr 28 22:57:42 2021 -0400
@@ -106,7 +106,7 @@
         EX_QUIT_ALL = 3
       };
 
-    debugger (interpreter& interp, size_t level)
+    debugger (interpreter& interp, std::size_t level)
       : m_interpreter (interp), m_level (level), m_debug_frame (0),
         m_execution_mode (EX_NORMAL), m_in_debug_repl (false)
     { }
@@ -134,8 +134,8 @@
 
     interpreter& m_interpreter;
 
-    size_t m_level;
-    size_t m_debug_frame;
+    std::size_t m_level;
+    std::size_t m_debug_frame;
     execution_mode m_execution_mode;
     bool m_in_debug_repl;
   };
@@ -446,8 +446,8 @@
     if (opt == "fullpathext")
       return fname;
 
-    size_t dpos = fname.rfind (sys::file_ops::dir_sep_char ());
-    size_t epos = fname.rfind ('.');
+    std::size_t dpos = fname.rfind (sys::file_ops::dir_sep_char ());
+    std::size_t epos = fname.rfind ('.');
 
     if (epos <= dpos+1)
       epos = std::string::npos;
@@ -618,7 +618,7 @@
                                             const std::string& try_code,
                                             int nargout)
   {
-    unwind_action act ([this] (size_t frm)
+    unwind_action act ([this] (std::size_t frm)
                        {
                          m_call_stack.restore_frame (frm);
                        }, m_call_stack.current_frame ());
@@ -642,7 +642,7 @@
   {
     octave_value_list retval;
 
-    unwind_action act1 ([this] (size_t frm)
+    unwind_action act1 ([this] (std::size_t frm)
                         {
                           m_call_stack.restore_frame (frm);
                         }, m_call_stack.current_frame ());
@@ -896,7 +896,7 @@
     // the corresponding function name.  At least try to do it without N
     // string compares.
 
-    size_t len = name.length ();
+    std::size_t len = name.length ();
 
     if (len == 3 && name == ".**")
       return "power";
@@ -1026,7 +1026,7 @@
 
     bool name_is_operator = fcn_name != name;
 
-    size_t pos = fcn_name.find ('.');
+    std::size_t pos = fcn_name.find ('.');
 
     if (pos != std::string::npos)
       {
@@ -1414,7 +1414,7 @@
     // by getting a reference to the caller or base stack frame and
     // calling assign on that?
 
-    unwind_action act ([this] (size_t frm)
+    unwind_action act ([this] (std::size_t frm)
                        {
                          m_call_stack.restore_frame (frm);
                        }, m_call_stack.current_frame ());
@@ -1485,7 +1485,7 @@
     std::string file_full_name
       = sys::file_ops::tilde_expand (file_name);
 
-    size_t pos
+    std::size_t pos
       = file_full_name.find_last_of (sys::file_ops::dir_sep_str ());
 
     std::string dir_name = file_full_name.substr (0, pos);
@@ -1518,11 +1518,11 @@
       }
 
     // Find symbol name that would be in symbol_table, if it were loaded.
-    size_t dir_end
+    std::size_t dir_end
       = file_name.find_last_of (sys::file_ops::dir_sep_chars ());
     dir_end = (dir_end == std::string::npos) ? 0 : dir_end + 1;
 
-    size_t extension = file_name.find_last_of ('.');
+    std::size_t extension = file_name.find_last_of ('.');
     if (extension == std::string::npos)
       extension = file_name.length ();
 
@@ -1926,7 +1926,7 @@
     return m_call_stack.current_function (true);
   }
 
-  bool tree_evaluator::goto_frame (size_t n, bool verbose)
+  bool tree_evaluator::goto_frame (std::size_t n, bool verbose)
   {
     return m_call_stack.goto_frame (n, verbose);
   }
@@ -1941,7 +1941,7 @@
     m_call_stack.goto_base_frame ();
   }
 
-  void tree_evaluator::restore_frame (size_t n)
+  void tree_evaluator::restore_frame (std::size_t n)
   {
     return m_call_stack.restore_frame (n);
   }
@@ -2280,7 +2280,7 @@
             std::replace (beg, end, '/', sys::file_ops::dir_sep_char ());
           }
 
-        size_t name_len = name.length ();
+        std::size_t name_len = name.length ();
 
         if (name_len > 2 && name.substr (name_len-2) == ".m")
           name = name.substr (0, name_len-2);
@@ -2291,11 +2291,11 @@
         symbol_table& symtab = m_interpreter.get_symbol_table ();
 
         octave_value fcn;
-        size_t p2 = std::string::npos;
+        std::size_t p2 = std::string::npos;
 
         if (name[0] == '@')
           {
-            size_t p1 = name.find (sys::file_ops::dir_sep_char (), 1);
+            std::size_t p1 = name.find (sys::file_ops::dir_sep_char (), 1);
 
             if (p1 == std::string::npos)
               return nullptr;
@@ -2653,7 +2653,7 @@
     if (! cmd_list)
       return retval;
 
-    if (m_call_stack.size () >= static_cast<size_t> (m_max_recursion_depth))
+    if (m_call_stack.size () >= static_cast<std::size_t> (m_max_recursion_depth))
       error ("max_recursion_depth exceeded");
 
     unwind_protect_var<stmt_list_type> upv (m_statement_context, SC_SCRIPT);
@@ -4176,12 +4176,12 @@
             // evaluate the partial expression that the special "end"
             // token applies to in the calling stack frame.
 
-            unwind_action act ([this] (size_t frm)
+            unwind_action act ([this] (std::size_t frm)
                                {
                                  m_call_stack.restore_frame (frm);
                                }, m_call_stack.current_frame ());
 
-            size_t n = m_call_stack.find_current_user_frame ();
+            std::size_t n = m_call_stack.find_current_user_frame ();
             m_call_stack.goto_frame (n);
 
             // End is only valid inside argument lists used for