Petr Onderka has submitted this change and it was merged.
Change subject: More fixes for GCC 4.6
......................................................................
More fixes for GCC 4.6
Change-Id: I8724db48bae8bc71347155badc33aef62f1024a4
---
M DumpException.h
M DumpObjects/DumpTraits.h
M DumpWriters/DumpWriter.cpp
M Indexes/IndexInnerNode.h
M Indexes/IndexLeafNode.h
5 files changed, 24 insertions(+), 8 deletions(-)
Approvals:
Petr Onderka: Verified; Looks good to me, approved
diff --git a/DumpException.h b/DumpException.h
index 6a832ff..3c11e6c 100644
--- a/DumpException.h
+++ b/DumpException.h
@@ -17,6 +17,10 @@
UserException(const std::string &message);
virtual const char* what() const NOEXCEPT OVERRIDE;
+
+ // GCC 4.6 seems to require this
+ virtual ~UserException() NOEXCEPT
+ {}
};
// user exception that was caused by invalid parameters,
diff --git a/DumpObjects/DumpTraits.h b/DumpObjects/DumpTraits.h
index 45a686e..0a6d579 100644
--- a/DumpObjects/DumpTraits.h
+++ b/DumpObjects/DumpTraits.h
@@ -163,7 +163,14 @@
template<typename T>
class DumpTraits<T, typename std::enable_if<std::is_enum<T>::value>::type>
{
- typedef DumpTraits<typename std::underlying_type<T>::type> TargetTraits;
+#ifdef GCC_4_6
+ typedef std::uint64_t UnderlyingType;
+ typedef DumpTraitsNumeric<UnderlyingType, sizeof(T)> TargetTraits;
+#else
+ typedef typename std::underlying_type<T>::type UnderlyingType;
+ typedef DumpTraits<UnderlyingType> TargetTraits;
+#endif
+
public:
static T Read(istream &stream)
{
@@ -173,13 +180,13 @@
static void Write(ostream &stream, const T value)
{
- auto target = static_cast<typename
std::underlying_type<T>::type>(value);
+ auto target = static_cast<UnderlyingType>(value);
TargetTraits::Write(stream, target);
}
static uint32_t DumpSize(const T value = T())
{
- auto target = static_cast<typename
std::underlying_type<T>::type>(value);
+ auto target = static_cast<UnderlyingType>(value);
return TargetTraits::DumpSize(target);
}
};
diff --git a/DumpWriters/DumpWriter.cpp b/DumpWriters/DumpWriter.cpp
index 1154b20..9609ded 100644
--- a/DumpWriters/DumpWriter.cpp
+++ b/DumpWriters/DumpWriter.cpp
@@ -28,13 +28,17 @@
// invalid UTF-8 at the end of a string is represented as U+FFFD
// this can get string over 255 bytes, so that character needs to be
removed
+ size_t charsToErase;
+
std::string replacementChar = "\xEF\xBF\xBD"; // UTF-8 encoded U+FFFD
REPLACEMENT CHARACTER
if (comment.substr(comment.length() - 3) == replacementChar)
- comment.erase(comment.length() - 3, 3);
+ charsToErase = 3;
else if (comment.substr(comment.length() - 6) == replacementChar +
"...")
- comment.pop_back();
+ charsToErase = 1;
else
throw DumpException();
+
+ comment.erase(comment.length() - charsToErase, charsToErase);
}
}
@@ -166,4 +170,4 @@
if (diffWriter != nullptr)
diffWriter->Complete();
-}
\ No newline at end of file
+}
diff --git a/Indexes/IndexInnerNode.h b/Indexes/IndexInnerNode.h
index d76c928..a1b4c5b 100644
--- a/Indexes/IndexInnerNode.h
+++ b/Indexes/IndexInnerNode.h
@@ -9,7 +9,7 @@
template<typename TIndexKey, typename TIndexValue>
friend class IndexInnerIterator;
- using typename IndexNode<TKey, TValue>::SplitResult;
+ typedef typename IndexNode<TKey, TValue>::SplitResult SplitResult;
using DumpObjectBase::WriteValue;
private:
diff --git a/Indexes/IndexLeafNode.h b/Indexes/IndexLeafNode.h
index 36daf16..b35553d 100644
--- a/Indexes/IndexLeafNode.h
+++ b/Indexes/IndexLeafNode.h
@@ -9,7 +9,8 @@
template<typename TIndexKey, typename TIndexValue>
friend class IndexLeafIterator;
- using typename IndexNode<TKey, TValue>::SplitResult;
+ typedef typename IndexNode<TKey, TValue>::SplitResult SplitResult;
+
private:
std::map<TKey, TValue> indexMap;
protected:
--
To view, visit https://gerrit.wikimedia.org/r/84124
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8724db48bae8bc71347155badc33aef62f1024a4
Gerrit-PatchSet: 1
Gerrit-Project: operations/dumps/incremental
Gerrit-Branch: gsoc
Gerrit-Owner: Petr Onderka <[email protected]>
Gerrit-Reviewer: Petr Onderka <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits