Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
a269fc98
Commit
a269fc98
authored
Apr 03, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/Charset: enable RVO in FixSeparators()
parent
915c48f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
Charset.cxx
src/fs/Charset.cxx
+7
-5
No files found.
src/fs/Charset.cxx
View file @
a269fc98
...
...
@@ -74,19 +74,21 @@ GetFSCharset() noexcept
#endif
}
static
inline
PathTraitsUTF8
::
string
&&
FixSeparators
(
PathTraitsUTF8
::
string
&&
s
)
static
inline
PathTraitsUTF8
::
string
FixSeparators
(
const
PathTraitsUTF8
::
string_view
_
s
)
{
// For whatever reason GCC can't convert constexpr to value reference.
// This leads to link errors when passing separators directly.
auto
to
=
PathTraitsUTF8
::
SEPARATOR
;
decltype
(
to
)
from
=
PathTraitsFS
::
SEPARATOR
;
PathTraitsUTF8
::
string
s
(
_s
);
if
(
from
!=
to
)
/* convert backslash to slash on WIN32 */
std
::
replace
(
s
.
begin
(),
s
.
end
(),
from
,
to
);
return
s
td
::
move
(
s
)
;
return
s
;
}
PathTraitsUTF8
::
string
...
...
@@ -99,7 +101,7 @@ PathToUTF8(PathTraitsFS::const_pointer path_fs)
#ifdef _WIN32
const
auto
buffer
=
WideCharToMultiByte
(
CP_UTF8
,
path_fs
);
return
FixSeparators
(
PathTraitsUTF8
::
string
(
buffer
)
);
return
FixSeparators
(
buffer
);
#else
#ifdef HAVE_FS_CHARSET
if
(
fs_converter
==
nullptr
)
...
...
@@ -108,7 +110,7 @@ PathToUTF8(PathTraitsFS::const_pointer path_fs)
#ifdef HAVE_FS_CHARSET
const
auto
buffer
=
fs_converter
->
ToUTF8
(
path_fs
);
return
FixSeparators
(
PathTraitsUTF8
::
string
(
buffer
)
);
return
FixSeparators
(
buffer
);
#endif
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment