Bladeren bron

Be afraid of premature pessimization, use pre(in|de)crement ;D

Lorenz Haas 8 jaren geleden
bovenliggende
commit
71e9f80031

+ 7 - 7
deps/libc_time.c

@@ -30,7 +30,7 @@ int __secs_to_tm(long long t, struct tm *tm)
     remsecs = (int)(secs % 86400);
     if (remsecs < 0) {
         remsecs += 86400;
-        days--;
+        --days;
     }
 
     wday = (int)((3+days)%7);
@@ -40,19 +40,19 @@ int __secs_to_tm(long long t, struct tm *tm)
     remdays = (int)(days % DAYS_PER_400Y);
     if (remdays < 0) {
         remdays += DAYS_PER_400Y;
-        qc_cycles--;
+        --qc_cycles;
     }
 
     c_cycles = remdays / DAYS_PER_100Y;
-    if (c_cycles == 4) c_cycles--;
+    if (c_cycles == 4) --c_cycles;
     remdays -= c_cycles * DAYS_PER_100Y;
 
     q_cycles = remdays / DAYS_PER_4Y;
-    if (q_cycles == 25) q_cycles--;
+    if (q_cycles == 25) --q_cycles;
     remdays -= q_cycles * DAYS_PER_4Y;
 
     remyears = remdays / 365;
-    if (remyears == 4) remyears--;
+    if (remyears == 4) --remyears;
     remdays -= remyears * 365;
 
     leap = !remyears && (q_cycles || !c_cycles);
@@ -61,7 +61,7 @@ int __secs_to_tm(long long t, struct tm *tm)
 
     years = remyears + 4*q_cycles + 100*c_cycles + 400LL*qc_cycles;
 
-    for (months=0; days_in_month[months] <= remdays; months++)
+    for (months=0; days_in_month[months] <= remdays; ++months)
         remdays -= days_in_month[months];
 
     if (years+100 > INT_MAX || years+100 < INT_MIN)
@@ -71,7 +71,7 @@ int __secs_to_tm(long long t, struct tm *tm)
     tm->tm_mon = months + 2;
     if (tm->tm_mon >= 12) {
         tm->tm_mon -=12;
-        tm->tm_year++;
+        ++tm->tm_year;
     }
     tm->tm_mday = remdays + 1;
     tm->tm_wday = wday;

+ 9 - 9
plugins/ua_network_tcp.c

