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
4937d77c
Commit
4937d77c
authored
Jan 03, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/{Const,Writable}Buffer: drop "_type" from type names
Behave like STL.
parent
53f80531
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
176 additions
and
180 deletions
+176
-180
FileCommands.cxx
src/command/FileCommands.cxx
+1
-1
AllocatedPath.hxx
src/fs/AllocatedPath.hxx
+17
-19
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
+1
-1
LookupFile.cxx
src/fs/LookupFile.cxx
+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
+3
-3
Traits.cxx
src/fs/Traits.cxx
+26
-26
Traits.hxx
src/fs/Traits.hxx
+33
-33
Cancellable.hxx
src/lib/nfs/Cancellable.hxx
+2
-2
LocalStorage.cxx
src/storage/plugins/LocalStorage.cxx
+1
-1
NfsStorage.cxx
src/storage/plugins/NfsStorage.cxx
+1
-1
AllocatedString.cxx
src/util/AllocatedString.cxx
+2
-2
AllocatedString.hxx
src/util/AllocatedString.hxx
+12
-12
BindMethod.hxx
src/util/BindMethod.hxx
+4
-4
CircularBuffer.hxx
src/util/CircularBuffer.hxx
+3
-3
ConstBuffer.hxx
src/util/ConstBuffer.hxx
+16
-16
DynamicFifoBuffer.hxx
src/util/DynamicFifoBuffer.hxx
+4
-4
ForeignFifoBuffer.hxx
src/util/ForeignFifoBuffer.hxx
+3
-3
StringPointer.hxx
src/util/StringPointer.hxx
+5
-5
StringView.hxx
src/util/StringView.hxx
+6
-7
WritableBuffer.hxx
src/util/WritableBuffer.hxx
+16
-17
No files found.
src/command/FileCommands.cxx
View file @
4937d77c
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
gcc_pure
gcc_pure
static
bool
static
bool
SkipNameFS
(
PathTraitsFS
::
const_pointer
_type
name_fs
)
noexcept
SkipNameFS
(
PathTraitsFS
::
const_pointer
name_fs
)
noexcept
{
{
return
name_fs
[
0
]
==
'.'
&&
return
name_fs
[
0
]
==
'.'
&&
(
name_fs
[
1
]
==
0
||
(
name_fs
[
1
]
==
0
||
...
...
src/fs/AllocatedPath.hxx
View file @
4937d77c
...
@@ -38,23 +38,22 @@ class AllocatedPath {
...
@@ -38,23 +38,22 @@ class AllocatedPath {
using
Traits
=
PathTraitsFS
;
using
Traits
=
PathTraitsFS
;
typedef
Traits
::
string
string
;
typedef
Traits
::
string
string
;
typedef
Traits
::
value_type
value_type
;
typedef
Traits
::
value_type
value_type
;
typedef
Traits
::
pointer
_type
pointer_type
;
typedef
Traits
::
pointer
pointer
;
typedef
Traits
::
const_pointer
_type
const_pointer_type
;
typedef
Traits
::
const_pointer
const_pointer
;
string
value
;
string
value
;
explicit
AllocatedPath
(
const_pointer
_type
_value
)
noexcept
explicit
AllocatedPath
(
const_pointer
_value
)
noexcept
:
value
(
_value
)
{}
:
value
(
_value
)
{}
AllocatedPath
(
const_pointer_type
_begin
,
AllocatedPath
(
const_pointer
_begin
,
const_pointer
_end
)
noexcept
const_pointer_type
_end
)
noexcept
:
value
(
_begin
,
_end
)
{}
:
value
(
_begin
,
_end
)
{}
AllocatedPath
(
string
&&
_value
)
noexcept
AllocatedPath
(
string
&&
_value
)
noexcept
:
value
(
std
::
move
(
_value
))
{}
:
value
(
std
::
move
(
_value
))
{}
static
AllocatedPath
Build
(
const_pointer
_type
a
,
size_t
a_size
,
static
AllocatedPath
Build
(
const_pointer
a
,
size_t
a_size
,
const_pointer
_type
b
,
size_t
b_size
)
noexcept
{
const_pointer
b
,
size_t
b_size
)
noexcept
{
return
AllocatedPath
(
Traits
::
Build
(
a
,
a_size
,
b
,
b_size
));
return
AllocatedPath
(
Traits
::
Build
(
a
,
a_size
,
b
,
b_size
));
}
}
public
:
public
:
...
@@ -91,14 +90,13 @@ public:
...
@@ -91,14 +90,13 @@ public:
* Join two path components with the path separator.
* Join two path components with the path separator.
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
AllocatedPath
Build
(
const_pointer_type
a
,
static
AllocatedPath
Build
(
const_pointer
a
,
const_pointer
b
)
noexcept
{
const_pointer_type
b
)
noexcept
{
return
Build
(
a
,
Traits
::
GetLength
(
a
),
return
Build
(
a
,
Traits
::
GetLength
(
a
),
b
,
Traits
::
GetLength
(
b
));
b
,
Traits
::
GetLength
(
b
));
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
AllocatedPath
Build
(
Path
a
,
const_pointer
_type
b
)
noexcept
{
static
AllocatedPath
Build
(
Path
a
,
const_pointer
b
)
noexcept
{
return
Build
(
a
.
c_str
(),
b
);
return
Build
(
a
.
c_str
(),
b
);
}
}
...
@@ -108,7 +106,7 @@ public:
...
@@ -108,7 +106,7 @@ public:
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
AllocatedPath
Build
(
const_pointer
_type
a
,
static
AllocatedPath
Build
(
const_pointer
a
,
const
AllocatedPath
&
b
)
noexcept
{
const
AllocatedPath
&
b
)
noexcept
{
return
Build
(
a
,
Traits
::
GetLength
(
a
),
return
Build
(
a
,
Traits
::
GetLength
(
a
),
b
.
value
.
c_str
(),
b
.
value
.
size
());
b
.
value
.
c_str
(),
b
.
value
.
size
());
...
@@ -116,7 +114,7 @@ public:
...
@@ -116,7 +114,7 @@ public:
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
AllocatedPath
Build
(
const
AllocatedPath
&
a
,
static
AllocatedPath
Build
(
const
AllocatedPath
&
a
,
const_pointer
_type
b
)
noexcept
{
const_pointer
b
)
noexcept
{
return
Build
(
a
.
value
.
c_str
(),
a
.
value
.
size
(),
return
Build
(
a
.
value
.
c_str
(),
a
.
value
.
size
(),
b
,
Traits
::
GetLength
(
b
));
b
,
Traits
::
GetLength
(
b
));
}
}
...
@@ -138,13 +136,13 @@ public:
...
@@ -138,13 +136,13 @@ public:
* character set to a #Path instance.
* character set to a #Path instance.
*/
*/
gcc_pure
gcc_pure
static
AllocatedPath
FromFS
(
const_pointer
_type
fs
)
noexcept
{
static
AllocatedPath
FromFS
(
const_pointer
fs
)
noexcept
{
return
AllocatedPath
(
fs
);
return
AllocatedPath
(
fs
);
}
}
gcc_pure
gcc_pure
static
AllocatedPath
FromFS
(
const_pointer
_type
_begin
,
static
AllocatedPath
FromFS
(
const_pointer
_begin
,
const_pointer
_type
_end
)
noexcept
{
const_pointer
_end
)
noexcept
{
return
AllocatedPath
(
_begin
,
_end
);
return
AllocatedPath
(
_begin
,
_end
);
}
}
...
@@ -247,7 +245,7 @@ public:
...
@@ -247,7 +245,7 @@ public:
* instance ends.
* instance ends.
*/
*/
gcc_pure
gcc_pure
const_pointer
_type
c_str
()
const
noexcept
{
const_pointer
c_str
()
const
noexcept
{
return
value
.
c_str
();
return
value
.
c_str
();
}
}
...
@@ -256,7 +254,7 @@ public:
...
@@ -256,7 +254,7 @@ public:
* null-terminated.
* null-terminated.
*/
*/
gcc_pure
gcc_pure
const_pointer
_type
data
()
const
noexcept
{
const_pointer
data
()
const
noexcept
{
return
value
.
data
();
return
value
.
data
();
}
}
...
@@ -290,12 +288,12 @@ public:
...
@@ -290,12 +288,12 @@ public:
* nullptr on mismatch.
* nullptr on mismatch.
*/
*/
gcc_pure
gcc_pure
const_pointer
_type
Relative
(
Path
other_fs
)
const
noexcept
{
const_pointer
Relative
(
Path
other_fs
)
const
noexcept
{
return
Traits
::
Relative
(
c_str
(),
other_fs
.
c_str
());
return
Traits
::
Relative
(
c_str
(),
other_fs
.
c_str
());
}
}
gcc_pure
gcc_pure
const_pointer
_type
GetSuffix
()
const
noexcept
{
const_pointer
GetSuffix
()
const
noexcept
{
return
((
Path
)
*
this
).
GetSuffix
();
return
((
Path
)
*
this
).
GetSuffix
();
}
}
...
...
src/fs/Charset.cxx
View file @
4937d77c
...
@@ -91,7 +91,7 @@ FixSeparators(PathTraitsUTF8::string &&s)
...
@@ -91,7 +91,7 @@ FixSeparators(PathTraitsUTF8::string &&s)
}
}
PathTraitsUTF8
::
string
PathTraitsUTF8
::
string
PathToUTF8
(
PathTraitsFS
::
const_pointer
_type
path_fs
)
PathToUTF8
(
PathTraitsFS
::
const_pointer
path_fs
)
{
{
#if !CLANG_CHECK_VERSION(3,6)
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
/* disabled on clang due to -Wtautological-pointer-compare */
...
@@ -117,7 +117,7 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs)
...
@@ -117,7 +117,7 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs)
#if defined(HAVE_FS_CHARSET) || defined(_WIN32)
#if defined(HAVE_FS_CHARSET) || defined(_WIN32)
PathTraitsFS
::
string
PathTraitsFS
::
string
PathFromUTF8
(
PathTraitsUTF8
::
const_pointer
_type
path_utf8
)
PathFromUTF8
(
PathTraitsUTF8
::
const_pointer
path_utf8
)
{
{
#if !CLANG_CHECK_VERSION(3,6)
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
/* disabled on clang due to -Wtautological-pointer-compare */
...
...
src/fs/Charset.hxx
View file @
4937d77c
...
@@ -46,7 +46,7 @@ DeinitFSCharset() noexcept;
...
@@ -46,7 +46,7 @@ DeinitFSCharset() noexcept;
*/
*/
gcc_nonnull_all
gcc_nonnull_all
PathTraitsUTF8
::
string
PathTraitsUTF8
::
string
PathToUTF8
(
PathTraitsFS
::
const_pointer
_type
path_fs
);
PathToUTF8
(
PathTraitsFS
::
const_pointer
path_fs
);
/**
/**
* Convert the path from UTF-8.
* Convert the path from UTF-8.
...
@@ -55,6 +55,6 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs);
...
@@ -55,6 +55,6 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs);
*/
*/
gcc_nonnull_all
gcc_nonnull_all
PathTraitsFS
::
string
PathTraitsFS
::
string
PathFromUTF8
(
PathTraitsUTF8
::
const_pointer
_type
path_utf8
);
PathFromUTF8
(
PathTraitsUTF8
::
const_pointer
path_utf8
);
#endif
#endif
src/fs/DirectoryReader.hxx
View file @
4937d77c
...
@@ -36,10 +36,10 @@ class DirectoryReader {
...
@@ -36,10 +36,10 @@ class DirectoryReader {
bool
first
=
true
;
bool
first
=
true
;
class
MakeWildcardPath
{
class
MakeWildcardPath
{
PathTraitsFS
::
pointer
_type
path
;
PathTraitsFS
::
pointer
path
;
public
:
public
:
MakeWildcardPath
(
PathTraitsFS
::
const_pointer
_type
_path
)
{
MakeWildcardPath
(
PathTraitsFS
::
const_pointer
_path
)
{
auto
l
=
_tcslen
(
_path
);
auto
l
=
_tcslen
(
_path
);
path
=
new
PathTraitsFS
::
value_type
[
l
+
3
];
path
=
new
PathTraitsFS
::
value_type
[
l
+
3
];
_tcscpy
(
path
,
_path
);
_tcscpy
(
path
,
_path
);
...
@@ -52,7 +52,7 @@ class DirectoryReader {
...
@@ -52,7 +52,7 @@ class DirectoryReader {
delete
[]
path
;
delete
[]
path
;
}
}
operator
PathTraitsFS
::
const_pointer
_type
()
const
{
operator
PathTraitsFS
::
const_pointer
()
const
{
return
path
;
return
path
;
}
}
};
};
...
...
src/fs/FileSystem.hxx
View file @
4937d77c
...
@@ -39,7 +39,7 @@ class AllocatedPath;
...
@@ -39,7 +39,7 @@ class AllocatedPath;
* Wrapper for fopen() that uses #Path names.
* Wrapper for fopen() that uses #Path names.
*/
*/
static
inline
FILE
*
static
inline
FILE
*
FOpen
(
Path
file
,
PathTraitsFS
::
const_pointer
_type
mode
)
FOpen
(
Path
file
,
PathTraitsFS
::
const_pointer
mode
)
{
{
#ifdef _WIN32
#ifdef _WIN32
return
_tfopen
(
file
.
c_str
(),
mode
);
return
_tfopen
(
file
.
c_str
(),
mode
);
...
...
src/fs/LookupFile.cxx
View file @
4937d77c
...
@@ -22,8 +22,8 @@
...
@@ -22,8 +22,8 @@
#include "system/Error.hxx"
#include "system/Error.hxx"
gcc_pure
gcc_pure
static
PathTraitsFS
::
pointer
_type
static
PathTraitsFS
::
pointer
FindSlash
(
PathTraitsFS
::
pointer
_type
p
,
size_t
i
)
noexcept
FindSlash
(
PathTraitsFS
::
pointer
p
,
size_t
i
)
noexcept
{
{
for
(;
i
>
0
;
--
i
)
for
(;
i
>
0
;
--
i
)
if
(
p
[
i
]
==
'/'
)
if
(
p
[
i
]
==
'/'
)
...
@@ -38,7 +38,7 @@ LookupFile(Path pathname)
...
@@ -38,7 +38,7 @@ LookupFile(Path pathname)
PathTraitsFS
::
string
buffer
(
pathname
.
c_str
());
PathTraitsFS
::
string
buffer
(
pathname
.
c_str
());
size_t
idx
=
buffer
.
size
();
size_t
idx
=
buffer
.
size
();
PathTraitsFS
::
pointer
_type
slash
=
nullptr
;
PathTraitsFS
::
pointer
slash
=
nullptr
;
while
(
true
)
{
while
(
true
)
{
try
{
try
{
...
...
src/fs/NarrowPath.hxx
View file @
4937d77c
...
@@ -41,7 +41,7 @@ class NarrowPath {
...
@@ -41,7 +41,7 @@ class NarrowPath {
#else
#else
typedef
StringPointer
<>
Value
;
typedef
StringPointer
<>
Value
;
#endif
#endif
typedef
typename
Value
::
const_pointer
_type
const_pointer_type
;
typedef
typename
Value
::
const_pointer
const_pointer
;
Value
value
;
Value
value
;
...
@@ -57,11 +57,11 @@ public:
...
@@ -57,11 +57,11 @@ public:
explicit
NarrowPath
(
Path
_path
)
:
value
(
_path
.
c_str
())
{}
explicit
NarrowPath
(
Path
_path
)
:
value
(
_path
.
c_str
())
{}
#endif
#endif
operator
const_pointer
_type
()
const
{
operator
const_pointer
()
const
{
return
c_str
();
return
c_str
();
}
}
const_pointer
_type
c_str
()
const
{
const_pointer
c_str
()
const
{
return
value
.
c_str
();
return
value
.
c_str
();
}
}
};
};
...
...
src/fs/Path.cxx
View file @
4937d77c
...
@@ -36,7 +36,7 @@ Path::ToUTF8Throw() const
...
@@ -36,7 +36,7 @@ Path::ToUTF8Throw() const
return
::
PathToUTF8
(
c_str
());
return
::
PathToUTF8
(
c_str
());
}
}
Path
::
const_pointer
_type
Path
::
const_pointer
Path
::
GetSuffix
()
const
noexcept
Path
::
GetSuffix
()
const
noexcept
{
{
const
auto
base
=
GetBase
().
c_str
();
const
auto
base
=
GetBase
().
c_str
();
...
...
src/fs/Path.hxx
View file @
4937d77c
...
@@ -39,7 +39,7 @@ class Path : public PathTraitsFS::Pointer {
...
@@ -39,7 +39,7 @@ class Path : public PathTraitsFS::Pointer {
using
Traits
=
PathTraitsFS
;
using
Traits
=
PathTraitsFS
;
typedef
Traits
::
Pointer
Base
;
typedef
Traits
::
Pointer
Base
;
constexpr
Path
(
const_pointer
_type
_value
)
noexcept
:
Base
(
_value
)
{}
constexpr
Path
(
const_pointer
_value
)
noexcept
:
Base
(
_value
)
{}
public
:
public
:
/**
/**
...
@@ -59,7 +59,7 @@ public:
...
@@ -59,7 +59,7 @@ public:
* Create a new instance pointing to the specified path
* Create a new instance pointing to the specified path
* string.
* string.
*/
*/
static
constexpr
Path
FromFS
(
const_pointer
_type
fs
)
noexcept
{
static
constexpr
Path
FromFS
(
const_pointer
fs
)
noexcept
{
return
Path
(
fs
);
return
Path
(
fs
);
}
}
...
@@ -101,7 +101,7 @@ public:
...
@@ -101,7 +101,7 @@ public:
* pointer is invalidated whenever the value of life of this
* pointer is invalidated whenever the value of life of this
* instance ends.
* instance ends.
*/
*/
constexpr
const_pointer
_type
c_str
()
const
noexcept
{
constexpr
const_pointer
c_str
()
const
noexcept
{
return
Base
::
c_str
();
return
Base
::
c_str
();
}
}
...
@@ -109,7 +109,7 @@ public:
...
@@ -109,7 +109,7 @@ public:
* Returns a pointer to the raw value, not necessarily
* Returns a pointer to the raw value, not necessarily
* null-terminated.
* null-terminated.
*/
*/
constexpr
const_pointer
_type
data
()
const
noexcept
{
constexpr
const_pointer
data
()
const
noexcept
{
return
c_str
();
return
c_str
();
}
}
...
@@ -159,7 +159,7 @@ public:
...
@@ -159,7 +159,7 @@ public:
* nullptr on mismatch.
* nullptr on mismatch.
*/
*/
gcc_pure
gcc_pure
const_pointer
_type
Relative
(
Path
other_fs
)
const
noexcept
{
const_pointer
Relative
(
Path
other_fs
)
const
noexcept
{
return
Traits
::
Relative
(
c_str
(),
other_fs
.
c_str
());
return
Traits
::
Relative
(
c_str
(),
other_fs
.
c_str
());
}
}
...
@@ -169,7 +169,7 @@ public:
...
@@ -169,7 +169,7 @@ public:
}
}
gcc_pure
gcc_pure
const_pointer
_type
GetSuffix
()
const
noexcept
;
const_pointer
GetSuffix
()
const
noexcept
;
};
};
/**
/**
...
...
src/fs/StandardDirectory.cxx
View file @
4937d77c
...
@@ -87,20 +87,20 @@ public:
...
@@ -87,20 +87,20 @@ public:
#ifndef ANDROID
#ifndef ANDROID
static
inline
bool
static
inline
bool
IsValidPathString
(
PathTraitsFS
::
const_pointer
_type
path
)
IsValidPathString
(
PathTraitsFS
::
const_pointer
path
)
{
{
return
path
!=
nullptr
&&
*
path
!=
'\0'
;
return
path
!=
nullptr
&&
*
path
!=
'\0'
;
}
}
static
inline
bool
static
inline
bool
IsValidDir
(
PathTraitsFS
::
const_pointer
_type
dir
)
IsValidDir
(
PathTraitsFS
::
const_pointer
dir
)
{
{
return
PathTraitsFS
::
IsAbsolute
(
dir
)
&&
return
PathTraitsFS
::
IsAbsolute
(
dir
)
&&
DirectoryExists
(
Path
::
FromFS
(
dir
));
DirectoryExists
(
Path
::
FromFS
(
dir
));
}
}
static
inline
AllocatedPath
static
inline
AllocatedPath
SafePathFromFS
(
PathTraitsFS
::
const_pointer
_type
dir
)
SafePathFromFS
(
PathTraitsFS
::
const_pointer
dir
)
{
{
if
(
IsValidPathString
(
dir
)
&&
IsValidDir
(
dir
))
if
(
IsValidPathString
(
dir
)
&&
IsValidDir
(
dir
))
return
AllocatedPath
::
FromFS
(
dir
);
return
AllocatedPath
::
FromFS
(
dir
);
...
...
src/fs/Traits.cxx
View file @
4937d77c
...
@@ -24,8 +24,8 @@
...
@@ -24,8 +24,8 @@
template
<
typename
Traits
>
template
<
typename
Traits
>
typename
Traits
::
string
typename
Traits
::
string
BuildPathImpl
(
typename
Traits
::
const_pointer
_type
a
,
size_t
a_size
,
BuildPathImpl
(
typename
Traits
::
const_pointer
a
,
size_t
a_size
,
typename
Traits
::
const_pointer
_type
b
,
size_t
b_size
)
noexcept
typename
Traits
::
const_pointer
b
,
size_t
b_size
)
noexcept
{
{
assert
(
a
!=
nullptr
);
assert
(
a
!=
nullptr
);
assert
(
b
!=
nullptr
);
assert
(
b
!=
nullptr
);
...
@@ -52,15 +52,15 @@ BuildPathImpl(typename Traits::const_pointer_type a, size_t a_size,
...
@@ -52,15 +52,15 @@ BuildPathImpl(typename Traits::const_pointer_type a, size_t a_size,
}
}
template
<
typename
Traits
>
template
<
typename
Traits
>
typename
Traits
::
const_pointer
_type
typename
Traits
::
const_pointer
GetBasePathImpl
(
typename
Traits
::
const_pointer
_type
p
)
noexcept
GetBasePathImpl
(
typename
Traits
::
const_pointer
p
)
noexcept
{
{
#if !CLANG_CHECK_VERSION(3,6)
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
assert
(
p
!=
nullptr
);
#endif
#endif
typename
Traits
::
const_pointer
_type
sep
=
Traits
::
FindLastSeparator
(
p
);
typename
Traits
::
const_pointer
sep
=
Traits
::
FindLastSeparator
(
p
);
return
sep
!=
nullptr
return
sep
!=
nullptr
?
sep
+
1
?
sep
+
1
:
p
;
:
p
;
...
@@ -68,14 +68,14 @@ GetBasePathImpl(typename Traits::const_pointer_type p) noexcept
...
@@ -68,14 +68,14 @@ GetBasePathImpl(typename Traits::const_pointer_type p) noexcept
template
<
typename
Traits
>
template
<
typename
Traits
>
typename
Traits
::
string
typename
Traits
::
string
GetParentPathImpl
(
typename
Traits
::
const_pointer
_type
p
)
noexcept
GetParentPathImpl
(
typename
Traits
::
const_pointer
p
)
noexcept
{
{
#if !CLANG_CHECK_VERSION(3,6)
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
assert
(
p
!=
nullptr
);
#endif
#endif
typename
Traits
::
const_pointer
_type
sep
=
Traits
::
FindLastSeparator
(
p
);
typename
Traits
::
const_pointer
sep
=
Traits
::
FindLastSeparator
(
p
);
if
(
sep
==
nullptr
)
if
(
sep
==
nullptr
)
return
typename
Traits
::
string
(
Traits
::
CURRENT_DIRECTORY
);
return
typename
Traits
::
string
(
Traits
::
CURRENT_DIRECTORY
);
if
(
sep
==
p
)
if
(
sep
==
p
)
...
@@ -88,9 +88,9 @@ GetParentPathImpl(typename Traits::const_pointer_type p) noexcept
...
@@ -88,9 +88,9 @@ GetParentPathImpl(typename Traits::const_pointer_type p) noexcept
}
}
template
<
typename
Traits
>
template
<
typename
Traits
>
typename
Traits
::
const_pointer
_type
typename
Traits
::
const_pointer
RelativePathImpl
(
typename
Traits
::
const_pointer
_type
base
,
RelativePathImpl
(
typename
Traits
::
const_pointer
base
,
typename
Traits
::
const_pointer
_type
other
)
noexcept
typename
Traits
::
const_pointer
other
)
noexcept
{
{
assert
(
base
!=
nullptr
);
assert
(
base
!=
nullptr
);
assert
(
other
!=
nullptr
);
assert
(
other
!=
nullptr
);
...
@@ -122,32 +122,32 @@ RelativePathImpl(typename Traits::const_pointer_type base,
...
@@ -122,32 +122,32 @@ RelativePathImpl(typename Traits::const_pointer_type base,
}
}
PathTraitsFS
::
string
PathTraitsFS
::
string
PathTraitsFS
::
Build
(
const_pointer
_type
a
,
size_t
a_size
,
PathTraitsFS
::
Build
(
const_pointer
a
,
size_t
a_size
,
const_pointer
_type
b
,
size_t
b_size
)
noexcept
const_pointer
b
,
size_t
b_size
)
noexcept
{
{
return
BuildPathImpl
<
PathTraitsFS
>
(
a
,
a_size
,
b
,
b_size
);
return
BuildPathImpl
<
PathTraitsFS
>
(
a
,
a_size
,
b
,
b_size
);
}
}
PathTraitsFS
::
const_pointer
_type
PathTraitsFS
::
const_pointer
PathTraitsFS
::
GetBase
(
PathTraitsFS
::
const_pointer
_type
p
)
noexcept
PathTraitsFS
::
GetBase
(
PathTraitsFS
::
const_pointer
p
)
noexcept
{
{
return
GetBasePathImpl
<
PathTraitsFS
>
(
p
);
return
GetBasePathImpl
<
PathTraitsFS
>
(
p
);
}
}
PathTraitsFS
::
string
PathTraitsFS
::
string
PathTraitsFS
::
GetParent
(
PathTraitsFS
::
const_pointer
_type
p
)
noexcept
PathTraitsFS
::
GetParent
(
PathTraitsFS
::
const_pointer
p
)
noexcept
{
{
return
GetParentPathImpl
<
PathTraitsFS
>
(
p
);
return
GetParentPathImpl
<
PathTraitsFS
>
(
p
);
}
}
PathTraitsFS
::
const_pointer
_type
PathTraitsFS
::
const_pointer
PathTraitsFS
::
Relative
(
const_pointer
_type
base
,
const_pointer_type
other
)
noexcept
PathTraitsFS
::
Relative
(
const_pointer
base
,
const_pointer
other
)
noexcept
{
{
return
RelativePathImpl
<
PathTraitsFS
>
(
base
,
other
);
return
RelativePathImpl
<
PathTraitsFS
>
(
base
,
other
);
}
}
PathTraitsFS
::
string
PathTraitsFS
::
string
PathTraitsFS
::
Apply
(
const_pointer
_type
base
,
const_pointer_type
path
)
noexcept
PathTraitsFS
::
Apply
(
const_pointer
base
,
const_pointer
path
)
noexcept
{
{
// TODO: support the Windows syntax (absolute path with or without drive, drive with relative path)
// TODO: support the Windows syntax (absolute path with or without drive, drive with relative path)
...
@@ -161,27 +161,27 @@ PathTraitsFS::Apply(const_pointer_type base, const_pointer_type path) noexcept
...
@@ -161,27 +161,27 @@ PathTraitsFS::Apply(const_pointer_type base, const_pointer_type path) noexcept
}
}
PathTraitsUTF8
::
string
PathTraitsUTF8
::
string
PathTraitsUTF8
::
Build
(
const_pointer
_type
a
,
size_t
a_size
,
PathTraitsUTF8
::
Build
(
const_pointer
a
,
size_t
a_size
,
const_pointer
_type
b
,
size_t
b_size
)
noexcept
const_pointer
b
,
size_t
b_size
)
noexcept
{
{
return
BuildPathImpl
<
PathTraitsUTF8
>
(
a
,
a_size
,
b
,
b_size
);
return
BuildPathImpl
<
PathTraitsUTF8
>
(
a
,
a_size
,
b
,
b_size
);
}
}
PathTraitsUTF8
::
const_pointer
_type
PathTraitsUTF8
::
const_pointer
PathTraitsUTF8
::
GetBase
(
const_pointer
_type
p
)
noexcept
PathTraitsUTF8
::
GetBase
(
const_pointer
p
)
noexcept
{
{
return
GetBasePathImpl
<
PathTraitsUTF8
>
(
p
);
return
GetBasePathImpl
<
PathTraitsUTF8
>
(
p
);
}
}
PathTraitsUTF8
::
string
PathTraitsUTF8
::
string
PathTraitsUTF8
::
GetParent
(
const_pointer
_type
p
)
noexcept
PathTraitsUTF8
::
GetParent
(
const_pointer
p
)
noexcept
{
{
return
GetParentPathImpl
<
PathTraitsUTF8
>
(
p
);
return
GetParentPathImpl
<
PathTraitsUTF8
>
(
p
);
}
}
PathTraitsUTF8
::
const_pointer
_type
PathTraitsUTF8
::
const_pointer
PathTraitsUTF8
::
Relative
(
const_pointer
_type
base
,
PathTraitsUTF8
::
Relative
(
const_pointer
base
,
const_pointer
_type
other
)
noexcept
const_pointer
other
)
noexcept
{
{
return
RelativePathImpl
<
PathTraitsUTF8
>
(
base
,
other
);
return
RelativePathImpl
<
PathTraitsUTF8
>
(
base
,
other
);
}
}
src/fs/Traits.hxx
View file @
4937d77c
...
@@ -51,8 +51,8 @@ struct PathTraitsFS {
...
@@ -51,8 +51,8 @@ struct PathTraitsFS {
typedef
string
::
traits_type
char_traits
;
typedef
string
::
traits_type
char_traits
;
typedef
char_traits
::
char_type
value_type
;
typedef
char_traits
::
char_type
value_type
;
typedef
StringPointer
<
value_type
>
Pointer
;
typedef
StringPointer
<
value_type
>
Pointer
;
typedef
Pointer
::
pointer
_type
pointer_type
;
typedef
Pointer
::
pointer
pointer
;
typedef
Pointer
::
const_pointer
_type
const_pointer_type
;
typedef
Pointer
::
const_pointer
const_pointer
;
#ifdef _WIN32
#ifdef _WIN32
static
constexpr
value_type
SEPARATOR
=
'\\'
;
static
constexpr
value_type
SEPARATOR
=
'\\'
;
...
@@ -60,7 +60,7 @@ struct PathTraitsFS {
...
@@ -60,7 +60,7 @@ struct PathTraitsFS {
static
constexpr
value_type
SEPARATOR
=
'/'
;
static
constexpr
value_type
SEPARATOR
=
'/'
;
#endif
#endif
static
constexpr
const_pointer
_type
CURRENT_DIRECTORY
=
PATH_LITERAL
(
"."
);
static
constexpr
const_pointer
CURRENT_DIRECTORY
=
PATH_LITERAL
(
"."
);
static
constexpr
bool
IsSeparator
(
value_type
ch
)
noexcept
{
static
constexpr
bool
IsSeparator
(
value_type
ch
)
noexcept
{
return
return
...
@@ -71,14 +71,14 @@ struct PathTraitsFS {
...
@@ -71,14 +71,14 @@ struct PathTraitsFS {
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
const_pointer
_type
FindLastSeparator
(
const_pointer_type
p
)
noexcept
{
static
const_pointer
FindLastSeparator
(
const_pointer
p
)
noexcept
{
#if !CLANG_CHECK_VERSION(3,6)
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
assert
(
p
!=
nullptr
);
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
const_pointer
_type
pos
=
p
+
GetLength
(
p
);
const_pointer
pos
=
p
+
GetLength
(
p
);
while
(
p
!=
pos
&&
!
IsSeparator
(
*
pos
))
while
(
p
!=
pos
&&
!
IsSeparator
(
*
pos
))
--
pos
;
--
pos
;
return
IsSeparator
(
*
pos
)
?
pos
:
nullptr
;
return
IsSeparator
(
*
pos
)
?
pos
:
nullptr
;
...
@@ -89,13 +89,13 @@ struct PathTraitsFS {
...
@@ -89,13 +89,13 @@ struct PathTraitsFS {
#ifdef _WIN32
#ifdef _WIN32
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
constexpr
bool
IsDrive
(
const_pointer
_type
p
)
noexcept
{
static
constexpr
bool
IsDrive
(
const_pointer
p
)
noexcept
{
return
IsAlphaASCII
(
p
[
0
])
&&
p
[
1
]
==
':'
;
return
IsAlphaASCII
(
p
[
0
])
&&
p
[
1
]
==
':'
;
}
}
#endif
#endif
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
bool
IsAbsolute
(
const_pointer
_type
p
)
noexcept
{
static
bool
IsAbsolute
(
const_pointer
p
)
noexcept
{
#if !CLANG_CHECK_VERSION(3,6)
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
assert
(
p
!=
nullptr
);
...
@@ -109,12 +109,12 @@ struct PathTraitsFS {
...
@@ -109,12 +109,12 @@ struct PathTraitsFS {
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
size_t
GetLength
(
const_pointer
_type
p
)
noexcept
{
static
size_t
GetLength
(
const_pointer
p
)
noexcept
{
return
StringLength
(
p
);
return
StringLength
(
p
);
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
const_pointer
_type
Find
(
const_pointer_type
p
,
value_type
ch
)
noexcept
{
static
const_pointer
Find
(
const_pointer
p
,
value_type
ch
)
noexcept
{
return
StringFind
(
p
,
ch
);
return
StringFind
(
p
,
ch
);
}
}
...
@@ -123,7 +123,7 @@ struct PathTraitsFS {
...
@@ -123,7 +123,7 @@ struct PathTraitsFS {
* The return value points inside the given string.
* The return value points inside the given string.
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
const_pointer
_type
GetBase
(
const_pointer_type
p
)
noexcept
;
static
const_pointer
GetBase
(
const_pointer
p
)
noexcept
;
/**
/**
* Determine the "parent" file name of the given native path.
* Determine the "parent" file name of the given native path.
...
@@ -131,7 +131,7 @@ struct PathTraitsFS {
...
@@ -131,7 +131,7 @@ struct PathTraitsFS {
* separator in the given input string.
* separator in the given input string.
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
string
GetParent
(
const_pointer
_type
p
)
noexcept
;
static
string
GetParent
(
const_pointer
p
)
noexcept
;
/**
/**
* Determine the relative part of the given path to this
* Determine the relative part of the given path to this
...
@@ -140,8 +140,8 @@ struct PathTraitsFS {
...
@@ -140,8 +140,8 @@ struct PathTraitsFS {
* nullptr on mismatch.
* nullptr on mismatch.
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
const_pointer
_type
Relative
(
const_pointer_type
base
,
static
const_pointer
Relative
(
const_pointer
base
,
const_pointer_type
other
)
noexcept
;
const_pointer
other
)
noexcept
;
/**
/**
* Constructs the path from the given components.
* Constructs the path from the given components.
...
@@ -150,11 +150,11 @@ struct PathTraitsFS {
...
@@ -150,11 +150,11 @@ struct PathTraitsFS {
* If both components are empty strings, empty string is returned.
* If both components are empty strings, empty string is returned.
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
string
Build
(
const_pointer
_type
a
,
size_t
a_size
,
static
string
Build
(
const_pointer
a
,
size_t
a_size
,
const_pointer
_type
b
,
size_t
b_size
)
noexcept
;
const_pointer
b
,
size_t
b_size
)
noexcept
;
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
string
Build
(
const_pointer
_type
a
,
const_pointer_type
b
)
noexcept
{
static
string
Build
(
const_pointer
a
,
const_pointer
b
)
noexcept
{
return
Build
(
a
,
GetLength
(
a
),
b
,
GetLength
(
b
));
return
Build
(
a
,
GetLength
(
a
),
b
,
GetLength
(
b
));
}
}
...
@@ -163,8 +163,8 @@ struct PathTraitsFS {
...
@@ -163,8 +163,8 @@ struct PathTraitsFS {
* base, and return the concatenated path.
* base, and return the concatenated path.
*/
*/
gcc_pure
gcc_pure
static
string
Apply
(
const_pointer
_type
base
,
static
string
Apply
(
const_pointer
base
,
const_pointer
_type
path
)
noexcept
;
const_pointer
path
)
noexcept
;
};
};
/**
/**
...
@@ -174,19 +174,19 @@ struct PathTraitsUTF8 {
...
@@ -174,19 +174,19 @@ struct PathTraitsUTF8 {
typedef
std
::
string
string
;
typedef
std
::
string
string
;
typedef
string
::
traits_type
char_traits
;
typedef
string
::
traits_type
char_traits
;
typedef
char_traits
::
char_type
value_type
;
typedef
char_traits
::
char_type
value_type
;
typedef
value_type
*
pointer
_type
;
typedef
value_type
*
pointer
;
typedef
const
value_type
*
const_pointer
_type
;
typedef
const
value_type
*
const_pointer
;
static
constexpr
value_type
SEPARATOR
=
'/'
;
static
constexpr
value_type
SEPARATOR
=
'/'
;
static
constexpr
const_pointer
_type
CURRENT_DIRECTORY
=
"."
;
static
constexpr
const_pointer
CURRENT_DIRECTORY
=
"."
;
static
constexpr
bool
IsSeparator
(
value_type
ch
)
{
static
constexpr
bool
IsSeparator
(
value_type
ch
)
{
return
ch
==
SEPARATOR
;
return
ch
==
SEPARATOR
;
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
const_pointer
_type
FindLastSeparator
(
const_pointer_type
p
)
noexcept
{
static
const_pointer
FindLastSeparator
(
const_pointer
p
)
noexcept
{
#if !CLANG_CHECK_VERSION(3,6)
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
assert
(
p
!=
nullptr
);
...
@@ -197,13 +197,13 @@ struct PathTraitsUTF8 {
...
@@ -197,13 +197,13 @@ struct PathTraitsUTF8 {
#ifdef _WIN32
#ifdef _WIN32
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
constexpr
bool
IsDrive
(
const_pointer
_type
p
)
noexcept
{
static
constexpr
bool
IsDrive
(
const_pointer
p
)
noexcept
{
return
IsAlphaASCII
(
p
[
0
])
&&
p
[
1
]
==
':'
;
return
IsAlphaASCII
(
p
[
0
])
&&
p
[
1
]
==
':'
;
}
}
#endif
#endif
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
bool
IsAbsolute
(
const_pointer
_type
p
)
noexcept
{
static
bool
IsAbsolute
(
const_pointer
p
)
noexcept
{
#if !CLANG_CHECK_VERSION(3,6)
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
p
!=
nullptr
);
assert
(
p
!=
nullptr
);
...
@@ -217,12 +217,12 @@ struct PathTraitsUTF8 {
...
@@ -217,12 +217,12 @@ struct PathTraitsUTF8 {
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
size_t
GetLength
(
const_pointer
_type
p
)
noexcept
{
static
size_t
GetLength
(
const_pointer
p
)
noexcept
{
return
StringLength
(
p
);
return
StringLength
(
p
);
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
const_pointer
_type
Find
(
const_pointer_type
p
,
value_type
ch
)
noexcept
{
static
const_pointer
Find
(
const_pointer
p
,
value_type
ch
)
noexcept
{
return
StringFind
(
p
,
ch
);
return
StringFind
(
p
,
ch
);
}
}
...
@@ -231,7 +231,7 @@ struct PathTraitsUTF8 {
...
@@ -231,7 +231,7 @@ struct PathTraitsUTF8 {
* The return value points inside the given string.
* The return value points inside the given string.
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
const_pointer
_type
GetBase
(
const_pointer_type
p
)
noexcept
;
static
const_pointer
GetBase
(
const_pointer
p
)
noexcept
;
/**
/**
* Determine the "parent" file name of the given UTF-8 path.
* Determine the "parent" file name of the given UTF-8 path.
...
@@ -239,7 +239,7 @@ struct PathTraitsUTF8 {
...
@@ -239,7 +239,7 @@ struct PathTraitsUTF8 {
* separator in the given input string.
* separator in the given input string.
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
string
GetParent
(
const_pointer
_type
p
)
noexcept
;
static
string
GetParent
(
const_pointer
p
)
noexcept
;
/**
/**
* Determine the relative part of the given path to this
* Determine the relative part of the given path to this
...
@@ -248,8 +248,8 @@ struct PathTraitsUTF8 {
...
@@ -248,8 +248,8 @@ struct PathTraitsUTF8 {
* nullptr on mismatch.
* nullptr on mismatch.
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
const_pointer
_type
Relative
(
const_pointer_type
base
,
static
const_pointer
Relative
(
const_pointer
base
,
const_pointer_type
other
)
noexcept
;
const_pointer
other
)
noexcept
;
/**
/**
* Constructs the path from the given components.
* Constructs the path from the given components.
...
@@ -258,11 +258,11 @@ struct PathTraitsUTF8 {
...
@@ -258,11 +258,11 @@ struct PathTraitsUTF8 {
* If both components are empty strings, empty string is returned.
* If both components are empty strings, empty string is returned.
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
string
Build
(
const_pointer
_type
a
,
size_t
a_size
,
static
string
Build
(
const_pointer
a
,
size_t
a_size
,
const_pointer
_type
b
,
size_t
b_size
)
noexcept
;
const_pointer
b
,
size_t
b_size
)
noexcept
;
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
string
Build
(
const_pointer
_type
a
,
const_pointer_type
b
)
noexcept
{
static
string
Build
(
const_pointer
a
,
const_pointer
b
)
noexcept
{
return
Build
(
a
,
GetLength
(
a
),
b
,
GetLength
(
b
));
return
Build
(
a
,
GetLength
(
a
),
b
,
GetLength
(
b
));
}
}
};
};
...
...
src/lib/nfs/Cancellable.hxx
View file @
4937d77c
...
@@ -32,12 +32,12 @@ template<typename T>
...
@@ -32,12 +32,12 @@ template<typename T>
class
CancellablePointer
class
CancellablePointer
:
public
boost
::
intrusive
::
list_base_hook
<
boost
::
intrusive
::
link_mode
<
boost
::
intrusive
::
normal_link
>>
{
:
public
boost
::
intrusive
::
list_base_hook
<
boost
::
intrusive
::
link_mode
<
boost
::
intrusive
::
normal_link
>>
{
public
:
public
:
typedef
T
*
pointer
_type
;
typedef
T
*
pointer
;
typedef
T
&
reference_type
;
typedef
T
&
reference_type
;
typedef
const
T
&
const_reference_type
;
typedef
const
T
&
const_reference_type
;
private
:
private
:
pointer
_type
p
;
pointer
p
;
public
:
public
:
explicit
CancellablePointer
(
reference_type
_p
)
:
p
(
&
_p
)
{}
explicit
CancellablePointer
(
reference_type
_p
)
:
p
(
&
_p
)
{}
...
...
src/storage/plugins/LocalStorage.cxx
View file @
4937d77c
...
@@ -146,7 +146,7 @@ LocalStorage::OpenDirectory(const char *uri_utf8)
...
@@ -146,7 +146,7 @@ LocalStorage::OpenDirectory(const char *uri_utf8)
gcc_pure
gcc_pure
static
bool
static
bool
SkipNameFS
(
PathTraitsFS
::
const_pointer
_type
name_fs
)
noexcept
SkipNameFS
(
PathTraitsFS
::
const_pointer
name_fs
)
noexcept
{
{
return
name_fs
[
0
]
==
'.'
&&
return
name_fs
[
0
]
==
'.'
&&
(
name_fs
[
1
]
==
0
||
(
name_fs
[
1
]
==
0
||
...
...
src/storage/plugins/NfsStorage.cxx
View file @
4937d77c
...
@@ -307,7 +307,7 @@ NfsStorage::GetInfo(const char *uri_utf8, bool follow)
...
@@ -307,7 +307,7 @@ NfsStorage::GetInfo(const char *uri_utf8, bool follow)
gcc_pure
gcc_pure
static
bool
static
bool
SkipNameFS
(
PathTraitsFS
::
const_pointer
_type
name
)
noexcept
SkipNameFS
(
PathTraitsFS
::
const_pointer
name
)
noexcept
{
{
return
name
[
0
]
==
'.'
&&
return
name
[
0
]
==
'.'
&&
(
name
[
1
]
==
0
||
(
name
[
1
]
==
0
||
...
...
src/util/AllocatedString.cxx
View file @
4937d77c
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
template
<>
template
<>
AllocatedString
<
char
>
AllocatedString
<
char
>
AllocatedString
<
char
>::
Duplicate
(
const_pointer
_type
src
)
AllocatedString
<
char
>::
Duplicate
(
const_pointer
src
)
{
{
return
Duplicate
(
src
,
StringLength
(
src
));
return
Duplicate
(
src
,
StringLength
(
src
));
}
}
...
@@ -41,7 +41,7 @@ AllocatedString<char>::Duplicate(const_pointer_type src)
...
@@ -41,7 +41,7 @@ AllocatedString<char>::Duplicate(const_pointer_type src)
template
<>
template
<>
AllocatedString
<
wchar_t
>
AllocatedString
<
wchar_t
>
AllocatedString
<
wchar_t
>::
Duplicate
(
const_pointer
_type
src
)
AllocatedString
<
wchar_t
>::
Duplicate
(
const_pointer
src
)
{
{
return
Duplicate
(
src
,
StringLength
(
src
));
return
Duplicate
(
src
,
StringLength
(
src
));
}
}
...
...
src/util/AllocatedString.hxx
View file @
4937d77c
...
@@ -46,16 +46,16 @@ public:
...
@@ -46,16 +46,16 @@ public:
typedef
typename
StringPointer
<
T
>::
value_type
value_type
;
typedef
typename
StringPointer
<
T
>::
value_type
value_type
;
typedef
typename
StringPointer
<
T
>::
reference_type
reference_type
;
typedef
typename
StringPointer
<
T
>::
reference_type
reference_type
;
typedef
typename
StringPointer
<
T
>::
const_reference_type
const_reference_type
;
typedef
typename
StringPointer
<
T
>::
const_reference_type
const_reference_type
;
typedef
typename
StringPointer
<
T
>::
pointer
_type
pointer_type
;
typedef
typename
StringPointer
<
T
>::
pointer
pointer
;
typedef
typename
StringPointer
<
T
>::
const_pointer
_type
const_pointer_type
;
typedef
typename
StringPointer
<
T
>::
const_pointer
const_pointer
;
typedef
std
::
size_t
size_type
;
typedef
std
::
size_t
size_type
;
static
constexpr
value_type
SENTINEL
=
'\0'
;
static
constexpr
value_type
SENTINEL
=
'\0'
;
private
:
private
:
pointer
_type
value
;
pointer
value
;
explicit
AllocatedString
(
pointer
_type
_value
)
explicit
AllocatedString
(
pointer
_value
)
:
value
(
_value
)
{}
:
value
(
_value
)
{}
public
:
public
:
...
@@ -68,7 +68,7 @@ public:
...
@@ -68,7 +68,7 @@ public:
delete
[]
value
;
delete
[]
value
;
}
}
static
AllocatedString
Donate
(
pointer
_type
value
)
{
static
AllocatedString
Donate
(
pointer
value
)
{
return
AllocatedString
(
value
);
return
AllocatedString
(
value
);
}
}
...
@@ -82,16 +82,16 @@ public:
...
@@ -82,16 +82,16 @@ public:
return
Donate
(
p
);
return
Donate
(
p
);
}
}
static
AllocatedString
Duplicate
(
const_pointer
_type
src
);
static
AllocatedString
Duplicate
(
const_pointer
src
);
static
AllocatedString
Duplicate
(
const_pointer
_type
begin
,
static
AllocatedString
Duplicate
(
const_pointer
begin
,
const_pointer
_type
end
)
{
const_pointer
end
)
{
auto
p
=
new
value_type
[
end
-
begin
+
1
];
auto
p
=
new
value_type
[
end
-
begin
+
1
];
*
std
::
copy
(
begin
,
end
,
p
)
=
SENTINEL
;
*
std
::
copy
(
begin
,
end
,
p
)
=
SENTINEL
;
return
Donate
(
p
);
return
Donate
(
p
);
}
}
static
AllocatedString
Duplicate
(
const_pointer
_type
begin
,
static
AllocatedString
Duplicate
(
const_pointer
begin
,
size_type
length
)
{
size_type
length
)
{
auto
p
=
new
value_type
[
length
+
1
];
auto
p
=
new
value_type
[
length
+
1
];
*
std
::
copy_n
(
begin
,
length
,
p
)
=
SENTINEL
;
*
std
::
copy_n
(
begin
,
length
,
p
)
=
SENTINEL
;
...
@@ -115,7 +115,7 @@ public:
...
@@ -115,7 +115,7 @@ public:
return
value
==
nullptr
;
return
value
==
nullptr
;
}
}
constexpr
const_pointer
_type
c_str
()
const
{
constexpr
const_pointer
c_str
()
const
{
return
value
;
return
value
;
}
}
...
@@ -123,7 +123,7 @@ public:
...
@@ -123,7 +123,7 @@ public:
return
*
value
==
SENTINEL
;
return
*
value
==
SENTINEL
;
}
}
constexpr
pointer
_type
data
()
const
{
constexpr
pointer
data
()
const
{
return
value
;
return
value
;
}
}
...
@@ -135,7 +135,7 @@ public:
...
@@ -135,7 +135,7 @@ public:
return
value
[
i
];
return
value
[
i
];
}
}
pointer
_type
Steal
()
{
pointer
Steal
()
{
return
std
::
exchange
(
value
,
nullptr
);
return
std
::
exchange
(
value
,
nullptr
);
}
}
...
...
src/util/BindMethod.hxx
View file @
4937d77c
...
@@ -246,7 +246,7 @@ struct FunctionTraits<R(Args...) noexcept(NoExcept)> {
...
@@ -246,7 +246,7 @@ struct FunctionTraits<R(Args...) noexcept(NoExcept)> {
* A function pointer type which describes the "plain"
* A function pointer type which describes the "plain"
* function signature.
* function signature.
*/
*/
typedef
R
(
*
pointer
_type
)(
Args
...)
typedef
R
(
*
pointer
)(
Args
...)
#if !GCC_OLDER_THAN(7,0)
#if !GCC_OLDER_THAN(7,0)
noexcept
(
NoExcept
)
noexcept
(
NoExcept
)
#endif
#endif
...
@@ -289,12 +289,12 @@ struct BindFunctionWrapperGenerator<R(Args...) noexcept(NoExcept), P, function>
...
@@ -289,12 +289,12 @@ struct BindFunctionWrapperGenerator<R(Args...) noexcept(NoExcept), P, function>
:
BindFunctionWrapperGenerator2
<
NoExcept
,
P
,
function
,
R
,
Args
...
>
{
:
BindFunctionWrapperGenerator2
<
NoExcept
,
P
,
function
,
R
,
Args
...
>
{
};
};
template
<
typename
T
,
typename
T
::
pointer
_type
function
>
template
<
typename
T
,
typename
T
::
pointer
function
>
typename
MethodWrapperWithSignature
<
typename
T
::
function_type
>::
function_pointer
typename
MethodWrapperWithSignature
<
typename
T
::
function_type
>::
function_pointer
MakeBindFunctionWrapper
()
noexcept
MakeBindFunctionWrapper
()
noexcept
{
{
return
BindFunctionWrapperGenerator
<
typename
T
::
function_type
,
return
BindFunctionWrapperGenerator
<
typename
T
::
function_type
,
typename
T
::
pointer
_type
,
typename
T
::
pointer
,
function
>::
Invoke
;
function
>::
Invoke
;
}
}
...
@@ -338,7 +338,7 @@ BindMethod(T &_instance) noexcept
...
@@ -338,7 +338,7 @@ BindMethod(T &_instance) noexcept
* @param T the #FunctionTraits class
* @param T the #FunctionTraits class
* @param function the function pointer
* @param function the function pointer
*/
*/
template
<
typename
T
,
typename
T
::
pointer
_type
function
>
template
<
typename
T
,
typename
T
::
pointer
function
>
constexpr
BoundMethod
<
typename
T
::
function_type
>
constexpr
BoundMethod
<
typename
T
::
function_type
>
BindFunction
()
noexcept
BindFunction
()
noexcept
{
{
...
...
src/util/CircularBuffer.hxx
View file @
4937d77c
...
@@ -51,7 +51,7 @@ template<typename T>
...
@@ -51,7 +51,7 @@ template<typename T>
class
CircularBuffer
{
class
CircularBuffer
{
public
:
public
:
typedef
WritableBuffer
<
T
>
Range
;
typedef
WritableBuffer
<
T
>
Range
;
typedef
typename
Range
::
pointer
_type
pointer_type
;
typedef
typename
Range
::
pointer
pointer
;
typedef
typename
Range
::
size_type
size_type
;
typedef
typename
Range
::
size_type
size_type
;
protected
:
protected
:
...
@@ -66,10 +66,10 @@ protected:
...
@@ -66,10 +66,10 @@ protected:
size_type
tail
;
size_type
tail
;
const
size_type
capacity
;
const
size_type
capacity
;
const
pointer
_type
data
;
const
pointer
data
;
public
:
public
:
constexpr
CircularBuffer
(
pointer
_type
_data
,
size_type
_capacity
)
constexpr
CircularBuffer
(
pointer
_data
,
size_type
_capacity
)
:
head
(
0
),
tail
(
0
),
capacity
(
_capacity
),
data
(
_data
)
{}
:
head
(
0
),
tail
(
0
),
capacity
(
_capacity
),
data
(
_data
)
{}
CircularBuffer
(
const
CircularBuffer
&
other
)
=
delete
;
CircularBuffer
(
const
CircularBuffer
&
other
)
=
delete
;
...
...
src/util/ConstBuffer.hxx
View file @
4937d77c
...
@@ -45,12 +45,12 @@ template<>
...
@@ -45,12 +45,12 @@ template<>
struct
ConstBuffer
<
void
>
{
struct
ConstBuffer
<
void
>
{
typedef
std
::
size_t
size_type
;
typedef
std
::
size_t
size_type
;
typedef
void
value_type
;
typedef
void
value_type
;
typedef
const
void
*
pointer
_type
;
typedef
const
void
*
pointer
;
typedef
pointer
_type
const_pointer_type
;
typedef
pointer
const_pointer
;
typedef
pointer
_type
iterator
;
typedef
pointer
iterator
;
typedef
pointer
_type
const_iterator
;
typedef
pointer
const_iterator
;
pointer
_type
data
;
pointer
data
;
size_type
size
;
size_type
size
;
ConstBuffer
()
=
default
;
ConstBuffer
()
=
default
;
...
@@ -58,7 +58,7 @@ struct ConstBuffer<void> {
...
@@ -58,7 +58,7 @@ struct ConstBuffer<void> {
constexpr
ConstBuffer
(
std
::
nullptr_t
)
noexcept
constexpr
ConstBuffer
(
std
::
nullptr_t
)
noexcept
:
data
(
nullptr
),
size
(
0
)
{}
:
data
(
nullptr
),
size
(
0
)
{}
constexpr
ConstBuffer
(
pointer
_type
_data
,
size_type
_size
)
noexcept
constexpr
ConstBuffer
(
pointer
_data
,
size_type
_size
)
noexcept
:
data
(
_data
),
size
(
_size
)
{}
:
data
(
_data
),
size
(
_size
)
{}
constexpr
static
ConstBuffer
<
void
>
FromVoid
(
ConstBuffer
<
void
>
other
)
noexcept
{
constexpr
static
ConstBuffer
<
void
>
FromVoid
(
ConstBuffer
<
void
>
other
)
noexcept
{
...
@@ -95,12 +95,12 @@ struct ConstBuffer {
...
@@ -95,12 +95,12 @@ struct ConstBuffer {
typedef
T
value_type
;
typedef
T
value_type
;
typedef
const
T
&
reference_type
;
typedef
const
T
&
reference_type
;
typedef
reference_type
const_reference_type
;
typedef
reference_type
const_reference_type
;
typedef
const
T
*
pointer
_type
;
typedef
const
T
*
pointer
;
typedef
pointer
_type
const_pointer_type
;
typedef
pointer
const_pointer
;
typedef
pointer
_type
iterator
;
typedef
pointer
iterator
;
typedef
pointer
_type
const_iterator
;
typedef
pointer
const_iterator
;
pointer
_type
data
;
pointer
data
;
size_type
size
;
size_type
size
;
ConstBuffer
()
=
default
;
ConstBuffer
()
=
default
;
...
@@ -108,10 +108,10 @@ struct ConstBuffer {
...
@@ -108,10 +108,10 @@ struct ConstBuffer {
constexpr
ConstBuffer
(
std
::
nullptr_t
)
noexcept
constexpr
ConstBuffer
(
std
::
nullptr_t
)
noexcept
:
data
(
nullptr
),
size
(
0
)
{}
:
data
(
nullptr
),
size
(
0
)
{}
constexpr
ConstBuffer
(
pointer
_type
_data
,
size_type
_size
)
noexcept
constexpr
ConstBuffer
(
pointer
_data
,
size_type
_size
)
noexcept
:
data
(
_data
),
size
(
_size
)
{}
:
data
(
_data
),
size
(
_size
)
{}
constexpr
ConstBuffer
(
pointer
_type
_data
,
pointer_type
_end
)
noexcept
constexpr
ConstBuffer
(
pointer
_data
,
pointer
_end
)
noexcept
:
data
(
_data
),
size
(
_end
-
_data
)
{}
:
data
(
_data
),
size
(
_end
-
_data
)
{}
/**
/**
...
@@ -127,7 +127,7 @@ struct ConstBuffer {
...
@@ -127,7 +127,7 @@ struct ConstBuffer {
*/
*/
static
constexpr
ConstBuffer
<
T
>
FromVoidFloor
(
ConstBuffer
<
void
>
other
)
noexcept
{
static
constexpr
ConstBuffer
<
T
>
FromVoidFloor
(
ConstBuffer
<
void
>
other
)
noexcept
{
static_assert
(
sizeof
(
T
)
>
0
,
"Empty base type"
);
static_assert
(
sizeof
(
T
)
>
0
,
"Empty base type"
);
return
ConstBuffer
<
T
>
(
pointer
_type
(
other
.
data
),
return
ConstBuffer
<
T
>
(
pointer
(
other
.
data
),
other
.
size
/
sizeof
(
T
));
other
.
size
/
sizeof
(
T
));
}
}
...
@@ -282,7 +282,7 @@ struct ConstBuffer {
...
@@ -282,7 +282,7 @@ struct ConstBuffer {
* Move the front pointer to the given address, and adjust the
* Move the front pointer to the given address, and adjust the
* size attribute to retain the old end address.
* size attribute to retain the old end address.
*/
*/
void
MoveFront
(
pointer
_type
new_data
)
noexcept
{
void
MoveFront
(
pointer
new_data
)
noexcept
{
#ifndef NDEBUG
#ifndef NDEBUG
assert
(
IsNull
()
==
(
new_data
==
nullptr
));
assert
(
IsNull
()
==
(
new_data
==
nullptr
));
assert
(
new_data
<=
end
());
assert
(
new_data
<=
end
());
...
@@ -296,7 +296,7 @@ struct ConstBuffer {
...
@@ -296,7 +296,7 @@ struct ConstBuffer {
* Move the end pointer to the given address (by adjusting the
* Move the end pointer to the given address (by adjusting the
* size).
* size).
*/
*/
void
SetEnd
(
pointer
_type
new_end
)
noexcept
{
void
SetEnd
(
pointer
new_end
)
noexcept
{
#ifndef NDEBUG
#ifndef NDEBUG
assert
(
IsNull
()
==
(
new_end
==
nullptr
));
assert
(
IsNull
()
==
(
new_end
==
nullptr
));
assert
(
new_end
>=
begin
());
assert
(
new_end
>=
begin
());
...
...
src/util/DynamicFifoBuffer.hxx
View file @
4937d77c
...
@@ -41,8 +41,8 @@ template<typename T>
...
@@ -41,8 +41,8 @@ template<typename T>
class
DynamicFifoBuffer
:
protected
ForeignFifoBuffer
<
T
>
{
class
DynamicFifoBuffer
:
protected
ForeignFifoBuffer
<
T
>
{
public
:
public
:
using
typename
ForeignFifoBuffer
<
T
>::
size_type
;
using
typename
ForeignFifoBuffer
<
T
>::
size_type
;
using
typename
ForeignFifoBuffer
<
T
>::
pointer
_type
;
using
typename
ForeignFifoBuffer
<
T
>::
pointer
;
using
typename
ForeignFifoBuffer
<
T
>::
const_pointer
_type
;
using
typename
ForeignFifoBuffer
<
T
>::
const_pointer
;
using
typename
ForeignFifoBuffer
<
T
>::
Range
;
using
typename
ForeignFifoBuffer
<
T
>::
Range
;
/**
/**
...
@@ -101,7 +101,7 @@ public:
...
@@ -101,7 +101,7 @@ public:
* Write data to the buffer, growing it as needed. Returns a
* Write data to the buffer, growing it as needed. Returns a
* writable pointer.
* writable pointer.
*/
*/
pointer
_type
Write
(
size_type
n
)
noexcept
{
pointer
Write
(
size_type
n
)
noexcept
{
WantWrite
(
n
);
WantWrite
(
n
);
return
Write
().
data
;
return
Write
().
data
;
}
}
...
@@ -109,7 +109,7 @@ public:
...
@@ -109,7 +109,7 @@ public:
/**
/**
* Append data to the buffer, growing it as needed.
* Append data to the buffer, growing it as needed.
*/
*/
void
Append
(
const_pointer
_type
p
,
size_type
n
)
noexcept
{
void
Append
(
const_pointer
p
,
size_type
n
)
noexcept
{
std
::
copy_n
(
p
,
n
,
Write
(
n
));
std
::
copy_n
(
p
,
n
,
Write
(
n
));
Append
(
n
);
Append
(
n
);
}
}
...
...
src/util/ForeignFifoBuffer.hxx
View file @
4937d77c
...
@@ -53,8 +53,8 @@ class ForeignFifoBuffer {
...
@@ -53,8 +53,8 @@ class ForeignFifoBuffer {
public
:
public
:
using
size_type
=
std
::
size_t
;
using
size_type
=
std
::
size_t
;
using
Range
=
WritableBuffer
<
T
>
;
using
Range
=
WritableBuffer
<
T
>
;
using
pointer
_type
=
typename
Range
::
pointer_type
;
using
pointer
=
typename
Range
::
pointer
;
using
const_pointer
_type
=
typename
Range
::
const_pointer_type
;
using
const_pointer
=
typename
Range
::
const_pointer
;
protected
:
protected
:
size_type
head
=
0
,
tail
=
0
,
capacity
;
size_type
head
=
0
,
tail
=
0
,
capacity
;
...
@@ -211,7 +211,7 @@ public:
...
@@ -211,7 +211,7 @@ public:
head
+=
n
;
head
+=
n
;
}
}
size_type
Read
(
pointer
_type
p
,
size_type
n
)
noexcept
{
size_type
Read
(
pointer
p
,
size_type
n
)
noexcept
{
auto
range
=
Read
();
auto
range
=
Read
();
if
(
n
>
range
.
size
)
if
(
n
>
range
.
size
)
n
=
range
.
size
;
n
=
range
.
size
;
...
...
src/util/StringPointer.hxx
View file @
4937d77c
...
@@ -39,17 +39,17 @@ public:
...
@@ -39,17 +39,17 @@ public:
typedef
T
value_type
;
typedef
T
value_type
;
typedef
T
&
reference_type
;
typedef
T
&
reference_type
;
typedef
const
T
&
const_reference_type
;
typedef
const
T
&
const_reference_type
;
typedef
T
*
pointer
_type
;
typedef
T
*
pointer
;
typedef
const
T
*
const_pointer
_type
;
typedef
const
T
*
const_pointer
;
static
constexpr
value_type
SENTINEL
=
'\0'
;
static
constexpr
value_type
SENTINEL
=
'\0'
;
private
:
private
:
const_pointer
_type
value
;
const_pointer
value
;
public
:
public
:
StringPointer
()
=
default
;
StringPointer
()
=
default
;
constexpr
StringPointer
(
const_pointer
_type
_value
)
constexpr
StringPointer
(
const_pointer
_value
)
:
value
(
_value
)
{}
:
value
(
_value
)
{}
/**
/**
...
@@ -60,7 +60,7 @@ public:
...
@@ -60,7 +60,7 @@ public:
return
value
==
nullptr
;
return
value
==
nullptr
;
}
}
constexpr
const_pointer
_type
c_str
()
const
{
constexpr
const_pointer
c_str
()
const
{
return
value
;
return
value
;
}
}
...
...
src/util/StringView.hxx
View file @
4937d77c
...
@@ -44,7 +44,7 @@ template<typename T>
...
@@ -44,7 +44,7 @@ template<typename T>
struct
BasicStringView
:
ConstBuffer
<
T
>
{
struct
BasicStringView
:
ConstBuffer
<
T
>
{
using
typename
ConstBuffer
<
T
>::
size_type
;
using
typename
ConstBuffer
<
T
>::
size_type
;
using
typename
ConstBuffer
<
T
>::
value_type
;
using
typename
ConstBuffer
<
T
>::
value_type
;
using
typename
ConstBuffer
<
T
>::
pointer
_type
;
using
typename
ConstBuffer
<
T
>::
pointer
;
using
ConstBuffer
<
T
>::
data
;
using
ConstBuffer
<
T
>::
data
;
using
ConstBuffer
<
T
>::
size
;
using
ConstBuffer
<
T
>::
size
;
...
@@ -57,14 +57,13 @@ struct BasicStringView : ConstBuffer<T> {
...
@@ -57,14 +57,13 @@ struct BasicStringView : ConstBuffer<T> {
explicit
constexpr
BasicStringView
(
ConstBuffer
<
void
>
src
)
explicit
constexpr
BasicStringView
(
ConstBuffer
<
void
>
src
)
:
ConstBuffer
<
T
>
(
ConstBuffer
<
T
>::
FromVoid
(
src
))
{}
:
ConstBuffer
<
T
>
(
ConstBuffer
<
T
>::
FromVoid
(
src
))
{}
constexpr
BasicStringView
(
pointer
_type
_data
,
size_type
_size
)
noexcept
constexpr
BasicStringView
(
pointer
_data
,
size_type
_size
)
noexcept
:
ConstBuffer
<
T
>
(
_data
,
_size
)
{}
:
ConstBuffer
<
T
>
(
_data
,
_size
)
{}
constexpr
BasicStringView
(
pointer_type
_begin
,
constexpr
BasicStringView
(
pointer
_begin
,
pointer
_end
)
noexcept
pointer_type
_end
)
noexcept
:
ConstBuffer
<
T
>
(
_begin
,
_end
-
_begin
)
{}
:
ConstBuffer
<
T
>
(
_begin
,
_end
-
_begin
)
{}
BasicStringView
(
pointer
_type
_data
)
noexcept
BasicStringView
(
pointer
_data
)
noexcept
:
ConstBuffer
<
T
>
(
_data
,
:
ConstBuffer
<
T
>
(
_data
,
_data
!=
nullptr
?
StringLength
(
_data
)
:
0
)
{}
_data
!=
nullptr
?
StringLength
(
_data
)
:
0
)
{}
...
@@ -90,12 +89,12 @@ struct BasicStringView : ConstBuffer<T> {
...
@@ -90,12 +89,12 @@ struct BasicStringView : ConstBuffer<T> {
using
ConstBuffer
<
T
>::
skip_front
;
using
ConstBuffer
<
T
>::
skip_front
;
gcc_pure
gcc_pure
pointer
_type
Find
(
value_type
ch
)
const
noexcept
{
pointer
Find
(
value_type
ch
)
const
noexcept
{
return
StringFind
(
data
,
ch
,
this
->
size
);
return
StringFind
(
data
,
ch
,
this
->
size
);
}
}
gcc_pure
gcc_pure
pointer
_type
FindLast
(
value_type
ch
)
const
noexcept
{
pointer
FindLast
(
value_type
ch
)
const
noexcept
{
return
StringFindLast
(
data
,
ch
,
size
);
return
StringFindLast
(
data
,
ch
,
size
);
}
}
...
...
src/util/WritableBuffer.hxx
View file @
4937d77c
...
@@ -46,12 +46,12 @@ template<>
...
@@ -46,12 +46,12 @@ template<>
struct
WritableBuffer
<
void
>
{
struct
WritableBuffer
<
void
>
{
typedef
std
::
size_t
size_type
;
typedef
std
::
size_t
size_type
;
typedef
void
value_type
;
typedef
void
value_type
;
typedef
void
*
pointer
_type
;
typedef
void
*
pointer
;
typedef
const
void
*
const_pointer
_type
;
typedef
const
void
*
const_pointer
;
typedef
pointer
_type
iterator
;
typedef
pointer
iterator
;
typedef
const_pointer
_type
const_iterator
;
typedef
const_pointer
const_iterator
;
pointer
_type
data
;
pointer
data
;
size_type
size
;
size_type
size
;
WritableBuffer
()
=
default
;
WritableBuffer
()
=
default
;
...
@@ -59,7 +59,7 @@ struct WritableBuffer<void> {
...
@@ -59,7 +59,7 @@ struct WritableBuffer<void> {
constexpr
WritableBuffer
(
std
::
nullptr_t
)
noexcept
constexpr
WritableBuffer
(
std
::
nullptr_t
)
noexcept
:
data
(
nullptr
),
size
(
0
)
{}
:
data
(
nullptr
),
size
(
0
)
{}
constexpr
WritableBuffer
(
pointer
_type
_data
,
size_type
_size
)
noexcept
constexpr
WritableBuffer
(
pointer
_data
,
size_type
_size
)
noexcept
:
data
(
_data
),
size
(
_size
)
{}
:
data
(
_data
),
size
(
_size
)
{}
constexpr
operator
ConstBuffer
<
void
>
()
const
noexcept
{
constexpr
operator
ConstBuffer
<
void
>
()
const
noexcept
{
...
@@ -94,12 +94,12 @@ struct WritableBuffer {
...
@@ -94,12 +94,12 @@ struct WritableBuffer {
typedef
T
value_type
;
typedef
T
value_type
;
typedef
T
&
reference_type
;
typedef
T
&
reference_type
;
typedef
const
T
&
const_reference_type
;
typedef
const
T
&
const_reference_type
;
typedef
T
*
pointer
_type
;
typedef
T
*
pointer
;
typedef
const
T
*
const_pointer
_type
;
typedef
const
T
*
const_pointer
;
typedef
pointer
_type
iterator
;
typedef
pointer
iterator
;
typedef
const_pointer
_type
const_iterator
;
typedef
const_pointer
const_iterator
;
pointer
_type
data
;
pointer
data
;
size_type
size
;
size_type
size
;
WritableBuffer
()
=
default
;
WritableBuffer
()
=
default
;
...
@@ -107,11 +107,10 @@ struct WritableBuffer {
...
@@ -107,11 +107,10 @@ struct WritableBuffer {
constexpr
WritableBuffer
(
std
::
nullptr_t
)
noexcept
constexpr
WritableBuffer
(
std
::
nullptr_t
)
noexcept
:
data
(
nullptr
),
size
(
0
)
{}
:
data
(
nullptr
),
size
(
0
)
{}
constexpr
WritableBuffer
(
pointer
_type
_data
,
size_type
_size
)
noexcept
constexpr
WritableBuffer
(
pointer
_data
,
size_type
_size
)
noexcept
:
data
(
_data
),
size
(
_size
)
{}
:
data
(
_data
),
size
(
_size
)
{}
constexpr
WritableBuffer
(
pointer_type
_data
,
constexpr
WritableBuffer
(
pointer
_data
,
pointer
_end
)
noexcept
pointer_type
_end
)
noexcept
:
data
(
_data
),
size
(
_end
-
_data
)
{}
:
data
(
_data
),
size
(
_end
-
_data
)
{}
/**
/**
...
@@ -131,7 +130,7 @@ struct WritableBuffer {
...
@@ -131,7 +130,7 @@ struct WritableBuffer {
*/
*/
static
constexpr
WritableBuffer
<
T
>
FromVoidFloor
(
WritableBuffer
<
void
>
other
)
noexcept
{
static
constexpr
WritableBuffer
<
T
>
FromVoidFloor
(
WritableBuffer
<
void
>
other
)
noexcept
{
static_assert
(
sizeof
(
T
)
>
0
,
"Empty base type"
);
static_assert
(
sizeof
(
T
)
>
0
,
"Empty base type"
);
return
WritableBuffer
<
T
>
(
pointer
_type
(
other
.
data
),
return
WritableBuffer
<
T
>
(
pointer
(
other
.
data
),
other
.
size
/
sizeof
(
T
));
other
.
size
/
sizeof
(
T
));
}
}
...
@@ -272,7 +271,7 @@ struct WritableBuffer {
...
@@ -272,7 +271,7 @@ struct WritableBuffer {
* Move the front pointer to the given address, and adjust the
* Move the front pointer to the given address, and adjust the
* size attribute to retain the old end address.
* size attribute to retain the old end address.
*/
*/
void
MoveFront
(
pointer
_type
new_data
)
noexcept
{
void
MoveFront
(
pointer
new_data
)
noexcept
{
#ifndef NDEBUG
#ifndef NDEBUG
assert
(
IsNull
()
==
(
new_data
==
nullptr
));
assert
(
IsNull
()
==
(
new_data
==
nullptr
));
assert
(
new_data
<=
end
());
assert
(
new_data
<=
end
());
...
@@ -286,7 +285,7 @@ struct WritableBuffer {
...
@@ -286,7 +285,7 @@ struct WritableBuffer {
* Move the end pointer to the given address (by adjusting the
* Move the end pointer to the given address (by adjusting the
* size).
* size).
*/
*/
void
SetEnd
(
pointer
_type
new_end
)
noexcept
{
void
SetEnd
(
pointer
new_end
)
noexcept
{
#ifndef NDEBUG
#ifndef NDEBUG
assert
(
IsNull
()
==
(
new_end
==
nullptr
));
assert
(
IsNull
()
==
(
new_end
==
nullptr
));
assert
(
new_end
>=
begin
());
assert
(
new_end
>=
begin
());
...
...
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