mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 13:04:23 -04:00
fix API problems for get in some types
svn:r175
This commit is contained in:
parent
6e55da606c
commit
aaf56fb61e
@ -393,7 +393,7 @@ class EntryBytes(Entry):
|
|||||||
self._ctype = 'uint8_t'
|
self._ctype = 'uint8_t'
|
||||||
|
|
||||||
def GetDeclaration(self, funcname):
|
def GetDeclaration(self, funcname):
|
||||||
code = [ 'int %s(struct %s *, %s *);' % (
|
code = [ 'int %s(struct %s *, %s **);' % (
|
||||||
funcname, self._struct.Name(), self._ctype ) ]
|
funcname, self._struct.Name(), self._ctype ) ]
|
||||||
return code
|
return code
|
||||||
|
|
||||||
@ -410,14 +410,13 @@ class EntryBytes(Entry):
|
|||||||
def CodeGet(self):
|
def CodeGet(self):
|
||||||
name = self._name
|
name = self._name
|
||||||
code = [ 'int',
|
code = [ 'int',
|
||||||
'%s_%s_get(struct %s *msg, %s *value)' % (
|
'%s_%s_get(struct %s *msg, %s **value)' % (
|
||||||
self._struct.Name(), name,
|
self._struct.Name(), name,
|
||||||
self._struct.Name(), self._ctype),
|
self._struct.Name(), self._ctype),
|
||||||
'{',
|
'{',
|
||||||
' if (msg->%s_set != 1)' % name,
|
' if (msg->%s_set != 1)' % name,
|
||||||
' return (-1);',
|
' return (-1);',
|
||||||
' memcpy(value, msg->%s_data, %s);' % (
|
' *value = msg->%s_data;' % name,
|
||||||
name, self._length),
|
|
||||||
' return (0);',
|
' return (0);',
|
||||||
'}' ]
|
'}' ]
|
||||||
return code
|
return code
|
||||||
@ -696,6 +695,11 @@ class EntryVarBytes(Entry):
|
|||||||
|
|
||||||
self._ctype = 'uint8_t *'
|
self._ctype = 'uint8_t *'
|
||||||
|
|
||||||
|
def GetDeclaration(self, funcname):
|
||||||
|
code = [ 'int %s(struct %s *, %s *, uint32_t *);' % (
|
||||||
|
funcname, self._struct.Name(), self._ctype ) ]
|
||||||
|
return code
|
||||||
|
|
||||||
def AssignDeclaration(self, funcname):
|
def AssignDeclaration(self, funcname):
|
||||||
code = [ 'int %s(struct %s *, %s, uint32_t);' % (
|
code = [ 'int %s(struct %s *, %s, uint32_t);' % (
|
||||||
funcname, self._struct.Name(), self._ctype ) ]
|
funcname, self._struct.Name(), self._ctype ) ]
|
||||||
@ -720,6 +724,21 @@ class EntryVarBytes(Entry):
|
|||||||
'}' ]
|
'}' ]
|
||||||
return code
|
return code
|
||||||
|
|
||||||
|
def CodeGet(self):
|
||||||
|
name = self._name
|
||||||
|
code = [ 'int',
|
||||||
|
'%s_%s_get(struct %s *msg, %s *value, uint32_t *plen)' % (
|
||||||
|
self._struct.Name(), name,
|
||||||
|
self._struct.Name(), self._ctype),
|
||||||
|
'{',
|
||||||
|
' if (msg->%s_set != 1)' % name,
|
||||||
|
' return (-1);',
|
||||||
|
' *value = msg->%s_data;' % name,
|
||||||
|
' *plen = msg->%s_length;' % name,
|
||||||
|
' return (0);',
|
||||||
|
'}' ]
|
||||||
|
return code
|
||||||
|
|
||||||
def CodeUnmarshal(self, buf, tag_name, var_name):
|
def CodeUnmarshal(self, buf, tag_name, var_name):
|
||||||
code = ['if (evtag_peek_length(%s, &%s->%s_length) == -1)' % (
|
code = ['if (evtag_peek_length(%s, &%s->%s_length) == -1)' % (
|
||||||
buf, var_name, self._name),
|
buf, var_name, self._name),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user