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
eb174d5b
Commit
eb174d5b
authored
Feb 25, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/{Allocated,}Path,Charset: use PathTraitsFS typedefs
parent
4c899e9c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
21 deletions
+19
-21
AllocatedPath.cxx
src/fs/AllocatedPath.cxx
+1
-1
AllocatedPath.hxx
src/fs/AllocatedPath.hxx
+1
-1
Charset.cxx
src/fs/Charset.cxx
+7
-8
Charset.hxx
src/fs/Charset.hxx
+5
-6
Path.hxx
src/fs/Path.hxx
+3
-3
StandardDirectory.cxx
src/fs/StandardDirectory.cxx
+2
-2
No files found.
src/fs/AllocatedPath.cxx
View file @
eb174d5b
...
...
@@ -87,7 +87,7 @@ void
AllocatedPath
::
ChopSeparators
()
{
size_t
l
=
length
();
const
char
*
p
=
data
();
const
auto
*
p
=
data
();
while
(
l
>=
2
&&
PathTraitsFS
::
IsSeparator
(
p
[
l
-
1
]))
{
--
l
;
...
...
src/fs/AllocatedPath.hxx
View file @
eb174d5b
...
...
@@ -176,7 +176,7 @@ public:
* Allows the caller to "steal" the internal value by
* providing a rvalue reference to the std::string attribute.
*/
st
d
::
st
ring
&&
Steal
()
{
string
&&
Steal
()
{
return
std
::
move
(
value
);
}
...
...
src/fs/Charset.cxx
View file @
eb174d5b
...
...
@@ -22,7 +22,6 @@
#include "Domain.hxx"
#include "Limits.hxx"
#include "Log.hxx"
#include "Traits.hxx"
#include "lib/icu/Converter.hxx"
#include "util/Error.hxx"
...
...
@@ -73,13 +72,13 @@ GetFSCharset()
#endif
}
static
inline
std
::
string
&&
FixSeparators
(
std
::
string
&&
s
)
static
inline
PathTraitsUTF8
::
string
&&
FixSeparators
(
PathTraitsUTF8
::
string
&&
s
)
{
// For whatever reason GCC can't convert constexpr to value reference.
// This leads to link errors when passing separators directly.
auto
from
=
PathTraitsFS
::
SEPARATOR
;
auto
to
=
PathTraitsUTF8
::
SEPARATOR
;
decltype
(
to
)
from
=
PathTraitsFS
::
SEPARATOR
;
if
(
from
!=
to
)
/* convert backslash to slash on WIN32 */
...
...
@@ -88,8 +87,8 @@ FixSeparators(std::string &&s)
return
std
::
move
(
s
);
}
std
::
string
PathToUTF8
(
const
char
*
path_fs
)
PathTraitsUTF8
::
string
PathToUTF8
(
PathTraitsFS
::
const_pointer
path_fs
)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
...
...
@@ -108,8 +107,8 @@ PathToUTF8(const char *path_fs)
#ifdef HAVE_FS_CHARSET
std
::
string
PathFromUTF8
(
const
char
*
path_utf8
)
PathTraitsFS
::
string
PathFromUTF8
(
PathTraitsUTF8
::
const_pointer
path_utf8
)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
...
...
src/fs/Charset.hxx
View file @
eb174d5b
...
...
@@ -22,8 +22,7 @@
#include "check.h"
#include "Compiler.h"
#include <string>
#include "Traits.hxx"
#if defined(HAVE_ICU) || defined(HAVE_GLIB)
#define HAVE_FS_CHARSET
...
...
@@ -49,15 +48,15 @@ DeinitFSCharset();
* Returns empty string on error.
*/
gcc_pure
gcc_nonnull_all
std
::
string
PathToUTF8
(
const
char
*
path_fs
);
PathTraitsUTF8
::
string
PathToUTF8
(
PathTraitsFS
::
const_pointer
path_fs
);
/**
* Convert the path from UTF-8.
* Returns empty string on error.
*/
gcc_pure
gcc_nonnull_all
std
::
string
PathFromUTF8
(
const
char
*
path_utf8
);
PathTraitsFS
::
string
PathFromUTF8
(
PathTraitsUTF8
::
const_pointer
path_utf8
);
#endif
src/fs/Path.hxx
View file @
eb174d5b
...
...
@@ -42,7 +42,7 @@ class Path {
typedef
PathTraitsFS
::
pointer
pointer
;
typedef
PathTraitsFS
::
const_pointer
const_pointer
;
const
char
*
value
;
const
_pointer
value
;
constexpr
Path
(
const_pointer
_value
)
:
value
(
_value
)
{}
...
...
@@ -100,7 +100,7 @@ public:
size_t
length
()
const
{
assert
(
value
!=
nullptr
);
return
strlen
(
value
);
return
PathTraitsFS
::
GetLength
(
value
);
}
/**
...
...
@@ -153,7 +153,7 @@ public:
* nullptr on mismatch.
*/
gcc_pure
const
char
*
RelativeFS
(
const
char
*
other_fs
)
const
{
const
_pointer
RelativeFS
(
const_pointer
other_fs
)
const
{
return
PathTraitsFS
::
Relative
(
value
,
other_fs
);
}
...
...
src/fs/StandardDirectory.cxx
View file @
eb174d5b
...
...
@@ -112,7 +112,7 @@ static inline AllocatedPath SafePathFromFS(PathTraitsFS::const_pointer dir)
#ifdef WIN32
static
AllocatedPath
GetStandardDir
(
int
folder_id
)
{
std
::
array
<
char
,
MAX_PATH
>
dir
;
std
::
array
<
PathTraitsFS
::
value_type
,
MAX_PATH
>
dir
;
auto
ret
=
SHGetFolderPath
(
nullptr
,
folder_id
|
CSIDL_FLAG_DONT_VERIFY
,
nullptr
,
SHGFP_TYPE_CURRENT
,
dir
.
data
());
if
(
FAILED
(
ret
))
...
...
@@ -287,7 +287,7 @@ AllocatedPath GetSystemConfigDir()
AllocatedPath
GetAppBaseDir
()
{
std
::
array
<
char
,
MAX_PATH
>
app
;
std
::
array
<
PathTraitsFS
::
value_type
,
MAX_PATH
>
app
;
auto
ret
=
GetModuleFileName
(
nullptr
,
app
.
data
(),
app
.
size
());
// Check for error
...
...
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