소스 검색

add a cast to _new type allocation

Julius Pfrommer 10 년 전
부모
커밋
21a040fa4f
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      tools/generate_datatypes.py

+ 2 - 2
tools/generate_datatypes.py

@@ -307,7 +307,7 @@ class StructType(object):
         return layout + "}"
         return layout + "}"
 
 
     def functions_c(self, typeTableName):
     def functions_c(self, typeTableName):
-        return '''#define %s_new() UA_new(%s)
+        return '''#define %s_new() (%s*)UA_new(%s)
 #define %s_init(p) UA_init(p, %s)
 #define %s_init(p) UA_init(p, %s)
 #define %s_delete(p) UA_delete(p, %s)
 #define %s_delete(p) UA_delete(p, %s)
 #define %s_deleteMembers(p) UA_deleteMembers(p, %s)
 #define %s_deleteMembers(p) UA_deleteMembers(p, %s)
@@ -315,7 +315,7 @@ class StructType(object):
 #define %s_calcSizeBinary(p) UA_calcSizeBinary(p, %s)
 #define %s_calcSizeBinary(p) UA_calcSizeBinary(p, %s)
 #define %s_encodeBinary(src, dst, offset) UA_encodeBinary(src, %s, dst, offset)
 #define %s_encodeBinary(src, dst, offset) UA_encodeBinary(src, %s, dst, offset)
 #define %s_decodeBinary(src, offset, dst) UA_decodeBinary(src, offset, dst, %s)''' % \
 #define %s_decodeBinary(src, offset, dst) UA_decodeBinary(src, offset, dst, %s)''' % \
-    tuple(itertools.chain(*itertools.repeat([self.name, "&"+typeTableName+"[" + typeTableName + "_" + self.name[3:].upper()+"]"], 8)))
+    tuple([self.name] + list(itertools.chain(*itertools.repeat([self.name, "&"+typeTableName+"[" + typeTableName + "_" + self.name[3:].upper()+"]"], 8))))
 
 
 def parseTypeDefinitions(xmlDescription, existing_types = OrderedDict()):
 def parseTypeDefinitions(xmlDescription, existing_types = OrderedDict()):
     '''Returns an ordered dict that maps names to types. The order is such that
     '''Returns an ordered dict that maps names to types. The order is such that