@@ -287,7 +287,7 @@ setFDSet(ServerNetworkLayerTCP *layer, fd_set *fdset) {
     FD_ZERO(fdset);
     UA_fd_set(layer->serversockfd, fdset);
     UA_Int32 highestfd = layer->serversockfd;
-    for(size_t i = 0; i < layer->mappingsSize; i++) {
+    for(size_t i = 0; i < layer->mappingsSize; ++i) {
         UA_fd_set(layer->mappings[i].sockfd, fdset);
         if(layer->mappings[i].sockfd > highestfd)
             highestfd = layer->mappings[i].sockfd;
@@ -358,7 +358,7 @@ ServerNetworkLayerTCP_add(ServerNetworkLayerTCP *layer, UA_Int32 newsockfd) {
     layer->mappings = nm;
     layer->mappings[layer->mappingsSize].connection = c;
     layer->mappings[layer->mappingsSize].sockfd = newsockfd;
-    layer->mappingsSize++;
+    ++layer->mappingsSize;
     return UA_STATUSCODE_GOOD;
 }
 
@@ -448,7 +448,7 @@ ServerNetworkLayerTCP_getJobs(UA_ServerNetworkLayer *nl, UA_Job **jobs, UA_UInt1
 
     /* accept new connections (can only be a single one) */
     if(UA_fd_isset(layer->serversockfd, &fdset)) {
-        resultsize--;
+        --resultsize;
         SOCKET newsockfd = accept((SOCKET)layer->serversockfd, NULL, NULL);
 #ifdef _WIN32
         if(newsockfd != INVALID_SOCKET)
@@ -476,7 +476,7 @@ ServerNetworkLayerTCP_getJobs(UA_ServerNetworkLayer *nl, UA_Job **jobs, UA_UInt1
     /* read from established sockets */
     size_t j = 0;
     UA_ByteString buf = UA_BYTESTRING_NULL;
-    for(size_t i = 0; i < layer->mappingsSize && j < (size_t)resultsize; i++) {
+    for(size_t i = 0; i < layer->mappingsSize && j < (size_t)resultsize; ++i) {
         if(!UA_fd_isset(layer->mappings[i].sockfd, &errset) &&
            !UA_fd_isset(layer->mappings[i].sockfd, &fdset))
           continue;
@@ -486,7 +486,7 @@ ServerNetworkLayerTCP_getJobs(UA_ServerNetworkLayer *nl, UA_Job **jobs, UA_UInt1
             js[j].job.binaryMessage.connection = layer->mappings[i].connection;
             js[j].job.binaryMessage.message = buf;
             js[j].type = UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER;
-            j++;
+            ++j;
         } else if (retval == UA_STATUSCODE_BADCONNECTIONCLOSED) {
             UA_Connection *c = layer->mappings[i].connection;
             UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
@@ -495,12 +495,12 @@ ServerNetworkLayerTCP_getJobs(UA_ServerNetworkLayer *nl, UA_Job **jobs, UA_UInt1
             js[j].type = UA_JOBTYPE_DETACHCONNECTION;
             js[j].job.closeConnection = layer->mappings[i].connection;
             layer->mappings[i] = layer->mappings[layer->mappingsSize-1];
-            layer->mappingsSize--;
-            j++;
+            --layer->mappingsSize;
+            ++j;
             js[j].type = UA_JOBTYPE_METHODCALL_DELAYED;
             js[j].job.methodCall.method = FreeConnectionCallback;
             js[j].job.methodCall.data = c;
-            j++;
+            ++j;
         }
     }
 
@@ -524,7 +524,7 @@ ServerNetworkLayerTCP_stop(UA_ServerNetworkLayer *nl, UA_Job **jobs) {
     UA_Job *items = malloc(sizeof(UA_Job) * layer->mappingsSize * 2);
     if(!items)
         return 0;
-    for(size_t i = 0; i < layer->mappingsSize; i++) {
+    for(size_t i = 0; i < layer->mappingsSize; ++i) {
         socket_close(layer->mappings[i].connection);
         items[i*2].type = UA_JOBTYPE_DETACHCONNECTION;
         items[i*2].job.closeConnection = layer->mappings[i].connection;

+ 1 - 1
src/client/ua_client.c

@@ -445,7 +445,7 @@ static UA_StatusCode EndpointsHandshake(UA_Client *client) {
                                           "Transport/uatcp-uasc-uabinary");
 
     //TODO: compare endpoint information with client->endpointUri
-    for(size_t i = 0; i < endpointArraySize; i++) {
+    for(size_t i = 0; i < endpointArraySize; ++i) {
         UA_EndpointDescription* endpoint = &endpointArray[i];
         /* look out for binary transport endpoints */
         //NODE: Siemens returns empty ProfileUrl, we will accept it as binary

+ 1 - 1
src/client/ua_client_highlevel.c

@@ -33,7 +33,7 @@ UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri,
 
     retval = UA_STATUSCODE_BADNOTFOUND;
     UA_String *ns = response.results[0].value.data;
-    for(size_t i = 0; i < response.results[0].value.arrayLength; i++){
+    for(size_t i = 0; i < response.results[0].value.arrayLength; ++i){
         if(UA_String_equal(namespaceUri, &ns[i])) {
             *namespaceIndex = (UA_UInt16)i;
             retval = UA_STATUSCODE_GOOD;

+ 5 - 5
src/client/ua_client_highlevel_subscriptions.c

@@ -229,7 +229,7 @@ UA_Client_processPublishResponse(UA_Client *client, UA_PublishRequest *request,
                  sub->SubscriptionID, response->notificationMessage.notificationDataSize);
 
     /* Check if the server has acknowledged any of the sent ACKs */
-    for(size_t i = 0; i < response->resultsSize && i < request->subscriptionAcknowledgementsSize; i++) {
+    for(size_t i = 0; i < response->resultsSize && i < request->subscriptionAcknowledgementsSize; ++i) {
         /* remove also acks that are unknown to the server */
         if(response->results[i] != UA_STATUSCODE_GOOD &&
            response->results[i] != UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN)
@@ -251,7 +251,7 @@ UA_Client_processPublishResponse(UA_Client *client, UA_PublishRequest *request,
 
     /* Process the notification messages */
     UA_NotificationMessage *msg = &response->notificationMessage;
-    for(size_t k = 0; k < msg->notificationDataSize; k++) {
+    for(size_t k = 0; k < msg->notificationDataSize; ++k) {
         if(msg->notificationData[k].encoding != UA_EXTENSIONOBJECT_DECODED)
             continue;
 
@@ -260,7 +260,7 @@ UA_Client_processPublishResponse(UA_Client *client, UA_PublishRequest *request,
             continue;
 
         UA_DataChangeNotification *dataChangeNotification = msg->notificationData[k].content.decoded.data;
-        for(size_t j = 0; j < dataChangeNotification->monitoredItemsSize; j++) {
+        for(size_t j = 0; j < dataChangeNotification->monitoredItemsSize; ++j) {
             UA_MonitoredItemNotification *mitemNot = &dataChangeNotification->monitoredItems[j];
             UA_Client_MonitoredItem *mon;
             LIST_FOREACH(mon, &sub->MonitoredItems, listEntry) {
@@ -296,7 +296,7 @@ UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client) {
 
         UA_Client_NotificationsAckNumber *ack;
         LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry)
-            request.subscriptionAcknowledgementsSize++;
+            ++request.subscriptionAcknowledgementsSize;
         if(request.subscriptionAcknowledgementsSize > 0) {
             request.subscriptionAcknowledgements =
                 UA_malloc(sizeof(UA_SubscriptionAcknowledgement) * request.subscriptionAcknowledgementsSize);
@@ -308,7 +308,7 @@ UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client) {
         LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) {
             request.subscriptionAcknowledgements[i].sequenceNumber = ack->subAck.sequenceNumber;
             request.subscriptionAcknowledgements[i].subscriptionId = ack->subAck.subscriptionId;
-            i++;
+            ++i;
         }
         
         UA_PublishResponse response = UA_Client_Service_publish(client, request);

+ 6 - 6
src/server/ua_nodestore.c

@@ -160,12 +160,12 @@ expand(UA_NodeStore *ns) {
     ns->sizePrimeIndex = nindex;
 
     /* recompute the position of every entry and insert the pointer */
-    for(size_t i = 0, j = 0; i < osize && j < count; i++) {
+    for(size_t i = 0, j = 0; i < osize && j < count; ++i) {
         if(oentries[i] <= UA_NODESTORE_TOMBSTONE)
             continue;
         UA_NodeStoreEntry **e = findSlot(ns, &oentries[i]->node.nodeId);
         *e = oentries[i];
-        j++;
+        ++j;
     }
 
     UA_free(oentries);
@@ -196,7 +196,7 @@ void
 UA_NodeStore_delete(UA_NodeStore *ns) {
     UA_UInt32 size = ns->size;
     UA_NodeStoreEntry **entries = ns->entries;
-    for(UA_UInt32 i = 0; i < size; i++) {
+    for(UA_UInt32 i = 0; i < size; ++i) {
         if(entries[i] > UA_NODESTORE_TOMBSTONE)
             deleteEntry(entries[i]);
     }
@@ -255,7 +255,7 @@ UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node) {
     }
 
     *entry = container_of(node, UA_NodeStoreEntry, node);
-    ns->count++;
+    ++ns->count;
     return UA_STATUSCODE_GOOD;
 }
 
@@ -307,7 +307,7 @@ UA_NodeStore_remove(UA_NodeStore *ns, const UA_NodeId *nodeid) {
         return UA_STATUSCODE_BADNODEIDUNKNOWN;
     deleteEntry(*slot);
     *slot = UA_NODESTORE_TOMBSTONE;
-    ns->count--;
+    --ns->count;
     /* Downsize the hashmap if it is very empty */
     if(ns->count * 8 < ns->size && ns->size > 32)
         expand(ns); // this can fail. we just continue with the bigger hashmap.
@@ -316,7 +316,7 @@ UA_NodeStore_remove(UA_NodeStore *ns, const UA_NodeId *nodeid) {
 
 void
 UA_NodeStore_iterate(UA_NodeStore *ns, UA_NodeStore_nodeVisitor visitor) {
-    for(UA_UInt32 i = 0; i < ns->size; i++) {
+    for(UA_UInt32 i = 0; i < ns->size; ++i) {
         if(ns->entries[i] > UA_NODESTORE_TOMBSTONE)
             visitor((UA_Node*)&ns->entries[i]->node);
     }

+ 1 - 1
src/server/ua_nodestore_concurrent.c

@@ -127,7 +127,7 @@ UA_StatusCode UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node) {
         unsigned long identifier;
         long before, after;
         cds_lfht_count_nodes(ht, &before, &identifier, &after); // current number of nodes stored
-        identifier++;
+        ++identifier;
 
         node->nodeId.identifier.numeric = (UA_UInt32)identifier;
         while(true) {

+ 13 - 13
src/server/ua_server.c

@@ -51,7 +51,7 @@ UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char* name) {
                                              .data = (UA_Byte*)(uintptr_t)name};
 
     /* Check if the namespace already exists in the server's namespace array */
-    for(UA_UInt16 i=0;i<server->namespacesSize;i++) {
+    for(UA_UInt16 i=0;i<server->namespacesSize;++i) {
         if(UA_String_equal(&nameString, &server->namespaces[i]))
             return i;
     }
@@ -60,7 +60,7 @@ UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char* name) {
     server->namespaces = UA_realloc(server->namespaces,
                                     sizeof(UA_String) * (server->namespacesSize + 1));
     UA_String_copy(&nameString, &server->namespaces[server->namespacesSize]);
-    server->namespacesSize++;
+    ++server->namespacesSize;
     return (UA_UInt16)(server->namespacesSize - 1);
 }
 
@@ -76,7 +76,7 @@ static void UA_ExternalNamespace_deleteMembers(UA_ExternalNamespace *ens) {
 }
 
 static void UA_Server_deleteExternalNamespaces(UA_Server *server) {
-    for(UA_UInt32 i = 0; i < server->externalNamespacesSize; i++)
+    for(UA_UInt32 i = 0; i < server->externalNamespacesSize; ++i)
         UA_ExternalNamespace_deleteMembers(&server->externalNamespaces[i]);
     if(server->externalNamespacesSize > 0) {
         UA_free(server->externalNamespaces);
@@ -105,7 +105,7 @@ UA_Server_addExternalNamespace(UA_Server *server, const UA_String *url,
     server->externalNamespaces[size].index = (UA_UInt16)server->namespacesSize;
     *assignedNamespaceIndex = (UA_UInt16)server->namespacesSize;
     UA_String_copy(url, &server->externalNamespaces[size].url);
-    server->externalNamespacesSize++;
+    ++server->externalNamespacesSize;
     addNamespaceInternal(server, urlString);
 
     return UA_STATUSCODE_GOOD;
@@ -122,7 +122,7 @@ UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId,
         UA_RCU_UNLOCK();
         return UA_STATUSCODE_BADNODEIDINVALID;
     }
-    for(size_t i = 0; i < parent->referencesSize; i++) {
+    for(size_t i = 0; i < parent->referencesSize; ++i) {
         UA_ReferenceNode *ref = &parent->references[i];
         retval |= callback(ref->targetId.nodeId, ref->isInverse,
                            ref->referenceTypeId, handle);
@@ -183,7 +183,7 @@ static void deleteInstanceChildren(UA_Server *server, UA_NodeId *objectNodeId) {
   UA_BrowseResult bRes;
   UA_BrowseResult_init(&bRes);
   Service_Browse_single(server, &adminSession, NULL, &bDes, 0, &bRes);
-  for(size_t i=0; i<bRes.referencesSize; i++) {
+  for(size_t i=0; i<bRes.referencesSize; ++i) {
     UA_ReferenceDescription *rd = &bRes.references[i];
     if((rd->nodeClass == UA_NODECLASS_OBJECT || rd->nodeClass == UA_NODECLASS_VARIABLE)) 
     {
@@ -413,7 +413,7 @@ GetMonitoredItems(void *handle, const UA_NodeId objectId, size_t inputSize,
     UA_UInt32 sizeOfOutput = 0;
     UA_MonitoredItem* monitoredItem;
     LIST_FOREACH(monitoredItem, &subscription->MonitoredItems, listEntry) {
-        sizeOfOutput++;
+        ++sizeOfOutput;
     }
     if(sizeOfOutput==0)
         return UA_STATUSCODE_GOOD;
@@ -424,7 +424,7 @@ GetMonitoredItems(void *handle, const UA_NodeId objectId, size_t inputSize,
     LIST_FOREACH(monitoredItem, &subscription->MonitoredItems, listEntry) {
         clientHandles[i] = monitoredItem->clientHandle;
         serverHandles[i] = monitoredItem->itemId;
-        i++;
+        ++i;
     }
     UA_Variant_setArray(&output[0], clientHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
     UA_Variant_setArray(&output[1], serverHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
@@ -462,7 +462,7 @@ UA_Server * UA_Server_new(const UA_ServerConfig config) {
     server->endpointDescriptions = UA_Array_new(server->config.networkLayersSize,
                                                 &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
     server->endpointDescriptionsSize = server->config.networkLayersSize;
-    for(size_t i = 0; i < server->config.networkLayersSize; i++) {
+    for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
         UA_EndpointDescription *endpoint = &server->endpointDescriptions[i];
         endpoint->securityMode = UA_MESSAGESECURITYMODE_NONE;
         endpoint->securityPolicyUri =
@@ -472,9 +472,9 @@ UA_Server * UA_Server_new(const UA_ServerConfig config) {
 
         size_t policies = 0;
         if(server->config.enableAnonymousLogin)
-            policies++;
+            ++policies;
         if(server->config.enableUsernamePasswordLogin)
-            policies++;
+            ++policies;
         endpoint->userIdentityTokensSize = policies;
         endpoint->userIdentityTokens = UA_Array_new(policies, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]);
 
@@ -483,7 +483,7 @@ UA_Server * UA_Server_new(const UA_ServerConfig config) {
             UA_UserTokenPolicy_init(&endpoint->userIdentityTokens[currentIndex]);
             endpoint->userIdentityTokens[currentIndex].tokenType = UA_USERTOKENTYPE_ANONYMOUS;
             endpoint->userIdentityTokens[currentIndex].policyId = UA_STRING_ALLOC(ANONYMOUS_POLICY);
-            currentIndex++;
+            ++currentIndex;
         }
         if(server->config.enableUsernamePasswordLogin) {
             UA_UserTokenPolicy_init(&endpoint->userIdentityTokens[currentIndex]);
@@ -995,7 +995,7 @@ UA_Server * UA_Server_new(const UA_ServerConfig config) {
     UA_Variant_setArray(&serverProfileArray->value.data.value.value,
                         UA_Array_new(profileArraySize, &UA_TYPES[UA_TYPES_STRING]),
                         profileArraySize, &UA_TYPES[UA_TYPES_STRING]);
-    for(UA_UInt16 i=0;i<profileArraySize;i++)
+    for(UA_UInt16 i=0;i<profileArraySize;++i)
         ((UA_String *)serverProfileArray->value.data.value.value.data)[i] = profileArray[i];
     serverProfileArray->value.data.value.hasValue = true;
     serverProfileArray->valueRank = 1;

+ 10 - 10
src/server/ua_server_utils.c

@@ -14,7 +14,7 @@ readDimension(UA_Byte *buf, size_t buflen, UA_NumericRangeDimension *dim) {
         return progress;
     }
 
-    progress++;
+    ++progress;
     size_t progress2 = UA_readNumber(&buf[progress], buflen - progress, &dim->max);
     if(progress2 == 0)
         return 0;
@@ -55,7 +55,7 @@ parse_numericrange(const UA_String *str, UA_NumericRange *range) {
             break;
         }
         offset += progress;
-        idx++;
+        ++idx;
 
         /* loop into the next dimension */
         if(offset >= str->length)
@@ -65,7 +65,7 @@ parse_numericrange(const UA_String *str, UA_NumericRange *range) {
             retval = UA_STATUSCODE_BADINDEXRANGEINVALID;
             break;
         }
-        offset++;
+        ++offset;
     }
 
     if(retval == UA_STATUSCODE_GOOD && idx > 0) {
@@ -100,7 +100,7 @@ getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse,
     size_t last = 0; /* Index of the last element in the array */
     const UA_NodeId hasSubtypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
     while(true) {
-        for(size_t i = 0; i < node->referencesSize; i++) {
+        for(size_t i = 0; i < node->referencesSize; ++i) {
             /* is the reference relevant? */
             if(node->references[i].isInverse != inverse ||
                !UA_NodeId_equal(&hasSubtypeNodeId, &node->references[i].referenceTypeId))
@@ -108,7 +108,7 @@ getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse,
 
             /* is the target already considered? (multi-inheritance) */
             UA_Boolean duplicate = false;
-            for(size_t j = 0; j <= last; j++) {
+            for(size_t j = 0; j <= last; ++j) {
                 if(UA_NodeId_equal(&node->references[i].targetId.nodeId, &results[j])) {
                     duplicate = true;
                     break;
@@ -137,7 +137,7 @@ getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse,
 
         /* Get the next node */
     next:
-        idx++;
+        ++idx;
         if(idx > last || retval != UA_STATUSCODE_GOOD)
             break;
         node = UA_NodeStore_get(ns, &results[idx]);
@@ -167,12 +167,12 @@ isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode, const UA_NodeId *nodeT
         return false;
 
     /* Search upwards in the tree */
-    for(size_t i = 0; i < node->referencesSize; i++) {
+    for(size_t i = 0; i < node->referencesSize; ++i) {
         if(!node->references[i].isInverse)
             continue;
 
         /* Recurse only for valid reference types */
-        for(size_t j = 0; j < referenceTypeIdsSize; j++) {
+        for(size_t j = 0; j < referenceTypeIdsSize; ++j) {
             if(UA_NodeId_equal(&node->references[i].referenceTypeId, &referenceTypeIds[j]) &&
                isNodeInTree(ns, &node->references[i].targetId.nodeId, nodeToFind,
                             referenceTypeIds, referenceTypeIdsSize))
@@ -203,7 +203,7 @@ getNodeType(UA_Server *server, const UA_Node *node) {
 
     /* stop at the first matching candidate */
     UA_NodeId *parentId = NULL;
-    for(size_t i = 0; i < node->referencesSize; i++) {
+    for(size_t i = 0; i < node->referencesSize; ++i) {
         if(node->references[i].isInverse == inverse &&
            UA_NodeId_equal(&node->references[i].referenceTypeId, &parentRef)) {
             parentId = &node->references[i].targetId.nodeId;
@@ -236,7 +236,7 @@ UA_Boolean
 UA_Node_hasSubTypeOrInstances(const UA_Node *node) {
     const UA_NodeId hasSubType = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
     const UA_NodeId hasTypeDefinition = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
-    for(size_t i = 0; i < node->referencesSize; i++) {
+    for(size_t i = 0; i < node->referencesSize; ++i) {
         if(node->references[i].isInverse == false &&
            UA_NodeId_equal(&node->references[i].referenceTypeId, &hasSubType))
             return true;

+ 13 - 13
src/server/ua_server_worker.c

@@ -362,7 +362,7 @@ struct DelayedJobs {
 /* Dispatched as an ordinary job when the DelayedJobs list is full */
 static void getCounters(UA_Server *server, struct DelayedJobs *delayed) {
     UA_UInt32 *counters = UA_malloc(server->config.nThreads * sizeof(UA_UInt32));
-    for(UA_UInt16 i = 0; i < server->config.nThreads; i++)
+    for(UA_UInt16 i = 0; i < server->config.nThreads; ++i)
         counters[i] = server->workers[i].counter;
     delayed->workerCounters = counters;
 }
@@ -394,7 +394,7 @@ static void addDelayedJob(UA_Server *server, UA_Job *job) {
         }
     }
     dj->jobs[dj->jobsCount] = *job;
-    dj->jobsCount++;
+    ++dj->jobsCount;
 }
 
 static void
@@ -443,7 +443,7 @@ dispatchDelayedJobs(UA_Server *server, void *_) {
             continue;
         }
         UA_Boolean allMoved = true;
-        for(size_t i = 0; i < server->config.nThreads; i++) {
+        for(size_t i = 0; i < server->config.nThreads; ++i) {
             if(dw->workerCounters[i] == server->workers[i].counter) {
                 allMoved = false;
                 break;
@@ -457,7 +457,7 @@ dispatchDelayedJobs(UA_Server *server, void *_) {
 
     /* process and free all delayed jobs from here on */
     while(dw) {
-        for(size_t i = 0; i < dw->jobsCount; i++)
+        for(size_t i = 0; i < dw->jobsCount; ++i)
             processJob(server, &dw->jobs[i]);
         struct DelayedJobs *next = UA_atomic_xchg((void**)&beforedw->next, NULL);
         UA_free(dw->workerCounters);
@@ -498,7 +498,7 @@ UA_StatusCode UA_Server_run_startup(UA_Server *server) {
     server->workers = UA_malloc(server->config.nThreads * sizeof(UA_Worker));
     if(!server->workers)
         return UA_STATUSCODE_BADOUTOFMEMORY;
-    for(size_t i = 0; i < server->config.nThreads; i++) {
+    for(size_t i = 0; i < server->config.nThreads; ++i) {
         UA_Worker *worker = &server->workers[i];
         worker->server = server;
         worker->counter = 0;
@@ -514,7 +514,7 @@ UA_StatusCode UA_Server_run_startup(UA_Server *server) {
 
     /* Start the networklayers */
     UA_StatusCode result = UA_STATUSCODE_GOOD;
-    for(size_t i = 0; i < server->config.networkLayersSize; i++) {
+    for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
         UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
         result |= nl->start(nl, server->config.logger);
     }
@@ -563,7 +563,7 @@ UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal) {
         timeout = (UA_UInt16)((nextRepeated - now) / UA_MSEC_TO_DATETIME);
 
     /* Get work from the networklayer */
-    for(size_t i = 0; i < server->config.networkLayersSize; i++) {
+    for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
         UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
         UA_Job *jobs;
         size_t jobsSize;
@@ -573,7 +573,7 @@ UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal) {
         else
             jobsSize = nl->getJobs(nl, &jobs, 0);
 
-        for(size_t k = 0; k < jobsSize; k++) {
+        for(size_t k = 0; k < jobsSize; ++k) {
 #ifdef UA_ENABLE_MULTITHREADING
             /* Filter out delayed work */
             if(jobs[k].type == UA_JOBTYPE_METHODCALL_DELAYED) {
@@ -588,7 +588,7 @@ UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal) {
         }
 
         /* Dispatch/process jobs */
-        for(size_t j = 0; j < jobsSize; j++) {
+        for(size_t j = 0; j < jobsSize; ++j) {
 #ifdef UA_ENABLE_MULTITHREADING
             dispatchJob(server, &jobs[j]);
 #else
@@ -617,11 +617,11 @@ UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal) {
 }
 
 UA_StatusCode UA_Server_run_shutdown(UA_Server *server) {
-    for(size_t i = 0; i < server->config.networkLayersSize; i++) {
+    for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
         UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
         UA_Job *stopJobs;
         size_t stopJobsSize = nl->stop(nl, &stopJobs);
-        for(size_t j = 0; j < stopJobsSize; j++)
+        for(size_t j = 0; j < stopJobsSize; ++j)
             processJob(server, &stopJobs[j]);
         UA_free(stopJobs);
     }
@@ -630,10 +630,10 @@ UA_StatusCode UA_Server_run_shutdown(UA_Server *server) {
     UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
                 "Shutting down %u worker thread(s)", server->config.nThreads);
     /* Wait for all worker threads to finish */
-    for(size_t i = 0; i < server->config.nThreads; i++)
+    for(size_t i = 0; i < server->config.nThreads; ++i)
         server->workers[i].running = false;
     pthread_cond_broadcast(&server->dispatchQueue_condition);
-    for(size_t i = 0; i < server->config.nThreads; i++)
+    for(size_t i = 0; i < server->config.nThreads; ++i)
         pthread_join(server->workers[i].thr, NULL);
     UA_free(server->workers);
 

+ 12 - 12
src/server/ua_services_attribute.c

@@ -37,7 +37,7 @@ typeEquivalence(const UA_DataType *t) {
 
 static const UA_DataType *
 findDataType(const UA_NodeId *typeId) {
-    for(size_t i = 0; i < UA_TYPES_COUNT; i++) {
+    for(size_t i = 0; i < UA_TYPES_COUNT; ++i) {
         if(UA_TYPES[i].typeId.identifier.numeric == typeId->identifier.numeric)
             return &UA_TYPES[i];
     }
@@ -95,7 +95,7 @@ compatibleArrayDimensions(size_t constraintArrayDimensionsSize,
     if(testArrayDimensionsSize != constraintArrayDimensionsSize)
         return UA_STATUSCODE_BADTYPEMISMATCH;
     /* dimension size zero in the constraint is a wildcard */
-    for(size_t i = 0; i < constraintArrayDimensionsSize; i++) {
+    for(size_t i = 0; i < constraintArrayDimensionsSize; ++i) {
         if(constraintArrayDimensions[i] != testArrayDimensions[i] &&
            constraintArrayDimensions[i] != 0)
             return UA_STATUSCODE_BADTYPEMISMATCH;
@@ -799,14 +799,14 @@ void Service_Read(UA_Server *server, UA_Session *session,
     UA_Boolean isExternal[size];
     UA_UInt32 indices[size];
     memset(isExternal, false, sizeof(UA_Boolean) * size);
-    for(size_t j = 0;j<server->externalNamespacesSize;j++) {
+    for(size_t j = 0;j<server->externalNamespacesSize;++j) {
         size_t indexSize = 0;
-        for(size_t i = 0;i < size;i++) {
+        for(size_t i = 0;i < size;++i) {
             if(request->nodesToRead[i].nodeId.namespaceIndex != server->externalNamespaces[j].index)
                 continue;
             isExternal[i] = true;
             indices[indexSize] = (UA_UInt32)i;
-            indexSize++;
+            ++indexSize;
         }
         if(indexSize == 0)
             continue;
@@ -817,7 +817,7 @@ void Service_Read(UA_Server *server, UA_Session *session,
     }
 #endif
 
-    for(size_t i = 0;i < size;i++) {
+    for(size_t i = 0;i < size;++i) {
 #ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
 #endif
@@ -844,7 +844,7 @@ void Service_Read(UA_Server *server, UA_Session *session,
         variant.data = expireArray;
 
         /* expires in 20 seconds */
-        for(UA_UInt32 i = 0;i < response->resultsSize;i++) {
+        for(UA_UInt32 i = 0;i < response->resultsSize;++i) {
             expireArray[i] = UA_DateTime_now() + 20 * 100 * 1000 * 1000;
         }
         UA_Variant_setArray(&variant, expireArray, request->nodesToReadSize,
@@ -1093,7 +1093,7 @@ Service_Write(UA_Server *server, UA_Session *session,
     response->resultsSize = request->nodesToWriteSize;
 
 #ifndef UA_ENABLE_EXTERNAL_NAMESPACES
-    for(size_t i = 0;i < request->nodesToWriteSize;i++) {
+    for(size_t i = 0;i < request->nodesToWriteSize;++i) {
         response->results[i] = UA_Server_editNode(server, session, &request->nodesToWrite[i].nodeId,
                                                   (UA_EditNodeCallback)CopyAttributeIntoNode,
                                                   &request->nodesToWrite[i]);
@@ -1102,15 +1102,15 @@ Service_Write(UA_Server *server, UA_Session *session,
     UA_Boolean isExternal[request->nodesToWriteSize];
     UA_UInt32 indices[request->nodesToWriteSize];
     memset(isExternal, false, sizeof(UA_Boolean)*request->nodesToWriteSize);
-    for(size_t j = 0; j < server->externalNamespacesSize; j++) {
+    for(size_t j = 0; j < server->externalNamespacesSize; ++j) {
         UA_UInt32 indexSize = 0;
-        for(size_t i = 0; i < request->nodesToWriteSize; i++) {
+        for(size_t i = 0; i < request->nodesToWriteSize; ++i) {
             if(request->nodesToWrite[i].nodeId.namespaceIndex !=
                server->externalNamespaces[j].index)
                 continue;
             isExternal[i] = true;
             indices[indexSize] = (UA_UInt32)i;
-            indexSize++;
+            ++indexSize;
         }
         if(indexSize == 0)
             continue;
@@ -1118,7 +1118,7 @@ Service_Write(UA_Server *server, UA_Session *session,
         ens->writeNodes(ens->ensHandle, &request->requestHeader, request->nodesToWrite,
                         indices, indexSize, response->results, response->diagnosticInfos);
     }
-    for(size_t i = 0;i < request->nodesToWriteSize;i++) {
+    for(size_t i = 0;i < request->nodesToWriteSize;++i) {
         if(isExternal[i])
             continue;
         response->results[i] = UA_Server_editNode(server, session, &request->nodesToWrite[i].nodeId,

+ 7 - 7
src/server/ua_services_call.c

@@ -7,7 +7,7 @@ static const UA_VariableNode *
 getArgumentsVariableNode(UA_Server *server, const UA_MethodNode *ofMethod,
                          UA_String withBrowseName) {
     UA_NodeId hasProperty = UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY);
-    for(size_t i = 0; i < ofMethod->referencesSize; i++) {
+    for(size_t i = 0; i < ofMethod->referencesSize; ++i) {
         if(ofMethod->references[i].isInverse == false &&
             UA_NodeId_equal(&hasProperty, &ofMethod->references[i].referenceTypeId)) {
             const UA_Node *refTarget =
@@ -41,7 +41,7 @@ argumentsConformsToDefinition(UA_Server *server, const UA_VariableNode *argRequi
         return UA_STATUSCODE_BADINVALIDARGUMENT;
 
     UA_StatusCode retval = UA_STATUSCODE_GOOD;
-    for(size_t i = 0; i < argReqsSize; i++)
+    for(size_t i = 0; i < argReqsSize; ++i)
         retval |= typeCheckValue(server, &argReqs[i].dataType, argReqs[i].valueRank,
                                  argReqs[i].arrayDimensionsSize, argReqs[i].arrayDimensions,
                                  &args[i], NULL, args);
@@ -87,7 +87,7 @@ Service_Call_single(UA_Server *server, UA_Session *session,
     UA_Boolean found = false;
     UA_NodeId hasComponentNodeId = UA_NODEID_NUMERIC(0,UA_NS0ID_HASCOMPONENT);
     UA_NodeId hasSubTypeNodeId = UA_NODEID_NUMERIC(0,UA_NS0ID_HASSUBTYPE);
-    for(size_t i = 0; i < methodCalled->referencesSize; i++) {
+    for(size_t i = 0; i < methodCalled->referencesSize; ++i) {
         if(methodCalled->references[i].isInverse &&
            UA_NodeId_equal(&methodCalled->references[i].targetId.nodeId, &withObject->nodeId)) {
             found = isNodeInTree(server->nodestore, &methodCalled->references[i].referenceTypeId,
@@ -166,14 +166,14 @@ void Service_Call(UA_Server *server, UA_Session *session,
     UA_Boolean isExternal[request->methodsToCallSize];
     UA_UInt32 indices[request->methodsToCallSize];
     memset(isExternal, false, sizeof(UA_Boolean) * request->methodsToCallSize);
-    for(size_t j = 0;j<server->externalNamespacesSize;j++) {
+    for(size_t j = 0;j<server->externalNamespacesSize;++j) {
         size_t indexSize = 0;
-        for(size_t i = 0;i < request->methodsToCallSize;i++) {
+        for(size_t i = 0;i < request->methodsToCallSize;++i) {
             if(request->methodsToCall[i].methodId.namespaceIndex != server->externalNamespaces[j].index)
                 continue;
             isExternal[i] = true;
             indices[indexSize] = (UA_UInt32)i;
-            indexSize++;
+            ++indexSize;
         }
         if(indexSize == 0)
             continue;
@@ -183,7 +183,7 @@ void Service_Call(UA_Server *server, UA_Session *session,
     }
 #endif
     
-    for(size_t i = 0; i < request->methodsToCallSize;i++){
+    for(size_t i = 0; i < request->methodsToCallSize;++i){
 #ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
 #endif    

+ 8 - 8
src/server/ua_services_discovery.c

@@ -31,7 +31,7 @@ void Service_FindServers(UA_Server *server, UA_Session *session,
     descr->discoveryUrlsSize += server->config.networkLayersSize;
 
     // TODO: Add nl only if discoveryUrl not already present
-    for(size_t i = 0; i < server->config.networkLayersSize; i++) {
+    for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
         UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
         UA_String_copy(&nl->discoveryUrl, &descr->discoveryUrls[existing + i]);
     }
@@ -61,16 +61,16 @@ void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEn
     memset(relevant_endpoints, 0, sizeof(UA_Boolean) * server->endpointDescriptionsSize);
     size_t relevant_count = 0;
     if(request->profileUrisSize == 0) {
-        for(size_t j = 0; j < server->endpointDescriptionsSize; j++)
+        for(size_t j = 0; j < server->endpointDescriptionsSize; ++j)
             relevant_endpoints[j] = true;
         relevant_count = server->endpointDescriptionsSize;
     } else {
-        for(size_t j = 0; j < server->endpointDescriptionsSize; j++) {
-            for(size_t i = 0; i < request->profileUrisSize; i++) {
+        for(size_t j = 0; j < server->endpointDescriptionsSize; ++j) {
+            for(size_t i = 0; i < request->profileUrisSize; ++i) {
                 if(!UA_String_equal(&request->profileUris[i], &server->endpointDescriptions[j].transportProfileUri))
                     continue;
                 relevant_endpoints[j] = true;
-                relevant_count++;
+                ++relevant_count;
                 break;
             }
         }
@@ -98,15 +98,15 @@ void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEn
 
     size_t k = 0;
     UA_StatusCode retval = UA_STATUSCODE_GOOD;
-    for(size_t i = 0; i < clone_times; i++) {
+    for(size_t i = 0; i < clone_times; ++i) {
         if(nl_endpointurl)
             endpointUrl = &server->config.networkLayers[i].discoveryUrl;
-        for(size_t j = 0; j < server->endpointDescriptionsSize; j++) {
+        for(size_t j = 0; j < server->endpointDescriptionsSize; ++j) {
             if(!relevant_endpoints[j])
                 continue;
             retval |= UA_EndpointDescription_copy(&server->endpointDescriptions[j], &response->endpoints[k]);
             retval |= UA_String_copy(endpointUrl, &response->endpoints[k].endpointUrl);
-            k++;
+            ++k;
         }
     }
 

+ 20 - 20
src/server/ua_services_nodemanagement.c

@@ -184,7 +184,7 @@ instantiateNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
         return retval;
     
     /* Copy members of the type and supertypes */
-    for(size_t i = 0; i < hierarchySize; i++)
+    for(size_t i = 0; i < hierarchySize; ++i)
         retval |= copyChildNodesToNode(server, session, &hierarchy[i], nodeId, instantiationCallback);
     UA_Array_delete(hierarchy, hierarchySize, &UA_TYPES[UA_TYPES_NODEID]);
     if(retval != UA_STATUSCODE_GOOD)
@@ -233,7 +233,7 @@ instanceFindAggregateByBrowsename(UA_Server *server, UA_Session *session,
         return br.statusCode;
     
     UA_StatusCode retval = UA_STATUSCODE_GOOD;
-    for(size_t i = 0; i < br.referencesSize; i++) {
+    for(size_t i = 0; i < br.referencesSize; ++i) {
         UA_ReferenceDescription *rd = &br.references[i];
         if(rd->browseName.namespaceIndex == browseName->namespaceIndex &&
            UA_String_equal(&rd->browseName.name, &browseName->name)) {
@@ -277,7 +277,7 @@ copyChildNodesToNode(UA_Server* server, UA_Session* session,
     /* Copy all children */
     UA_StatusCode retval = UA_STATUSCODE_GOOD;
     UA_NodeId existingChild = UA_NODEID_NULL;
-    for(size_t i = 0; i < br.referencesSize; i++) {
+    for(size_t i = 0; i < br.referencesSize; ++i) {
         UA_ReferenceDescription *rd = &br.references[i];
         // Check for deduplication
         retval = instanceFindAggregateByBrowsename(server, session, destinationNodeId,
@@ -725,15 +725,15 @@ void Service_AddNodes(UA_Server *server, UA_Session *session,
     UA_UInt32 indices[size];
 #endif
     memset(isExternal, false, sizeof(UA_Boolean) * size);
-    for(size_t j = 0; j <server->externalNamespacesSize; j++) {
+    for(size_t j = 0; j <server->externalNamespacesSize; ++j) {
         size_t indexSize = 0;
-        for(size_t i = 0;i < size;i++) {
+        for(size_t i = 0;i < size;++i) {
             if(request->nodesToAdd[i].requestedNewNodeId.nodeId.namespaceIndex !=
                server->externalNamespaces[j].index)
                 continue;
             isExternal[i] = true;
             indices[indexSize] = (UA_UInt32)i;
-            indexSize++;
+            ++indexSize;
         }
         if(indexSize == 0)
             continue;
@@ -745,7 +745,7 @@ void Service_AddNodes(UA_Server *server, UA_Session *session,
 #endif
 
     response->resultsSize = size;
-    for(size_t i = 0; i < size; i++) {
+    for(size_t i = 0; i < size; ++i) {
 #ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
 #endif
@@ -996,7 +996,7 @@ Service_AddReferences_single(UA_Server *server, UA_Session *session,
 #else
     UA_StatusCode retval = UA_STATUSCODE_GOOD;
     UA_Boolean handledExternally = UA_FALSE;
-    for(size_t j = 0; j <server->externalNamespacesSize; j++) {
+    for(size_t j = 0; j <server->externalNamespacesSize; ++j) {
         if(item->sourceNodeId.namespaceIndex != server->externalNamespaces[j].index) {
             continue;
         } else {
@@ -1027,7 +1027,7 @@ Service_AddReferences_single(UA_Server *server, UA_Session *session,
                                 (UA_EditNodeCallback)addOneWayReference, &secondItem);
 #else
     handledExternally = UA_FALSE;
-    for(size_t j = 0; j <server->externalNamespacesSize; j++) {
+    for(size_t j = 0; j <server->externalNamespacesSize; ++j) {
         if(secondItem.sourceNodeId.namespaceIndex != server->externalNamespaces[j].index) {
             continue;
         } else {
@@ -1075,7 +1075,7 @@ void Service_AddReferences(UA_Server *server, UA_Session *session,
     response->resultsSize = request->referencesToAddSize;
 
 #ifndef UA_ENABLE_EXTERNAL_NAMESPACES
-    for(size_t i = 0; i < response->resultsSize; i++)
+    for(size_t i = 0; i < response->resultsSize; ++i)
         response->results[i] =
             Service_AddReferences_single(server, session, &request->referencesToAdd[i]);
 #else
@@ -1088,15 +1088,15 @@ void Service_AddReferences(UA_Server *server, UA_Session *session,
     UA_UInt32 *indices = UA_alloca(sizeof(UA_UInt32) * size);
 # endif /*NO_ALLOCA */
     memset(isExternal, false, sizeof(UA_Boolean) * size);
-    for(size_t j = 0; j < server->externalNamespacesSize; j++) {
+    for(size_t j = 0; j < server->externalNamespacesSize; ++j) {
         size_t indicesSize = 0;
-        for(size_t i = 0;i < size;i++) {
+        for(size_t i = 0;i < size;++i) {
             if(request->referencesToAdd[i].sourceNodeId.namespaceIndex
                != server->externalNamespaces[j].index)
                 continue;
             isExternal[i] = true;
             indices[indicesSize] = (UA_UInt32)i;
-            indicesSize++;
+            ++indicesSize;
         }
         if (indicesSize == 0)
             continue;
@@ -1105,7 +1105,7 @@ void Service_AddReferences(UA_Server *server, UA_Session *session,
                            indices, (UA_UInt32)indicesSize, response->results, response->diagnosticInfos);
     }
 
-    for(size_t i = 0; i < response->resultsSize; i++) {
+    for(size_t i = 0; i < response->resultsSize; ++i) {
         if(!isExternal[i])
             response->results[i] =
                 Service_AddReferences_single(server, session, &request->referencesToAdd[i]);
@@ -1155,7 +1155,7 @@ Service_DeleteNodes_single(UA_Server *server, UA_Session *session,
         UA_BrowseResult result;
         UA_BrowseResult_init(&result);
         Service_Browse_single(server, &adminSession, NULL, &bd, 0, &result);
-        for(size_t i = 0; i < result.referencesSize; i++) {
+        for(size_t i = 0; i < result.referencesSize; ++i) {
             /* call the destructor */
             UA_ReferenceDescription *rd = &result.references[i];
             const UA_ObjectTypeNode *typenode =
@@ -1174,7 +1174,7 @@ Service_DeleteNodes_single(UA_Server *server, UA_Session *session,
     /* remove references */
     /* TODO: check if consistency is violated */
     if(deleteReferences == true) { 
-        for(size_t i = 0; i < node->referencesSize; i++) {
+        for(size_t i = 0; i < node->referencesSize; ++i) {
             UA_DeleteReferencesItem item;
             UA_DeleteReferencesItem_init(&item);
             item.isForward = node->references[i].isInverse;
@@ -1205,7 +1205,7 @@ void Service_DeleteNodes(UA_Server *server, UA_Session *session,
     }
     response->resultsSize = request->nodesToDeleteSize;
 
-    for(size_t i = 0; i < request->nodesToDeleteSize; i++) {
+    for(size_t i = 0; i < request->nodesToDeleteSize; ++i) {
         UA_DeleteNodesItem *item = &request->nodesToDelete[i];
         response->results[i] = Service_DeleteNodes_single(server, session, &item->nodeId,
                                                           item->deleteTargetReferences);
@@ -1231,7 +1231,7 @@ static UA_StatusCode
 deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node,
                       const UA_DeleteReferencesItem *item) {
     UA_Boolean edited = false;
-    for(size_t i = node->referencesSize-1; ; i--) {
+    for(size_t i = node->referencesSize-1; ; --i) {
         if(i > node->referencesSize)
             break; /* underflow after i == 0 */
         if(!UA_NodeId_equal(&item->targetNodeId.nodeId, &node->references[i].targetId.nodeId))
@@ -1243,7 +1243,7 @@ deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node,
         /* move the last entry to override the current position */
         UA_ReferenceNode_deleteMembers(&node->references[i]);
         node->references[i] = node->references[node->referencesSize-1];
-        node->referencesSize--;
+        --node->referencesSize;
         edited = true;
         break;
     }
@@ -1293,7 +1293,7 @@ Service_DeleteReferences(UA_Server *server, UA_Session *session,
     }
     response->resultsSize = request->referencesToDeleteSize;
 
-    for(size_t i = 0; i < request->referencesToDeleteSize; i++)
+    for(size_t i = 0; i < request->referencesToDeleteSize; ++i)
         response->results[i] =
             Service_DeleteReferences_single(server, session, &request->referencesToDelete[i]);
 }

+ 2 - 2
src/server/ua_services_session.c

@@ -20,7 +20,7 @@ void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
     response->serverEndpointsSize = server->endpointDescriptionsSize;
 
     /* Mirror back the endpointUrl */
-    for(size_t i = 0; i < response->serverEndpointsSize; i++)
+    for(size_t i = 0; i < response->serverEndpointsSize; ++i)
         UA_String_copy(&request->endpointUrl, &response->serverEndpoints[i].endpointUrl);
 
     UA_Session *newSession;
@@ -109,7 +109,7 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
 
         /* trying to match pw/username */
         UA_Boolean match = false;
-        for(size_t i = 0; i < server->config.usernamePasswordLoginsSize; i++) {
+        for(size_t i = 0; i < server->config.usernamePasswordLoginsSize; ++i) {
             UA_String *user = &server->config.usernamePasswordLogins[i].username;
             UA_String *pw = &server->config.usernamePasswordLogins[i].password;
             if(UA_String_equal(&token->userName, user) && UA_String_equal(&token->password, pw)) {

+ 7 - 7
src/server/ua_services_subscription.c

@@ -124,7 +124,7 @@ Service_SetPublishingMode(UA_Server *server, UA_Session *session,
     }
 
     response->resultsSize = size;
-    for(size_t i = 0; i < size; i++) {
+    for(size_t i = 0; i < size; ++i) {
         UA_Subscription *sub =
             UA_Session_getSubscriptionByID(session, request->subscriptionIds[i]);
         if(!sub) {
@@ -293,7 +293,7 @@ Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
     }
     response->resultsSize = request->itemsToCreateSize;
 
-    for(size_t i = 0; i < request->itemsToCreateSize; i++)
+    for(size_t i = 0; i < request->itemsToCreateSize; ++i)
         Service_CreateMonitoredItems_single(server, session, sub, request->timestampsToReturn,
                                             &request->itemsToCreate[i], &response->results[i]);
 }
@@ -348,7 +348,7 @@ void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
     }
     response->resultsSize = request->itemsToModifySize;
 
-    for(size_t i = 0; i < request->itemsToModifySize; i++)
+    for(size_t i = 0; i < request->itemsToModifySize; ++i)
         Service_ModifyMonitoredItems_single(server, session, sub, &request->itemsToModify[i],
                                             &response->results[i]);
 
@@ -376,7 +376,7 @@ void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
     }
     response->resultsSize = request->monitoredItemIdsSize;
 
-    for(size_t i = 0; i < response->resultsSize; i++) {
+    for(size_t i = 0; i < response->resultsSize; ++i) {
         UA_MonitoredItem *mon =
             UA_Subscription_getMonitoredItem(sub, request->monitoredItemIds[i]);
         if(!mon) {
@@ -428,7 +428,7 @@ Service_Publish(UA_Server *server, UA_Session *session,
     }
 
     /* Delete Acknowledged Subscription Messages */
-    for(size_t i = 0; i < request->subscriptionAcknowledgementsSize; i++) {
+    for(size_t i = 0; i < request->subscriptionAcknowledgementsSize; ++i) {
         UA_SubscriptionAcknowledgement *ack = &request->subscriptionAcknowledgements[i];
         UA_Subscription *sub = UA_Session_getSubscriptionByID(session, ack->subscriptionId);
         if(!sub) {
@@ -500,7 +500,7 @@ Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
     }
     response->resultsSize = request->subscriptionIdsSize;
 
-    for(size_t i = 0; i < request->subscriptionIdsSize; i++) {
+    for(size_t i = 0; i < request->subscriptionIdsSize; ++i) {
         response->results[i] = UA_Session_deleteSubscription(server, session, request->subscriptionIds[i]);
         if(response->results[i] == UA_STATUSCODE_GOOD) {
             UA_LOG_DEBUG_SESSION(server->config.logger, session, "Subscription %u | "
@@ -551,7 +551,7 @@ void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
     }
     response->resultsSize = request->monitoredItemIdsSize;
 
-    for(size_t i = 0; i < request->monitoredItemIdsSize; i++)
+    for(size_t i = 0; i < request->monitoredItemIdsSize; ++i)
         response->results[i] = UA_Subscription_deleteMonitoredItem(server, sub, request->monitoredItemIds[i]);
 }
 

+ 21 - 21
src/server/ua_services_view.c

@@ -18,7 +18,7 @@ fillReferenceDescription(UA_NodeStore *ns, const UA_Node *curr, UA_ReferenceNode
         retval |= UA_LocalizedText_copy(&curr->displayName, &descr->displayName);
     if(mask & UA_BROWSERESULTMASK_TYPEDEFINITION){
         if(curr->nodeClass == UA_NODECLASS_OBJECT || curr->nodeClass == UA_NODECLASS_VARIABLE) {
-            for(size_t i = 0; i < curr->referencesSize; i++) {
+            for(size_t i = 0; i < curr->referencesSize; ++i) {
                 UA_ReferenceNode *refnode = &curr->references[i];
                 if(refnode->referenceTypeId.identifier.numeric == UA_NS0ID_HASTYPEDEFINITION) {
                     retval |= UA_ExpandedNodeId_copy(&refnode->targetId, &descr->typeDefinition);
@@ -40,7 +40,7 @@ returnRelevantNodeExternal(UA_ExternalNodeStore *ens, const UA_BrowseDescription
     UA_UInt32 indicesSize = 6;
     UA_DataValue *readNodesResults = UA_Array_new(6,&UA_TYPES[UA_TYPES_DATAVALUE]);
     UA_DiagnosticInfo *diagnosticInfos = UA_Array_new(6,&UA_TYPES[UA_TYPES_DIAGNOSTICINFO]);
-    for(UA_UInt32 i = 0; i < 6; i++) {
+    for(UA_UInt32 i = 0; i < 6; ++i) {
         readValueIds[i].nodeId = reference->targetId.nodeId;
         indices[i] = i;
     }
@@ -96,7 +96,7 @@ returnRelevantNode(UA_Server *server, const UA_BrowseDescription *descr, UA_Bool
     /* is the reference part of the hierarchy of references we look for? */
     if(!return_all) {
         UA_Boolean is_relevant = false;
-        for(size_t i = 0; i < relevant_count; i++) {
+        for(size_t i = 0; i < relevant_count; ++i) {
             if(UA_NodeId_equal(&reference->referenceTypeId, &relevant[i])) {
                 is_relevant = true;
                 break;
@@ -108,7 +108,7 @@ returnRelevantNode(UA_Server *server, const UA_BrowseDescription *descr, UA_Bool
 
 #ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     /* return the node from an external namespace*/
-    for(size_t nsIndex = 0; nsIndex < server->externalNamespacesSize; nsIndex++) {
+    for(size_t nsIndex = 0; nsIndex < server->externalNamespacesSize; ++nsIndex) {
         if(reference->targetId.nodeId.namespaceIndex != server->externalNamespaces[nsIndex].index)
             continue;
         *isExternal = true;
@@ -130,7 +130,7 @@ static void removeCp(struct ContinuationPointEntry *cp, UA_Session* session) {
     UA_ByteString_deleteMembers(&cp->identifier);
     UA_BrowseDescription_deleteMembers(&cp->browseDescription);
     UA_free(cp);
-    session->availableContinuationPoints++;
+    ++session->availableContinuationPoints;
 }
 
 /* Results for a single browsedescription. This is the inner loop for both
@@ -220,7 +220,7 @@ Service_Browse_single(UA_Server *server, UA_Session *session,
     size_t skipped = 0;
     UA_Boolean isExternal = false;
     UA_StatusCode retval = UA_STATUSCODE_GOOD;
-    for(; referencesIndex < node->referencesSize && referencesCount < real_maxrefs; referencesIndex++) {
+    for(; referencesIndex < node->referencesSize && referencesCount < real_maxrefs; ++referencesIndex) {
         isExternal = false;
         const UA_Node *current =
             returnRelevantNode(server, descr, all_refs, &node->references[referencesIndex],
@@ -229,13 +229,13 @@ Service_Browse_single(UA_Server *server, UA_Session *session,
             continue;
 
         if(skipped < continuationIndex) {
-            skipped++;
+            ++skipped;
         } else {
             retval |= fillReferenceDescription(server->nodestore, current,
                                                &node->references[referencesIndex],
                                                descr->resultMask,
                                                &result->references[referencesCount]);
-            referencesCount++;
+            ++referencesCount;
         }
     }
     result->referencesSize = referencesCount;
@@ -288,7 +288,7 @@ Service_Browse_single(UA_Server *server, UA_Session *session,
 
         /* store the cp */
         LIST_INSERT_HEAD(&session->continuationPoints, cp, pointers);
-        session->availableContinuationPoints--;
+        --session->availableContinuationPoints;
     }
 }
 
@@ -322,14 +322,14 @@ void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseReque
     UA_UInt32 *indices = UA_alloca(sizeof(UA_UInt32) * size);
 #endif /*NO_ALLOCA */
     memset(isExternal, false, sizeof(UA_Boolean) * size);
-    for(size_t j = 0; j < server->externalNamespacesSize; j++) {
+    for(size_t j = 0; j < server->externalNamespacesSize; ++j) {
         size_t indexSize = 0;
-        for(size_t i = 0; i < size; i++) {
+        for(size_t i = 0; i < size; ++i) {
             if(request->nodesToBrowse[i].nodeId.namespaceIndex != server->externalNamespaces[j].index)
                 continue;
             isExternal[i] = true;
             indices[indexSize] = (UA_UInt32)i;
-            indexSize++;
+            ++indexSize;
         }
         if(indexSize == 0)
             continue;
@@ -340,7 +340,7 @@ void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseReque
     }
 #endif
 
-    for(size_t i = 0; i < size; i++) {
+    for(size_t i = 0; i < size; ++i) {
 #ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
 #endif
@@ -391,7 +391,7 @@ void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseN
     }
 
     response->resultsSize = size;
-    for(size_t i = 0; i < size; i++)
+    for(size_t i = 0; i < size; ++i)
         UA_Server_browseNext_single(server, session, request->releaseContinuationPoints,
                                     &request->continuationPoints[i], &response->results[i]);
 }
@@ -434,9 +434,9 @@ walkBrowsePath(UA_Server *server, UA_Session *session, const UA_Node *node, cons
             return retval;
     }
 
-    for(size_t i = 0; i < node->referencesSize && retval == UA_STATUSCODE_GOOD; i++) {
+    for(size_t i = 0; i < node->referencesSize && retval == UA_STATUSCODE_GOOD; ++i) {
         UA_Boolean match = all_refs;
-        for(size_t j = 0; j < reftypes_count && !match; j++) {
+        for(size_t j = 0; j < reftypes_count && !match; ++j) {
             if(node->references[i].isInverse == elem->isInverse &&
                UA_NodeId_equal(&node->references[i].referenceTypeId, &reftypes[j]))
                 match = true;
@@ -495,7 +495,7 @@ void Service_TranslateBrowsePathsToNodeIds_single(UA_Server *server, UA_Session
     }
         
     //relativePath elements should not have an empty targetName
-    for(size_t i=0;i<path->relativePath.elementsSize;i++){
+    for(size_t i=0;i<path->relativePath.elementsSize;++i){
         UA_QualifiedName *qname = &(path->relativePath.elements[i].targetName);
         if(UA_QualifiedName_isNull(qname)){
             result->statusCode = UA_STATUSCODE_BADBROWSENAMEINVALID;
@@ -555,14 +555,14 @@ void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *sessio
     UA_UInt32 *indices = UA_alloca(sizeof(UA_UInt32) * size);
 #endif /* NO_ALLOCA */
     memset(isExternal, false, sizeof(UA_Boolean) * size);
-    for(size_t j = 0; j < server->externalNamespacesSize; j++) {
+    for(size_t j = 0; j < server->externalNamespacesSize; ++j) {
         size_t indexSize = 0;
-        for(size_t i = 0;i < size;i++) {
+        for(size_t i = 0;i < size;++i) {
             if(request->browsePaths[i].startingNode.namespaceIndex != server->externalNamespaces[j].index)
                 continue;
             isExternal[i] = true;
             indices[indexSize] = (UA_UInt32)i;
-            indexSize++;
+            ++indexSize;
         }
         if(indexSize == 0)
             continue;
@@ -574,7 +574,7 @@ void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *sessio
 #endif
 
     response->resultsSize = size;
-    for(size_t i = 0; i < size; i++) {
+    for(size_t i = 0; i < size; ++i) {
 #ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
 #endif

+ 9 - 9
src/server/ua_subscription.c

@@ -59,7 +59,7 @@ ensureSpaceInMonitoredItemQueue(UA_MonitoredItem *mon) {
     TAILQ_REMOVE(&mon->queue, queueItem, listEntry);
     UA_DataValue_deleteMembers(&queueItem->value);
     UA_free(queueItem);
-    mon->currentQueueSize--;
+    --mon->currentQueueSize;
 }
 
 /* Has this sample changed from the last one? The method may allocate additional
@@ -211,7 +211,7 @@ void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monito
     /* Add the sample to the queue for publication */
     ensureSpaceInMonitoredItemQueue(monitoredItem);
     TAILQ_INSERT_TAIL(&monitoredItem->queue, newQueueItem, listEntry);
-    monitoredItem->currentQueueSize++;
+    ++monitoredItem->currentQueueSize;
     return;
 
  cleanup:
@@ -320,7 +320,7 @@ countQueuedNotifications(UA_Subscription *sub, UA_Boolean *moreNotifications) {
                     *moreNotifications = true;
                     break;
                 }
-                notifications++;
+                ++notifications;
             }
         }
     }
@@ -366,8 +366,8 @@ prepareNotificationMessage(UA_Subscription *sub, UA_NotificationMessage *message
             min->value = qv->value;
             TAILQ_REMOVE(&mon->queue, qv, listEntry);
             UA_free(qv);
-            mon->currentQueueSize--;
-            l++;
+            --mon->currentQueueSize;
+            ++l;
         }
     }
     return UA_STATUSCODE_GOOD;
@@ -387,7 +387,7 @@ void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub) {
 
     /* Return if nothing to do */
     if(notifications == 0) {
-        sub->currentKeepAliveCount++;
+        ++sub->currentKeepAliveCount;
         if(sub->currentKeepAliveCount < sub->maxKeepAliveCount)
             return;
         UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
@@ -411,7 +411,7 @@ void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub) {
         if(sub->state != UA_SUBSCRIPTIONSTATE_LATE) {
             sub->state = UA_SUBSCRIPTIONSTATE_LATE;
         } else {
-            sub->currentLifetimeCount++;
+            ++sub->currentLifetimeCount;
             if(sub->currentLifetimeCount > sub->lifeTimeCount) {
                 UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | "
                                      "End of lifetime for subscription", sub->subscriptionID);
@@ -473,7 +473,7 @@ void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub) {
     size_t available = 0;
     UA_NotificationMessageEntry *nme;
     LIST_FOREACH(nme, &sub->retransmissionQueue, listEntry)
-        available++;
+        ++available;
     // cppcheck-suppress knownConditionTrueFalse
     if(available > 0) {
         response->availableSequenceNumbers = UA_alloca(available * sizeof(UA_UInt32));
@@ -482,7 +482,7 @@ void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub) {
     size_t i = 0;
     LIST_FOREACH(nme, &sub->retransmissionQueue, listEntry) {
         response->availableSequenceNumbers[i] = nme->message.sequenceNumber;
-        i++;
+        ++i;
     }
 
     /* Send the response */

+ 4 - 4
src/ua_connection.c

@@ -153,7 +153,7 @@ UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname,
     // opc.tcp://[2001:0db8:85a3::8a2e:0370:7334]:1234/path
     // if ip6, then end not found, otherwise we are fine
     UA_Boolean ip6_end_found = endpointUrl[portpos] != '[';
-    for(; portpos < urlLength; portpos++) {
+    for(; portpos < urlLength; ++portpos) {
         if (!ip6_end_found) {
             if (endpointUrl[portpos] == ']')
                 ip6_end_found = UA_TRUE;
@@ -180,7 +180,7 @@ UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname,
 
     if(path) {
         size_t pathpos = portpos < urlLength ? portpos : 10;
-        for(; pathpos < urlLength; pathpos++) {
+        for(; pathpos < urlLength; ++pathpos) {
             if(endpointUrl[pathpos] == '/')
                 break;
         }
@@ -224,7 +224,7 @@ UA_EndpointUrl_split(const char *endpointUrl, char *hostname,
         portStr[portLen]='\0';
 
         if(port) {
-            for (size_t i=0; i<6; i++) {
+            for (size_t i=0; i<6; ++i) {
                 if (portStr[i] == 0)
                     break;
                 if (portStr[i] < '0' || portStr[i] > '9')
@@ -257,7 +257,7 @@ size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number) {
         if('0' > c || '9' < c)
             break;
         n = (n*10) + (UA_UInt32)(c-'0');
-        progress++;
+        ++progress;
     }
     *number = n;
     return progress;

+ 1 - 1
src/ua_securechannel.c

@@ -344,7 +344,7 @@ UA_SecureChannel_processSequenceNumber(UA_SecureChannel *channel, UA_UInt32 Sequ
         else
             return UA_STATUSCODE_BADSECURITYCHECKSFAILED;
     }
-    channel->receiveSequenceNumber++;
+    ++channel->receiveSequenceNumber;
     return UA_STATUSCODE_GOOD;
 }
 

+ 17 - 17
src/ua_types.c

@@ -103,7 +103,7 @@ UA_DateTime_toStruct(UA_DateTime t) {
 
 static void
 printNumber(UA_UInt16 n, UA_Byte *pos, size_t digits) {
-    for(size_t i = digits; i > 0; i--) {
+    for(size_t i = digits; i > 0; --i) {
         pos[i-1] = (UA_Byte)((n % 10) + '0');
         n = n / 10;
     }
@@ -434,7 +434,7 @@ computeStrides(const UA_Variant *v, const UA_NumericRange range,
         size_t elements = 1;
         dims_count = v->arrayDimensionsSize;
         dims = (UA_UInt32*)v->arrayDimensions;
-        for(size_t i = 0; i < dims_count; i++)
+        for(size_t i = 0; i < dims_count; ++i)
             elements *= dims[i];
         if(elements != v->arrayLength)
             return UA_STATUSCODE_BADINTERNALERROR;
@@ -444,7 +444,7 @@ computeStrides(const UA_Variant *v, const UA_NumericRange range,
     size_t count = 1;
     if(range.dimensionsSize != dims_count)
         return UA_STATUSCODE_BADINDEXRANGENODATA;
-    for(size_t i = 0; i < dims_count; i++) {
+    for(size_t i = 0; i < dims_count; ++i) {
         if(range.dimensions[i].min > range.dimensions[i].max)
             return UA_STATUSCODE_BADINDEXRANGEINVALID;
         if(range.dimensions[i].max >= dims[i])
@@ -460,7 +460,7 @@ computeStrides(const UA_Variant *v, const UA_NumericRange range,
     size_t running_dimssize = 1;
     UA_Boolean found_contiguous = false;
     for(size_t k = dims_count; k > 0;) {
-        k--;
+        --k;
         size_t dimrange = 1 + range.dimensions[k].max - range.dimensions[k].min;
         if(!found_contiguous && dimrange != dims[k]) {
             /* Found the maximum block that can be copied contiguously */
@@ -558,14 +558,14 @@ UA_Variant_copyRange(const UA_Variant *orig_src, UA_Variant *dst,
     if(nextrange.dimensionsSize == 0) {
         /* no nextrange */
         if(src->type->fixedSize) {
-            for(size_t i = 0; i < block_count; i++) {
+            for(size_t i = 0; i < block_count; ++i) {
                 memcpy((void*)nextdst, (void*)nextsrc, elem_size * block);
                 nextdst += block * elem_size;
                 nextsrc += stride * elem_size;
             }
         } else {
-            for(size_t i = 0; i < block_count; i++) {
-                for(size_t j = 0; j < block; j++) {
+            for(size_t i = 0; i < block_count; ++i) {
+                for(size_t j = 0; j < block; ++j) {
                     retval = UA_copy((const void*)nextsrc,
                                      (void*)nextdst, src->type);
                     nextdst += elem_size;
@@ -585,8 +585,8 @@ UA_Variant_copyRange(const UA_Variant *orig_src, UA_Variant *dst,
         }
 
         /* Copy the content */
-        for(size_t i = 0; i < block_count; i++) {
-            for(size_t j = 0; j < block && retval == UA_STATUSCODE_GOOD; j++) {
+        for(size_t i = 0; i < block_count; ++i) {
+            for(size_t j = 0; j < block && retval == UA_STATUSCODE_GOOD; ++j) {
                 if(stringLike)
                     retval = copySubString((const UA_String*)nextsrc,
                                            (UA_String*)nextdst,
@@ -624,7 +624,7 @@ UA_Variant_copyRange(const UA_Variant *orig_src, UA_Variant *dst,
             return UA_STATUSCODE_BADOUTOFMEMORY;
         }
         dst->arrayDimensionsSize = thisrange.dimensionsSize;
-        for(size_t k = 0; k < thisrange.dimensionsSize; k++)
+        for(size_t k = 0; k < thisrange.dimensionsSize; ++k)
             dst->arrayDimensions[k] =
                 thisrange.dimensions[k].max - thisrange.dimensions[k].min + 1;
     }
@@ -651,14 +651,14 @@ Variant_setRange(UA_Variant *v, void *array, size_t arraySize,
     uintptr_t nextdst = (uintptr_t)v->data + (first * elem_size);
     uintptr_t nextsrc = (uintptr_t)array;
     if(v->type->fixedSize || !copy) {
-        for(size_t i = 0; i < block_count; i++) {
+        for(size_t i = 0; i < block_count; ++i) {
             memcpy((void*)nextdst, (void*)nextsrc, elem_size * block);
             nextsrc += block * elem_size;
             nextdst += stride * elem_size;
         }
     } else {
-        for(size_t i = 0; i < block_count; i++) {
-            for(size_t j = 0; j < block; j++) {
+        for(size_t i = 0; i < block_count; ++i) {
+            for(size_t j = 0; j < block; ++j) {
                 deleteMembers_noInit((void*)nextdst, v->type);
                 retval |= UA_copy((void*)nextsrc, (void*)nextdst, v->type);
                 nextdst += elem_size;
@@ -831,7 +831,7 @@ copy_noInit(const void *src, void *dst, const UA_DataType *type) {
     uintptr_t ptrs = (uintptr_t)src;
     uintptr_t ptrd = (uintptr_t)dst;
     UA_Byte membersSize = type->membersSize;
-    for(size_t i = 0; i < membersSize; i++) {
+    for(size_t i = 0; i < membersSize; ++i) {
         const UA_DataTypeMember *m= &type->members[i];
         const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
         const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex];
@@ -908,7 +908,7 @@ static void
 deleteMembers_noInit(void *p, const UA_DataType *type) {
     uintptr_t ptr = (uintptr_t)p;
     UA_Byte membersSize = type->membersSize;
-    for(size_t i = 0; i < membersSize; i++) {
+    for(size_t i = 0; i < membersSize; ++i) {
         const UA_DataTypeMember *m= &type->members[i];
         const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
         const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex];
@@ -977,7 +977,7 @@ UA_Array_copy(const void *src, size_t src_size,
     uintptr_t ptrs = (uintptr_t)src;
     uintptr_t ptrd = (uintptr_t)*dst;
     UA_StatusCode retval = UA_STATUSCODE_GOOD;
-    for(size_t i = 0; i < src_size; i++) {
+    for(size_t i = 0; i < src_size; ++i) {
         retval |= UA_copy((void*)ptrs, (void*)ptrd, type);
         ptrs += type->memSize;
         ptrd += type->memSize;
@@ -993,7 +993,7 @@ void
 UA_Array_delete(void *p, size_t size, const UA_DataType *type) {
     if(!type->fixedSize) {
         uintptr_t ptr = (uintptr_t)p;
-        for(size_t i = 0; i < size; i++) {
+        for(size_t i = 0; i < size; ++i) {
             UA_deleteMembers((void*)ptr, type);
             ptr += type->memSize;
         }

+ 20 - 20
src/ua_types_encoding_binary.c

@@ -150,7 +150,7 @@ Boolean_encodeBinary(const UA_Boolean *src, const UA_DataType *_) {
     if(pos + sizeof(UA_Boolean) > end)
         return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED;
     *pos = *(const UA_Byte*)src;
-    pos++;
+    ++pos;
     return UA_STATUSCODE_GOOD;
 }
 
@@ -159,7 +159,7 @@ Boolean_decodeBinary(UA_Boolean *dst, const UA_DataType *_) {
     if(pos + sizeof(UA_Boolean) > end)
         return UA_STATUSCODE_BADDECODINGERROR;
     *dst = (*pos > 0) ? true : false;
-    pos++;
+    ++pos;
     return UA_STATUSCODE_GOOD;
 }
 
@@ -169,7 +169,7 @@ Byte_encodeBinary(const UA_Byte *src, const UA_DataType *_) {
     if(pos + sizeof(UA_Byte) > end)
         return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED;
     *pos = *(const UA_Byte*)src;
-    pos++;
+    ++pos;
     return UA_STATUSCODE_GOOD;
 }
 
@@ -178,7 +178,7 @@ Byte_decodeBinary(UA_Byte *dst, const UA_DataType *_) {
     if(pos + sizeof(UA_Byte) > end)
         return UA_STATUSCODE_BADDECODINGERROR;
     *dst = *pos;
-    pos++;
+    ++pos;
     return UA_STATUSCODE_GOOD;
 }
 
@@ -337,8 +337,8 @@ pack754(long double f, unsigned bits, unsigned expbits) {
     if (f < 0) { sign = 1; fnorm = -f; }
     else { sign = 0; fnorm = f; }
     int shift = 0;
-    while(fnorm >= 2.0) { fnorm /= 2.0; shift++; }
-    while(fnorm < 1.0) { fnorm *= 2.0; shift--; }
+    while(fnorm >= 2.0) { fnorm /= 2.0; ++shift; }
+    while(fnorm < 1.0) { fnorm *= 2.0; --shift; }
     fnorm = fnorm - 1.0;
     long long significand = (long long)(fnorm * ((float)(1LL<<significandbits) + 0.5f));
     long long exponent = shift + ((1<<(expbits-1)) - 1);
@@ -353,8 +353,8 @@ unpack754(uint64_t i, unsigned bits, unsigned expbits) {
     result += 1.0f;
     unsigned bias = (unsigned)(1<<(expbits-1)) - 1;
     long long shift = (long long)((i>>significandbits) & (uint64_t)((1LL<<expbits)-1)) - bias;
-    while(shift > 0) { result *= 2.0; shift--; }
-    while(shift < 0) { result /= 2.0; shift++; }
+    while(shift > 0) { result *= 2.0; --shift; }
+    while(shift < 0) { result /= 2.0; ++shift; }
     result *= ((i>>(bits-1))&1)? -1.0: 1.0;
     return result;
 }
@@ -469,7 +469,7 @@ Array_encodeBinary(const void *src, size_t length, const UA_DataType *type) {
 
     uintptr_t ptr = (uintptr_t)src;
     size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
-    for(size_t i = 0; i < length && retval == UA_STATUSCODE_GOOD; i++) {
+    for(size_t i = 0; i < length && retval == UA_STATUSCODE_GOOD; ++i) {
         UA_Byte *oldpos = pos;
         retval = encodeBinaryJumpTable[encode_index]((const void*)ptr, type);
         ptr += type->memSize;
@@ -479,7 +479,7 @@ Array_encodeBinary(const void *src, size_t length, const UA_DataType *type) {
             retval = exchangeBuffer();
             /* Repeat encoding of the same element */
             ptr -= type->memSize;
-            i--;
+            --i;
         }
     }
     return retval;
@@ -526,7 +526,7 @@ Array_decodeBinary(void *UA_RESTRICT *UA_RESTRICT dst,
         /* Decode array members */
         uintptr_t ptr = (uintptr_t)*dst;
         size_t decode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
-        for(size_t i = 0; i < length; i++) {
+        for(size_t i = 0; i < length; ++i) {
             retval = decodeBinaryJumpTable[decode_index]((void*)ptr, type);
             if(retval != UA_STATUSCODE_GOOD) {
                 UA_Array_delete(*dst, i, type);
@@ -764,7 +764,7 @@ LocalizedText_decodeBinary(UA_LocalizedText *dst, const UA_DataType *_) {
 
 static UA_StatusCode
 findDataTypeByBinary(const UA_NodeId *typeId, const UA_DataType **findtype) {
-    for(size_t i = 0; i < UA_TYPES_COUNT; i++) {
+    for(size_t i = 0; i < UA_TYPES_COUNT; ++i) {
         if (UA_TYPES[i].binaryEncodingId == typeId->identifier.numeric) {
             *findtype = &UA_TYPES[i];
             return UA_STATUSCODE_GOOD;
@@ -920,7 +920,7 @@ Variant_encodeBinary(UA_Variant const *src, const UA_DataType *_) {
         eo.content.decoded.type = src->type;
         const UA_UInt16 memSize = src->type->memSize;
         uintptr_t ptr = (uintptr_t)src->data;
-        for(size_t i = 0; i < length && retval == UA_STATUSCODE_GOOD; i++) {
+        for(size_t i = 0; i < length && retval == UA_STATUSCODE_GOOD; ++i) {
             UA_Byte *oldpos = pos;
             eo.content.decoded.data = (void*)ptr;
             retval |= ExtensionObject_encodeBinary(&eo, NULL);
@@ -930,7 +930,7 @@ Variant_encodeBinary(UA_Variant const *src, const UA_DataType *_) {
                 pos = oldpos;
                 retval = exchangeBuffer();
                 /* encode the same element in the next iteration */
-                i--;
+                --i;
                 ptr -= memSize;
             }
         }
@@ -1194,7 +1194,7 @@ UA_encodeBinaryInternal(const void *src, const UA_DataType *type) {
     UA_StatusCode retval = UA_STATUSCODE_GOOD;
     UA_Byte membersSize = type->membersSize;
     const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
-    for(size_t i = 0; i < membersSize && retval == UA_STATUSCODE_GOOD; i++) {
+    for(size_t i = 0; i < membersSize && retval == UA_STATUSCODE_GOOD; ++i) {
         const UA_DataTypeMember *member = &type->members[i];
         const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
         if(!member->isArray) {
@@ -1210,7 +1210,7 @@ UA_encodeBinaryInternal(const void *src, const UA_DataType *type) {
                 retval = exchangeBuffer();
                 /* re-encode the same member on the new buffer */
                 ptr -= member->padding + memSize;
-                i--;
+                --i;
             }
         } else {
             ptr += member->padding;
@@ -1279,7 +1279,7 @@ UA_decodeBinaryInternal(void *dst, const UA_DataType *type) {
     UA_StatusCode retval = UA_STATUSCODE_GOOD;
     UA_Byte membersSize = type->membersSize;
     const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
-    for(size_t i = 0; i < membersSize; i++) {
+    for(size_t i = 0; i < membersSize; ++i) {
         const UA_DataTypeMember *member = &type->members[i];
         const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
         if(!member->isArray) {
@@ -1334,7 +1334,7 @@ Array_calcSizeBinary(const void *src, size_t length, const UA_DataType *type) {
     }
     uintptr_t ptr = (uintptr_t)src;
     size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
-    for(size_t i = 0; i < length; i++) {
+    for(size_t i = 0; i < length; ++i) {
         s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, type);
         ptr += type->memSize;
     }
@@ -1460,7 +1460,7 @@ Variant_calcSizeBinary(UA_Variant const *src, UA_DataType *_) {
 
     uintptr_t ptr = (uintptr_t)src->data;
     size_t memSize = src->type->memSize;
-    for(size_t i = 0; i < length; i++) {
+    for(size_t i = 0; i < length; ++i) {
         if(!isBuiltin) {
             /* The type is wrapped inside an extensionobject */
             s += NodeId_calcSizeBinary(&typeId, NULL);
@@ -1549,7 +1549,7 @@ UA_calcSizeBinary(void *p, const UA_DataType *type) {
     uintptr_t ptr = (uintptr_t)p;
     UA_Byte membersSize = type->membersSize;
     const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
-    for(size_t i = 0; i < membersSize; i++) {
+    for(size_t i = 0; i < membersSize; ++i) {
         const UA_DataTypeMember *member = &type->members[i];
         const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
         if(!member->isArray) {

+ 1 - 1
tools/generate_statuscode_descriptions.py

@@ -54,7 +54,7 @@ printc('''\n};
 
 printc('''
 const UA_StatusCodeDescription * UA_StatusCode_description(UA_StatusCode code) {
-    for(size_t i = 0; i < statusCodeDescriptionsSize; i++) {
+    for(size_t i = 0; i < statusCodeDescriptionsSize; ++i) {
         if(statusCodeDescriptions[i].code == code)
             return &statusCodeDescriptions[i];
     }

+ 2 - 2
tools/pyUANamespace/open62541_MacroHelper.py

@@ -161,7 +161,7 @@ class open62541_MacroHelper():
             code.append("")
             code.append("inputArguments = (UA_Argument *) malloc(sizeof(UA_Argument) * " + str(len(inArgVal)) + ");")
             code.append("int inputArgumentCnt;")
-            code.append("for (inputArgumentCnt=0; inputArgumentCnt<" + str(len(inArgVal)) + "; inputArgumentCnt++) UA_Argument_init(&inputArguments[inputArgumentCnt]); ")
+            code.append("for (inputArgumentCnt=0; inputArgumentCnt<" + str(len(inArgVal)) + "; ++inputArgumentCnt) UA_Argument_init(&inputArguments[inputArgumentCnt]); ")
             argumentCnt = 0
             for inArg in inArgVal:
                 if inArg.getValueFieldByAlias("Description") != None:
@@ -179,7 +179,7 @@ class open62541_MacroHelper():
             code.append("")
             code.append("outputArguments = (UA_Argument *) malloc(sizeof(UA_Argument) * " + str(len(outArgVal)) + ");")
             code.append("int outputArgumentCnt;")
-            code.append("for (outputArgumentCnt=0; outputArgumentCnt<" + str(len(outArgVal)) + "; outputArgumentCnt++) UA_Argument_init(&outputArguments[outputArgumentCnt]); ")
+            code.append("for (outputArgumentCnt=0; outputArgumentCnt<" + str(len(outArgVal)) + "; ++outputArgumentCnt) UA_Argument_init(&outputArguments[outputArgumentCnt]); ")
             argumentCnt = 0
             for outArg in outArgVal:
                 if outArg.getValueFieldByAlias("Description") != None: