annotate liboctave/util/pathsearch.cc @ 33240:4e5bc9c4f657

use std::stoi or std::stoul instead of atoi (bug #65342) The std::stoi and std::stoul functions allow us to distinguish between invalid values and out of range values instead of just returning 0 for any conversion failure as atoi does. In the following changes, we now attempt to provide better diagnostics where possible. * pathsearch.cc (directory_path::init): Use std::stoul instead of atoi. Issue warnings for out of range or invalid values. * __init_fltk__.cc (fltk_uimenu::add_entry): Use std::stoi instead of atoi. * event-manager.cc (F__event_manager_file_dialog__): Use std::stoi instead of atoi. * bp-table.cc (bp_table::parse_dbfunction_params): Use std::stoi instead of atoi. * data-conv.cc (oct_data_conv::string_to_data_type): Use std::stoi instead of atoi. * debug.cc (parse_start_end, parse_integer_argument): New static functions. (Fdbtype): Use parse_start_end to improve parsing of integer arguments. (Fdblist, Fdbstack, do_dbupdown): Use parse_integer_argument to improve handling of integer argument values.
author John W. Eaton <jwe@octave.org>
date Sat, 23 Mar 2024 12:13:17 -0400
parents 2e484f9f1f18
children
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 //
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 32590
diff changeset
3 // Copyright (C) 1996-2024 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 ////////////////////////////////////////////////////////////////////////
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21202
diff changeset
27 # include "config.h"
2021
aa68db31dc34 [project @ 1996-03-23 05:53:57 by jwe]
jwe
parents: 2006
diff changeset
28 #endif
aa68db31dc34 [project @ 1996-03-23 05:53:57 by jwe]
jwe
parents: 2006
diff changeset
29
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
30 #include <cstdlib>
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
31
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
32 #include <string>
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
33
21883
02add2f597a1 compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents: 21882
diff changeset
34 #include "kpse.h"
02add2f597a1 compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents: 21882
diff changeset
35 #include "lo-error.h"
3024
95e8b5c4824a [project @ 1997-06-04 05:06:26 by jwe]
jwe
parents: 2847
diff changeset
36 #include "lo-utils.h"
3833
f3278ec3ccb7 [project @ 2001-05-17 12:31:52 by jwe]
jwe
parents: 3505
diff changeset
37 #include "oct-env.h"
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
38 #include "pathsearch.h"
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
39
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
40 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
41
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
42 directory_path::directory_path (const std::string& s)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
43 : m_orig_path (s), m_initialized (false), m_expanded_path (),
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
44 m_path_elements ()
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
45 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
46 if (! m_orig_path.empty ())
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
47 init ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
48 }
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
49
32590
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
50 std::list<std::string>
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
51 directory_path::elements ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
52 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
53 return m_initialized ? m_path_elements : std::list<std::string> ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
54 }
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
55
32590
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
56 std::list<std::string>
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
57 directory_path::all_directories ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
58 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
59 std::list<std::string> retval;
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
60
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
61 if (m_initialized)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
62 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
63 for (const auto& elt : m_path_elements)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
64 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
65 std::string elt_dir = kpse_element_dir (elt);
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
66
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
67 if (! elt_dir.empty ())
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
68 retval.push_back (elt_dir);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
69 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
70 }
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
71
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
72 return retval;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
73 }
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
74
32590
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
75 std::string
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
76 directory_path::find_first (const std::string& nm)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
77 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
78 return m_initialized ? kpse_path_search (m_expanded_path, nm) : "";
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
79 }
4242
4d3994172bd5 [project @ 2002-12-26 22:06:10 by jwe]
jwe
parents: 4126
diff changeset
80
32590
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
81 std::list<std::string>
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
82 directory_path::find_all (const std::string& nm)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
83 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
84 return (m_initialized
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
85 ? kpse_all_path_search (m_expanded_path, nm)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
86 : std::list<std::string> ());
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
87 }
4242
4d3994172bd5 [project @ 2002-12-26 22:06:10 by jwe]
jwe
parents: 4126
diff changeset
88
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
89 std::string
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
90 directory_path::find_first_of (const std::list<std::string>& names)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
91 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
92 return (m_initialized
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
93 ? kpse_path_find_first_of (m_expanded_path, names) : "");
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
94 }
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
95
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
96 std::list<std::string>
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
97 directory_path::find_all_first_of (const std::list<std::string>& names)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
98 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
99 return (m_initialized
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
100 ? kpse_all_path_find_first_of (m_expanded_path, names)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
101 : std::list<std::string> ());
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
102 }
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
103
32590
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
104 void
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
105 directory_path::init ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
106 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
107 static bool octave_kpse_initialized = false;
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
108
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
109 if (! octave_kpse_initialized)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
110 {
33240
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
111 std::string env_val = sys::env::getenv ("KPATHSEA_DEBUG");
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
112
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
113 if (! env_val.empty ())
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
114 {
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
115 unsigned int env_debug_flags = 0;
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
116
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
117 try
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
118 {
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
119 unsigned long val = std::stoul (env_val);
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
120
33240
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
121 if (val > std::numeric_limits<unsigned int>::max ())
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
122 (*current_liboctave_warning_with_id_handler)
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
123 ("Octave:kpathsea-debug-value-ignored", "directory_path::init: ignoring out of range KPATHSEA_DEBUG value '%s'", env_val.c_str ());
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
124 else
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
125 env_debug_flags = val;
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
126 }
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
127 catch (const std::invalid_argument&)
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
128 {
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
129 (*current_liboctave_warning_with_id_handler)
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
130 ("Octave:kpathsea-debug-value-ignored", "directory_path::init: ignoring invalid KPATHSEA_DEBUG value '%s'", env_val.c_str ());
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
131 }
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
132 catch (const std::out_of_range&)
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
133 {
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
134 (*current_liboctave_warning_with_id_handler)
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
135 ("Octave:kpathsea-debug-value-ignored", "directory_path::init: ignoring out of range KPATHSEA_DEBUG value '%s'", env_val.c_str ());
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
136 }
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
137
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
138 kpse_debug |= env_debug_flags;
4e5bc9c4f657 use std::stoi or std::stoul instead of atoi (bug #65342)
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
139 }
3174
390d5e396682 [project @ 1998-05-04 16:36:17 by jwe]
jwe
parents: 3024
diff changeset
140
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
141 octave_kpse_initialized = true;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
142 }
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
143
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
144 m_expanded_path = kpse_path_expand (m_orig_path);
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
145
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
146 for (kpse_path_iterator pi (m_expanded_path); pi != std::string::npos; pi++)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
147 m_path_elements.push_back (*pi);
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
148
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
149 m_initialized = true;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
150 }
23743
e919cc8d9d92 don't use singleton pattern in pathsearch class; treat pathsep as constant
John W. Eaton <jwe@octave.org>
parents: 23696
diff changeset
151
32590
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
152 char
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
153 directory_path::path_sep_char ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
154 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
155 return SEPCHAR;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
156 }
23743
e919cc8d9d92 don't use singleton pattern in pathsearch class; treat pathsep as constant
John W. Eaton <jwe@octave.org>
parents: 23696
diff changeset
157
32590
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
158 std::string
3c2c585965cc maint: C++ style check for liboctave/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
159 directory_path::path_sep_str ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
160 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
161 return SEPCHAR_STR;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
162 }
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
163
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
164 OCTAVE_END_NAMESPACE(octave)