Explorar el Código

Avoid changing const variable

Stefan Profanter hace 7 años
padre
commit
eb410d1792
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      src/ua_types_encoding_binary.c

+ 3 - 0
src/ua_types_encoding_binary.c

@@ -789,7 +789,10 @@ ExpandedNodeId_decodeBinary(UA_ExpandedNodeId *dst, const UA_DataType *_) {
     /* Mask out the encoding byte on the stream to decode the NodeId only */
     *pos = encoding & (UA_Byte)~(UA_EXPANDEDNODEID_NAMESPACEURI_FLAG |
                                  UA_EXPANDEDNODEID_SERVERINDEX_FLAG);
+    UA_Byte *oldPos = pos;
     UA_StatusCode retval = NodeId_decodeBinary(&dst->nodeId, NULL);
+    // revert the changes since pos is const
+    *oldPos = encoding;
 
     /* Decode the NamespaceUri */
     if(encoding & UA_EXPANDEDNODEID_NAMESPACEURI_FLAG) {