fix const wstring& typemaps
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9012 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9fa4db6131
commit
d0a1364215
1 changed files with 10 additions and 9 deletions
|
|
@ -39,9 +39,9 @@ class wstring;
|
||||||
if ($1_len) {
|
if ($1_len) {
|
||||||
wchar_t *conv_buf = new wchar_t[$1_len];
|
wchar_t *conv_buf = new wchar_t[$1_len];
|
||||||
for (jsize i = 0; i < $1_len; ++i) {
|
for (jsize i = 0; i < $1_len; ++i) {
|
||||||
conv_buf[i] = $1_pstr[i];
|
conv_buf[i] = $1_pstr[i];
|
||||||
}
|
}
|
||||||
$1 = std::wstring(conv_buf, $1_len);
|
$1 = std::wstring(conv_buf, $1_len);
|
||||||
delete [] conv_buf;
|
delete [] conv_buf;
|
||||||
}
|
}
|
||||||
jenv->ReleaseStringChars($input, $1_pstr);
|
jenv->ReleaseStringChars($input, $1_pstr);
|
||||||
|
|
@ -58,9 +58,9 @@ class wstring;
|
||||||
if ($1_len) {
|
if ($1_len) {
|
||||||
wchar_t *conv_buf = new wchar_t[$1_len];
|
wchar_t *conv_buf = new wchar_t[$1_len];
|
||||||
for (jsize i = 0; i < $1_len; ++i) {
|
for (jsize i = 0; i < $1_len; ++i) {
|
||||||
conv_buf[i] = $1_pstr[i];
|
conv_buf[i] = $1_pstr[i];
|
||||||
}
|
}
|
||||||
$1 = std::wstring(conv_buf, $1_len);
|
$1 = std::wstring(conv_buf, $1_len);
|
||||||
delete [] conv_buf;
|
delete [] conv_buf;
|
||||||
}
|
}
|
||||||
jenv->ReleaseStringChars($input, $1_pstr);
|
jenv->ReleaseStringChars($input, $1_pstr);
|
||||||
|
|
@ -98,7 +98,7 @@ class wstring;
|
||||||
%typemap(javadirectorin) const wstring & "$jniinput"
|
%typemap(javadirectorin) const wstring & "$jniinput"
|
||||||
%typemap(javadirectorout) const wstring & "$javacall"
|
%typemap(javadirectorout) const wstring & "$javacall"
|
||||||
|
|
||||||
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const wstring &
|
%typemap(in) const wstring &
|
||||||
%{if(!$input) {
|
%{if(!$input) {
|
||||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null std::wstring");
|
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null std::wstring");
|
||||||
return $null;
|
return $null;
|
||||||
|
|
@ -106,17 +106,18 @@ class wstring;
|
||||||
const jchar *$1_pstr = jenv->GetStringChars($input, 0);
|
const jchar *$1_pstr = jenv->GetStringChars($input, 0);
|
||||||
if (!$1_pstr) return $null;
|
if (!$1_pstr) return $null;
|
||||||
jsize $1_len = jenv->GetStringLength($input);
|
jsize $1_len = jenv->GetStringLength($input);
|
||||||
static std::wstring $1_str;
|
std::wstring $1_str;
|
||||||
if ($1_len) {
|
if ($1_len) {
|
||||||
wchar_t *conv_buf = new wchar_t[$1_len];
|
wchar_t *conv_buf = new wchar_t[$1_len];
|
||||||
for (jsize i = 0; i < $1_len; ++i) {
|
for (jsize i = 0; i < $1_len; ++i) {
|
||||||
conv_buf[i] = $1_pstr[i];
|
conv_buf[i] = $1_pstr[i];
|
||||||
}
|
}
|
||||||
$1_str = std::wstring(conv_buf, $1_len);
|
$1_str = std::wstring(conv_buf, $1_len);
|
||||||
delete [] conv_buf;
|
delete [] conv_buf;
|
||||||
}
|
}
|
||||||
$1 = &$1_str;
|
$1 = &$1_str;
|
||||||
jenv->ReleaseStringChars($input, $1_pstr); %}
|
jenv->ReleaseStringChars($input, $1_pstr);
|
||||||
|
%}
|
||||||
|
|
||||||
%typemap(directorout) const wstring &
|
%typemap(directorout) const wstring &
|
||||||
%{if(!$input) {
|
%{if(!$input) {
|
||||||
|
|
@ -130,7 +131,7 @@ class wstring;
|
||||||
if ($1_len) {
|
if ($1_len) {
|
||||||
wchar_t *conv_buf = new wchar_t[$1_len];
|
wchar_t *conv_buf = new wchar_t[$1_len];
|
||||||
for (jsize i = 0; i < $1_len; ++i) {
|
for (jsize i = 0; i < $1_len; ++i) {
|
||||||
conv_buf[i] = $1_pstr[i];
|
conv_buf[i] = $1_pstr[i];
|
||||||
}
|
}
|
||||||
$1_str = std::wstring(conv_buf, $1_len);
|
$1_str = std::wstring(conv_buf, $1_len);
|
||||||
delete [] conv_buf;
|
delete [] conv_buf;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue