File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -88,9 +88,12 @@ class wstring;
88
88
// %typemap(typecheck) wstring = wchar_t *;
89
89
90
90
%typemap(throws) wstring
91
- %{ std::string message ($1 .begin (), $1 .end ());
92
- SWIG_JavaThrowException (jenv, SWIG_JavaRuntimeException, message.c_str ());
93
- return $null; %}
91
+ %{std::string message ($1 .size (), ' \0 ' );
92
+ for (size_t i = 0 ; i < $1 .size (); ++i) {
93
+ message[i] = (char )$1 [i];
94
+ }
95
+ SWIG_JavaThrowException (jenv, SWIG_JavaRuntimeException, message.c_str ());
96
+ return $null; %}
94
97
95
98
// const wstring &
96
99
%typemap(jni) const wstring & " jstring"
@@ -166,9 +169,12 @@ class wstring;
166
169
// %typemap(typecheck) const wstring & = wchar_t *;
167
170
168
171
%typemap(throws) const wstring &
169
- %{ std::string message ($1 .begin (), $1 .end ());
170
- SWIG_JavaThrowException (jenv, SWIG_JavaRuntimeException, message.c_str ());
171
- return $null; %}
172
+ %{std::string message ($1 .size (), ' \0 ' );
173
+ for (size_t i = 0 ; i < $1 .size (); ++i) {
174
+ message[i] = (char )$1 [i];
175
+ }
176
+ SWIG_JavaThrowException (jenv, SWIG_JavaRuntimeException, message.c_str ());
177
+ return $null; %}
172
178
173
179
}
174
180
You can’t perform that action at this time.
0 commit comments