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
9b854468
Commit
9b854468
authored
Apr 12, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/StringPointer: rename typedef pointer to pointer_type
parent
fd5d4283
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
116 additions
and
111 deletions
+116
-111
CommandLine.cxx
src/CommandLine.cxx
+2
-2
FileCommands.cxx
src/command/FileCommands.cxx
+1
-1
AllocatedPath.hxx
src/fs/AllocatedPath.hxx
+13
-13
Charset.cxx
src/fs/Charset.cxx
+2
-2
Charset.hxx
src/fs/Charset.hxx
+2
-2
DirectoryReader.hxx
src/fs/DirectoryReader.hxx
+3
-3
FileSystem.hxx
src/fs/FileSystem.hxx
+3
-3
NarrowPath.hxx
src/fs/NarrowPath.hxx
+3
-3
Path.cxx
src/fs/Path.cxx
+1
-1
Path.hxx
src/fs/Path.hxx
+6
-6
StandardDirectory.cxx
src/fs/StandardDirectory.cxx
+6
-3
Traits.cxx
src/fs/Traits.cxx
+24
-24
Traits.hxx
src/fs/Traits.hxx
+31
-29
LocalStorage.cxx
src/storage/plugins/LocalStorage.cxx
+1
-1
AllocatedString.cxx
src/util/AllocatedString.cxx
+1
-1
AllocatedString.hxx
src/util/AllocatedString.hxx
+12
-12
StringPointer.hxx
src/util/StringPointer.hxx
+5
-5
No files found.
src/CommandLine.cxx
View file @
9b854468
...
...
@@ -280,7 +280,7 @@ class ConfigLoader
public
:
bool
TryFile
(
const
Path
path
);
bool
TryFile
(
const
AllocatedPath
&
base_path
,
PathTraitsFS
::
const_pointer
path
);
PathTraitsFS
::
const_pointer
_type
path
);
};
bool
ConfigLoader
::
TryFile
(
Path
path
)
...
...
@@ -293,7 +293,7 @@ bool ConfigLoader::TryFile(Path path)
}
bool
ConfigLoader
::
TryFile
(
const
AllocatedPath
&
base_path
,
PathTraitsFS
::
const_pointer
path
)
PathTraitsFS
::
const_pointer
_type
path
)
{
if
(
base_path
.
IsNull
())
return
false
;
...
...
src/command/FileCommands.cxx
View file @
9b854468
...
...
@@ -45,7 +45,7 @@
gcc_pure
static
bool
SkipNameFS
(
PathTraitsFS
::
const_pointer
name_fs
)
SkipNameFS
(
PathTraitsFS
::
const_pointer
_type
name_fs
)
{
return
name_fs
[
0
]
==
'.'
&&
(
name_fs
[
1
]
==
0
||
...
...
src/fs/AllocatedPath.hxx
View file @
9b854468
...
...
@@ -40,18 +40,18 @@ class Error;
class
AllocatedPath
{
typedef
PathTraitsFS
::
string
string
;
typedef
PathTraitsFS
::
value_type
value_type
;
typedef
PathTraitsFS
::
pointer
pointer
;
typedef
PathTraitsFS
::
const_pointer
const_pointer
;
typedef
PathTraitsFS
::
pointer
_type
pointer_type
;
typedef
PathTraitsFS
::
const_pointer
_type
const_pointer_type
;
string
value
;
AllocatedPath
(
std
::
nullptr_t
)
:
value
()
{}
AllocatedPath
(
const_pointer
_value
)
:
value
(
_value
)
{}
AllocatedPath
(
const_pointer
_type
_value
)
:
value
(
_value
)
{}
AllocatedPath
(
string
&&
_value
)
:
value
(
std
::
move
(
_value
))
{}
static
AllocatedPath
Build
(
const_pointer
a
,
size_t
a_size
,
const_pointer
b
,
size_t
b_size
)
{
static
AllocatedPath
Build
(
const_pointer
_type
a
,
size_t
a_size
,
const_pointer
_type
b
,
size_t
b_size
)
{
return
AllocatedPath
(
PathTraitsFS
::
Build
(
a
,
a_size
,
b
,
b_size
));
}
public
:
...
...
@@ -89,13 +89,13 @@ public:
* Join two path components with the path separator.
*/
gcc_pure
gcc_nonnull_all
static
AllocatedPath
Build
(
const_pointer
a
,
const_pointer
b
)
{
static
AllocatedPath
Build
(
const_pointer
_type
a
,
const_pointer_type
b
)
{
return
Build
(
a
,
PathTraitsFS
::
GetLength
(
a
),
b
,
PathTraitsFS
::
GetLength
(
b
));
}
gcc_pure
gcc_nonnull_all
static
AllocatedPath
Build
(
Path
a
,
const_pointer
b
)
{
static
AllocatedPath
Build
(
Path
a
,
const_pointer
_type
b
)
{
return
Build
(
a
.
c_str
(),
b
);
}
...
...
@@ -105,13 +105,13 @@ public:
}
gcc_pure
gcc_nonnull_all
static
AllocatedPath
Build
(
const_pointer
a
,
const
AllocatedPath
&
b
)
{
static
AllocatedPath
Build
(
const_pointer
_type
a
,
const
AllocatedPath
&
b
)
{
return
Build
(
a
,
PathTraitsFS
::
GetLength
(
a
),
b
.
value
.
c_str
(),
b
.
value
.
size
());
}
gcc_pure
gcc_nonnull_all
static
AllocatedPath
Build
(
const
AllocatedPath
&
a
,
const_pointer
b
)
{
static
AllocatedPath
Build
(
const
AllocatedPath
&
a
,
const_pointer
_type
b
)
{
return
Build
(
a
.
value
.
c_str
(),
a
.
value
.
size
(),
b
,
PathTraitsFS
::
GetLength
(
b
));
}
...
...
@@ -128,7 +128,7 @@ public:
* character set to a #Path instance.
*/
gcc_pure
static
AllocatedPath
FromFS
(
const_pointer
fs
)
{
static
AllocatedPath
FromFS
(
const_pointer
_type
fs
)
{
return
AllocatedPath
(
fs
);
}
...
...
@@ -214,7 +214,7 @@ public:
* instance ends.
*/
gcc_pure
const_pointer
c_str
()
const
{
const_pointer
_type
c_str
()
const
{
return
value
.
c_str
();
}
...
...
@@ -223,7 +223,7 @@ public:
* null-terminated.
*/
gcc_pure
const_pointer
data
()
const
{
const_pointer
_type
data
()
const
{
return
value
.
data
();
}
...
...
@@ -249,7 +249,7 @@ public:
* nullptr on mismatch.
*/
gcc_pure
const_pointer
Relative
(
Path
other_fs
)
const
{
const_pointer
_type
Relative
(
Path
other_fs
)
const
{
return
PathTraitsFS
::
Relative
(
c_str
(),
other_fs
.
c_str
());
}
...
...
src/fs/Charset.cxx
View file @
9b854468
...
...
@@ -94,7 +94,7 @@ FixSeparators(PathTraitsUTF8::string &&s)
}
PathTraitsUTF8
::
string
PathToUTF8
(
PathTraitsFS
::
const_pointer
path_fs
)
PathToUTF8
(
PathTraitsFS
::
const_pointer
_type
path_fs
)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
...
...
@@ -126,7 +126,7 @@ PathToUTF8(PathTraitsFS::const_pointer path_fs)
#if defined(HAVE_FS_CHARSET) || defined(WIN32)
PathTraitsFS
::
string
PathFromUTF8
(
PathTraitsUTF8
::
const_pointer
path_utf8
)
PathFromUTF8
(
PathTraitsUTF8
::
const_pointer
_type
path_utf8
)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
...
...
src/fs/Charset.hxx
View file @
9b854468
...
...
@@ -49,7 +49,7 @@ DeinitFSCharset();
*/
gcc_pure
gcc_nonnull_all
PathTraitsUTF8
::
string
PathToUTF8
(
PathTraitsFS
::
const_pointer
path_fs
);
PathToUTF8
(
PathTraitsFS
::
const_pointer
_type
path_fs
);
/**
* Convert the path from UTF-8.
...
...
@@ -57,6 +57,6 @@ PathToUTF8(PathTraitsFS::const_pointer path_fs);
*/
gcc_pure
gcc_nonnull_all
PathTraitsFS
::
string
PathFromUTF8
(
PathTraitsUTF8
::
const_pointer
path_utf8
);
PathFromUTF8
(
PathTraitsUTF8
::
const_pointer
_type
path_utf8
);
#endif
src/fs/DirectoryReader.hxx
View file @
9b854468
...
...
@@ -37,10 +37,10 @@ class DirectoryReader {
bool
first
=
true
;
class
MakeWildcardPath
{
PathTraitsFS
::
pointer
path
;
PathTraitsFS
::
pointer
_type
path
;
public
:
MakeWildcardPath
(
PathTraitsFS
::
const_pointer
_path
)
{
MakeWildcardPath
(
PathTraitsFS
::
const_pointer
_type
_path
)
{
auto
l
=
_tcslen
(
_path
);
path
=
new
PathTraitsFS
::
value_type
[
l
+
3
];
_tcscpy
(
path
,
_path
);
...
...
@@ -53,7 +53,7 @@ class DirectoryReader {
delete
[]
path
;
}
operator
PathTraitsFS
::
const_pointer
()
const
{
operator
PathTraitsFS
::
const_pointer
_type
()
const
{
return
path
;
}
};
...
...
src/fs/FileSystem.hxx
View file @
9b854468
...
...
@@ -41,19 +41,19 @@ namespace FOpenMode {
/**
* Open mode for writing text files.
*/
constexpr
PathTraitsFS
::
const_pointer
WriteText
=
PATH_LITERAL
(
"w"
);
constexpr
PathTraitsFS
::
const_pointer
_type
WriteText
=
PATH_LITERAL
(
"w"
);
/**
* Open mode for appending text files.
*/
constexpr
PathTraitsFS
::
const_pointer
AppendText
=
PATH_LITERAL
(
"a"
);
constexpr
PathTraitsFS
::
const_pointer
_type
AppendText
=
PATH_LITERAL
(
"a"
);
}
/**
* Wrapper for fopen() that uses #Path names.
*/
static
inline
FILE
*
FOpen
(
Path
file
,
PathTraitsFS
::
const_pointer
mode
)
FOpen
(
Path
file
,
PathTraitsFS
::
const_pointer
_type
mode
)
{
#ifdef WIN32
return
_tfopen
(
file
.
c_str
(),
mode
);
...
...
src/fs/NarrowPath.hxx
View file @
9b854468
...
...
@@ -43,7 +43,7 @@ class NarrowPath {
#else
typedef
StringPointer
<>
Value
;
#endif
typedef
typename
Value
::
const_pointer
const_pointer
;
typedef
typename
Value
::
const_pointer
_type
const_pointer_type
;
Value
value
;
...
...
@@ -59,11 +59,11 @@ public:
explicit
NarrowPath
(
Path
_path
)
:
value
(
_path
.
c_str
())
{}
#endif
operator
const_pointer
()
const
{
operator
const_pointer
_type
()
const
{
return
c_str
();
}
const_pointer
c_str
()
const
{
const_pointer
_type
c_str
()
const
{
return
value
.
c_str
();
}
};
...
...
src/fs/Path.cxx
View file @
9b854468
...
...
@@ -27,7 +27,7 @@ Path::ToUTF8() const
return
::
PathToUTF8
(
c_str
());
}
Path
::
const_pointer
Path
::
const_pointer
_type
Path
::
GetSuffix
()
const
{
const
auto
base
=
GetBase
().
c_str
();
...
...
src/fs/Path.hxx
View file @
9b854468
...
...
@@ -39,7 +39,7 @@ class AllocatedPath;
class
Path
:
public
PathTraitsFS
::
Pointer
{
typedef
PathTraitsFS
::
Pointer
Base
;
constexpr
Path
(
const_pointer
_value
)
:
Base
(
_value
)
{}
constexpr
Path
(
const_pointer
_type
_value
)
:
Base
(
_value
)
{}
public
:
/**
...
...
@@ -61,7 +61,7 @@ public:
* Create a new instance pointing to the specified path
* string.
*/
static
constexpr
Path
FromFS
(
const_pointer
fs
)
{
static
constexpr
Path
FromFS
(
const_pointer
_type
fs
)
{
return
Path
(
fs
);
}
...
...
@@ -104,7 +104,7 @@ public:
* instance ends.
*/
gcc_pure
const_pointer
c_str
()
const
{
const_pointer
_type
c_str
()
const
{
return
Base
::
c_str
();
}
...
...
@@ -113,7 +113,7 @@ public:
* null-terminated.
*/
gcc_pure
const_pointer
data
()
const
{
const_pointer
_type
data
()
const
{
return
c_str
();
}
...
...
@@ -158,7 +158,7 @@ public:
* nullptr on mismatch.
*/
gcc_pure
const_pointer
Relative
(
Path
other_fs
)
const
{
const_pointer
_type
Relative
(
Path
other_fs
)
const
{
return
PathTraitsFS
::
Relative
(
c_str
(),
other_fs
.
c_str
());
}
...
...
@@ -168,7 +168,7 @@ public:
}
gcc_pure
const_pointer
GetSuffix
()
const
;
const_pointer
_type
GetSuffix
()
const
;
};
#endif
src/fs/StandardDirectory.cxx
View file @
9b854468
...
...
@@ -91,18 +91,21 @@ public:
};
#endif
static
inline
bool
IsValidPathString
(
PathTraitsFS
::
const_pointer
path
)
static
inline
bool
IsValidPathString
(
PathTraitsFS
::
const_pointer_type
path
)
{
return
path
!=
nullptr
&&
*
path
!=
'\0'
;
}
static
inline
bool
IsValidDir
(
PathTraitsFS
::
const_pointer
dir
)
static
inline
bool
IsValidDir
(
PathTraitsFS
::
const_pointer_type
dir
)
{
return
PathTraitsFS
::
IsAbsolute
(
dir
)
&&
DirectoryExists
(
Path
::
FromFS
(
dir
));
}
static
inline
AllocatedPath
SafePathFromFS
(
PathTraitsFS
::
const_pointer
dir
)
static
inline
AllocatedPath
SafePathFromFS
(
PathTraitsFS
::
const_pointer_type
dir
)
{
if
(
IsValidPathString
(
dir
)
&&
IsValidDir
(
dir
))
return
AllocatedPath
::
FromFS
(
dir
);
...
...
src/fs/Traits.cxx
View file @
9b854468
...
...
@@ -25,8 +25,8 @@
template
<
typename
Traits
>
typename
Traits
::
string
BuildPathImpl
(
typename
Traits
::
const_pointer
a
,
size_t
a_size
,
typename
Traits
::
const_pointer
b
,
size_t
b_size
)
BuildPathImpl
(
typename
Traits
::
const_pointer
_type
a
,
size_t
a_size
,
typename
Traits
::
const_pointer
_type
b
,
size_t
b_size
)
{
assert
(
a
!=
nullptr
);
assert
(
b
!=
nullptr
);
...
...
@@ -50,15 +50,15 @@ BuildPathImpl(typename Traits::const_pointer a, size_t a_size,
}
template
<
typename
Traits
>
typename
Traits
::
const_pointer
GetBasePathImpl
(
typename
Traits
::
const_pointer
p
)
typename
Traits
::
const_pointer
_type
GetBasePathImpl
(
typename
Traits
::
const_pointer
_type
p
)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
#endif
typename
Traits
::
const_pointer
sep
=
Traits
::
FindLastSeparator
(
p
);
typename
Traits
::
const_pointer
_type
sep
=
Traits
::
FindLastSeparator
(
p
);
return
sep
!=
nullptr
?
sep
+
1
:
p
;
...
...
@@ -66,14 +66,14 @@ GetBasePathImpl(typename Traits::const_pointer p)
template
<
typename
Traits
>
typename
Traits
::
string
GetParentPathImpl
(
typename
Traits
::
const_pointer
p
)
GetParentPathImpl
(
typename
Traits
::
const_pointer
_type
p
)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
#endif
typename
Traits
::
const_pointer
sep
=
Traits
::
FindLastSeparator
(
p
);
typename
Traits
::
const_pointer
_type
sep
=
Traits
::
FindLastSeparator
(
p
);
if
(
sep
==
nullptr
)
return
typename
Traits
::
string
(
Traits
::
CURRENT_DIRECTORY
);
if
(
sep
==
p
)
...
...
@@ -86,9 +86,9 @@ GetParentPathImpl(typename Traits::const_pointer p)
}
template
<
typename
Traits
>
typename
Traits
::
const_pointer
RelativePathImpl
(
typename
Traits
::
const_pointer
base
,
typename
Traits
::
const_pointer
other
)
typename
Traits
::
const_pointer
_type
RelativePathImpl
(
typename
Traits
::
const_pointer
_type
base
,
typename
Traits
::
const_pointer
_type
other
)
{
assert
(
base
!=
nullptr
);
assert
(
other
!=
nullptr
);
...
...
@@ -113,51 +113,51 @@ RelativePathImpl(typename Traits::const_pointer base,
}
PathTraitsFS
::
string
PathTraitsFS
::
Build
(
PathTraitsFS
::
const_pointer
a
,
size_t
a_size
,
PathTraitsFS
::
const_pointer
b
,
size_t
b_size
)
PathTraitsFS
::
Build
(
const_pointer_type
a
,
size_t
a_size
,
const_pointer_type
b
,
size_t
b_size
)
{
return
BuildPathImpl
<
PathTraitsFS
>
(
a
,
a_size
,
b
,
b_size
);
}
PathTraitsFS
::
const_pointer
PathTraitsFS
::
GetBase
(
PathTraitsFS
::
const_pointer
p
)
PathTraitsFS
::
const_pointer
_type
PathTraitsFS
::
GetBase
(
PathTraitsFS
::
const_pointer
_type
p
)
{
return
GetBasePathImpl
<
PathTraitsFS
>
(
p
);
}
PathTraitsFS
::
string
PathTraitsFS
::
GetParent
(
PathTraitsFS
::
const_pointer
p
)
PathTraitsFS
::
GetParent
(
PathTraitsFS
::
const_pointer
_type
p
)
{
return
GetParentPathImpl
<
PathTraitsFS
>
(
p
);
}
PathTraitsFS
::
const_pointer
PathTraitsFS
::
Relative
(
const_pointer
base
,
const_pointer
other
)
PathTraitsFS
::
const_pointer
_type
PathTraitsFS
::
Relative
(
const_pointer
_type
base
,
const_pointer_type
other
)
{
return
RelativePathImpl
<
PathTraitsFS
>
(
base
,
other
);
}
PathTraitsUTF8
::
string
PathTraitsUTF8
::
Build
(
PathTraitsUTF8
::
const_pointer
a
,
size_t
a_size
,
PathTraitsUTF8
::
const_pointer
b
,
size_t
b_size
)
PathTraitsUTF8
::
Build
(
const_pointer_type
a
,
size_t
a_size
,
const_pointer_type
b
,
size_t
b_size
)
{
return
BuildPathImpl
<
PathTraitsUTF8
>
(
a
,
a_size
,
b
,
b_size
);
}
PathTraitsUTF8
::
const_pointer
PathTraitsUTF8
::
GetBase
(
PathTraitsUTF8
::
const_pointer
p
)
PathTraitsUTF8
::
const_pointer
_type
PathTraitsUTF8
::
GetBase
(
const_pointer_type
p
)
{
return
GetBasePathImpl
<
PathTraitsUTF8
>
(
p
);
}
PathTraitsUTF8
::
string
PathTraitsUTF8
::
GetParent
(
PathTraitsUTF8
::
const_pointer
p
)
PathTraitsUTF8
::
GetParent
(
const_pointer_type
p
)
{
return
GetParentPathImpl
<
PathTraitsUTF8
>
(
p
);
}
PathTraitsUTF8
::
const_pointer
PathTraitsUTF8
::
Relative
(
const_pointer
base
,
const_pointer
other
)
PathTraitsUTF8
::
const_pointer
_type
PathTraitsUTF8
::
Relative
(
const_pointer
_type
base
,
const_pointer_type
other
)
{
return
RelativePathImpl
<
PathTraitsUTF8
>
(
base
,
other
);
}
src/fs/Traits.hxx
View file @
9b854468
...
...
@@ -52,8 +52,8 @@ struct PathTraitsFS {
typedef
string
::
traits_type
char_traits
;
typedef
char_traits
::
char_type
value_type
;
typedef
StringPointer
<
value_type
>
Pointer
;
typedef
Pointer
::
pointer
pointer
;
typedef
Pointer
::
const_pointer
const_pointer
;
typedef
Pointer
::
pointer
_type
pointer_type
;
typedef
Pointer
::
const_pointer
_type
const_pointer_type
;
#ifdef WIN32
static
constexpr
value_type
SEPARATOR
=
'\\'
;
...
...
@@ -61,7 +61,7 @@ struct PathTraitsFS {
static
constexpr
value_type
SEPARATOR
=
'/'
;
#endif
static
constexpr
const_pointer
CURRENT_DIRECTORY
=
PATH_LITERAL
(
"."
);
static
constexpr
const_pointer
_type
CURRENT_DIRECTORY
=
PATH_LITERAL
(
"."
);
static
constexpr
bool
IsSeparator
(
value_type
ch
)
{
return
...
...
@@ -72,14 +72,14 @@ struct PathTraitsFS {
}
gcc_pure
gcc_nonnull_all
static
const_pointer
FindLastSeparator
(
const_pointer
p
)
{
static
const_pointer
_type
FindLastSeparator
(
const_pointer_type
p
)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
#endif
#ifdef WIN32
const_pointer
pos
=
p
+
GetLength
(
p
);
const_pointer
_type
pos
=
p
+
GetLength
(
p
);
while
(
p
!=
pos
&&
!
IsSeparator
(
*
pos
))
--
pos
;
return
IsSeparator
(
*
pos
)
?
pos
:
nullptr
;
...
...
@@ -90,13 +90,13 @@ struct PathTraitsFS {
#ifdef WIN32
gcc_pure
gcc_nonnull_all
static
constexpr
bool
IsDrive
(
const_pointer
p
)
{
static
constexpr
bool
IsDrive
(
const_pointer
_type
p
)
{
return
IsAlphaASCII
(
p
[
0
])
&&
p
[
1
]
==
':'
;
}
#endif
gcc_pure
gcc_nonnull_all
static
bool
IsAbsolute
(
const_pointer
p
)
{
static
bool
IsAbsolute
(
const_pointer
_type
p
)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
...
...
@@ -110,12 +110,12 @@ struct PathTraitsFS {
}
gcc_pure
gcc_nonnull_all
static
size_t
GetLength
(
const_pointer
p
)
{
static
size_t
GetLength
(
const_pointer
_type
p
)
{
return
StringLength
(
p
);
}
gcc_pure
gcc_nonnull_all
static
const_pointer
Find
(
const_pointer
p
,
value_type
ch
)
{
static
const_pointer
_type
Find
(
const_pointer_type
p
,
value_type
ch
)
{
return
StringFind
(
p
,
ch
);
}
...
...
@@ -124,7 +124,7 @@ struct PathTraitsFS {
* The return value points inside the given string.
*/
gcc_pure
gcc_nonnull_all
static
const_pointer
GetBase
(
const_pointer
p
);
static
const_pointer
_type
GetBase
(
const_pointer_type
p
);
/**
* Determine the "parent" file name of the given native path.
...
...
@@ -132,7 +132,7 @@ struct PathTraitsFS {
* separator in the given input string.
*/
gcc_pure
gcc_nonnull_all
static
string
GetParent
(
const_pointer
p
);
static
string
GetParent
(
const_pointer
_type
p
);
/**
* Determine the relative part of the given path to this
...
...
@@ -141,7 +141,8 @@ struct PathTraitsFS {
* nullptr on mismatch.
*/
gcc_pure
gcc_nonnull_all
static
const_pointer
Relative
(
const_pointer
base
,
const_pointer
other
);
static
const_pointer_type
Relative
(
const_pointer_type
base
,
const_pointer_type
other
);
/**
* Constructs the path from the given components.
...
...
@@ -150,11 +151,11 @@ struct PathTraitsFS {
* If both components are empty strings, empty string is returned.
*/
gcc_pure
gcc_nonnull_all
static
string
Build
(
const_pointer
a
,
size_t
a_size
,
const_pointer
b
,
size_t
b_size
);
static
string
Build
(
const_pointer
_type
a
,
size_t
a_size
,
const_pointer
_type
b
,
size_t
b_size
);
gcc_pure
gcc_nonnull_all
static
string
Build
(
const_pointer
a
,
const_pointer
b
)
{
static
string
Build
(
const_pointer
_type
a
,
const_pointer_type
b
)
{
return
Build
(
a
,
GetLength
(
a
),
b
,
GetLength
(
b
));
}
};
...
...
@@ -166,19 +167,19 @@ struct PathTraitsUTF8 {
typedef
std
::
string
string
;
typedef
string
::
traits_type
char_traits
;
typedef
char_traits
::
char_type
value_type
;
typedef
value_type
*
pointer
;
typedef
const
value_type
*
const_pointer
;
typedef
value_type
*
pointer
_type
;
typedef
const
value_type
*
const_pointer
_type
;
static
constexpr
value_type
SEPARATOR
=
'/'
;
static
constexpr
const_pointer
CURRENT_DIRECTORY
=
"."
;
static
constexpr
const_pointer
_type
CURRENT_DIRECTORY
=
"."
;
static
constexpr
bool
IsSeparator
(
value_type
ch
)
{
return
ch
==
SEPARATOR
;
}
gcc_pure
gcc_nonnull_all
static
const_pointer
FindLastSeparator
(
const_pointer
p
)
{
static
const_pointer
_type
FindLastSeparator
(
const_pointer_type
p
)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
...
...
@@ -189,13 +190,13 @@ struct PathTraitsUTF8 {
#ifdef WIN32
gcc_pure
gcc_nonnull_all
static
constexpr
bool
IsDrive
(
const_pointer
p
)
{
static
constexpr
bool
IsDrive
(
const_pointer
_type
p
)
{
return
IsAlphaASCII
(
p
[
0
])
&&
p
[
1
]
==
':'
;
}
#endif
gcc_pure
gcc_nonnull_all
static
bool
IsAbsolute
(
const_pointer
p
)
{
static
bool
IsAbsolute
(
const_pointer
_type
p
)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
...
...
@@ -209,12 +210,12 @@ struct PathTraitsUTF8 {
}
gcc_pure
gcc_nonnull_all
static
size_t
GetLength
(
const_pointer
p
)
{
static
size_t
GetLength
(
const_pointer
_type
p
)
{
return
StringLength
(
p
);
}
gcc_pure
gcc_nonnull_all
static
const_pointer
Find
(
const_pointer
p
,
value_type
ch
)
{
static
const_pointer
_type
Find
(
const_pointer_type
p
,
value_type
ch
)
{
return
StringFind
(
p
,
ch
);
}
...
...
@@ -223,7 +224,7 @@ struct PathTraitsUTF8 {
* The return value points inside the given string.
*/
gcc_pure
gcc_nonnull_all
static
const_pointer
GetBase
(
const_pointer
p
);
static
const_pointer
_type
GetBase
(
const_pointer_type
p
);
/**
* Determine the "parent" file name of the given UTF-8 path.
...
...
@@ -231,7 +232,7 @@ struct PathTraitsUTF8 {
* separator in the given input string.
*/
gcc_pure
gcc_nonnull_all
static
string
GetParent
(
const_pointer
p
);
static
string
GetParent
(
const_pointer
_type
p
);
/**
* Determine the relative part of the given path to this
...
...
@@ -240,7 +241,8 @@ struct PathTraitsUTF8 {
* nullptr on mismatch.
*/
gcc_pure
gcc_nonnull_all
static
const_pointer
Relative
(
const_pointer
base
,
const_pointer
other
);
static
const_pointer_type
Relative
(
const_pointer_type
base
,
const_pointer_type
other
);
/**
* Constructs the path from the given components.
...
...
@@ -249,11 +251,11 @@ struct PathTraitsUTF8 {
* If both components are empty strings, empty string is returned.
*/
gcc_pure
gcc_nonnull_all
static
string
Build
(
const_pointer
a
,
size_t
a_size
,
const_pointer
b
,
size_t
b_size
);
static
string
Build
(
const_pointer
_type
a
,
size_t
a_size
,
const_pointer
_type
b
,
size_t
b_size
);
gcc_pure
gcc_nonnull_all
static
string
Build
(
const_pointer
a
,
const_pointer
b
)
{
static
string
Build
(
const_pointer
_type
a
,
const_pointer_type
b
)
{
return
Build
(
a
,
GetLength
(
a
),
b
,
GetLength
(
b
));
}
};
...
...
src/storage/plugins/LocalStorage.cxx
View file @
9b854468
...
...
@@ -161,7 +161,7 @@ LocalStorage::OpenDirectory(const char *uri_utf8, Error &error)
gcc_pure
static
bool
SkipNameFS
(
PathTraitsFS
::
const_pointer
name_fs
)
SkipNameFS
(
PathTraitsFS
::
const_pointer
_type
name_fs
)
{
return
name_fs
[
0
]
==
'.'
&&
(
name_fs
[
1
]
==
0
||
...
...
src/util/AllocatedString.cxx
View file @
9b854468
...
...
@@ -32,7 +32,7 @@
template
<>
AllocatedString
<
char
>
AllocatedString
<
char
>::
Duplicate
(
const_pointer
src
)
AllocatedString
<
char
>::
Duplicate
(
const_pointer
_type
src
)
{
return
Duplicate
(
src
,
StringLength
(
src
));
}
src/util/AllocatedString.hxx
View file @
9b854468
...
...
@@ -44,15 +44,15 @@ template<typename T=char>
class
AllocatedString
{
public
:
typedef
typename
StringPointer
<
T
>::
value_type
value_type
;
typedef
typename
StringPointer
<
T
>::
pointer
pointer
;
typedef
typename
StringPointer
<
T
>::
const_pointer
const_pointer
;
typedef
typename
StringPointer
<
T
>::
pointer
_type
pointer_type
;
typedef
typename
StringPointer
<
T
>::
const_pointer
_type
const_pointer_type
;
static
constexpr
value_type
SENTINEL
=
'\0'
;
private
:
pointer
value
;
pointer
_type
value
;
explicit
AllocatedString
(
pointer
_value
)
explicit
AllocatedString
(
pointer
_type
_value
)
:
value
(
_value
)
{}
public
:
...
...
@@ -65,7 +65,7 @@ public:
delete
[]
value
;
}
static
AllocatedString
Donate
(
pointer
value
)
{
static
AllocatedString
Donate
(
pointer
_type
value
)
{
return
AllocatedString
(
value
);
}
...
...
@@ -79,16 +79,16 @@ public:
return
Donate
(
p
);
}
static
AllocatedString
Duplicate
(
const_pointer
src
);
static
AllocatedString
Duplicate
(
const_pointer
_type
src
);
static
AllocatedString
Duplicate
(
const_pointer
begin
,
const_pointer
end
)
{
static
AllocatedString
Duplicate
(
const_pointer
_type
begin
,
const_pointer
_type
end
)
{
auto
p
=
new
value_type
[
end
-
begin
+
1
];
*
std
::
copy
(
begin
,
end
,
p
)
=
SENTINEL
;
return
Donate
(
p
);
}
static
AllocatedString
Duplicate
(
const_pointer
begin
,
static
AllocatedString
Duplicate
(
const_pointer
_type
begin
,
size_t
length
)
{
auto
p
=
new
value_type
[
length
+
1
];
*
std
::
copy_n
(
begin
,
length
,
p
)
=
SENTINEL
;
...
...
@@ -104,7 +104,7 @@ public:
return
value
==
nullptr
;
}
constexpr
const_pointer
c_str
()
const
{
constexpr
const_pointer
_type
c_str
()
const
{
return
value
;
}
...
...
@@ -112,8 +112,8 @@ public:
return
*
value
==
SENTINEL
;
}
pointer
Steal
()
{
pointer
result
=
value
;
pointer
_type
Steal
()
{
pointer
_type
result
=
value
;
value
=
nullptr
;
return
result
;
}
...
...
src/util/StringPointer.hxx
View file @
9b854468
...
...
@@ -37,17 +37,17 @@ template<typename T=char>
class
StringPointer
{
public
:
typedef
T
value_type
;
typedef
T
*
pointer
;
typedef
const
T
*
const_pointer
;
typedef
T
*
pointer
_type
;
typedef
const
T
*
const_pointer
_type
;
static
constexpr
value_type
SENTINEL
=
'\0'
;
private
:
const_pointer
value
;
const_pointer
_type
value
;
public
:
StringPointer
()
=
default
;
constexpr
StringPointer
(
const_pointer
_value
)
constexpr
StringPointer
(
const_pointer
_type
_value
)
:
value
(
_value
)
{}
/**
...
...
@@ -58,7 +58,7 @@ public:
return
value
==
nullptr
;
}
constexpr
const_pointer
c_str
()
const
{
constexpr
const_pointer
_type
c_str
()
const
{
return
value
;
}
...
...
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