Commit 567a7496 authored by Glenn Washburn's avatar Glenn Washburn Committed by Nikias Bassen

Allow swig typemap to recognize any std::vector<char> as a python string.

parent da9f709f
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment