Browse Source

Fix std namespace usage for make_unsigned/is_signed

Alexey Edelev 5 years ago
parent
commit
de37768ba0
2 changed files with 22 additions and 20 deletions
  1. 20 18
      src/protobuf/qtprotobuftypes.h
  2. 2 2
      tests/test_qml/qml/tst_simple.qml

+ 20 - 18
src/protobuf/qtprotobuftypes.h

@@ -246,59 +246,61 @@ Q_DECLARE_METATYPE(QtProtobuf::sfixed64List)
 Q_DECLARE_METATYPE(QtProtobuf::FloatList)
 Q_DECLARE_METATYPE(QtProtobuf::DoubleList)
 
+namespace std {
 //! \private
 template<>
-struct std::make_unsigned<QtProtobuf::int32> { typedef typename std::make_unsigned<decltype(QtProtobuf::int32::_t)>::type type; };
+struct make_unsigned<QtProtobuf::int32> { typedef typename make_unsigned<decltype(QtProtobuf::int32::_t)>::type type; };
 //! \private
 template<>
-struct std::make_unsigned<QtProtobuf::int64> { typedef typename std::make_unsigned<decltype(QtProtobuf::int64::_t)>::type type; };
+struct make_unsigned<QtProtobuf::int64> { typedef typename make_unsigned<decltype(QtProtobuf::int64::_t)>::type type; };
 //! \private
 template<>
-struct std::make_unsigned<QtProtobuf::fixed32> { typedef typename std::make_unsigned<decltype(QtProtobuf::fixed32::_t)>::type type; };
+struct make_unsigned<QtProtobuf::fixed32> { typedef typename make_unsigned<decltype(QtProtobuf::fixed32::_t)>::type type; };
 //! \private
 template<>
-struct std::make_unsigned<QtProtobuf::fixed64> { typedef typename std::make_unsigned<decltype(QtProtobuf::fixed64::_t)>::type type; };
+struct make_unsigned<QtProtobuf::fixed64> { typedef typename make_unsigned<decltype(QtProtobuf::fixed64::_t)>::type type; };
 //! \private
 template<>
-struct std::make_unsigned<QtProtobuf::sfixed32> { typedef typename std::make_unsigned<decltype(QtProtobuf::sfixed32::_t)>::type type; };
+struct make_unsigned<QtProtobuf::sfixed32> { typedef typename make_unsigned<decltype(QtProtobuf::sfixed32::_t)>::type type; };
 //! \private
 template<>
-struct std::make_unsigned<QtProtobuf::sfixed64> { typedef typename std::make_unsigned<decltype(QtProtobuf::sfixed64::_t)>::type type; };
+struct make_unsigned<QtProtobuf::sfixed64> { typedef typename make_unsigned<decltype(QtProtobuf::sfixed64::_t)>::type type; };
 
 //! \private
 template<>
-struct std::make_signed<QtProtobuf::int32> { typedef typename std::make_signed<decltype(QtProtobuf::int32::_t)>::type type; };
+struct make_signed<QtProtobuf::int32> { typedef typename make_signed<decltype(QtProtobuf::int32::_t)>::type type; };
 //! \private
 template<>
-struct std::make_signed<QtProtobuf::int64> { typedef typename std::make_signed<decltype(QtProtobuf::int64::_t)>::type type; };
+struct make_signed<QtProtobuf::int64> { typedef typename make_signed<decltype(QtProtobuf::int64::_t)>::type type; };
 //! \private
 template<>
-struct std::make_signed<QtProtobuf::fixed32> { typedef typename std::make_signed<decltype(QtProtobuf::fixed32::_t)>::type type; };
+struct make_signed<QtProtobuf::fixed32> { typedef typename make_signed<decltype(QtProtobuf::fixed32::_t)>::type type; };
 //! \private
 template<>
-struct std::make_signed<QtProtobuf::fixed64> { typedef typename std::make_signed<decltype(QtProtobuf::fixed64::_t)>::type type; };
+struct make_signed<QtProtobuf::fixed64> { typedef typename make_signed<decltype(QtProtobuf::fixed64::_t)>::type type; };
 //! \private
 template<>
-struct std::make_signed<QtProtobuf::sfixed32> { typedef typename std::make_signed<decltype(QtProtobuf::sfixed32::_t)>::type type; };
+struct make_signed<QtProtobuf::sfixed32> { typedef typename make_signed<decltype(QtProtobuf::sfixed32::_t)>::type type; };
 //! \private
 template<>
-struct std::make_signed<QtProtobuf::sfixed64> { typedef typename std::make_signed<decltype(QtProtobuf::sfixed64::_t)>::type type; };
+struct make_signed<QtProtobuf::sfixed64> { typedef typename make_signed<decltype(QtProtobuf::sfixed64::_t)>::type type; };
 
 //! \private
 template<>
-struct std::is_signed<QtProtobuf::int32> : public is_signed<decltype(QtProtobuf::int32::_t)> {};
+struct is_signed<QtProtobuf::int32> : public is_signed<decltype(QtProtobuf::int32::_t)> {};
 //! \private
 template<>
-struct std::is_signed<QtProtobuf::int64> : public is_signed<decltype(QtProtobuf::int64::_t)> {};
+struct is_signed<QtProtobuf::int64> : public is_signed<decltype(QtProtobuf::int64::_t)> {};
 //! \private
 template<>
-struct std::is_signed<QtProtobuf::fixed32> : public is_signed<decltype(QtProtobuf::fixed32::_t)> {};
+struct is_signed<QtProtobuf::fixed32> : public is_signed<decltype(QtProtobuf::fixed32::_t)> {};
 //! \private
 template<>
-struct std::is_signed<QtProtobuf::fixed64> : public is_signed<decltype(QtProtobuf::fixed64::_t)> {};
+struct is_signed<QtProtobuf::fixed64> : public is_signed<decltype(QtProtobuf::fixed64::_t)> {};
 //! \private
 template<>
-struct std::is_signed<QtProtobuf::sfixed32> : public is_signed<decltype(QtProtobuf::sfixed32::_t)> {};
+struct is_signed<QtProtobuf::sfixed32> : public is_signed<decltype(QtProtobuf::sfixed32::_t)> {};
 //! \private
 template<>
-struct std::is_signed<QtProtobuf::sfixed64> : public is_signed<decltype(QtProtobuf::sfixed64::_t)> {};
+struct is_signed<QtProtobuf::sfixed64> : public is_signed<decltype(QtProtobuf::sfixed64::_t)> {};
+}

+ 2 - 2
tests/test_qml/qml/tst_simple.qml

@@ -130,7 +130,7 @@ TestCase {
         uint32Msg.testFieldInt = 2147483647;
         compare(uint32Msg.testFieldInt == 2147483647, true, "SimpleUIntMessage == 2147483647")
         uint32Msg.testFieldInt = 4294967295;
-        compare(uint32Msg.testFieldInt == 4294967295, true, "SimpleUIntMessage == 2147483647")
+        compare(uint32Msg.testFieldInt == 4294967295, true, "SimpleUIntMessage == 4294967295")
     }
 
     function test_simplefixed32message() {
@@ -147,7 +147,7 @@ TestCase {
         fixed32Msg.testFieldFixedInt32 = 2147483647;
         compare(fixed32Msg.testFieldFixedInt32 == 2147483647, true, "SimpleFixedInt32Message == 2147483647")
         fixed32Msg.testFieldFixedInt32 = 4294967295;
-        compare(fixed32Msg.testFieldFixedInt32 == 4294967295, true, "SimpleFixedInt32Message == 2147483647")
+        compare(fixed32Msg.testFieldFixedInt32 == 4294967295, true, "SimpleFixedInt32Message == 4294967295")
     }
 
     function test_simplesfixed32message() {