Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mojtaba Abdolkhani
ogs
Commits
12b87085
Commit
12b87085
authored
9 years ago
by
Tom Fischer
Browse files
Options
Downloads
Plain Diff
Merge pull request #1054 from TomFischer/FixClangSanitizerIssues
Fix clang sanitizer issues
parents
7104bbaf
48bd905f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
BaseLib/FileTools.cpp
+12
-8
12 additions, 8 deletions
BaseLib/FileTools.cpp
MeshGeoToolsLib/BoundaryElementsSearcher.cpp
+2
-0
2 additions, 0 deletions
MeshGeoToolsLib/BoundaryElementsSearcher.cpp
with
14 additions
and
8 deletions
BaseLib/FileTools.cpp
+
12
−
8
View file @
12b87085
...
...
@@ -56,13 +56,16 @@ void truncateFile( std::string const& filename)
ofs
.
close
();
}
namespace
{
/** Finds the position of last file path separator.
* Checks for unix or windows file path separators in given path and returns the
* position of the last one or std::string::npos if no file path separator was
* found.
*/
static
std
::
size_t
findLastPathSeparator
(
std
::
string
const
&
path
)
std
::
string
::
size_t
ype
findLastPathSeparator
(
std
::
string
const
&
path
)
{
return
path
.
find_last_of
(
"/
\\
"
);
}
...
...
@@ -71,20 +74,21 @@ std::size_t findLastPathSeparator(std::string const& path)
* This could be used to extract file extension.
*/
static
std
::
size_t
findLastDot
(
std
::
string
const
&
path
)
std
::
string
::
size_t
ype
findLastDot
(
std
::
string
const
&
path
)
{
return
path
.
find_last_of
(
"."
);
}
}
// end namespace
std
::
string
dropFileExtension
(
std
::
string
const
&
filename
)
{
// Look for dots in filename.
const
std
::
size_
t
p
=
findLastDot
(
filename
);
auto
cons
t
p
=
findLastDot
(
filename
);
if
(
p
==
std
::
string
::
npos
)
return
filename
;
// Check position of the last path separator.
const
std
::
size_
t
s
=
findLastPathSeparator
(
filename
);
auto
cons
t
s
=
findLastPathSeparator
(
filename
);
if
(
s
!=
std
::
string
::
npos
&&
p
<
s
)
return
filename
;
...
...
@@ -93,7 +97,7 @@ std::string dropFileExtension(std::string const& filename)
std
::
string
extractBaseName
(
std
::
string
const
&
pathname
)
{
const
std
::
size_
t
p
=
findLastPathSeparator
(
pathname
);
auto
cons
t
p
=
findLastPathSeparator
(
pathname
);
if
(
p
==
std
::
string
::
npos
)
return
pathname
;
return
pathname
.
substr
(
p
+
1
);
...
...
@@ -108,7 +112,7 @@ std::string extractBaseNameWithoutExtension(std::string const& pathname)
std
::
string
getFileExtension
(
const
std
::
string
&
path
)
{
const
std
::
string
str
=
extractBaseName
(
path
);
const
std
::
size_
t
p
=
findLastDot
(
str
);
auto
cons
t
p
=
findLastDot
(
str
);
if
(
p
==
std
::
string
::
npos
)
return
std
::
string
();
return
str
.
substr
(
p
+
1
);
...
...
@@ -123,7 +127,7 @@ std::string copyPathToFileName(const std::string &file_name,
const
std
::
string
&
source
)
{
// check if file_name already contains a full path
const
std
::
size_
t
pos
=
findLastPathSeparator
(
file_name
);
auto
cons
t
pos
=
findLastPathSeparator
(
file_name
);
if
(
pos
!=
std
::
string
::
npos
)
return
file_name
;
...
...
@@ -132,7 +136,7 @@ std::string copyPathToFileName(const std::string &file_name,
std
::
string
extractPath
(
std
::
string
const
&
pathname
)
{
const
std
::
size_
t
pos
=
findLastPathSeparator
(
pathname
);
auto
cons
t
pos
=
findLastPathSeparator
(
pathname
);
if
(
pos
==
std
::
string
::
npos
)
return
""
;
return
pathname
.
substr
(
0
,
pos
+
1
);
...
...
This diff is collapsed.
Click to expand it.
MeshGeoToolsLib/BoundaryElementsSearcher.cpp
+
2
−
0
View file @
12b87085
...
...
@@ -31,6 +31,8 @@ BoundaryElementsSearcher::BoundaryElementsSearcher(MeshLib::Mesh const& mesh, Me
BoundaryElementsSearcher
::~
BoundaryElementsSearcher
()
{
for
(
auto
p
:
_boundary_elements_at_point
)
delete
p
;
for
(
auto
p
:
_boundary_elements_along_polylines
)
delete
p
;
for
(
auto
p
:
_boundary_elements_along_surfaces
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment