Kaydet (Commit) 3bd267a3 authored tarafından Lionel Elie Mamane's avatar Lionel Elie Mamane

better fix for build with 32bit SQLWCHAR

Change-Id: I8aa94ee7509994866593ff96404b0d8244701f15
üst 1b5479c6
...@@ -25,9 +25,6 @@ ...@@ -25,9 +25,6 @@
#include "diagnose_ex.h" #include "diagnose_ex.h"
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <string.h> #include <string.h>
...@@ -402,6 +399,25 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection, ...@@ -402,6 +399,25 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection,
return aData; return aData;
} }
namespace
{
template < typename C > inline void append(OUStringBuffer s, C* d, sal_Int32 n);
template <> inline void append(OUStringBuffer s, wchar_t* d, sal_Int32 n)
{
assert(sizeof(wchar_t) == 4);
for (sal_Int32 i = 0; i < n; ++i)
{
s.appendUtf32(d[i]);
}
}
template <> inline void append(OUStringBuffer s, sal_Unicode* d, sal_Int32 n)
{
s.append(d, n);
}
}
OUString OTools::getStringValue(OConnection* _pConnection, OUString OTools::getStringValue(OConnection* _pConnection,
SQLHANDLE _aStatementHandle, SQLHANDLE _aStatementHandle,
sal_Int32 columnIndex, sal_Int32 columnIndex,
...@@ -460,17 +476,7 @@ OUString OTools::getStringValue(OConnection* _pConnection, ...@@ -460,17 +476,7 @@ OUString OTools::getStringValue(OConnection* _pConnection,
nReadChars = pcbValue/sizeof(SQLWCHAR); nReadChars = pcbValue/sizeof(SQLWCHAR);
} }
if (sizeof (SQLWCHAR) == 2) append(aData, waCharArray, nReadChars);
{
aData.append(reinterpret_cast< boost::mpl::if_< boost::mpl::bool_< sizeof(SQLWCHAR) == 2 >, BOOST_TYPEOF(&waCharArray[0]), sal_Unicode* >::type >(waCharArray), nReadChars);
}
else
{
for (sal_Int32 i = 0; i < nReadChars; ++i)
{
aData.appendUtf32(waCharArray[i]);
}
}
} }
break; break;
} }
......
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