Bug 1383816 - Fixes several minor errors in Variant's IPC implementation. r?botond
* VariantWriter construction switched to use aggregate initialization
* Call to AsVariant was inappropriately called via |paramType| when it should
have been called via |mozilla|
* |Next::Read| call in VariantReader specialization was missing the |result|
argument
MozReview-Commit-ID: Izany7iDX0k
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -917,17 +917,17 @@ struct ParamTraits<mozilla::Variant<Ts..
void match(const T& t) {
WriteParam(msg, t);
}
};
static void Write(Message* msg, const paramType& param)
{
WriteParam(msg, param.tag);
- param.match(VariantWriter(msg));
+ param.match(VariantWriter{msg});
}
// Because VariantReader is a nested struct, we need the dummy template
// parameter to avoid making VariantReader<0> an explicit specialization,
// which is not allowed for a nested class template
template<size_t N, typename dummy = void>
struct VariantReader
{
@@ -940,22 +940,22 @@ struct ParamTraits<mozilla::Variant<Ts..
// subtract one to look at N - 1, the first valid tag. This means our
// comparisons are off by 1. If we get to N = 0 then we have failed to
// find a match to the tag.
if (tag == N - 1) {
// Recall, even though the template parameter is N, we are
// actually interested in the N - 1 tag.
typename mozilla::detail::Nth<N - 1, Ts...>::Type val;
if (ReadParam(msg, iter, &val)) {
- *result = paramType::AsVariant(val);
+ *result = mozilla::AsVariant(val);
return true;
}
return false;
} else {
- return Next::Read(msg, iter, tag);
+ return Next::Read(msg, iter, tag, result);
}
}
}; // VariantReader<N>
// Since we are conditioning on tag = N - 1 in the preceding specialization,
// if we get to `VariantReader<0, dummy>` we have failed to find
// a matching tag.