summaryrefslogtreecommitdiff
path: root/matlab/src
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2017-10-02 17:11:05 -0700
committerMark Spruiell <mes@zeroc.com>2017-10-02 17:11:05 -0700
commitb939c8baf5fe33ef9eced1c3de7acb64b8c7e7b5 (patch)
treef64f39b19a5b84426f6c3f638e7fc98467aaa612 /matlab/src
parentAdding facets test (diff)
downloadice-b939c8baf5fe33ef9eced1c3de7acb64b8c7e7b5.tar.bz2
ice-b939c8baf5fe33ef9eced1c3de7acb64b8c7e7b5.tar.xz
ice-b939c8baf5fe33ef9eced1c3de7acb64b8c7e7b5.zip
Adding inheritance test
Diffstat (limited to 'matlab/src')
-rw-r--r--matlab/src/IceMatlab/Util.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/matlab/src/IceMatlab/Util.cpp b/matlab/src/IceMatlab/Util.cpp
index 854f8594acb..6259061d7e7 100644
--- a/matlab/src/IceMatlab/Util.cpp
+++ b/matlab/src/IceMatlab/Util.cpp
@@ -58,27 +58,34 @@ getMajorMinor(mxArray* p, Ice::Byte& major, Ice::Byte& minor)
mxArray*
IceMatlab::createStringFromUTF8(const string& s)
{
+ if(s.empty())
+ {
+ return mxCreateString("");
+ }
+ else
+ {
#ifdef _MSC_VER
- //
- // Workaround for Visual Studio bug that causes a link error when using char16_t.
- //
- wstring utf16 = wstring_convert<codecvt_utf8_utf16<wchar_t>, wchar_t>{}.from_bytes(s.data());
+ //
+ // Workaround for Visual Studio bug that causes a link error when using char16_t.
+ //
+ wstring utf16 = wstring_convert<codecvt_utf8_utf16<wchar_t>, wchar_t>{}.from_bytes(s.data());
#else
- u16string utf16 = wstring_convert<codecvt_utf8_utf16<char16_t>, char16_t>{}.from_bytes(s.data());
+ u16string utf16 = wstring_convert<codecvt_utf8_utf16<char16_t>, char16_t>{}.from_bytes(s.data());
#endif
- mwSize dims[2] = { 1, static_cast<mwSize>(utf16.size()) };
- auto r = mxCreateCharArray(2, dims);
- auto buf = mxGetChars(r);
- int i = 0;
+ mwSize dims[2] = { 1, static_cast<mwSize>(utf16.size()) };
+ auto r = mxCreateCharArray(2, dims);
+ auto buf = mxGetChars(r);
+ int i = 0;
#ifdef _MSC_VER
- for(wchar_t c : utf16)
+ for(wchar_t c : utf16)
#else
- for(char16_t c : utf16)
+ for(char16_t c : utf16)
#endif
- {
- buf[i++] = static_cast<mxChar>(c);
+ {
+ buf[i++] = static_cast<mxChar>(c);
+ }
+ return r;
}
- return r;
}
string