@@ -45,7 +45,7 @@ UA_ByteString;
/* Function return values */
#define UA_SUCCESS 0
#define UA_NO_ERROR UA_SUCCESS
-#define UA_ERROR (0x01)
+#define UA_ERROR (0x01 << 31)
#define UA_ERR_INCONSISTENT (UA_ERROR | (0x01 << 1))
#define UA_ERR_INVALID_VALUE (UA_ERROR | (0x01 << 2))
#define UA_ERR_NO_MEMORY (UA_ERROR | (0x01 << 3))
@@ -1244,7 +1244,7 @@ UA_Int32 UA_Variant_decodeBinary(UA_ByteString const * src, UA_Int32 *pos, UA_Va
ns0Id = dst->encodingMask & UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK;
// initialize vTable
- if (ns0Id < UA_BOOLEAN && ns0Id > UA_DOUBLECOMPLEXNUMBERTYPE) {
+ if (UA_toIndex(ns0Id) == UA_ERR_INVALID_VALUE) {
return UA_ERR_INVALID_VALUE;
} else {
dst->vt = &UA_[UA_toIndex(ns0Id)];