Просмотр исходного кода

Stack: Add Boolean to the numeric data types; Improve documentation

Julius Pfrommer лет назад: 6
Родитель
Сommit
e8d10c4479
2 измененных файлов с 4 добавлено и 1 удалено
  1. 3 0
      include/ua_types.h
  2. 1 1
      src/ua_types.c

+ 3 - 0
include/ua_types.h

@@ -816,6 +816,9 @@ struct UA_DataType {
     UA_DataTypeMember *members;
 };
 
+/* Test if the data type is a numeric builtin data type. This includes Boolean,
+ * integers and floating point numbers. Not included are DateTime and
+ * StatusCode. */
 UA_Boolean
 UA_DataType_isNumeric(const UA_DataType *type);
 

+ 1 - 1
src/ua_types.c

@@ -1097,7 +1097,7 @@ UA_Array_delete(void *p, size_t size, const UA_DataType *type) {
 UA_Boolean
 UA_DataType_isNumeric(const UA_DataType *type) {
     /* All data types between UA_TYPES_SBYTE and UA_TYPES_DOUBLE are numeric */
-    for(size_t i = UA_TYPES_SBYTE; i <= UA_TYPES_DOUBLE; ++i)
+    for(size_t i = UA_TYPES_BOOLEAN; i <= UA_TYPES_DOUBLE; ++i)
         if(&UA_TYPES[i] == type)
             return true;
     return false;