Browse Source

fix bytestr

Julius Pfrommer 9 years ago
parent
commit
8c84d26cd1
1 changed files with 7 additions and 1 deletions
  1. 7 1
      include/ua_types.h

+ 7 - 1
include/ua_types.h

@@ -377,7 +377,13 @@ static UA_INLINE UA_ByteString UA_BYTESTRING(char *chars) {
     str.length = strlen(chars);
     str.data = (UA_Byte*)chars;
     return str; }
-#define UA_BYTESTRING_ALLOC(CHARS) (UA_ByteString)UA_String_fromChars(CHARS)
+static UA_INLINE UA_ByteString UA_BYTESTRING_ALLOC(const char *chars) {
+    UA_String str = UA_String_fromChars(chars);
+    UA_ByteString bstr;
+    bstr.length = str.length;
+    bstr.data = str.data;
+    return bstr;
+}
 
 /* XmlElement */
 static UA_INLINE UA_XmlElement * UA_XmlElement_new(void) { return UA_String_new(); }