diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-10-05 06:19:56 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-10-05 16:02:52 +0200 |
commit | 1944e3ddc0b2247de3138d2a441cd6999e21fd9a (patch) | |
tree | b59f213e245e151ee792ca424fd06b5a11c88857 /connectivity | |
parent | 81d404803f477eb71b74eb9c7a67bba6b1af95d1 (diff) |
Rename and move SAL_U/W to o3tl::toU/W
Previosly (since commit 9ac98e6e3488e434bf4864ecfb13a121784f640b)
it was expected to gradually remove SAL_U/W usage in Windows code
by replacing with reinterpret_cast or changing to some bettertypes.
But as it's useful to make use of fact that LibreOffice and Windows
use compatible representation of strings, this commit puts these
functions to a better-suited o3tl, and recommends that the functions
be consistently used throughout Windows-specific code to reflect the
compatibility and keep the casts safe.
Change-Id: I2f7c65606d0e2d0c01a00f08812bb4ab7659c5f6
Reviewed-on: https://gerrit.libreoffice.org/43150
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/ado/Aolevariant.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx index 8094e96ac997..09c0b2dc723e 100644 --- a/connectivity/source/drivers/ado/Aolevariant.cxx +++ b/connectivity/source/drivers/ado/Aolevariant.cxx @@ -20,6 +20,7 @@ #include "ado/Aolevariant.hxx" #include <connectivity/dbconversion.hxx> #include <osl/diagnose.h> +#include <o3tl/char16_t2wchar_t.hxx> #include <com/sun/star/sdbc/SQLException.hpp> #include <com/sun/star/util/Time.hpp> #include <com/sun/star/util/Date.hpp> @@ -46,7 +47,7 @@ OLEString::OLEString(const BSTR& _sBStr) } OLEString::OLEString(const OUString& _sBStr) { - m_sStr = ::SysAllocString(SAL_W(_sBStr.getStr())); + m_sStr = ::SysAllocString(o3tl::toW(_sBStr.getStr())); } OLEString::~OLEString() { @@ -57,7 +58,7 @@ OLEString& OLEString::operator=(const OUString& _rSrc) { if(m_sStr) ::SysFreeString(m_sStr); - m_sStr = ::SysAllocString(SAL_W(_rSrc.getStr())); + m_sStr = ::SysAllocString(o3tl::toW(_rSrc.getStr())); return *this; } OLEString& OLEString::operator=(const OLEString& _rSrc) @@ -79,7 +80,7 @@ OLEString& OLEString::operator=(const BSTR& _rSrc) } OUString OLEString::asOUString() const { - return (m_sStr != nullptr) ? OUString(SAL_U(LPCOLESTR(m_sStr)),::SysStringLen(m_sStr)) : OUString(); + return (m_sStr != nullptr) ? OUString(o3tl::toU(LPCOLESTR(m_sStr)),::SysStringLen(m_sStr)) : OUString(); } BSTR OLEString::asBSTR() const { @@ -121,7 +122,7 @@ OLEVariant::OLEVariant(const OUString& us) { ::VariantInit(this); vt = VT_BSTR; - bstrVal = SysAllocString(SAL_W(us.getStr())); + bstrVal = SysAllocString(o3tl::toW(us.getStr())); } OLEVariant::~OLEVariant() { @@ -277,7 +278,7 @@ void OLEVariant::setString(const OUString& us) HRESULT eRet = VariantClear(this); OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); vt = VT_BSTR; - bstrVal = ::SysAllocString(SAL_W(us.getStr())); + bstrVal = ::SysAllocString(o3tl::toW(us.getStr())); } void OLEVariant::setNoArg() { @@ -377,7 +378,7 @@ void OLEVariant::set(double n) OUString OLEVariant::getString() const { if (V_VT(this) == VT_BSTR) - return SAL_U(LPCOLESTR(V_BSTR(this))); + return o3tl::toU(LPCOLESTR(V_BSTR(this))); if(isNull()) return OUString(); @@ -386,7 +387,7 @@ OUString OLEVariant::getString() const varDest.ChangeType(VT_BSTR, this); - return SAL_U(LPCOLESTR(V_BSTR(&varDest))); + return o3tl::toU(LPCOLESTR(V_BSTR(&varDest))); } @@ -692,7 +693,7 @@ css::uno::Any OLEVariant::makeAny() const } case VT_BSTR: { - OUString b(SAL_U(bstrVal)); + OUString b(o3tl::toU(bstrVal)); aValue.setValue( &b, cppu::UnoType<decltype(b)>::get()); break; } |