mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
to_struct() now returns a boolean which is false if not all the elements of
the structure were present in the dictionary.
(This used to be commit b26d9d7939
)
This commit is contained in:
parent
67656e58f6
commit
119716f162
@ -78,7 +78,7 @@ PyObject *from_struct(void *s, struct pyconv *conv)
|
||||
|
||||
/* Convert a Python dict to a structure */
|
||||
|
||||
void to_struct(void *s, PyObject *dict, struct pyconv *conv)
|
||||
BOOL to_struct(void *s, PyObject *dict, struct pyconv *conv)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -86,6 +86,9 @@ void to_struct(void *s, PyObject *dict, struct pyconv *conv)
|
||||
PyObject *obj;
|
||||
|
||||
obj = PyDict_GetItemString(dict, conv[i].name);
|
||||
|
||||
if (!obj)
|
||||
return False;
|
||||
|
||||
switch (conv[i].type) {
|
||||
case PY_UNISTR: {
|
||||
@ -123,4 +126,6 @@ void to_struct(void *s, PyObject *dict, struct pyconv *conv)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ struct pyconv {
|
||||
};
|
||||
|
||||
PyObject *from_struct(void *s, struct pyconv *conv);
|
||||
void to_struct(void *s, PyObject *dict, struct pyconv *conv);
|
||||
BOOL to_struct(void *s, PyObject *dict, struct pyconv *conv);
|
||||
|
||||
/* Another version of offsetof (-: */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user