diff options
Diffstat (limited to 'source/core')
-rw-r--r-- | source/core/StarBTreeDatabase.cpp | 2 | ||||
-rw-r--r-- | source/core/StarColor.hpp | 2 | ||||
-rw-r--r-- | source/core/StarDirectives.cpp | 16 | ||||
-rw-r--r-- | source/core/StarDirectives.hpp | 2 | ||||
-rw-r--r-- | source/core/StarEncode.cpp | 4 | ||||
-rw-r--r-- | source/core/StarImageProcessing.cpp | 5 | ||||
-rw-r--r-- | source/core/StarJson.cpp | 2 | ||||
-rw-r--r-- | source/core/StarJsonRpc.cpp | 2 | ||||
-rw-r--r-- | source/core/StarLockFile_unix.cpp | 2 | ||||
-rw-r--r-- | source/core/StarLua.hpp | 2 | ||||
-rw-r--r-- | source/core/StarLuaConverters.cpp | 2 | ||||
-rw-r--r-- | source/core/StarOptionParser.cpp | 2 | ||||
-rw-r--r-- | source/core/StarParametricFunction.hpp | 2 | ||||
-rw-r--r-- | source/core/StarPythonic.hpp | 10 | ||||
-rw-r--r-- | source/core/StarRect.hpp | 8 | ||||
-rw-r--r-- | source/core/StarString.hpp | 4 | ||||
-rw-r--r-- | source/core/StarStringView.cpp | 2 | ||||
-rw-r--r-- | source/core/StarStringView.hpp | 2 | ||||
-rw-r--r-- | source/core/StarTime.cpp | 5 | ||||
-rw-r--r-- | source/core/StarTime.hpp | 1 |
20 files changed, 49 insertions, 28 deletions
diff --git a/source/core/StarBTreeDatabase.cpp b/source/core/StarBTreeDatabase.cpp index 175de9e..6983df8 100644 --- a/source/core/StarBTreeDatabase.cpp +++ b/source/core/StarBTreeDatabase.cpp @@ -199,7 +199,7 @@ void BTreeDatabase::forAll(function<void(ByteArray, ByteArray)> v) { bool BTreeDatabase::insert(ByteArray const& k, ByteArray const& data) { WriteLocker writeLocker(m_lock); checkKeySize(k); - return m_impl.insert(move(k), move(data)); + return m_impl.insert(k, data); } bool BTreeDatabase::remove(ByteArray const& k) { diff --git a/source/core/StarColor.hpp b/source/core/StarColor.hpp index 5af2ffa..d50d694 100644 --- a/source/core/StarColor.hpp +++ b/source/core/StarColor.hpp @@ -67,7 +67,7 @@ public: static Color temperature(float temp); static Vec4B hueShiftVec4B(Vec4B color, float hue); - static Vec4B Color::hexToVec4B(StringView s); + static Vec4B hexToVec4B(StringView s); // Black Color(); diff --git a/source/core/StarDirectives.cpp b/source/core/StarDirectives.cpp index a18951e..dc1765c 100644 --- a/source/core/StarDirectives.cpp +++ b/source/core/StarDirectives.cpp @@ -154,11 +154,11 @@ size_t Directives::size() const { return shared ? shared->entries.size() : 0; } -inline bool Directives::empty() const { +bool Directives::empty() const { return !shared || shared->empty(); } -inline Directives::operator bool() const { +Directives::operator bool() const { return !empty(); } @@ -172,7 +172,7 @@ DataStream& operator>>(DataStream& ds, Directives& directives) { return ds; } -DataStream& operator<<(DataStream& ds, Directives const& directives) { +DataStream& operator<<(DataStream & ds, Directives const& directives) { if (directives) ds.write(directives.shared->string); else @@ -205,11 +205,11 @@ DirectivesGroup::DirectivesGroup(String&& directives) : m_count(0) { } } -inline bool DirectivesGroup::empty() const { +bool DirectivesGroup::empty() const { return m_count == 0; } -inline DirectivesGroup::operator bool() const { +DirectivesGroup::operator bool() const { return empty(); } @@ -238,7 +238,7 @@ DirectivesGroup& DirectivesGroup::operator+=(Directives const& other) { return *this; } -inline String DirectivesGroup::toString() const { +String DirectivesGroup::toString() const { String string; addToString(string); return string; @@ -272,7 +272,7 @@ bool DirectivesGroup::forEachAbortable(AbortableDirectivesCallback callback) con return true; } -inline Image DirectivesGroup::applyNewImage(Image const& image) const { +Image DirectivesGroup::applyNewImage(Image const& image) const { Image result = image; applyExistingImage(result); return result; @@ -288,7 +288,7 @@ void DirectivesGroup::applyExistingImage(Image& image) const { }); } -inline size_t DirectivesGroup::hash() const { +size_t DirectivesGroup::hash() const { XXHash3 hasher; for (auto& directives : m_directives) { size_t hash = directives.hash(); diff --git a/source/core/StarDirectives.hpp b/source/core/StarDirectives.hpp index f841373..9936c51 100644 --- a/source/core/StarDirectives.hpp +++ b/source/core/StarDirectives.hpp @@ -23,7 +23,7 @@ public: size_t length; ImageOperation const& loadOperation(Shared const& parent) const; - inline StringView string(Shared const& parent) const; + StringView string(Shared const& parent) const; Entry(ImageOperation&& newOperation, size_t begin, size_t end); Entry(ImageOperation const& newOperation, size_t begin, size_t end); Entry(Entry const& other); diff --git a/source/core/StarEncode.cpp b/source/core/StarEncode.cpp index b3a8b79..3a63653 100644 --- a/source/core/StarEncode.cpp +++ b/source/core/StarEncode.cpp @@ -186,7 +186,7 @@ String hexEncode(char const* data, size_t len) { size_t encoded = hexEncode(data, len, &res[0], res.size()); _unused(encoded); starAssert(encoded == res.size()); - return move(res); + return res; } String base64Encode(char const* data, size_t len) { @@ -195,7 +195,7 @@ String base64Encode(char const* data, size_t len) { _unused(encoded); starAssert(encoded <= res.size()); res.resize(encoded); - return move(res); + return res; } String hexEncode(ByteArray const& data) { diff --git a/source/core/StarImageProcessing.cpp b/source/core/StarImageProcessing.cpp index e95a13f..2c79b58 100644 --- a/source/core/StarImageProcessing.cpp +++ b/source/core/StarImageProcessing.cpp @@ -204,7 +204,8 @@ ImageOperation imageOperationFromString(StringView string) { return move(operation); - if (which = !which) + which = !which; + if (which) operation.colorReplaceMap[*(Vec4B*)&a] = *(Vec4B*)&b; hexLen = 0; @@ -219,7 +220,7 @@ ImageOperation imageOperationFromString(StringView string) { //if (time != 0.0) // Logger::logf(LogLevel::Debug, "Parsed %u long directives to %u replace operations in %fs", view.size(), operation.colorReplaceMap.size(), Time::monotonicTime() - time); - return move(operation); + return operation; } List<StringView> bits; diff --git a/source/core/StarJson.cpp b/source/core/StarJson.cpp index 3f65e33..54d3fe7 100644 --- a/source/core/StarJson.cpp +++ b/source/core/StarJson.cpp @@ -1025,7 +1025,7 @@ Json jsonMerge(Json const& base, Json const& merger) { if (!res.second) res.first->second = jsonMerge(res.first->second, p.second); } - return move(merged); + return merged; } else if (merger.type() == Json::Type::Null) { return base; diff --git a/source/core/StarJsonRpc.cpp b/source/core/StarJsonRpc.cpp index dcdc16e..60779b9 100644 --- a/source/core/StarJsonRpc.cpp +++ b/source/core/StarJsonRpc.cpp @@ -13,7 +13,7 @@ JsonRpc::JsonRpc() { void JsonRpc::registerHandler(String const& handler, JsonRpcRemoteFunction func) { if (m_handlers.contains(handler)) throw JsonRpcException(strf("Handler by that name already exists '%s'", handler)); - m_handlers.add(move(handler), move(func)); + m_handlers.add(handler, move(func)); } void JsonRpc::registerHandlers(JsonRpcHandlers const& handlers) { diff --git a/source/core/StarLockFile_unix.cpp b/source/core/StarLockFile_unix.cpp index 2b6e0bf..9677f2d 100644 --- a/source/core/StarLockFile_unix.cpp +++ b/source/core/StarLockFile_unix.cpp @@ -14,7 +14,7 @@ int64_t const LockFile::MaximumSleepMillis; Maybe<LockFile> LockFile::acquireLock(String const& filename, int64_t lockTimeout) { LockFile lock(move(filename)); if (lock.lock(lockTimeout)) - return move(lock); + return lock; return {}; } diff --git a/source/core/StarLua.hpp b/source/core/StarLua.hpp index 1c34cc4..d82f906 100644 --- a/source/core/StarLua.hpp +++ b/source/core/StarLua.hpp @@ -109,7 +109,7 @@ namespace LuaDetail { LuaHandle& operator=(LuaHandle&& other); LuaEnginePtr engine; - int handleIndex; + int handleIndex = 0; }; // Not meant to be used directly, exposes a raw interface for wrapped C++ diff --git a/source/core/StarLuaConverters.cpp b/source/core/StarLuaConverters.cpp index e09876a..9cd44e3 100644 --- a/source/core/StarLuaConverters.cpp +++ b/source/core/StarLuaConverters.cpp @@ -33,7 +33,7 @@ Maybe<Color> LuaConverter<Color>::to(LuaEngine& engine, LuaValue const& v) { } else if (auto s = v.ptr<LuaString>()) { try { return Color(s->ptr()); - } catch (ColorException) {} + } catch (ColorException const&) {} } return {}; diff --git a/source/core/StarOptionParser.cpp b/source/core/StarOptionParser.cpp index f9d51ff..ecf6e28 100644 --- a/source/core/StarOptionParser.cpp +++ b/source/core/StarOptionParser.cpp @@ -67,7 +67,7 @@ pair<OptionParser::Options, StringList> OptionParser::parseOptions(StringList co } } else { - result.arguments.append(move(arg)); + result.arguments.append(arg); } } diff --git a/source/core/StarParametricFunction.hpp b/source/core/StarParametricFunction.hpp index 5eaff14..8221c05 100644 --- a/source/core/StarParametricFunction.hpp +++ b/source/core/StarParametricFunction.hpp @@ -124,7 +124,7 @@ ParametricTable<IndexType, ValueType>::ParametricTable(PairContainer indexValueP return std::get<0>(a) < std::get<0>(b); }); - for (auto const pair : indexValuePairs) { + for (auto const& pair : indexValuePairs) { m_indexes.push_back(move(std::get<0>(pair))); m_values.push_back(move(std::get<1>(pair))); } diff --git a/source/core/StarPythonic.hpp b/source/core/StarPythonic.hpp index 014e14e..0bfdc50 100644 --- a/source/core/StarPythonic.hpp +++ b/source/core/StarPythonic.hpp @@ -303,7 +303,13 @@ namespace RangeHelper { STAR_EXCEPTION(RangeException, StarException); template <typename Value, typename Diff = int> -class RangeIterator : public std::iterator<std::random_access_iterator_tag, Value> { +class RangeIterator { + using iterator_category = std::random_access_iterator_tag; + using value_type = Value; + using difference_type = Diff; + using pointer = Value*; + using reference = Value&; + public: RangeIterator() : m_start(), m_end(), m_diff(1), m_current(), m_stop(true) {} @@ -342,7 +348,7 @@ public: return *this; } - RangeIterator operator-=(Diff steps) const { + RangeIterator operator-=(Diff steps) { m_stop = false; sanity(); diff --git a/source/core/StarRect.hpp b/source/core/StarRect.hpp index 38bbabc..0e2ba90 100644 --- a/source/core/StarRect.hpp +++ b/source/core/StarRect.hpp @@ -52,6 +52,7 @@ public: Box(); Box(Coord const& min, Coord const& max); Box(Box const& b); + Box& operator=(Box const& b); template <typename T2> explicit Box(Box<T2, N> const& b); @@ -329,6 +330,13 @@ Box<T, N>::Box(Box const& b) : m_min(b.min()), m_max(b.max()) {} template <typename T, size_t N> +Box<T, N>& Box<T, N>::operator=(Box<T, N> const& b) { + m_min = b.m_min; + m_max = b.m_max; + return *this; +} + +template <typename T, size_t N> template <typename T2> Box<T, N>::Box(Box<T2, N> const& b) : m_min(b.min()), m_max(b.max()) {} diff --git a/source/core/StarString.hpp b/source/core/StarString.hpp index 5adb0f9..1fe1aaa 100644 --- a/source/core/StarString.hpp +++ b/source/core/StarString.hpp @@ -428,7 +428,7 @@ String String::lookupTags(Lookup&& lookup) const { } } - return move(finalString); + return finalString; } template <typename Lookup> @@ -466,7 +466,7 @@ Maybe<String> String::maybeLookupTagsView(Lookup&& lookup) const { for (auto& view : finalViews) finalString += view; - return move(finalString); + return String(finalString); } template <typename Lookup> diff --git a/source/core/StarStringView.cpp b/source/core/StarStringView.cpp index 1357404..d1c9ae3 100644 --- a/source/core/StarStringView.cpp +++ b/source/core/StarStringView.cpp @@ -425,7 +425,7 @@ bool operator<(StringView s1, StringView s2) { return s1.m_view < s2.m_view; } -std::ostream& operator<<(std::ostream& os, StringView& s) { +std::ostream& operator<<(std::ostream& os, StringView const& s) { os << s.utf8(); return os; } diff --git a/source/core/StarStringView.hpp b/source/core/StarStringView.hpp index ff6e564..ab40936 100644 --- a/source/core/StarStringView.hpp +++ b/source/core/StarStringView.hpp @@ -100,7 +100,7 @@ public: friend bool operator!=(StringView s1, StringView s2); friend bool operator<(StringView s1, StringView s2); - friend std::ostream& operator<<(std::ostream& os, StringView& s); + friend std::ostream& operator<<(std::ostream& os, StringView const& s); private: int compare(size_t selfOffset, diff --git a/source/core/StarTime.cpp b/source/core/StarTime.cpp index b8d01a4..4d0b516 100644 --- a/source/core/StarTime.cpp +++ b/source/core/StarTime.cpp @@ -177,6 +177,11 @@ Timer::Timer() : Clock(false) { Timer::Timer(Timer const& timer) : Clock(timer) {} +Timer& Timer::operator=(Timer const& timer) { + Clock::operator=(timer); + return *this; +} + void Timer::restart(double timeLeft) { Clock::setTime(-timeLeft); Clock::start(); diff --git a/source/core/StarTime.hpp b/source/core/StarTime.hpp index e4dd274..a071df5 100644 --- a/source/core/StarTime.hpp +++ b/source/core/StarTime.hpp @@ -85,6 +85,7 @@ public: // Constructs a stopped timer whose time is up. Timer(); Timer(Timer const& timer); + Timer& operator=(Timer const& timer); // Start the timer with the given time left. void restart(double timeLeft); |