diff options
-rw-r--r-- | src/command/FileCommands.cxx | 2 | ||||
-rw-r--r-- | src/fs/AllocatedPath.hxx | 36 | ||||
-rw-r--r-- | src/fs/Charset.cxx | 4 | ||||
-rw-r--r-- | src/fs/Charset.hxx | 4 | ||||
-rw-r--r-- | src/fs/DirectoryReader.hxx | 6 | ||||
-rw-r--r-- | src/fs/FileSystem.hxx | 2 | ||||
-rw-r--r-- | src/fs/LookupFile.cxx | 6 | ||||
-rw-r--r-- | src/fs/NarrowPath.hxx | 6 | ||||
-rw-r--r-- | src/fs/Path.cxx | 2 | ||||
-rw-r--r-- | src/fs/Path.hxx | 12 | ||||
-rw-r--r-- | src/fs/StandardDirectory.cxx | 6 | ||||
-rw-r--r-- | src/fs/Traits.cxx | 52 | ||||
-rw-r--r-- | src/fs/Traits.hxx | 66 | ||||
-rw-r--r-- | src/lib/nfs/Cancellable.hxx | 4 | ||||
-rw-r--r-- | src/storage/plugins/LocalStorage.cxx | 2 | ||||
-rw-r--r-- | src/storage/plugins/NfsStorage.cxx | 2 | ||||
-rw-r--r-- | src/util/AllocatedString.cxx | 4 | ||||
-rw-r--r-- | src/util/AllocatedString.hxx | 24 | ||||
-rw-r--r-- | src/util/BindMethod.hxx | 8 | ||||
-rw-r--r-- | src/util/CircularBuffer.hxx | 6 | ||||
-rw-r--r-- | src/util/ConstBuffer.hxx | 32 | ||||
-rw-r--r-- | src/util/DynamicFifoBuffer.hxx | 8 | ||||
-rw-r--r-- | src/util/ForeignFifoBuffer.hxx | 6 | ||||
-rw-r--r-- | src/util/StringPointer.hxx | 10 | ||||
-rw-r--r-- | src/util/StringView.hxx | 13 | ||||
-rw-r--r-- | src/util/WritableBuffer.hxx | 33 |
26 files changed, 176 insertions, 180 deletions
diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx index 301b309fd..5046d378e 100644 --- a/src/command/FileCommands.cxx +++ b/src/command/FileCommands.cxx @@ -48,7 +48,7 @@ gcc_pure static bool -SkipNameFS(PathTraitsFS::const_pointer_type name_fs) noexcept +SkipNameFS(PathTraitsFS::const_pointer name_fs) noexcept { return name_fs[0] == '.' && (name_fs[1] == 0 || diff --git a/src/fs/AllocatedPath.hxx b/src/fs/AllocatedPath.hxx index 43df85348..e7bf9c80e 100644 --- a/src/fs/AllocatedPath.hxx +++ b/src/fs/AllocatedPath.hxx @@ -38,23 +38,22 @@ class AllocatedPath { using Traits = PathTraitsFS; typedef Traits::string string; typedef Traits::value_type value_type; - typedef Traits::pointer_type pointer_type; - typedef Traits::const_pointer_type const_pointer_type; + typedef Traits::pointer pointer; + typedef Traits::const_pointer const_pointer; string value; - explicit AllocatedPath(const_pointer_type _value) noexcept + explicit AllocatedPath(const_pointer _value) noexcept :value(_value) {} - AllocatedPath(const_pointer_type _begin, - const_pointer_type _end) noexcept + AllocatedPath(const_pointer _begin, const_pointer _end) noexcept :value(_begin, _end) {} AllocatedPath(string &&_value) noexcept :value(std::move(_value)) {} - static AllocatedPath Build(const_pointer_type a, size_t a_size, - const_pointer_type b, size_t b_size) noexcept { + static AllocatedPath Build(const_pointer a, size_t a_size, + const_pointer b, size_t b_size) noexcept { return AllocatedPath(Traits::Build(a, a_size, b, b_size)); } public: @@ -91,14 +90,13 @@ public: * Join two path components with the path separator. */ gcc_pure gcc_nonnull_all - static AllocatedPath Build(const_pointer_type a, - const_pointer_type b) noexcept { + static AllocatedPath Build(const_pointer a, const_pointer b) noexcept { return Build(a, Traits::GetLength(a), b, Traits::GetLength(b)); } 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); } @@ -108,7 +106,7 @@ public: } gcc_pure gcc_nonnull_all - static AllocatedPath Build(const_pointer_type a, + static AllocatedPath Build(const_pointer a, const AllocatedPath &b) noexcept { return Build(a, Traits::GetLength(a), b.value.c_str(), b.value.size()); @@ -116,7 +114,7 @@ public: gcc_pure gcc_nonnull_all static AllocatedPath Build(const AllocatedPath &a, - const_pointer_type b) noexcept { + const_pointer b) noexcept { return Build(a.value.c_str(), a.value.size(), b, Traits::GetLength(b)); } @@ -138,13 +136,13 @@ public: * character set to a #Path instance. */ gcc_pure - static AllocatedPath FromFS(const_pointer_type fs) noexcept { + static AllocatedPath FromFS(const_pointer fs) noexcept { return AllocatedPath(fs); } gcc_pure - static AllocatedPath FromFS(const_pointer_type _begin, - const_pointer_type _end) noexcept { + static AllocatedPath FromFS(const_pointer _begin, + const_pointer _end) noexcept { return AllocatedPath(_begin, _end); } @@ -247,7 +245,7 @@ public: * instance ends. */ gcc_pure - const_pointer_type c_str() const noexcept { + const_pointer c_str() const noexcept { return value.c_str(); } @@ -256,7 +254,7 @@ public: * null-terminated. */ gcc_pure - const_pointer_type data() const noexcept { + const_pointer data() const noexcept { return value.data(); } @@ -290,12 +288,12 @@ public: * nullptr on mismatch. */ 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()); } gcc_pure - const_pointer_type GetSuffix() const noexcept { + const_pointer GetSuffix() const noexcept { return ((Path)*this).GetSuffix(); } diff --git a/src/fs/Charset.cxx b/src/fs/Charset.cxx index 880a0101c..7fa1bdbcd 100644 --- a/src/fs/Charset.cxx +++ b/src/fs/Charset.cxx @@ -91,7 +91,7 @@ FixSeparators(PathTraitsUTF8::string &&s) } PathTraitsUTF8::string -PathToUTF8(PathTraitsFS::const_pointer_type path_fs) +PathToUTF8(PathTraitsFS::const_pointer path_fs) { #if !CLANG_CHECK_VERSION(3,6) /* disabled on clang due to -Wtautological-pointer-compare */ @@ -117,7 +117,7 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs) #if defined(HAVE_FS_CHARSET) || defined(_WIN32) PathTraitsFS::string -PathFromUTF8(PathTraitsUTF8::const_pointer_type path_utf8) +PathFromUTF8(PathTraitsUTF8::const_pointer path_utf8) { #if !CLANG_CHECK_VERSION(3,6) /* disabled on clang due to -Wtautological-pointer-compare */ diff --git a/src/fs/Charset.hxx b/src/fs/Charset.hxx index 8c6ac9efe..dde6338a6 100644 --- a/src/fs/Charset.hxx +++ b/src/fs/Charset.hxx @@ -46,7 +46,7 @@ DeinitFSCharset() noexcept; */ gcc_nonnull_all PathTraitsUTF8::string -PathToUTF8(PathTraitsFS::const_pointer_type path_fs); +PathToUTF8(PathTraitsFS::const_pointer path_fs); /** * Convert the path from UTF-8. @@ -55,6 +55,6 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs); */ gcc_nonnull_all PathTraitsFS::string -PathFromUTF8(PathTraitsUTF8::const_pointer_type path_utf8); +PathFromUTF8(PathTraitsUTF8::const_pointer path_utf8); #endif diff --git a/src/fs/DirectoryReader.hxx b/src/fs/DirectoryReader.hxx index f5be9b6f3..7546f182d 100644 --- a/src/fs/DirectoryReader.hxx +++ b/src/fs/DirectoryReader.hxx @@ -36,10 +36,10 @@ class DirectoryReader { bool first = true; class MakeWildcardPath { - PathTraitsFS::pointer_type path; + PathTraitsFS::pointer path; public: - MakeWildcardPath(PathTraitsFS::const_pointer_type _path) { + MakeWildcardPath(PathTraitsFS::const_pointer _path) { auto l = _tcslen(_path); path = new PathTraitsFS::value_type[l + 3]; _tcscpy(path, _path); @@ -52,7 +52,7 @@ class DirectoryReader { delete[] path; } - operator PathTraitsFS::const_pointer_type() const { + operator PathTraitsFS::const_pointer() const { return path; } }; diff --git a/src/fs/FileSystem.hxx b/src/fs/FileSystem.hxx index 724b49348..9df3f6851 100644 --- a/src/fs/FileSystem.hxx +++ b/src/fs/FileSystem.hxx @@ -39,7 +39,7 @@ class AllocatedPath; * Wrapper for fopen() that uses #Path names. */ static inline FILE * -FOpen(Path file, PathTraitsFS::const_pointer_type mode) +FOpen(Path file, PathTraitsFS::const_pointer mode) { #ifdef _WIN32 return _tfopen(file.c_str(), mode); diff --git a/src/fs/LookupFile.cxx b/src/fs/LookupFile.cxx index 9cee68262..e2f4bfaac 100644 --- a/src/fs/LookupFile.cxx +++ b/src/fs/LookupFile.cxx @@ -22,8 +22,8 @@ #include "system/Error.hxx" gcc_pure -static PathTraitsFS::pointer_type -FindSlash(PathTraitsFS::pointer_type p, size_t i) noexcept +static PathTraitsFS::pointer +FindSlash(PathTraitsFS::pointer p, size_t i) noexcept { for (; i > 0; --i) if (p[i] == '/') @@ -38,7 +38,7 @@ LookupFile(Path pathname) PathTraitsFS::string buffer(pathname.c_str()); size_t idx = buffer.size(); - PathTraitsFS::pointer_type slash = nullptr; + PathTraitsFS::pointer slash = nullptr; while (true) { try { diff --git a/src/fs/NarrowPath.hxx b/src/fs/NarrowPath.hxx index b8cca2d45..053a1068f 100644 --- a/src/fs/NarrowPath.hxx +++ b/src/fs/NarrowPath.hxx @@ -41,7 +41,7 @@ class NarrowPath { #else typedef StringPointer<> Value; #endif - typedef typename Value::const_pointer_type const_pointer_type; + typedef typename Value::const_pointer const_pointer; Value value; @@ -57,11 +57,11 @@ public: explicit NarrowPath(Path _path):value(_path.c_str()) {} #endif - operator const_pointer_type() const { + operator const_pointer() const { return c_str(); } - const_pointer_type c_str() const { + const_pointer c_str() const { return value.c_str(); } }; diff --git a/src/fs/Path.cxx b/src/fs/Path.cxx index 1b332ec3a..d053bc773 100644 --- a/src/fs/Path.cxx +++ b/src/fs/Path.cxx @@ -36,7 +36,7 @@ Path::ToUTF8Throw() const return ::PathToUTF8(c_str()); } -Path::const_pointer_type +Path::const_pointer Path::GetSuffix() const noexcept { const auto base = GetBase().c_str(); diff --git a/src/fs/Path.hxx b/src/fs/Path.hxx index 63a2d04c7..d236c52a2 100644 --- a/src/fs/Path.hxx +++ b/src/fs/Path.hxx @@ -39,7 +39,7 @@ class Path : public PathTraitsFS::Pointer { using Traits = PathTraitsFS; typedef Traits::Pointer Base; - constexpr Path(const_pointer_type _value) noexcept:Base(_value) {} + constexpr Path(const_pointer _value) noexcept:Base(_value) {} public: /** @@ -59,7 +59,7 @@ public: * Create a new instance pointing to the specified path * string. */ - static constexpr Path FromFS(const_pointer_type fs) noexcept { + static constexpr Path FromFS(const_pointer fs) noexcept { return Path(fs); } @@ -101,7 +101,7 @@ public: * pointer is invalidated whenever the value of life of this * instance ends. */ - constexpr const_pointer_type c_str() const noexcept { + constexpr const_pointer c_str() const noexcept { return Base::c_str(); } @@ -109,7 +109,7 @@ public: * Returns a pointer to the raw value, not necessarily * null-terminated. */ - constexpr const_pointer_type data() const noexcept { + constexpr const_pointer data() const noexcept { return c_str(); } @@ -159,7 +159,7 @@ public: * nullptr on mismatch. */ 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()); } @@ -169,7 +169,7 @@ public: } gcc_pure - const_pointer_type GetSuffix() const noexcept; + const_pointer GetSuffix() const noexcept; }; /** diff --git a/src/fs/StandardDirectory.cxx b/src/fs/StandardDirectory.cxx index f3db5c01f..0037daab1 100644 --- a/src/fs/StandardDirectory.cxx +++ b/src/fs/StandardDirectory.cxx @@ -87,20 +87,20 @@ public: #ifndef ANDROID static inline bool -IsValidPathString(PathTraitsFS::const_pointer_type path) +IsValidPathString(PathTraitsFS::const_pointer path) { return path != nullptr && *path != '\0'; } static inline bool -IsValidDir(PathTraitsFS::const_pointer_type dir) +IsValidDir(PathTraitsFS::const_pointer dir) { return PathTraitsFS::IsAbsolute(dir) && DirectoryExists(Path::FromFS(dir)); } static inline AllocatedPath -SafePathFromFS(PathTraitsFS::const_pointer_type dir) +SafePathFromFS(PathTraitsFS::const_pointer dir) { if (IsValidPathString(dir) && IsValidDir(dir)) return AllocatedPath::FromFS(dir); diff --git a/src/fs/Traits.cxx b/src/fs/Traits.cxx index 0e4a6c3c3..4d8450986 100644 --- a/src/fs/Traits.cxx +++ b/src/fs/Traits.cxx @@ -24,8 +24,8 @@ template<typename Traits> typename Traits::string -BuildPathImpl(typename Traits::const_pointer_type a, size_t a_size, - typename Traits::const_pointer_type b, size_t b_size) noexcept +BuildPathImpl(typename Traits::const_pointer a, size_t a_size, + typename Traits::const_pointer b, size_t b_size) noexcept { assert(a != nullptr); assert(b != nullptr); @@ -52,15 +52,15 @@ BuildPathImpl(typename Traits::const_pointer_type a, size_t a_size, } template<typename Traits> -typename Traits::const_pointer_type -GetBasePathImpl(typename Traits::const_pointer_type p) noexcept +typename Traits::const_pointer +GetBasePathImpl(typename Traits::const_pointer p) noexcept { #if !CLANG_CHECK_VERSION(3,6) /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); #endif - typename Traits::const_pointer_type sep = Traits::FindLastSeparator(p); + typename Traits::const_pointer sep = Traits::FindLastSeparator(p); return sep != nullptr ? sep + 1 : p; @@ -68,14 +68,14 @@ GetBasePathImpl(typename Traits::const_pointer_type p) noexcept template<typename Traits> typename Traits::string -GetParentPathImpl(typename Traits::const_pointer_type p) noexcept +GetParentPathImpl(typename Traits::const_pointer p) noexcept { #if !CLANG_CHECK_VERSION(3,6) /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); #endif - typename Traits::const_pointer_type sep = Traits::FindLastSeparator(p); + typename Traits::const_pointer sep = Traits::FindLastSeparator(p); if (sep == nullptr) return typename Traits::string(Traits::CURRENT_DIRECTORY); if (sep == p) @@ -88,9 +88,9 @@ GetParentPathImpl(typename Traits::const_pointer_type p) noexcept } template<typename Traits> -typename Traits::const_pointer_type -RelativePathImpl(typename Traits::const_pointer_type base, - typename Traits::const_pointer_type other) noexcept +typename Traits::const_pointer +RelativePathImpl(typename Traits::const_pointer base, + typename Traits::const_pointer other) noexcept { assert(base != nullptr); assert(other != nullptr); @@ -122,32 +122,32 @@ RelativePathImpl(typename Traits::const_pointer_type base, } PathTraitsFS::string -PathTraitsFS::Build(const_pointer_type a, size_t a_size, - const_pointer_type b, size_t b_size) noexcept +PathTraitsFS::Build(const_pointer a, size_t a_size, + const_pointer b, size_t b_size) noexcept { return BuildPathImpl<PathTraitsFS>(a, a_size, b, b_size); } -PathTraitsFS::const_pointer_type -PathTraitsFS::GetBase(PathTraitsFS::const_pointer_type p) noexcept +PathTraitsFS::const_pointer +PathTraitsFS::GetBase(PathTraitsFS::const_pointer p) noexcept { return GetBasePathImpl<PathTraitsFS>(p); } PathTraitsFS::string -PathTraitsFS::GetParent(PathTraitsFS::const_pointer_type p) noexcept +PathTraitsFS::GetParent(PathTraitsFS::const_pointer p) noexcept { return GetParentPathImpl<PathTraitsFS>(p); } -PathTraitsFS::const_pointer_type -PathTraitsFS::Relative(const_pointer_type base, const_pointer_type other) noexcept +PathTraitsFS::const_pointer +PathTraitsFS::Relative(const_pointer base, const_pointer other) noexcept { return RelativePathImpl<PathTraitsFS>(base, other); } 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) @@ -161,27 +161,27 @@ PathTraitsFS::Apply(const_pointer_type base, const_pointer_type path) noexcept } PathTraitsUTF8::string -PathTraitsUTF8::Build(const_pointer_type a, size_t a_size, - const_pointer_type b, size_t b_size) noexcept +PathTraitsUTF8::Build(const_pointer a, size_t a_size, + const_pointer b, size_t b_size) noexcept { return BuildPathImpl<PathTraitsUTF8>(a, a_size, b, b_size); } -PathTraitsUTF8::const_pointer_type -PathTraitsUTF8::GetBase(const_pointer_type p) noexcept +PathTraitsUTF8::const_pointer +PathTraitsUTF8::GetBase(const_pointer p) noexcept { return GetBasePathImpl<PathTraitsUTF8>(p); } PathTraitsUTF8::string -PathTraitsUTF8::GetParent(const_pointer_type p) noexcept +PathTraitsUTF8::GetParent(const_pointer p) noexcept { return GetParentPathImpl<PathTraitsUTF8>(p); } -PathTraitsUTF8::const_pointer_type -PathTraitsUTF8::Relative(const_pointer_type base, - const_pointer_type other) noexcept +PathTraitsUTF8::const_pointer +PathTraitsUTF8::Relative(const_pointer base, + const_pointer other) noexcept { return RelativePathImpl<PathTraitsUTF8>(base, other); } diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx index 7fd296298..949053a52 100644 --- a/src/fs/Traits.hxx +++ b/src/fs/Traits.hxx @@ -51,8 +51,8 @@ struct PathTraitsFS { typedef string::traits_type char_traits; typedef char_traits::char_type value_type; typedef StringPointer<value_type> Pointer; - typedef Pointer::pointer_type pointer_type; - typedef Pointer::const_pointer_type const_pointer_type; + typedef Pointer::pointer pointer; + typedef Pointer::const_pointer const_pointer; #ifdef _WIN32 static constexpr value_type SEPARATOR = '\\'; @@ -60,7 +60,7 @@ struct PathTraitsFS { static constexpr value_type SEPARATOR = '/'; #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 { return @@ -71,14 +71,14 @@ struct PathTraitsFS { } 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) /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); #endif #ifdef _WIN32 - const_pointer_type pos = p + GetLength(p); + const_pointer pos = p + GetLength(p); while (p != pos && !IsSeparator(*pos)) --pos; return IsSeparator(*pos) ? pos : nullptr; @@ -89,13 +89,13 @@ struct PathTraitsFS { #ifdef _WIN32 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] == ':'; } #endif 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) /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); @@ -109,12 +109,12 @@ struct PathTraitsFS { } 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); } 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); } @@ -123,7 +123,7 @@ struct PathTraitsFS { * The return value points inside the given string. */ 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. @@ -131,7 +131,7 @@ struct PathTraitsFS { * separator in the given input string. */ 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 @@ -140,8 +140,8 @@ struct PathTraitsFS { * nullptr on mismatch. */ gcc_pure gcc_nonnull_all - static const_pointer_type Relative(const_pointer_type base, - const_pointer_type other) noexcept; + static const_pointer Relative(const_pointer base, + const_pointer other) noexcept; /** * Constructs the path from the given components. @@ -150,11 +150,11 @@ struct PathTraitsFS { * If both components are empty strings, empty string is returned. */ gcc_pure gcc_nonnull_all - static string Build(const_pointer_type a, size_t a_size, - const_pointer_type b, size_t b_size) noexcept; + static string Build(const_pointer a, size_t a_size, + const_pointer b, size_t b_size) noexcept; 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)); } @@ -163,8 +163,8 @@ struct PathTraitsFS { * base, and return the concatenated path. */ gcc_pure - static string Apply(const_pointer_type base, - const_pointer_type path) noexcept; + static string Apply(const_pointer base, + const_pointer path) noexcept; }; /** @@ -174,19 +174,19 @@ struct PathTraitsUTF8 { typedef std::string string; typedef string::traits_type char_traits; typedef char_traits::char_type value_type; - typedef value_type *pointer_type; - typedef const value_type *const_pointer_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; 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) { return ch == SEPARATOR; } 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) /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); @@ -197,13 +197,13 @@ struct PathTraitsUTF8 { #ifdef _WIN32 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] == ':'; } #endif 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) /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); @@ -217,12 +217,12 @@ struct PathTraitsUTF8 { } 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); } 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); } @@ -231,7 +231,7 @@ struct PathTraitsUTF8 { * The return value points inside the given string. */ 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. @@ -239,7 +239,7 @@ struct PathTraitsUTF8 { * separator in the given input string. */ 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 @@ -248,8 +248,8 @@ struct PathTraitsUTF8 { * nullptr on mismatch. */ gcc_pure gcc_nonnull_all - static const_pointer_type Relative(const_pointer_type base, - const_pointer_type other) noexcept; + static const_pointer Relative(const_pointer base, + const_pointer other) noexcept; /** * Constructs the path from the given components. @@ -258,11 +258,11 @@ struct PathTraitsUTF8 { * If both components are empty strings, empty string is returned. */ gcc_pure gcc_nonnull_all - static string Build(const_pointer_type a, size_t a_size, - const_pointer_type b, size_t b_size) noexcept; + static string Build(const_pointer a, size_t a_size, + const_pointer b, size_t b_size) noexcept; 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)); } }; diff --git a/src/lib/nfs/Cancellable.hxx b/src/lib/nfs/Cancellable.hxx index 60c891188..9e3ab4087 100644 --- a/src/lib/nfs/Cancellable.hxx +++ b/src/lib/nfs/Cancellable.hxx @@ -32,12 +32,12 @@ template<typename T> class CancellablePointer : public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> { public: - typedef T *pointer_type; + typedef T *pointer; typedef T &reference_type; typedef const T &const_reference_type; private: - pointer_type p; + pointer p; public: explicit CancellablePointer(reference_type _p):p(&_p) {} diff --git a/src/storage/plugins/LocalStorage.cxx b/src/storage/plugins/LocalStorage.cxx index 6f8fa63a4..07d473426 100644 --- a/src/storage/plugins/LocalStorage.cxx +++ b/src/storage/plugins/LocalStorage.cxx @@ -146,7 +146,7 @@ LocalStorage::OpenDirectory(const char *uri_utf8) gcc_pure static bool -SkipNameFS(PathTraitsFS::const_pointer_type name_fs) noexcept +SkipNameFS(PathTraitsFS::const_pointer name_fs) noexcept { return name_fs[0] == '.' && (name_fs[1] == 0 || diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx index d67283c3a..6bdce3d56 100644 --- a/src/storage/plugins/NfsStorage.cxx +++ b/src/storage/plugins/NfsStorage.cxx @@ -307,7 +307,7 @@ NfsStorage::GetInfo(const char *uri_utf8, bool follow) gcc_pure static bool -SkipNameFS(PathTraitsFS::const_pointer_type name) noexcept +SkipNameFS(PathTraitsFS::const_pointer name) noexcept { return name[0] == '.' && (name[1] == 0 || diff --git a/src/util/AllocatedString.cxx b/src/util/AllocatedString.cxx index ca0e0c5dd..b7e8d391f 100644 --- a/src/util/AllocatedString.cxx +++ b/src/util/AllocatedString.cxx @@ -32,7 +32,7 @@ template<> AllocatedString<char> -AllocatedString<char>::Duplicate(const_pointer_type src) +AllocatedString<char>::Duplicate(const_pointer src) { return Duplicate(src, StringLength(src)); } @@ -41,7 +41,7 @@ AllocatedString<char>::Duplicate(const_pointer_type src) template<> AllocatedString<wchar_t> -AllocatedString<wchar_t>::Duplicate(const_pointer_type src) +AllocatedString<wchar_t>::Duplicate(const_pointer src) { return Duplicate(src, StringLength(src)); } diff --git a/src/util/AllocatedString.hxx b/src/util/AllocatedString.hxx index 74e98333a..f575aa0a7 100644 --- a/src/util/AllocatedString.hxx +++ b/src/util/AllocatedString.hxx @@ -46,16 +46,16 @@ public: typedef typename StringPointer<T>::value_type value_type; typedef typename StringPointer<T>::reference_type reference_type; typedef typename StringPointer<T>::const_reference_type const_reference_type; - typedef typename StringPointer<T>::pointer_type pointer_type; - typedef typename StringPointer<T>::const_pointer_type const_pointer_type; + typedef typename StringPointer<T>::pointer pointer; + typedef typename StringPointer<T>::const_pointer const_pointer; typedef std::size_t size_type; static constexpr value_type SENTINEL = '\0'; private: - pointer_type value; + pointer value; - explicit AllocatedString(pointer_type _value) + explicit AllocatedString(pointer _value) :value(_value) {} public: @@ -68,7 +68,7 @@ public: delete[] value; } - static AllocatedString Donate(pointer_type value) { + static AllocatedString Donate(pointer value) { return AllocatedString(value); } @@ -82,16 +82,16 @@ public: return Donate(p); } - static AllocatedString Duplicate(const_pointer_type src); + static AllocatedString Duplicate(const_pointer src); - static AllocatedString Duplicate(const_pointer_type begin, - const_pointer_type end) { + static AllocatedString Duplicate(const_pointer begin, + const_pointer end) { auto p = new value_type[end - begin + 1]; *std::copy(begin, end, p) = SENTINEL; return Donate(p); } - static AllocatedString Duplicate(const_pointer_type begin, + static AllocatedString Duplicate(const_pointer begin, size_type length) { auto p = new value_type[length + 1]; *std::copy_n(begin, length, p) = SENTINEL; @@ -115,7 +115,7 @@ public: return value == nullptr; } - constexpr const_pointer_type c_str() const { + constexpr const_pointer c_str() const { return value; } @@ -123,7 +123,7 @@ public: return *value == SENTINEL; } - constexpr pointer_type data() const { + constexpr pointer data() const { return value; } @@ -135,7 +135,7 @@ public: return value[i]; } - pointer_type Steal() { + pointer Steal() { return std::exchange(value, nullptr); } diff --git a/src/util/BindMethod.hxx b/src/util/BindMethod.hxx index 81da8e874..a257deba3 100644 --- a/src/util/BindMethod.hxx +++ b/src/util/BindMethod.hxx @@ -246,7 +246,7 @@ struct FunctionTraits<R(Args...) noexcept(NoExcept)> { * A function pointer type which describes the "plain" * function signature. */ - typedef R (*pointer_type)(Args...) + typedef R (*pointer)(Args...) #if !GCC_OLDER_THAN(7,0) noexcept(NoExcept) #endif @@ -289,12 +289,12 @@ struct BindFunctionWrapperGenerator<R(Args...) noexcept(NoExcept), P, function> : 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 MakeBindFunctionWrapper() noexcept { return BindFunctionWrapperGenerator<typename T::function_type, - typename T::pointer_type, + typename T::pointer, function>::Invoke; } @@ -338,7 +338,7 @@ BindMethod(T &_instance) noexcept * @param T the #FunctionTraits class * @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> BindFunction() noexcept { diff --git a/src/util/CircularBuffer.hxx b/src/util/CircularBuffer.hxx index 23d54326d..0a058c19a 100644 --- a/src/util/CircularBuffer.hxx +++ b/src/util/CircularBuffer.hxx @@ -51,7 +51,7 @@ template<typename T> class CircularBuffer { public: typedef WritableBuffer<T> Range; - typedef typename Range::pointer_type pointer_type; + typedef typename Range::pointer pointer; typedef typename Range::size_type size_type; protected: @@ -66,10 +66,10 @@ protected: size_type tail; const size_type capacity; - const pointer_type data; + const pointer data; public: - constexpr CircularBuffer(pointer_type _data, size_type _capacity) + constexpr CircularBuffer(pointer _data, size_type _capacity) :head(0), tail(0), capacity(_capacity), data(_data) {} CircularBuffer(const CircularBuffer &other) = delete; diff --git a/src/util/ConstBuffer.hxx b/src/util/ConstBuffer.hxx index f9cf48cc6..0009270fd 100644 --- a/src/util/ConstBuffer.hxx +++ b/src/util/ConstBuffer.hxx @@ -45,12 +45,12 @@ template<> struct ConstBuffer<void> { typedef std::size_t size_type; typedef void value_type; - typedef const void *pointer_type; - typedef pointer_type const_pointer_type; - typedef pointer_type iterator; - typedef pointer_type const_iterator; + typedef const void *pointer; + typedef pointer const_pointer; + typedef pointer iterator; + typedef pointer const_iterator; - pointer_type data; + pointer data; size_type size; ConstBuffer() = default; @@ -58,7 +58,7 @@ struct ConstBuffer<void> { constexpr ConstBuffer(std::nullptr_t) noexcept :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) {} constexpr static ConstBuffer<void> FromVoid(ConstBuffer<void> other) noexcept { @@ -95,12 +95,12 @@ struct ConstBuffer { typedef T value_type; typedef const T &reference_type; typedef reference_type const_reference_type; - typedef const T *pointer_type; - typedef pointer_type const_pointer_type; - typedef pointer_type iterator; - typedef pointer_type const_iterator; + typedef const T *pointer; + typedef pointer const_pointer; + typedef pointer iterator; + typedef pointer const_iterator; - pointer_type data; + pointer data; size_type size; ConstBuffer() = default; @@ -108,10 +108,10 @@ struct ConstBuffer { constexpr ConstBuffer(std::nullptr_t) noexcept :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) {} - constexpr ConstBuffer(pointer_type _data, pointer_type _end) noexcept + constexpr ConstBuffer(pointer _data, pointer _end) noexcept :data(_data), size(_end - _data) {} /** @@ -127,7 +127,7 @@ struct ConstBuffer { */ static constexpr ConstBuffer<T> FromVoidFloor(ConstBuffer<void> other) noexcept { 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)); } @@ -282,7 +282,7 @@ struct ConstBuffer { * Move the front pointer to the given address, and adjust the * size attribute to retain the old end address. */ - void MoveFront(pointer_type new_data) noexcept { + void MoveFront(pointer new_data) noexcept { #ifndef NDEBUG assert(IsNull() == (new_data == nullptr)); assert(new_data <= end()); @@ -296,7 +296,7 @@ struct ConstBuffer { * Move the end pointer to the given address (by adjusting the * size). */ - void SetEnd(pointer_type new_end) noexcept { + void SetEnd(pointer new_end) noexcept { #ifndef NDEBUG assert(IsNull() == (new_end == nullptr)); assert(new_end >= begin()); diff --git a/src/util/DynamicFifoBuffer.hxx b/src/util/DynamicFifoBuffer.hxx index 422b35eec..6ca0d029f 100644 --- a/src/util/DynamicFifoBuffer.hxx +++ b/src/util/DynamicFifoBuffer.hxx @@ -41,8 +41,8 @@ template<typename T> class DynamicFifoBuffer : protected ForeignFifoBuffer<T> { public: using typename ForeignFifoBuffer<T>::size_type; - using typename ForeignFifoBuffer<T>::pointer_type; - using typename ForeignFifoBuffer<T>::const_pointer_type; + using typename ForeignFifoBuffer<T>::pointer; + using typename ForeignFifoBuffer<T>::const_pointer; using typename ForeignFifoBuffer<T>::Range; /** @@ -101,7 +101,7 @@ public: * Write data to the buffer, growing it as needed. Returns a * writable pointer. */ - pointer_type Write(size_type n) noexcept { + pointer Write(size_type n) noexcept { WantWrite(n); return Write().data; } @@ -109,7 +109,7 @@ public: /** * 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)); Append(n); } diff --git a/src/util/ForeignFifoBuffer.hxx b/src/util/ForeignFifoBuffer.hxx index 9d4013323..aca299323 100644 --- a/src/util/ForeignFifoBuffer.hxx +++ b/src/util/ForeignFifoBuffer.hxx @@ -53,8 +53,8 @@ class ForeignFifoBuffer { public: using size_type = std::size_t; using Range = WritableBuffer<T>; - using pointer_type = typename Range::pointer_type; - using const_pointer_type = typename Range::const_pointer_type; + using pointer = typename Range::pointer; + using const_pointer = typename Range::const_pointer; protected: size_type head = 0, tail = 0, capacity; @@ -211,7 +211,7 @@ public: head += n; } - size_type Read(pointer_type p, size_type n) noexcept { + size_type Read(pointer p, size_type n) noexcept { auto range = Read(); if (n > range.size) n = range.size; diff --git a/src/util/StringPointer.hxx b/src/util/StringPointer.hxx index 4555bfa7d..9d44a1398 100644 --- a/src/util/StringPointer.hxx +++ b/src/util/StringPointer.hxx @@ -39,17 +39,17 @@ public: typedef T value_type; typedef T &reference_type; typedef const T &const_reference_type; - typedef T *pointer_type; - typedef const T *const_pointer_type; + typedef T *pointer; + typedef const T *const_pointer; static constexpr value_type SENTINEL = '\0'; private: - const_pointer_type value; + const_pointer value; public: StringPointer() = default; - constexpr StringPointer(const_pointer_type _value) + constexpr StringPointer(const_pointer _value) :value(_value) {} /** @@ -60,7 +60,7 @@ public: return value == nullptr; } - constexpr const_pointer_type c_str() const { + constexpr const_pointer c_str() const { return value; } diff --git a/src/util/StringView.hxx b/src/util/StringView.hxx index a99f435a5..5be9de3ed 100644 --- a/src/util/StringView.hxx +++ b/src/util/StringView.hxx @@ -44,7 +44,7 @@ template<typename T> struct BasicStringView : ConstBuffer<T> { using typename ConstBuffer<T>::size_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>::size; @@ -57,14 +57,13 @@ struct BasicStringView : ConstBuffer<T> { explicit constexpr BasicStringView(ConstBuffer<void> 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) {} - constexpr BasicStringView(pointer_type _begin, - pointer_type _end) noexcept + constexpr BasicStringView(pointer _begin, pointer _end) noexcept :ConstBuffer<T>(_begin, _end - _begin) {} - BasicStringView(pointer_type _data) noexcept + BasicStringView(pointer _data) noexcept :ConstBuffer<T>(_data, _data != nullptr ? StringLength(_data) : 0) {} @@ -90,12 +89,12 @@ struct BasicStringView : ConstBuffer<T> { using ConstBuffer<T>::skip_front; gcc_pure - pointer_type Find(value_type ch) const noexcept { + pointer Find(value_type ch) const noexcept { return StringFind(data, ch, this->size); } gcc_pure - pointer_type FindLast(value_type ch) const noexcept { + pointer FindLast(value_type ch) const noexcept { return StringFindLast(data, ch, size); } diff --git a/src/util/WritableBuffer.hxx b/src/util/WritableBuffer.hxx index 73b26abbb..37c4b9623 100644 --- a/src/util/WritableBuffer.hxx +++ b/src/util/WritableBuffer.hxx @@ -46,12 +46,12 @@ template<> struct WritableBuffer<void> { typedef std::size_t size_type; typedef void value_type; - typedef void *pointer_type; - typedef const void *const_pointer_type; - typedef pointer_type iterator; - typedef const_pointer_type const_iterator; + typedef void *pointer; + typedef const void *const_pointer; + typedef pointer iterator; + typedef const_pointer const_iterator; - pointer_type data; + pointer data; size_type size; WritableBuffer() = default; @@ -59,7 +59,7 @@ struct WritableBuffer<void> { constexpr WritableBuffer(std::nullptr_t) noexcept :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) {} constexpr operator ConstBuffer<void>() const noexcept { @@ -94,12 +94,12 @@ struct WritableBuffer { typedef T value_type; typedef T &reference_type; typedef const T &const_reference_type; - typedef T *pointer_type; - typedef const T *const_pointer_type; - typedef pointer_type iterator; - typedef const_pointer_type const_iterator; + typedef T *pointer; + typedef const T *const_pointer; + typedef pointer iterator; + typedef const_pointer const_iterator; - pointer_type data; + pointer data; size_type size; WritableBuffer() = default; @@ -107,11 +107,10 @@ struct WritableBuffer { constexpr WritableBuffer(std::nullptr_t) noexcept :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) {} - constexpr WritableBuffer(pointer_type _data, - pointer_type _end) noexcept + constexpr WritableBuffer(pointer _data, pointer _end) noexcept :data(_data), size(_end - _data) {} /** @@ -131,7 +130,7 @@ struct WritableBuffer { */ static constexpr WritableBuffer<T> FromVoidFloor(WritableBuffer<void> other) noexcept { 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)); } @@ -272,7 +271,7 @@ struct WritableBuffer { * Move the front pointer to the given address, and adjust the * size attribute to retain the old end address. */ - void MoveFront(pointer_type new_data) noexcept { + void MoveFront(pointer new_data) noexcept { #ifndef NDEBUG assert(IsNull() == (new_data == nullptr)); assert(new_data <= end()); @@ -286,7 +285,7 @@ struct WritableBuffer { * Move the end pointer to the given address (by adjusting the * size). */ - void SetEnd(pointer_type new_end) noexcept { + void SetEnd(pointer new_end) noexcept { #ifndef NDEBUG assert(IsNull() == (new_end == nullptr)); assert(new_end >= begin()); |