Explorar o código

Consistantly use UA_Boolean instead of bool

Stefan Profanter %!s(int64=6) %!d(string=hai) anos
pai
achega
9fb454760d

+ 2 - 2
src/server/ua_mdns.c

@@ -490,8 +490,8 @@ void mdns_set_address_record(UA_Server *server, const char *fullServiceDomain,
             std::string ipv6_str(str_buffer);
 
             // Detect and skip non-external addresses
-            bool is_link_local(false);
-            bool is_special_use(false);
+            UA_Boolean is_link_local(false);
+            UA_Boolean is_special_use(false);
 
             if(0 == ipv6_str.find("fe")) {
             char c = ipv6_str[2];

+ 1 - 1
src/server/ua_services_nodemanagement.c

@@ -640,7 +640,7 @@ static UA_StatusCode callConstructors(UA_Server *server, UA_Session *session,
 static UA_StatusCode
 addRef(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
        const UA_NodeId *referenceTypeId, const UA_NodeId *parentNodeId,
-       bool forward) {
+       UA_Boolean forward) {
     UA_StatusCode retval = UA_STATUSCODE_GOOD;
     UA_AddReferencesItem ref_item;
     UA_AddReferencesItem_init(&ref_item);

+ 5 - 5
src/ua_types.c

@@ -550,7 +550,7 @@ computeStrides(const UA_Variant *v, const UA_NumericRange range,
     *stride = v->arrayLength; /* So it can be copied as a contiguous block.   */
     *first = 0;
     size_t running_dimssize = 1;
-    bool found_contiguous = false;
+    UA_Boolean found_contiguous = false;
     for(size_t k = dims_count; k > 0;) {
         --k;
         size_t dimrange = 1 + realmax[k] - range.dimensions[k].min;
@@ -567,7 +567,7 @@ computeStrides(const UA_Variant *v, const UA_NumericRange range,
 }
 
 /* Is the type string-like? */
-static bool
+static UA_Boolean
 isStringLike(const UA_DataType *type) {
     if(type == &UA_TYPES[UA_TYPES_STRING] ||
        type == &UA_TYPES[UA_TYPES_BYTESTRING] ||
@@ -604,8 +604,8 @@ UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst,
                      const UA_NumericRange range) {
     if(!src->type)
         return UA_STATUSCODE_BADINVALIDARGUMENT;
-    bool isScalar = UA_Variant_isScalar(src);
-    bool stringLike = isStringLike(src->type);
+    UA_Boolean isScalar = UA_Variant_isScalar(src);
+    UA_Boolean stringLike = isStringLike(src->type);
     UA_Variant arraySrc;
 
     /* Extract the range for copying at this level. The remaining range is dealt
@@ -733,7 +733,7 @@ UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst,
  * variant and strings. This is already possible for reading... */
 static UA_StatusCode
 Variant_setRange(UA_Variant *v, void *array, size_t arraySize,
-                 const UA_NumericRange range, bool copy) {
+                 const UA_NumericRange range, UA_Boolean copy) {
     /* Compute the strides */
     size_t count, block, stride, first;
     UA_StatusCode retval = computeStrides(v, range, &count,

+ 11 - 11
src/ua_types_encoding_binary.c

@@ -183,7 +183,7 @@ UA_decode64(const u8 buf[8], u64 *v) {
 
 /* Boolean */
 ENCODE_BINARY(Boolean) {
-    if(ctx->pos + sizeof(bool) > ctx->end)
+    if(ctx->pos + sizeof(UA_Boolean) > ctx->end)
         return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED;
     *ctx->pos = *(const u8*)src;
     ++ctx->pos;
@@ -191,7 +191,7 @@ ENCODE_BINARY(Boolean) {
 }
 
 DECODE_BINARY(Boolean) {
-    if(ctx->pos + sizeof(bool) > ctx->end)
+    if(ctx->pos + sizeof(UA_Boolean) > ctx->end)
         return UA_STATUSCODE_BADDECODINGERROR;
     *dst = (*ctx->pos > 0) ? true : false;
     ++ctx->pos;
@@ -968,7 +968,7 @@ DECODE_BINARY(ExtensionObject) {
 
 /* Never returns UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED */
 static status
-Variant_encodeBinaryWrapExtensionObject(const UA_Variant *src, const bool isArray, Ctx *ctx) {
+Variant_encodeBinaryWrapExtensionObject(const UA_Variant *src, const UA_Boolean isArray, Ctx *ctx) {
     /* Default to 1 for a scalar. */
     size_t length = 1;
 
@@ -1016,8 +1016,8 @@ ENCODE_BINARY(Variant) {
         return ENCODE_DIRECT(&encoding, Byte);
 
     /* Set the content type in the encoding mask */
-    const bool isBuiltin = src->type->builtin;
-    const bool isAlias = src->type->membersSize == 1
+    const UA_Boolean isBuiltin = src->type->builtin;
+    const UA_Boolean isAlias = src->type->membersSize == 1
                          && UA_TYPES[src->type->members[0].memberTypeIndex].builtin;
     if(isBuiltin)
         encoding |= UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK & (u8)(src->type->typeIndex + 1);
@@ -1027,8 +1027,8 @@ ENCODE_BINARY(Variant) {
         encoding |= UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK & (u8)(UA_TYPES_EXTENSIONOBJECT + 1);
 
     /* Set the array type in the encoding mask */
-    const bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
-    const bool hasDimensions = isArray && src->arrayDimensionsSize > 0;
+    const UA_Boolean isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
+    const UA_Boolean hasDimensions = isArray && src->arrayDimensionsSize > 0;
     if(isArray) {
         encoding |= UA_VARIANT_ENCODINGMASKTYPE_ARRAY;
         if(hasDimensions)
@@ -1111,7 +1111,7 @@ DECODE_BINARY(Variant) {
         return UA_STATUSCODE_GOOD;
 
     /* Does the variant contain an array? */
-    const bool isArray = (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_ARRAY) > 0;
+    const UA_Boolean isArray = (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_ARRAY) > 0;
 
     /* Get the datatype of the content. The type must be a builtin data type.
      * All not-builtin types are wrapped in an ExtensionObject. */
@@ -1644,9 +1644,9 @@ CALCSIZE_BINARY(Variant) {
     if(!src->type)
         return s;
 
-    bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
-    bool hasDimensions = isArray && src->arrayDimensionsSize > 0;
-    bool isBuiltin = src->type->builtin;
+    UA_Boolean isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
+    UA_Boolean hasDimensions = isArray && src->arrayDimensionsSize > 0;
+    UA_Boolean isBuiltin = src->type->builtin;
 
 
     size_t encode_index = src->type->typeIndex;

+ 19 - 19
tests/testing-plugins/testing_policy.h

@@ -13,31 +13,31 @@ extern "C" {
 #include "ua_plugin_log.h"
 
 typedef struct funcs_called {
-    bool asym_enc;
-    bool asym_dec;
+    UA_Boolean asym_enc;
+    UA_Boolean asym_dec;
 
-    bool sym_enc;
-    bool sym_dec;
+    UA_Boolean sym_enc;
+    UA_Boolean sym_dec;
 
-    bool asym_sign;
-    bool asym_verify;
+    UA_Boolean asym_sign;
+    UA_Boolean asym_verify;
 
-    bool sym_sign;
-    bool sym_verify;
+    UA_Boolean sym_sign;
+    UA_Boolean sym_verify;
 
-    bool newContext;
-    bool deleteContext;
+    UA_Boolean newContext;
+    UA_Boolean deleteContext;
 
-    bool makeCertificateThumbprint;
-    bool generateKey;
-    bool generateNonce;
+    UA_Boolean makeCertificateThumbprint;
+    UA_Boolean generateKey;
+    UA_Boolean generateNonce;
 
-    bool setLocalSymEncryptingKey;
-    bool setLocalSymSigningKey;
-    bool setLocalSymIv;
-    bool setRemoteSymEncryptingKey;
-    bool setRemoteSymSigningKey;
-    bool setRemoteSymIv;
+    UA_Boolean setLocalSymEncryptingKey;
+    UA_Boolean setLocalSymSigningKey;
+    UA_Boolean setLocalSymIv;
+    UA_Boolean setRemoteSymEncryptingKey;
+    UA_Boolean setRemoteSymSigningKey;
+    UA_Boolean setRemoteSymIv;
 } funcs_called;
 
 typedef struct key_sizes {