summaryrefslogtreecommitdiff
path: root/source3/python/py_conv.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-02-18 05:05:15 +0000
committerTim Potter <tpot@samba.org>2003-02-18 05:05:15 +0000
commit8f9a17be892f87ab576f1824a7b6fe37abd59887 (patch)
tree0d9c7b6a363f210a562f20c195c55afab32afc37 /source3/python/py_conv.c
parentfb8d1412e1e109a1af8acc759c128df8c82bd47d (diff)
downloadsamba-8f9a17be892f87ab576f1824a7b6fe37abd59887.tar.gz
samba-8f9a17be892f87ab576f1824a7b6fe37abd59887.tar.bz2
samba-8f9a17be892f87ab576f1824a7b6fe37abd59887.zip
Cleanup of header files for python extensions.
- combine py_foo_proto.h and py_foo.h - move #include of Python.h into one place so we can get rid of that annoying compiler warning about HAVE_FSTAT being redefined (This used to be commit 0659351b251aee438bb9e92682bc445f164923a5)
Diffstat (limited to 'source3/python/py_conv.c')
-rw-r--r--source3/python/py_conv.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/source3/python/py_conv.c b/source3/python/py_conv.c
index e865daf7d9..d0a2d78aab 100644
--- a/source3/python/py_conv.c
+++ b/source3/python/py_conv.c
@@ -18,8 +18,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "includes.h"
-#include "Python.h"
#include "py_conv.h"
/* Helper for rpcstr_pull() function */
@@ -29,6 +27,11 @@ static void fstr_pull(fstring str, UNISTR *uni)
rpcstr_pull(str, uni->buffer, sizeof(fstring), -1, STR_TERMINATE);
}
+static void fstr_pull2(fstring str, UNISTR2 *uni)
+{
+ rpcstr_pull(str, uni->buffer, sizeof(fstring), -1, STR_TERMINATE);
+}
+
/* Convert a structure to a Python dict */
PyObject *from_struct(void *s, struct pyconv *conv)
@@ -52,6 +55,18 @@ PyObject *from_struct(void *s, struct pyconv *conv)
break;
}
+ case PY_UNISTR2: {
+ UNISTR2 *u = (UNISTR2 *)((char *)s + conv[i].offset);
+ fstring str = "";
+
+ if (u->buffer)
+ fstr_pull2(str, u);
+
+ item = PyString_FromString(str);
+ PyDict_SetItemString(obj, conv[i].name, item);
+
+ break;
+ }
case PY_UINT32: {
uint32 *u = (uint32 *)((char *)s + conv[i].offset);