diff options
Diffstat (limited to 'bindings/python/gpod.i')
| -rw-r--r-- | bindings/python/gpod.i | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bindings/python/gpod.i b/bindings/python/gpod.i index 11670b8..482e5eb 100644 --- a/bindings/python/gpod.i +++ b/bindings/python/gpod.i @@ -77,8 +77,20 @@ PyObject* sw_get_playlists(Itdb_iTunesDB *itdb) { # them utf8 encoded Strings. typedef char gchar; +%typemap(in) guint8 { + long ival; + ival = PyInt_AsLong($input); + if (( ival > 255 ) || ( ival < 0 )) { + PyErr_SetString(PyExc_ValueError, "Value must be between 0 and 255"); + SWIG_fail; + } else { + $1 = (guint8) ival; + } +} + typedef int gboolean; typedef int gint32; + typedef unsigned int guint32; #define G_BEGIN_DECLS |
