Browse Source

Apply tidy after updating to clang-format 5.0.0

The behavior of clang-format slightly changed in Clang 5.0.0:
http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
experiment/srcref_basic_cfg
Martchus 4 years ago
parent
commit
e52fd5a4af
  1. 2
      application/argumentparser.h
  2. 2
      application/argumentparserprivate.h
  3. 2
      application/failure.cpp
  4. 2
      application/failure.h
  5. 4
      chrono/datetime.h
  6. 2
      chrono/period.cpp
  7. 2
      chrono/period.h
  8. 4
      chrono/timespan.h
  9. 2
      conversion/binaryconversion.h
  10. 2
      conversion/conversionexception.cpp
  11. 2
      conversion/conversionexception.h
  12. 24
      conversion/stringbuilder.h
  13. 2
      conversion/stringconversion.cpp
  14. 2
      conversion/stringconversion.h
  15. 2
      conversion/widen.h
  16. 2
      io/ansiescapecodes.h
  17. 2
      io/binaryreader.h
  18. 2
      io/binarywriter.h
  19. 2
      io/catchiofailure.cpp
  20. 2
      io/catchiofailure.h
  21. 2
      io/copy.h
  22. 2
      io/misc.cpp
  23. 6
      io/path.cpp
  24. 2
      io/path.h
  25. 2
      math/math.cpp
  26. 2
      math/math.h
  27. 2
      misc/memory.h
  28. 2
      misc/random.cpp
  29. 2
      misc/random.h
  30. 4
      misc/traits.h
  31. 9
      tests/iotests.cpp
  32. 2
      tests/testutils.cpp
  33. 4
      tests/testutils.h

2
application/argumentparser.h

@ -852,6 +852,6 @@ inline ConfigValueArgument::ConfigValueArgument(
setRequiredValueCount(valueNames.size());
setValueNames(valueNames);
}
}
} // namespace ApplicationUtilities
#endif // APPLICATION_UTILITIES_ARGUMENTPARSER_H

2
application/argumentparserprivate.h

@ -31,6 +31,6 @@ public:
/// \brief Whether completion mode is enabled. In this case reading args will be continued even if an denotation is unknown (regardless of unknownArgumentBehavior()).
bool completionMode;
};
}
} // namespace ApplicationUtilities
#endif // APPLICATION_UTILITIES_ARGUMENTPARSER_PRIVATE_H

2
application/failure.cpp

@ -41,4 +41,4 @@ const char *Failure::what() const USE_NOTHROW
{
return m_what.c_str();
}
}
} // namespace ApplicationUtilities

2
application/failure.h

@ -19,6 +19,6 @@ public:
private:
std::string m_what;
};
}
} // namespace ApplicationUtilities
#endif // APPLICATION_UTILITIES_FAILURE_H

4
chrono/datetime.h

@ -490,7 +490,7 @@ inline DateTime &DateTime::operator-=(const TimeSpan &timeSpan)
m_ticks -= timeSpan.m_ticks;
return *this;
}
}
} // namespace ChronoUtilities
namespace std {
template <> struct hash<ChronoUtilities::DateTime> {
@ -499,6 +499,6 @@ template <> struct hash<ChronoUtilities::DateTime> {
return hash<decltype(dateTime.totalTicks())>()(dateTime.totalTicks());
}
};
}
} // namespace std
#endif // CHRONO_UTILITIES_DATETIME_H

2
chrono/period.cpp

@ -27,4 +27,4 @@ Period::Period(const DateTime &beg, const DateTime &end)
--m_years;
}
}
}
} // namespace ChronoUtilities

2
chrono/period.h

@ -41,6 +41,6 @@ inline int Period::days() const
{
return m_days;
}
}
} // namespace ChronoUtilities
#endif // CHRONO_UTILITIES_PERIOD_H

4
chrono/timespan.h

@ -402,7 +402,7 @@ constexpr inline bool TimeSpan::isInfinity() const
{
return m_ticks == std::numeric_limits<decltype(m_ticks)>::max();
}
}
} // namespace ChronoUtilities
namespace std {
template <> struct hash<ChronoUtilities::TimeSpan> {
@ -411,6 +411,6 @@ template <> struct hash<ChronoUtilities::TimeSpan> {
return hash<decltype(timeSpan.totalTicks())>()(timeSpan.totalTicks());
}
};
}
} // namespace std
#endif // CHRONO_UTILITIES_TIMESPAN_H

