summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Glenn Washburn2011-09-26 17:50:45 +0200
committerGravatar Nikias Bassen2011-09-26 17:50:45 +0200
commit567a749696a4a01d1eccc01e61dd2b1d76c39b5a (patch)
treebe69f6fb50ea3e7f3bec2e331840ca4bf256ea62
parentda9f709fadbcb63bc8f6b2dd4d917d920af3fe42 (diff)
downloadlibplist-567a749696a4a01d1eccc01e61dd2b1d76c39b5a.tar.gz
libplist-567a749696a4a01d1eccc01e61dd2b1d76c39b5a.tar.bz2
Allow swig typemap to recognize any std::vector<char> as a python string.
-rw-r--r--swig/plist.i8
1 files changed, 4 insertions, 4 deletions
diff --git a/swig/plist.i b/swig/plist.i
index 172a330..7755cc5 100644
--- a/swig/plist.i
+++ b/swig/plist.i
@@ -11,15 +11,15 @@
%include "stdint.i"
%typemap(out) std::vector<char> {
- $result = SWIG_FromCharPtrAndSize((const char*)&($1[0]),(int)($1.size()));
+ $result = SWIG_FromCharPtrAndSize((const char*)&($1[0]),(size_t)($1.size()));
}
-%typemap(in) (const std::vector<char>& v)
+%typemap(in) (const std::vector<char>&)
{
char* buffer = NULL;
- int length = 0;
+ size_t length = 0;
SWIG_AsCharPtrAndSize($input, &buffer, &length, NULL);
- $1 = std::vector<char>(buffer, buffer + length);
+ $1 = new std::vector<char>(buffer, buffer + length - 1);
}
#if SWIGPYTHON