2
conversion/binaryconversion.h

@ -172,6 +172,6 @@ CPP_UTILITIES_EXPORT constexpr uint64 swapOrder(uint64 value)
| ((value & 0x000000FF00000000) >> (1 * 8)) | ((value & 0x00000000FF000000) << (1 * 8)) | ((value & 0x0000000000FF0000) << (3 * 8))
| ((value & 0x000000000000FF00) << (5 * 8)) | ((value) << (7 * 8));
}
}
} // namespace ConversionUtilities
#endif // CONVERSION_UTILITIES_BINARY_CONVERSION_H

2
conversion/conversionexception.cpp

@ -29,4 +29,4 @@ ConversionException::ConversionException(const std::string &what) USE_NOTHROW :
ConversionException::~ConversionException() USE_NOTHROW
{
}
}
} // namespace ConversionUtilities

2
conversion/conversionexception.h

@ -14,6 +14,6 @@ public:
ConversionException(const std::string &what) USE_NOTHROW;
~ConversionException() USE_NOTHROW;
};
}
} // namespace ConversionUtilities
#endif // CONVERSION_UTILITIES_CONVERSIONEXCEPTION_H

24
conversion/stringbuilder.h

@ -34,8 +34,9 @@ constexpr std::size_t computeTupleElementSize(CharType)
return 1;
}
template <class StringType, typename IntegralType, Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>,
std::is_integral<IntegralType>, std::is_unsigned<IntegralType>>...>
template <class StringType, typename IntegralType,
Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_unsigned<IntegralType>>...>
std::size_t computeTupleElementSize(IntegralType number, typename StringType::value_type base = 10)
{
std::size_t size = 0;
@ -44,8 +45,9 @@ std::size_t computeTupleElementSize(IntegralType number, typename StringType::va
return size;
}
template <class StringType, typename IntegralType, Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>,
std::is_integral<IntegralType>, std::is_signed<IntegralType>>...>
template <class StringType, typename IntegralType,
Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_signed<IntegralType>>...>
std::size_t computeTupleElementSize(IntegralType number, typename StringType::value_type base = 10)
{
std::size_t size = number < 0 ? 1 : 0;
@ -76,8 +78,9 @@ void append(StringType &target, CharType c)
target += c;
}
template <class StringType, typename IntegralType, Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>,
std::is_integral<IntegralType>, std::is_unsigned<IntegralType>>...>
template <class StringType, typename IntegralType,
Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_unsigned<IntegralType>>...>
void append(StringType &target, IntegralType number, typename StringType::value_type base = 10)
{
const auto start = target.begin() + target.size();
@ -87,8 +90,9 @@ void append(StringType &target, IntegralType number, typename StringType::value_
} while (number);
}
template <class StringType, typename IntegralType, Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>,
std::is_integral<IntegralType>, std::is_signed<IntegralType>>...>
template <class StringType, typename IntegralType,
Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_signed<IntegralType>>...>
void append(StringType &target, IntegralType number, typename StringType::value_type base = 10)
{
if (number < 0) {
@ -126,7 +130,7 @@ template <class StringType, class Tuple> struct TupleToString<StringType, Tuple,
Helper::append(str, std::get<0>(tuple));
}
};
}
} // namespace Helper
/// \endcond
/*!
@ -254,6 +258,6 @@ inline std::string operator+(const Tuple &lhs, IntegralType rhs)
{
return tupleToString(std::tuple_cat(lhs, std::make_tuple(rhs)));
}
}
} // namespace ConversionUtilities
#endif // CONVERSION_UTILITIES_STRINGBUILDER_H

2
conversion/stringconversion.cpp

@ -363,4 +363,4 @@ pair<unique_ptr<byte[]>, uint32> decodeBase64(const char *encodedStr, const uint
}
return make_pair(move(buffer), decodedSize);
}
}
} // namespace ConversionUtilities

2
conversion/stringconversion.h

@ -531,6 +531,6 @@ CPP_UTILITIES_EXPORT std::string dataSizeToString(uint64 sizeInByte, bool includ
CPP_UTILITIES_EXPORT std::string bitrateToString(double speedInKbitsPerSecond, bool useByteInsteadOfBits = false);
CPP_UTILITIES_EXPORT std::string encodeBase64(const byte *data, uint32 dataSize);
CPP_UTILITIES_EXPORT std::pair<std::unique_ptr<byte[]>, uint32> decodeBase64(const char *encodedStr, const uint32 strSize);
}
} // namespace ConversionUtilities
#endif // CONVERSION_UTILITIES_STRINGCONVERSION_H

2
conversion/widen.h

@ -46,6 +46,6 @@ private:
std::locale m_loc;
const std::ctype<E> *m_pctype;
};
}
} // namespace ConversionUtilities
#endif // CONVERSION_UTILITIES_WIDEN_H

2
io/ansiescapecodes.h

@ -79,6 +79,6 @@ inline void eraseLine(std::ostream &stream)
{
stream << "\33[2K";
}
}
} // namespace EscapeCodes
#endif // IOUTILITIES_ANSIESCAPECODES

2
io/binaryreader.h

@ -557,6 +557,6 @@ inline float32 BinaryReader::readFixed16LE()
{
return ConversionUtilities::toFloat32(readUInt32LE());
}
}
} // namespace IoUtilities
#endif // IOUTILITIES_BINERYREADER_H

2
io/binarywriter.h

@ -525,6 +525,6 @@ inline void BinaryWriter::writeFixed16LE(float32 valueToConvertAndWrite)
{
writeUInt32LE(ConversionUtilities::toFixed16(valueToConvertAndWrite));
}
}
} // namespace IoUtilities
#endif // IO_UTILITIES_BINARYWRITER_H

2
io/catchiofailure.cpp

@ -38,4 +38,4 @@ void throwIoFailure(const char *what)
{
throw ios_base::failure(what);
}
}
} // namespace IoUtilities

2
io/catchiofailure.h

@ -9,6 +9,6 @@ namespace IoUtilities {
CPP_UTILITIES_EXPORT const char *catchIoFailure();
CPP_UTILITIES_EXPORT void throwIoFailure(const char *what);
}
} // namespace IoUtilities
#endif // IOUTILITIES_CATCHIOFAILURE_H

2
io/copy.h

@ -84,6 +84,6 @@ template <std::size_t bufferSize> char *CopyHelper<bufferSize>::buffer()
{
return m_buffer;
}
}
} // namespace IoUtilities
#endif // IOUTILITIES_COPY_H

2
io/misc.cpp

@ -29,4 +29,4 @@ string readFile(const string &path, std::string::size_type maxSize)
res.assign((istreambuf_iterator<char>(file)), istreambuf_iterator<char>());
return res;
}
}
} // namespace IoUtilities

6
io/path.cpp

@ -112,8 +112,8 @@ bool settingsDirectory(std::string &result, std::string applicationDirectoryName
#if defined(PLATFORM_UNIX)
struct stat sb;
return (stat(result.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode));
#else // PLATFORM_WINDOWS
// FIXME: use UTF-16 API to support unicode, or rewrite using fs abstraction lib
#else // PLATFORM_WINDOWS \
// FIXME: use UTF-16 API to support unicode, or rewrite using fs abstraction lib
DWORD ftyp = GetFileAttributesA(result.c_str());
return (ftyp != INVALID_FILE_ATTRIBUTES) && (ftyp & FILE_ATTRIBUTE_DIRECTORY);
#endif
@ -209,4 +209,4 @@ std::list<std::string> directoryEntries(const char *path, DirectoryEntryType typ
return list<string>(); // TODO
#endif
}
}
} // namespace IoUtilities

2
io/path.h

@ -46,6 +46,6 @@ CPP_UTILITIES_EXPORT void removeInvalidChars(std::string &fileName);
CPP_UTILITIES_EXPORT bool settingsDirectory(
std::string &result, std::string applicationDirectoryName = std::string(), bool createApplicationDirectory = false);
CPP_UTILITIES_EXPORT std::list<std::string> directoryEntries(const char *path, DirectoryEntryType types = DirectoryEntryType::All);
}
} // namespace IoUtilities
#endif // IOUTILITIES_PATHHELPER_H

2
math/math.cpp

@ -90,4 +90,4 @@ uint64 orderModulo(const uint64 number, const uint64 module)
;
return order != module ? order : 0;
}
}
} // namespace MathUtilities

2
math/math.h

@ -12,6 +12,6 @@ CPP_UTILITIES_EXPORT int factorial(int number);
CPP_UTILITIES_EXPORT uint64 powerModulo(uint64 base, uint64 expontent, uint64 module);
CPP_UTILITIES_EXPORT int64 inverseModulo(int64 number, int64 module);
CPP_UTILITIES_EXPORT uint64 orderModulo(uint64 number, uint64 module);
}
} // namespace MathUtilities
#endif // MATHUTILITIES_H

2
misc/memory.h

@ -35,7 +35,7 @@ template <typename _Tp> inline typename _MakeUniq<_Tp>::__array make_unique(size
/// Disable std::make_unique for arrays of known bound
template <typename _Tp, typename... _Args> inline typename _MakeUniq<_Tp>::__invalid_type make_unique(_Args &&...) = delete;
}
} // namespace std
#endif
/// \endcond

2
misc/random.cpp

@ -124,4 +124,4 @@ void generateRandomCharacterSequence(char *result, unsigned int length, bool use
generateRandomCharacterSequence(
result, length, rand, RAND_MAX, useSmallLetters, useCapitalLetters, useNumbers, useSymbols, useAtLeastOneOfEachCategory);
}
}
} // namespace RandomUtilities

2
misc/random.h

@ -12,6 +12,6 @@ CPP_UTILITIES_EXPORT void generateRandomCharacterSequence(char *result, unsigned
CPP_UTILITIES_EXPORT void generateRandomCharacterSequence(char *result, unsigned int length, std::function<int()> randomizer, int maximalRandomNumber,
bool useSmallLetters = true, bool useCapitalLetters = true, bool useNumbers = true, bool useSymbols = true,
bool useAtLeastOneOfEachCategory = true);
}
} // namespace RandomUtilities
#endif // RANDOMUTILS_H

4
misc/traits.h

@ -65,10 +65,10 @@ auto isIteratableImpl(int) -> decltype(
void(*begin(std::declval<T &>())), Bool<true>{});
template <typename T> Bool<false> isIteratableImpl(...);
}
} // namespace Detail
/// \endcond
template <typename T> using IsIteratable = decltype(Detail::isIteratableImpl<T>(0));
}
} // namespace Traits
#endif // CPP_UTILITIES_TRAITS_H

9
tests/iotests.cpp

@ -134,10 +134,11 @@ void IoTests::testBinaryReader()
CPPUNIT_ASSERT(reader.readBool() == true);
CPPUNIT_ASSERT(reader.readString(3) == "abc");
CPPUNIT_ASSERT(reader.readLengthPrefixedString() == "ABC");
CPPUNIT_ASSERT(reader.readLengthPrefixedString() == "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
"23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"
"45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"
"678901234567890123456789");
CPPUNIT_ASSERT(reader.readLengthPrefixedString()
== "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
"23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"
"45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"
"678901234567890123456789");
CPPUNIT_ASSERT(reader.readTerminatedString() == "def");
CPPUNIT_ASSERT_THROW(reader.readLengthPrefixedString(), ConversionException);
CPPUNIT_ASSERT_MESSAGE("pos in stream not advanced on conversion error", reader.readByte() == 0);

2
tests/testutils.cpp

@ -392,4 +392,4 @@ int execHelperApp(const char *appPath, const char *const *args, std::string &out
return execAppInternal(appPath, args, output, errors, suppressLogging, timeout, string());
}
#endif
}
} // namespace TestUtilities

4
tests/testutils.h

@ -217,7 +217,7 @@ constexpr int64 operator"" _int64(unsigned long long size)
{
return static_cast<int64>(size);
}
}
}
} // namespace Literals
} // namespace TestUtilities
#endif // TESTUTILS_H

Loading…
Cancel
Save