[Libreoffice-commits] core.git: basic/qa basic/source cli_ure/source compilerplugins/clang configmgr/source dbaccess/source desktop/source embeddedobj/source embedserv/source extensions/source fpicker/source helpcompiler/inc include/comphelper include/oox include/rtl include/sal pyuno/source sal/osl sal/qa sd/source sfx2/source svl/source vcl/opengl vcl/source vcl/win winaccessibility/source xmlsecurity/source

Stephan Bergmann sbergman at redhat.com
Tue Apr 4 16:12:35 UTC 2017


 basic/qa/cppunit/test_vba.cxx                                         |    8 -
 basic/source/runtime/methods.cxx                                      |    2 
 basic/source/sbx/sbxdec.cxx                                           |    4 
 cli_ure/source/climaker/climaker_app.cxx                              |    2 
 cli_ure/source/climaker/climaker_share.h                              |    4 
 cli_ure/source/native/native_share.h                                  |    4 
 cli_ure/source/uno_bridge/cli_data.cxx                                |    6 
 compilerplugins/clang/unicodetochar.cxx                               |    3 
 configmgr/source/winreg.cxx                                           |   10 -
 dbaccess/source/ui/dlg/adodatalinks.cxx                               |    2 
 desktop/source/app/crashreport.cxx                                    |    2 
 embeddedobj/source/msole/olecomponent.cxx                             |    2 
 embedserv/source/embed/ed_ioleobject.cxx                              |    6 
 embedserv/source/embed/ed_ipersiststr.cxx                             |    6 
 extensions/source/config/ldap/ldapaccess.cxx                          |   12 -
 extensions/source/ole/unoconversionutilities.hxx                      |    2 
 fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx               |    2 
 fpicker/source/win32/filepicker/helppopupwindow.cxx                   |    2 
 helpcompiler/inc/HelpCompiler.hxx                                     |    2 
 include/comphelper/windowserrorstring.hxx                             |    2 
 include/oox/helper/helper.hxx                                         |    2 
 include/rtl/ustrbuf.hxx                                               |    3 
 include/sal/types.h                                                   |   24 ++-
 pyuno/source/module/pyuno_util.cxx                                    |    4 
 sal/osl/w32/file.cxx                                                  |   12 -
 sal/osl/w32/file_dirvol.cxx                                           |   62 ++++-----
 sal/osl/w32/file_url.cxx                                              |   32 ++---
 sal/osl/w32/module.cxx                                                |    2 
 sal/osl/w32/nlsupport.cxx                                             |    8 -
 sal/osl/w32/pipe.cxx                                                  |   10 -
 sal/osl/w32/procimpl.cxx                                              |   12 -
 sal/osl/w32/security.cxx                                              |   64 +++++-----
 sal/osl/w32/socket.cxx                                                |   10 -
 sal/qa/osl/security/osl_Security.cxx                                  |    2 
 sal/qa/rtl/oustringbuffer/test_oustringbuffer_assign.cxx              |    3 
 sal/qa/rtl/strings/test_oustring_stringliterals.cxx                   |    3 
 sd/source/ui/remotecontrol/DiscoveryService.cxx                       |    2 
 sfx2/source/appl/shutdowniconw32.cxx                                  |    2 
 svl/source/svdde/ddestrg.cxx                                          |    4 
 vcl/opengl/win/WinDeviceInfo.cxx                                      |   32 ++---
 vcl/source/gdi/pdfwriter_impl.cxx                                     |    2 
 vcl/win/app/salinst.cxx                                               |    4 
 vcl/win/gdi/salfont.cxx                                               |    4 
 vcl/win/gdi/salprn.cxx                                                |    8 -
 vcl/win/window/salframe.cxx                                           |    8 -
 vcl/win/window/salmenu.cxx                                            |    6 
 winaccessibility/source/UAccCOM/AccActionBase.cxx                     |    4 
 winaccessibility/source/UAccCOM/AccEditableText.cxx                   |   60 ++++-----
 winaccessibility/source/UAccCOM/AccImage.cxx                          |    2 
 winaccessibility/source/UAccCOM/AccTable.cxx                          |    4 
 winaccessibility/source/UAccCOM/AccTextBase.cxx                       |   10 -
 winaccessibility/source/UAccCOM/MAccessible.cxx                       |   18 +-
 winaccessibility/source/service/AccObject.cxx                         |   24 +--
 xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx        |    6 
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |    4 
 55 files changed, 271 insertions(+), 269 deletions(-)

New commits:
commit 9ac98e6e3488e434bf4864ecfb13a121784f640b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Apr 4 14:57:45 2017 +0200

    Finally switch MSVC to sal_Unicode = char16_t, too
    
    There is lots of (Windows-only) code that relied on sal_Unicode being the same
    as wchar_t, and the best change may be different in each case (and doing the
    changes may be somewhat error prone).  So for now add SAL_U/SAL_W scaffolding
    functions to sal/types.h, remove their uses one by one again, and finally drop
    those functions again.
    
    Change-Id: I2cc791bd941d089901abb5f6fc2f05fbc49e65ea
    Reviewed-on: https://gerrit.libreoffice.org/36077
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx
index 8e5a5ecc4f8d..5df8c0eb76f5 100644
--- a/basic/qa/cppunit/test_vba.cxx
+++ b/basic/qa/cppunit/test_vba.cxx
@@ -135,13 +135,13 @@ void VBATest::testMiscOLEStuff()
 
     const int nBufSize = 1024 * 4;
     sal_Unicode sBuf[nBufSize];
-    SQLGetInstalledDriversW( sBuf, nBufSize, nullptr );
+    SQLGetInstalledDriversW( SAL_W(sBuf), nBufSize, nullptr );
 
     const sal_Unicode *pODBCDriverName = sBuf;
     bool bFound = false;
-    for (; wcslen( pODBCDriverName ) != 0; pODBCDriverName += wcslen( pODBCDriverName ) + 1 ) {
-        if( wcscmp( pODBCDriverName, L"Microsoft Excel Driver (*.xls)" ) == 0 ||
-            wcscmp( pODBCDriverName, L"Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)" ) == 0 ) {
+    for (; wcslen( SAL_W(pODBCDriverName) ) != 0; pODBCDriverName += wcslen( SAL_W(pODBCDriverName) ) + 1 ) {
+        if( wcscmp( SAL_W(pODBCDriverName), L"Microsoft Excel Driver (*.xls)" ) == 0 ||
+            wcscmp( SAL_W(pODBCDriverName), L"Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)" ) == 0 ) {
             bFound = true;
             break;
         }
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 304e6c76b482..6344bdebaf6b 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -416,7 +416,7 @@ RTLFUNC(CurDir)
     wchar_t pBuffer[ _MAX_PATH ];
     if ( _wgetdcwd( nCurDir, pBuffer, _MAX_PATH ) != nullptr )
     {
-        rPar.Get(0)->PutString( OUString( pBuffer ) );
+        rPar.Get(0)->PutString( OUString( SAL_U(pBuffer) ) );
     }
     else
     {
diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index 59008e796923..a7421647bd1b 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -226,11 +226,11 @@ bool SbxDecimal::setString( OUString* pOUString )
                 pBuffer[i] = ',';
             i++;
         }
-        hResult = VarDecFromStr( pBuffer.get(), nLANGID, 0, &maDec );
+        hResult = VarDecFromStr( SAL_W(pBuffer.get()), nLANGID, 0, &maDec );
     }
     else
     {
-        hResult = VarDecFromStr( pOUString->getStr(), nLANGID, 0, &maDec );
+        hResult = VarDecFromStr( SAL_W(pOUString->getStr()), nLANGID, 0, &maDec );
     }
     bRet = ( hResult == S_OK );
     return bRet;
diff --git a/cli_ure/source/climaker/climaker_app.cxx b/cli_ure/source/climaker/climaker_app.cxx
index 23cca54d9557..550b99a9d696 100644
--- a/cli_ure/source/climaker/climaker_app.cxx
+++ b/cli_ure/source/climaker/climaker_app.cxx
@@ -471,7 +471,7 @@ SAL_IMPLEMENT_MAIN()
         // setup assembly info: xxx todo set more? e.g. avoid strong versioning
         AssemblyName ^ assembly_name = gcnew AssemblyName();
         assembly_name->CodeBase = output_dir;
-        assembly_name->Name = gcnew ::System::String(name.getStr());
+        assembly_name->Name = gcnew ::System::String(SAL_W(name.getStr()));
         if (kp != nullptr)
             assembly_name->KeyPair= kp;
 
diff --git a/cli_ure/source/climaker/climaker_share.h b/cli_ure/source/climaker/climaker_share.h
index 5aeeabe05504..ee36c6831d19 100644
--- a/cli_ure/source/climaker/climaker_share.h
+++ b/cli_ure/source/climaker/climaker_share.h
@@ -82,7 +82,7 @@ ref struct Constants
 
 inline ::System::String ^ ustring_to_String( OUString const & ustr )
 {
-    return gcnew ::System::String( ustr.getStr(), 0, ustr.getLength() );
+    return gcnew ::System::String( SAL_W(ustr.getStr()), 0, ustr.getLength() );
 }
 
 
@@ -90,7 +90,7 @@ inline OUString String_to_ustring( ::System::String ^ str )
 {
     OSL_ASSERT( sizeof (wchar_t) == sizeof (sal_Unicode) );
     pin_ptr<const wchar_t> chars = PtrToStringChars( str );
-    return OUString( chars, str->Length );
+    return OUString( SAL_U(chars), str->Length );
 }
 
 /* If the argument type is a typedef for an interface then the interface
diff --git a/cli_ure/source/native/native_share.h b/cli_ure/source/native/native_share.h
index 1be1b3a082b3..5ef576862196 100644
--- a/cli_ure/source/native/native_share.h
+++ b/cli_ure/source/native/native_share.h
@@ -35,14 +35,14 @@ namespace util
 
 inline ::System::String ^ ustring_to_String( OUString const & ustr )
 {
-    return gcnew ::System::String( ustr.getStr(), 0, ustr.getLength() );
+    return gcnew ::System::String( SAL_W(ustr.getStr()), 0, ustr.getLength() );
 }
 
 inline OUString String_to_ustring( ::System::String ^ str )
 {
     OSL_ASSERT( sizeof (wchar_t) == sizeof (sal_Unicode) );
     pin_ptr<wchar_t const> chars = PtrToStringChars( str );
-    return OUString( chars, str->Length );
+    return OUString( SAL_U(chars), str->Length );
 }
 
 template< typename T >
diff --git a/cli_ure/source/uno_bridge/cli_data.cxx b/cli_ure/source/uno_bridge/cli_data.cxx
index c325fc762bb0..24b3753ef61d 100644
--- a/cli_ure/source/uno_bridge/cli_data.cxx
+++ b/cli_ure/source/uno_bridge/cli_data.cxx
@@ -718,7 +718,7 @@ OUString mapCliString(System::String ^ data)
     {
         OSL_ASSERT(sizeof(wchar_t) == sizeof(sal_Unicode));
         pin_ptr<wchar_t const> pdata= PtrToStringChars(data);
-        return OUString(pdata, const_cast<System::String^>(data)->Length);
+        return OUString(SAL_U(pdata), const_cast<System::String^>(data)->Length);
     }
     else
     {
@@ -819,7 +819,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
                 System::String ^s= safe_cast<System::String^>(cli_data);
                 pin_ptr<const wchar_t> pdata= PtrToStringChars(s);
                 rtl_uString_newFromStr_WithLength( (rtl_uString**) uno_data,
-                                                  pdata, s->Length );
+                                                  SAL_U(pdata), s->Length );
             }
             break;
         }
@@ -1294,7 +1294,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
                             rtl_uString** pStr=  & ((rtl_uString**) &
                                                     ((uno_Sequence*) seq.get())->elements)[i];
                             *pStr= NULL;
-                            rtl_uString_newFromStr_WithLength( pStr, pdata,
+                            rtl_uString_newFromStr_WithLength( pStr, SAL_U(pdata),
                                                                arStr[i]->Length);
                         }
                         break;
diff --git a/compilerplugins/clang/unicodetochar.cxx b/compilerplugins/clang/unicodetochar.cxx
index cfcb5b5d7549..92660a118722 100644
--- a/compilerplugins/clang/unicodetochar.cxx
+++ b/compilerplugins/clang/unicodetochar.cxx
@@ -15,9 +15,6 @@
 // In C++, find implicit conversions from char16_t (aka sal_Unicode) to char.
 // Such places are probably meant to properly work on char16_t instead.
 
-// (This does not work for clang-cl/MSVC yet, where sal_Unicode is still a
-// typedef for wchar_t, but that is intended to be changed eventually.)
-
 namespace {
 
 class Visitor final:
diff --git a/configmgr/source/winreg.cxx b/configmgr/source/winreg.cxx
index 00b6656d4047..c48a85e70e26 100644
--- a/configmgr/source/winreg.cxx
+++ b/configmgr/source/winreg.cxx
@@ -85,7 +85,7 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
 {
     HKEY hCurKey;
 
-    if(RegOpenKeyExW(hKey, aKeyName.getStr(), 0, KEY_READ, &hCurKey) == ERROR_SUCCESS)
+    if(RegOpenKeyExW(hKey, SAL_W(aKeyName.getStr()), 0, KEY_READ, &hCurKey) == ERROR_SUCCESS)
     {
         DWORD nSubKeys = 0;
         DWORD nValues = 0;
@@ -106,9 +106,9 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
 
                 //Make up full key name
                 if(aKeyName.isEmpty())
-                    aSubkeyName = aKeyName + OUString(buffKeyName);
+                    aSubkeyName = aKeyName + OUString(SAL_U(buffKeyName));
                 else
-                    aSubkeyName = aKeyName + "\\" + OUString(buffKeyName);
+                    aSubkeyName = aKeyName + "\\" + OUString(SAL_U(buffKeyName));
 
                 //Recursion, until no more subkeys are found
                 dumpWindowsRegistryKey(hKey, aSubkeyName, aFileHandle);
@@ -137,9 +137,9 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
                 const wchar_t wsType[] = L"Type";
 
                 if(!wcscmp(pValueName.get(), wsValue))
-                    aValue = OUString(pValue.get());
+                    aValue = OUString(SAL_U(pValue.get()));
                 if (!wcscmp(pValueName.get(), wsType))
-                    aType = OUString(pValue.get());
+                    aType = OUString(SAL_U(pValue.get()));
                 if(!wcscmp(pValueName.get(), wsFinal) && *reinterpret_cast<DWORD*>(pValue.get()) == 1)
                     bFinal = true;
             }
diff --git a/dbaccess/source/ui/dlg/adodatalinks.cxx b/dbaccess/source/ui/dlg/adodatalinks.cxx
index 0c926f2be990..1039923a2478 100644
--- a/dbaccess/source/ui/dlg/adodatalinks.cxx
+++ b/dbaccess/source/ui/dlg/adodatalinks.cxx
@@ -45,7 +45,7 @@ OUString getAdoDatalink(long hWnd,OUString& oldLink)
     OUString dataLink;
     if (!oldLink.isEmpty())
     {
-        dataLink=PromptEdit(hWnd,oldLink.getStr());
+        dataLink=SAL_U(PromptEdit(hWnd,SAL_W(oldLink.getStr())));
     }
     else
         dataLink=reinterpret_cast<sal_Unicode *>(PromptNew(hWnd));
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index 2d104e0acc8e..678f433906a9 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -122,7 +122,7 @@ void CrashReporter::updateMinidumpLocation()
     mpExceptionHandler->set_minidump_descriptor(descriptor);
 #elif defined WNT
     OUString aURL = getCrashDirectory();
-    mpExceptionHandler->set_dump_path(aURL.getStr());
+    mpExceptionHandler->set_dump_path(SAL_W(aURL.getStr()));
 #endif
 }
 
diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx
index acfc61802d7d..0e2f837a0ad9 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -922,7 +922,7 @@ void OleComponent::InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent )
             hr = pOleLink->GetSourceDisplayName( &pOleStr );
             if ( SUCCEEDED( hr ) && pOleStr )
             {
-                OUString aFilePath( pOleStr );
+                OUString aFilePath( SAL_U(pOleStr) );
                 if ( pMalloc )
                     pMalloc->Free( pOleStr );
 
diff --git a/embedserv/source/embed/ed_ioleobject.cxx b/embedserv/source/embed/ed_ioleobject.cxx
index 54afccc3adb4..965337547ecd 100644
--- a/embedserv/source/embed/ed_ioleobject.cxx
+++ b/embedserv/source/embed/ed_ioleobject.cxx
@@ -47,10 +47,10 @@ STDMETHODIMP EmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, LPCOLES
     {
         m_pDocHolder->setTitle(
             OUString(
-                szContainerObj));
+                SAL_U(szContainerObj)));
         m_pDocHolder->setContainerName(
             OUString(
-                szContainerApp));
+                SAL_U(szContainerApp)));
     }
 
     return S_OK;
@@ -424,7 +424,7 @@ HRESULT EmbedDocument_Impl::SaveObject()
 
         // in case of links the containers does not provide client site sometimes
         hr = Save( static_cast<LPCOLESTR>(nullptr), FALSE ); // triggers saving to the link location
-        SaveCompleted( aPreservFileName.getStr() );
+        SaveCompleted( SAL_W(aPreservFileName.getStr()) );
     }
 
     notify( false );
diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx
index 86a2d93f6a8d..528df24b3bb5 100644
--- a/embedserv/source/embed/ed_ipersiststr.cxx
+++ b/embedserv/source/embed/ed_ipersiststr.cxx
@@ -425,7 +425,7 @@ STDMETHODIMP EmbedDocument_Impl::InitNew( IStorage *pStg )
                     CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" );
                     hr = WriteFmtUserTypeStg( pStg,
                                             cf,                         // ???
-                                            const_cast<sal_Unicode *>(aCurType.getStr()) );
+                                            SAL_W(const_cast<sal_Unicode *>(aCurType.getStr())) );
 
                     if ( hr == S_OK )
                     {
@@ -753,7 +753,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
     CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" );
     hr = WriteFmtUserTypeStg( m_pMasterStorage,
                             cf,                         // ???
-                            const_cast<sal_Unicode *>(aCurType.getStr()) );
+                            SAL_W(const_cast<sal_Unicode *>(aCurType.getStr())) );
     if ( FAILED( hr ) ) return E_FAIL;
 
     hr = m_pMasterStorage->SetClass( m_guid );
@@ -804,7 +804,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
             cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" );
             hr = WriteFmtUserTypeStg( m_pMasterStorage,
                                     cf,                         // ???
-                                    const_cast<sal_Unicode *>(aCurType.getStr()) );
+                                    SAL_W(const_cast<sal_Unicode *>(aCurType.getStr())) );
 
             if ( SUCCEEDED( hr ) )
             {
diff --git a/extensions/source/config/ldap/ldapaccess.cxx b/extensions/source/config/ldap/ldapaccess.cxx
index 87d686e39082..522c095026ab 100644
--- a/extensions/source/config/ldap/ldapaccess.cxx
+++ b/extensions/source/config/ldap/ldapaccess.cxx
@@ -132,8 +132,8 @@ void  LdapConnection::connectSimple()
         // Do the bind
 #ifdef _WIN32
         LdapErrCode retCode = ldap_simple_bind_sW(mConnection,
-                                               const_cast<sal_Unicode *>(mLdapDefinition.mAnonUser.getStr()),
-                                               const_cast<sal_Unicode *>(mLdapDefinition.mAnonCredentials.getStr()) );
+                                               SAL_W(const_cast<sal_Unicode *>(mLdapDefinition.mAnonUser.getStr())),
+                                               SAL_W(const_cast<sal_Unicode *>(mLdapDefinition.mAnonCredentials.getStr())) );
 #else
         LdapErrCode retCode = ldap_simple_bind_s(mConnection,
                                                OUStringToOString( mLdapDefinition.mAnonUser, RTL_TEXTENCODING_UTF8 ).getStr(),
@@ -154,7 +154,7 @@ void LdapConnection::initConnection()
     if (mLdapDefinition.mPort == 0) mLdapDefinition.mPort = LDAP_PORT;
 
 #ifdef _WIN32
-    mConnection = ldap_initW(const_cast<sal_Unicode *>(mLdapDefinition.mServer.getStr()),
+    mConnection = ldap_initW(SAL_W(const_cast<sal_Unicode *>(mLdapDefinition.mServer.getStr())),
                             mLdapDefinition.mPort) ;
 #else
     mConnection = ldap_init(OUStringToOString( mLdapDefinition.mServer, RTL_TEXTENCODING_UTF8 ).getStr(),
@@ -179,7 +179,7 @@ void LdapConnection::initConnection()
     LdapMessageHolder result;
 #ifdef _WIN32
     LdapErrCode retCode = ldap_search_sW(mConnection,
-                                      const_cast<sal_Unicode *>(aUserDn.getStr()),
+                                      SAL_W(const_cast<sal_Unicode *>(aUserDn.getStr())),
                                       LDAP_SCOPE_BASE,
                                       const_cast<PWCHAR>( L"(objectclass=*)" ),
                                       nullptr,
@@ -246,9 +246,9 @@ void LdapConnection::initConnection()
 #ifdef _WIN32
     PWCHAR attributes [2] = { const_cast<PWCHAR>( L"1.1" ), nullptr };
     LdapErrCode retCode = ldap_search_sW(mConnection,
-                                      const_cast<sal_Unicode *>(mLdapDefinition.mBaseDN.getStr()),
+                                      SAL_W(const_cast<sal_Unicode *>(mLdapDefinition.mBaseDN.getStr())),
                                       LDAP_SCOPE_SUBTREE,
-                                      const_cast<sal_Unicode *>(filter.makeStringAndClear().getStr()), attributes, 0, &result.msg) ;
+                                      SAL_W(const_cast<sal_Unicode *>(filter.makeStringAndClear().getStr())), attributes, 0, &result.msg) ;
 #else
     sal_Char * attributes [2] = { const_cast<sal_Char *>(LDAP_NO_ATTRS), nullptr };
     LdapErrCode retCode = ldap_search_s(mConnection,
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index c2151381d2fb..0249e5222124 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -1993,7 +1993,7 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva
         for( sal_Int32 i= 0; i< length; i++)
         {
             OUString ousIndex=OUString::number( i);
-            OLECHAR* sindex = const_cast<sal_Unicode *>(ousIndex.getStr());
+            OLECHAR* sindex = SAL_W(const_cast<sal_Unicode *>(ousIndex.getStr()));
 
             if( FAILED( hr= pdispEx->GetIDsOfNames(IID_NULL, &sindex , 1, LOCALE_USER_DEFAULT, &dispid)))
             {
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index 994326d4c14d..9e4fda73ddf7 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -62,7 +62,7 @@ bool createFolderItem(OUString const & url, ComPtr<IShellItem> & folder) {
         return false;
     }
     HRESULT res = SHCreateItemFromParsingName(
-        path.getStr(), nullptr, IID_PPV_ARGS(&folder));
+        SAL_W(path.getStr()), nullptr, IID_PPV_ARGS(&folder));
     return SUCCEEDED(res);
 }
 
diff --git a/fpicker/source/win32/filepicker/helppopupwindow.cxx b/fpicker/source/win32/filepicker/helppopupwindow.cxx
index 78395ed745bb..068a7f8ed39e 100644
--- a/fpicker/source/win32/filepicker/helppopupwindow.cxx
+++ b/fpicker/source/win32/filepicker/helppopupwindow.cxx
@@ -335,7 +335,7 @@ void SAL_CALL CHelpPopupWindow::onPaint( HWND hWnd, HDC hdc )
 
     DrawTextW(
         hdc,
-        m_HelpText.getStr( ),
+        SAL_W(m_HelpText.getStr( )),
         m_HelpText.getLength( ),
         &rect,
         nFormat );
diff --git a/helpcompiler/inc/HelpCompiler.hxx b/helpcompiler/inc/HelpCompiler.hxx
index b275e31939aa..56163f5bb5ce 100644
--- a/helpcompiler/inc/HelpCompiler.hxx
+++ b/helpcompiler/inc/HelpCompiler.hxx
@@ -92,7 +92,7 @@ namespace fs
         {
             OUString ustrSystemPath;
             osl::File::getSystemPathFromFileURL(data, ustrSystemPath);
-            return ustrSystemPath.getStr();
+            return SAL_W(ustrSystemPath.getStr());
         }
 #endif
         std::string toUTF8() const
diff --git a/include/comphelper/windowserrorstring.hxx b/include/comphelper/windowserrorstring.hxx
index f4c67aa39aec..34614fbfe93b 100644
--- a/include/comphelper/windowserrorstring.hxx
+++ b/include/comphelper/windowserrorstring.hxx
@@ -35,7 +35,7 @@ inline OUString WindowsErrorString(DWORD nErrorCode)
     if (pMsgBuf[wcslen(pMsgBuf)-1] == '\r')
         pMsgBuf[wcslen(pMsgBuf)-1] = '\0';
 
-    OUString result(pMsgBuf);
+    OUString result(SAL_U(pMsgBuf));
 
     LocalFree(pMsgBuf);
 
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index afbbef5322bd..0729a27aaf64 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -208,9 +208,7 @@ public:
 #ifdef OSL_BIGENDIAN
     static void  convertLittleEndian( sal_Int8& ) {}     // present for usage in templates
     static void  convertLittleEndian( sal_uInt8& ) {}    // present for usage in templates
-#if !defined SAL_W32 // cf. sal/types.h sal_Unicode
     static void  convertLittleEndian( char16_t& rnValue )   { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
-#endif
     static void  convertLittleEndian( sal_Int16& rnValue )  { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
     static void  convertLittleEndian( sal_uInt16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
     static void  convertLittleEndian( sal_Int32& rnValue )  { swap4( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
index 680572666ed8..04ba896b9b48 100644
--- a/include/rtl/ustrbuf.hxx
+++ b/include/rtl/ustrbuf.hxx
@@ -779,8 +779,7 @@ public:
         return append( &c, 1 );
     }
 
-#if defined LIBO_INTERNAL_ONLY && (!defined SAL_W32 || defined __clang__)
-        // cf. sal/types.h sal_Unicode
+#if defined LIBO_INTERNAL_ONLY
     void append(sal_uInt16) = delete;
 #endif
 
diff --git a/include/sal/types.h b/include/sal/types.h
index 8a22dd823312..30939f130281 100644
--- a/include/sal/types.h
+++ b/include/sal/types.h
@@ -132,16 +132,15 @@ typedef signed char sal_sChar;
 */
 typedef unsigned char sal_uChar;
 
-#if defined(SAL_W32)
-    typedef wchar_t sal_Unicode;
-#else
-    #define SAL_UNICODE_NOTEQUAL_WCHAR_T
 #if defined LIBO_INTERNAL_ONLY && defined __cplusplus
+    #define SAL_UNICODE_NOTEQUAL_WCHAR_T
     typedef char16_t sal_Unicode;
+#elif defined(SAL_W32)
+    typedef wchar_t sal_Unicode;
 #else
+    #define SAL_UNICODE_NOTEQUAL_WCHAR_T
     typedef sal_uInt16 sal_Unicode;
 #endif
-#endif
 
 typedef void *                   sal_Handle;
 
@@ -673,6 +672,21 @@ template< typename T1, typename T2 > inline T1 static_int_cast(T2 n) {
 
 /// @endcond
 
+#if defined LIBO_INTERNAL_ONLY && defined __cplusplus && defined SAL_W32
+/// @cond INTERNAL
+// Temporary scaffolding for the MSVC sal_Unicode wchar_t -> char16_t change; to
+// be removed again:
+inline wchar_t * SAL_W(char16_t * p)
+{ return reinterpret_cast<wchar_t *>(p); }
+inline wchar_t const * SAL_W(char16_t const * p)
+{ return reinterpret_cast<wchar_t const *>(p); }
+inline char16_t * SAL_U(wchar_t * p)
+{ return reinterpret_cast<char16_t *>(p); }
+inline char16_t const * SAL_U(wchar_t const * p)
+{ return reinterpret_cast<char16_t const *>(p); }
+/// @endcond
+#endif
+
 #endif // INCLUDED_SAL_TYPES_H
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx
index ecb383222458..30e636ffe2a2 100644
--- a/pyuno/source/module/pyuno_util.cxx
+++ b/pyuno/source/module/pyuno_util.cxx
@@ -48,7 +48,7 @@ PyRef ustring2PyUnicode( const OUString & str )
     // Hack to avoid that error
     ret = PyRef( PyUnicode_FromUnicode( (const unsigned short *)str.getStr(), str.getLength() ), SAL_NO_ACQUIRE );
 #else
-    ret = PyRef( PyUnicode_FromUnicode( str.getStr(), str.getLength() ), SAL_NO_ACQUIRE );
+    ret = PyRef( PyUnicode_FromUnicode( SAL_W(str.getStr()), str.getLength() ), SAL_NO_ACQUIRE );
 #endif
 #else
     OString sUtf8(OUStringToOString(str, RTL_TEXTENCODING_UTF8));
@@ -76,7 +76,7 @@ OUString pyString2ustring( PyObject *pystr )
     // Hack to avoid that error
     ret = OUString( (sal_Unicode *)PyUnicode_AS_UNICODE( pystr ) );
 #else
-    ret = OUString( PyUnicode_AS_UNICODE( pystr ) );
+    ret = OUString( SAL_U(PyUnicode_AS_UNICODE( pystr )) );
 #endif
 #else
 #if PY_MAJOR_VERSION >= 3
diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx
index dd052f985a7b..d7ef5623cd4e 100644
--- a/sal/osl/w32/file.cxx
+++ b/sal/osl/w32/file.cxx
@@ -735,7 +735,7 @@ SAL_CALL osl_openFile(
         dwCreation |= OPEN_EXISTING;
 
     HANDLE hFile = CreateFileW(
-        rtl_uString_getStr( strSysPath ),
+        SAL_W(rtl_uString_getStr( strSysPath )),
         dwAccess, dwShare, nullptr, dwCreation, dwAttributes, nullptr );
 
     // @@@ ERROR HANDLING @@@
@@ -1107,7 +1107,7 @@ oslFileError SAL_CALL osl_removeFile( rtl_uString* strPath )
 
     if ( osl_File_E_None == error )
     {
-        if ( DeleteFile( rtl_uString_getStr( strSysPath ) ) )
+        if ( DeleteFile( SAL_W(rtl_uString_getStr( strSysPath )) ) )
             error = osl_File_E_None;
         else
             error = oslTranslateFileError( GetLastError() );
@@ -1127,8 +1127,8 @@ oslFileError SAL_CALL osl_copyFile( rtl_uString* strPath, rtl_uString *strDestPa
 
     if ( osl_File_E_None == error )
     {
-        LPCWSTR src = rtl_uString_getStr( strSysPath );
-        LPCWSTR dst = rtl_uString_getStr( strSysDestPath );
+        LPCWSTR src = SAL_W(rtl_uString_getStr( strSysPath ));
+        LPCWSTR dst = SAL_W(rtl_uString_getStr( strSysDestPath ));
 
         if ( CopyFileW( src, dst, FALSE ) )
             error = osl_File_E_None;
@@ -1154,8 +1154,8 @@ oslFileError SAL_CALL osl_moveFile( rtl_uString* strPath, rtl_uString *strDestPa
 
     if ( osl_File_E_None == error )
     {
-        LPCWSTR src = rtl_uString_getStr( strSysPath );
-        LPCWSTR dst = rtl_uString_getStr( strSysDestPath );
+        LPCWSTR src = SAL_W(rtl_uString_getStr( strSysPath ));
+        LPCWSTR dst = SAL_W(rtl_uString_getStr( strSysDestPath ));
 
         if ( MoveFileEx( src, dst, MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH | MOVEFILE_REPLACE_EXISTING ) )
             error = osl_File_E_None;
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 4351ba0bf522..43bed440eb6d 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -128,7 +128,7 @@ namespace /* private */
     };
 
     inline bool is_UNC_path(const sal_Unicode* path)
-    { return (0 == wcsncmp(UNC_PREFIX, path, SAL_N_ELEMENTS(UNC_PREFIX) - 1)); }
+    { return (0 == wcsncmp(UNC_PREFIX, SAL_W(path), SAL_N_ELEMENTS(UNC_PREFIX) - 1)); }
 
     void parse_UNC_path(const sal_Unicode* path, UNCComponents* puncc)
     {
@@ -357,7 +357,7 @@ static HANDLE WINAPI OpenDirectory( rtl_uString* pPath)
 
             WCHAR* szFileMask = static_cast< WCHAR* >( rtl_allocateMemory( sizeof( WCHAR ) * ( nLen + nSuffLen + 1 ) ) );
 
-            _tcscpy( szFileMask, rtl_uString_getStr( pPath ) );
+            _tcscpy( szFileMask, SAL_W(rtl_uString_getStr( pPath )) );
             _tcscat( szFileMask, pSuffix );
 
             pDirectory = static_cast<LPDIRECTORY>(HeapAlloc(GetProcessHeap(), 0, sizeof(DIRECTORY)));
@@ -563,7 +563,7 @@ static oslFileError SAL_CALL osl_openNetworkServer(
 
     ZeroMemory( &aNetResource, sizeof(aNetResource) );
 
-    aNetResource.lpRemoteName = strSysDirPath->buffer;
+    aNetResource.lpRemoteName = SAL_W(strSysDirPath->buffer);
 
     dwError = WNetOpenEnumW(
         RESOURCE_GLOBALNET,
@@ -594,7 +594,7 @@ static DWORD create_dir_with_callback(
     // user specified callback function. On success
     // the function returns ERROR_SUCCESS else a Win32 error code.
 
-    BOOL bCreated = CreateDirectoryW( rtl_uString_getStr( dir_path ), nullptr );
+    BOOL bCreated = CreateDirectoryW( SAL_W(rtl_uString_getStr( dir_path )), nullptr );
 
     if ( bCreated )
     {
@@ -694,7 +694,7 @@ oslFileError osl_createDirectoryWithFlags(rtl_uString * strPath, sal_uInt32)
 
     if ( osl_File_E_None == error )
     {
-        BOOL bCreated = CreateDirectoryW( rtl_uString_getStr( strSysPath ), nullptr );
+        BOOL bCreated = CreateDirectoryW( SAL_W(rtl_uString_getStr( strSysPath )), nullptr );
 
         if ( !bCreated )
         {
@@ -729,7 +729,7 @@ oslFileError SAL_CALL osl_removeDirectory(rtl_uString* strPath)
 
     if ( osl_File_E_None == error )
     {
-        if ( RemoveDirectory( rtl_uString_getStr( strSysPath ) ) )
+        if ( RemoveDirectory( SAL_W(rtl_uString_getStr( strSysPath ) )) )
             error = osl_File_E_None;
         else
             error = oslTranslateFileError( GetLastError() );
@@ -882,7 +882,7 @@ static oslFileError SAL_CALL osl_getNextFileItem(
         pItemImpl->nRefCount = 1;
 
         rtl_uString* pTmpFileName = nullptr;
-        rtl_uString_newFromStr( &pTmpFileName,  pItemImpl->FindData.cFileName );
+        rtl_uString_newFromStr( &pTmpFileName, SAL_U(pItemImpl->FindData.cFileName) );
         rtl_uString_newConcat( &pItemImpl->m_pFullPath, pDirImpl->m_pDirectoryPath, pTmpFileName );
         rtl_uString_release( pTmpFileName );
 
@@ -1053,7 +1053,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
 
                 osl_acquireDirectoryItem( static_cast<oslDirectoryItem>(pItemImpl) );
 
-                _tcscpy( pItemImpl->cDriveString, strSysFilePath->buffer );
+                _tcscpy( pItemImpl->cDriveString, SAL_W(strSysFilePath->buffer) );
                 pItemImpl->cDriveString[0] = rtl::toAsciiUpperCase( pItemImpl->cDriveString[0] );
 
                 if ( pItemImpl->cDriveString[_tcslen(pItemImpl->cDriveString) - 1] != '\\' )
@@ -1073,7 +1073,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
             if ( strSysFilePath->length > 0 && strSysFilePath->buffer[strSysFilePath->length - 1] == '\\' )
                 rtl_uString_newFromStr_WithLength( &strSysFilePath, strSysFilePath->buffer, strSysFilePath->length - 1 );
 
-            hFind = FindFirstFile( rtl_uString_getStr(strSysFilePath), &aFindData );
+            hFind = FindFirstFile( SAL_W(rtl_uString_getStr(strSysFilePath)), &aFindData );
 
             if ( hFind != INVALID_HANDLE_VALUE )
             {
@@ -1173,7 +1173,7 @@ bool is_floppy_volume_mount_point(const rtl::OUString& path)
     osl::systemPathEnsureSeparator(p);
 
     WCHAR vn[51];
-    if (GetVolumeNameForVolumeMountPoint(p.getStr(), vn, SAL_N_ELEMENTS(vn)))
+    if (GetVolumeNameForVolumeMountPoint(SAL_W(p.getStr()), vn, SAL_N_ELEMENTS(vn)))
     {
         WCHAR vnfloppy[51];
         if (is_floppy_A_present() &&
@@ -1212,13 +1212,13 @@ static bool is_volume_mount_point(const rtl::OUString& path)
 
     if (!is_floppy_drive(p))
     {
-        DWORD fattr = GetFileAttributes(p.getStr());
+        DWORD fattr = GetFileAttributes(SAL_W(p.getStr()));
 
         if ((INVALID_FILE_ATTRIBUTES != fattr) &&
             (FILE_ATTRIBUTE_REPARSE_POINT & fattr))
         {
             WIN32_FIND_DATA find_data;
-            HANDLE h_find = FindFirstFile(p.getStr(), &find_data);
+            HANDLE h_find = FindFirstFile(SAL_W(p.getStr()), &find_data);
 
             if (IsValidHandle(h_find) &&
                 (FILE_ATTRIBUTE_REPARSE_POINT & find_data.dwFileAttributes) &&
@@ -1242,7 +1242,7 @@ static UINT get_volume_mount_point_drive_type(const rtl::OUString& path)
     osl::systemPathEnsureSeparator(p);
 
     WCHAR vn[51];
-    if (GetVolumeNameForVolumeMountPoint(p.getStr(), vn, SAL_N_ELEMENTS(vn)))
+    if (GetVolumeNameForVolumeMountPoint(SAL_W(p.getStr()), vn, SAL_N_ELEMENTS(vn)))
         return GetDriveType(vn);
 
     return DRIVE_NO_ROOT_DIR;
@@ -1262,7 +1262,7 @@ static oslFileError osl_get_drive_type(
     if (is_volume_mount_point(path))
         drive_type = get_volume_mount_point_drive_type(path);
     else
-        drive_type = GetDriveType(path.getStr());
+        drive_type = GetDriveType(SAL_W(path.getStr()));
 
     if (DRIVE_NO_ROOT_DIR == drive_type)
         return oslTranslateFileError(ERROR_INVALID_DRIVE);
@@ -1311,7 +1311,7 @@ static void get_volume_space_information(
     const rtl::OUString& path, oslVolumeInfo *pInfo)
 {
     BOOL ret = GetDiskFreeSpaceEx(
-        path.getStr(),
+        SAL_W(path.getStr()),
         reinterpret_cast<PULARGE_INTEGER>(&pInfo->uFreeSpace),
         reinterpret_cast<PULARGE_INTEGER>(&pInfo->uTotalSpace),
         nullptr);
@@ -1358,7 +1358,7 @@ static oslFileError get_filesystem_attributes(
         DWORD mcl;
         DWORD flags;
 
-        LPCWSTR pszPath = path.getStr();
+        LPCWSTR pszPath = SAL_W(path.getStr());
         if (GetVolumeInformation(pszPath, vn, MAX_PATH+1, &serial, &mcl, &flags, fsn, MAX_PATH+1))
         {
             // Currently sal does not use this value, instead MAX_PATH is used
@@ -1370,7 +1370,7 @@ static oslFileError get_filesystem_attributes(
             pInfo->uMaxPathLength  = MAX_PATH;
 
             pInfo->uValidFields   |= osl_VolumeInfo_Mask_FileSystemName;
-            rtl_uString_newFromStr(&pInfo->ustrFileSystemName, fsn);
+            rtl_uString_newFromStr(&pInfo->ustrFileSystemName, SAL_U(fsn));
 
             // volumes (even NTFS) will always be considered case
             // insensitive because the Win32 API is not able to
@@ -1474,9 +1474,9 @@ static oslFileError SAL_CALL osl_getDriveInfo(
                 LPCWSTR lpLastBkSlash = wcschr( &lpFirstBkSlash[1], '\\' );
 
                 if ( lpLastBkSlash )
-                    rtl_uString_newFromStr_WithLength( &pStatus->ustrFileName, &lpFirstBkSlash[1], lpLastBkSlash - lpFirstBkSlash - 1 );
+                    rtl_uString_newFromStr_WithLength( &pStatus->ustrFileName, SAL_U(&lpFirstBkSlash[1]), lpLastBkSlash - lpFirstBkSlash - 1 );
                 else
-                    rtl_uString_newFromStr( &pStatus->ustrFileName, &lpFirstBkSlash[1] );
+                    rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(&lpFirstBkSlash[1]) );
                 pStatus->uValidFields |= osl_FileStatus_Mask_FileName;
             }
         }
@@ -1494,10 +1494,10 @@ static oslFileError SAL_CALL osl_getDriveInfo(
                     WCHAR szFileName[dwBufsizeConst + 16];
 
                     swprintf( szFileName, L"%s [%s]", cDrive, szBuffer );
-                    rtl_uString_newFromStr( &pStatus->ustrFileName, szFileName );
+                    rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(szFileName) );
                 }
                 else
-                    rtl_uString_newFromStr( &pStatus->ustrFileName, cDrive );
+                    rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(cDrive) );
             }
             pStatus->uValidFields |= osl_FileStatus_Mask_FileName;
             break;
@@ -1511,17 +1511,17 @@ static oslFileError SAL_CALL osl_getDriveInfo(
                     WCHAR   szFileName[dwBufsizeConst + 16];
 
                     swprintf( szFileName, L"%s [%s]", cDrive, szVolumeNameBuffer );
-                    rtl_uString_newFromStr( &pStatus->ustrFileName, szFileName );
+                    rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(szFileName) );
                 }
                 else
-                    rtl_uString_newFromStr( &pStatus->ustrFileName, cDrive );
+                    rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(cDrive) );
             }
             pStatus->uValidFields |= osl_FileStatus_Mask_FileName;
             break;
             case DRIVE_CDROM:
             case DRIVE_REMOVABLE:
                 pStatus->uValidFields |= osl_FileStatus_Mask_FileName;
-                rtl_uString_newFromStr( &pStatus->ustrFileName, cRoot );
+                rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(cRoot) );
                 break;
             case DRIVE_UNKNOWN:
             default:
@@ -1536,7 +1536,7 @@ static oslFileError SAL_CALL osl_getDriveInfo(
     {
         rtl_uString *ustrSystemPath = nullptr;
 
-        rtl_uString_newFromStr( &ustrSystemPath, pItemImpl->cDriveString );
+        rtl_uString_newFromStr( &ustrSystemPath, SAL_U(pItemImpl->cDriveString) );
         oslFileError error = osl_getFileURLFromSystemPath( ustrSystemPath, &pStatus->ustrFileURL );
         rtl_uString_release( ustrSystemPath );
         if (error != osl_File_E_None)
@@ -1597,7 +1597,7 @@ oslFileError SAL_CALL osl_getFileStatus(
 
     if ( uFieldMask & osl_FileStatus_Mask_Validate )
     {
-        HANDLE  hFind = FindFirstFile( rtl_uString_getStr( pItemImpl->m_pFullPath ), &pItemImpl->FindData );
+        HANDLE  hFind = FindFirstFile( SAL_W(rtl_uString_getStr( pItemImpl->m_pFullPath )), &pItemImpl->FindData );
 
         if ( hFind != INVALID_HANDLE_VALUE )
             FindClose( hFind );
@@ -1636,7 +1636,7 @@ oslFileError SAL_CALL osl_getFileStatus(
 
     /* Most of the fields are already set, regardless of requiered fields */
 
-    rtl_uString_newFromStr( &pStatus->ustrFileName, pItemImpl->FindData.cFileName );
+    rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(pItemImpl->FindData.cFileName) );
     pStatus->uValidFields |= osl_FileStatus_Mask_FileName;
 
     if ((FILE_ATTRIBUTE_REPARSE_POINT & pItemImpl->FindData.dwFileAttributes) &&
@@ -1669,7 +1669,7 @@ oslFileError SAL_CALL osl_getFileStatus(
         if ( !pItemImpl->bFullPathNormalized )
         {
             ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
-            sal_uInt32 nNewLen = GetCaseCorrectPathName( rtl_uString_getStr( pItemImpl->m_pFullPath ),
+            sal_uInt32 nNewLen = GetCaseCorrectPathName( SAL_W(rtl_uString_getStr( pItemImpl->m_pFullPath )),
                                                       ::osl::mingw_reinterpret_cast<LPWSTR>( aBuffer ),
                                                       aBuffer.getBufSizeInSymbols(),
                                                       true );
@@ -1707,7 +1707,7 @@ oslFileError SAL_CALL osl_setFileAttributes(
     if ( osl_File_E_None != error )
         return error;
 
-    dwFileAttributes = GetFileAttributes( rtl_uString_getStr(ustrSysPath) );
+    dwFileAttributes = GetFileAttributes( SAL_W(rtl_uString_getStr(ustrSysPath)) );
 
     if ( (DWORD)-1 != dwFileAttributes )
     {
@@ -1719,7 +1719,7 @@ oslFileError SAL_CALL osl_setFileAttributes(
         if ( uAttributes & osl_File_Attribute_Hidden )
             dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
 
-        fSuccess = SetFileAttributes( rtl_uString_getStr(ustrSysPath), dwFileAttributes );
+        fSuccess = SetFileAttributes( SAL_W(rtl_uString_getStr(ustrSysPath)), dwFileAttributes );
     }
     else
         fSuccess = FALSE;
@@ -1754,7 +1754,7 @@ oslFileError SAL_CALL osl_setFileTime(
     if (error==osl_File_E_INVAL)
         return error;
 
-    hFile=CreateFileW(rtl_uString_getStr(sysPath), GENERIC_WRITE, 0, nullptr , OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
+    hFile=CreateFileW(SAL_W(rtl_uString_getStr(sysPath)), GENERIC_WRITE, 0, nullptr , OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
     rtl_uString_release(sysPath);
 
     if (hFile==INVALID_HANDLE_VALUE)
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index c1b84cbf5a02..2cfa469b3c66 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -156,7 +156,7 @@ static BOOL IsValidFilePathComponent(
 
 DWORD IsValidFilePath(rtl_uString *path, LPCWSTR *lppError, DWORD dwFlags, rtl_uString **corrected)
 {
-        LPCWSTR lpszPath = path->buffer;
+        LPCWSTR lpszPath = SAL_W(path->buffer);
         LPCWSTR lpComponent = lpszPath;
         BOOL    fValid = TRUE;
         DWORD   dwPathType = PATHTYPE_ERROR;
@@ -170,13 +170,13 @@ DWORD IsValidFilePath(rtl_uString *path, LPCWSTR *lppError, DWORD dwFlags, rtl_u
 
         DWORD   dwCandidatPathType = PATHTYPE_ERROR;
 
-        if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, WSTR_LONG_PATH_PREFIX_UNC, SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX_UNC) - 1, SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX_UNC) - 1 ) )
+        if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, SAL_U(WSTR_LONG_PATH_PREFIX_UNC), SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX_UNC) - 1, SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX_UNC) - 1 ) )
         {
             /* This is long path in UNC notation */
             lpComponent = lpszPath + SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX_UNC) - 1;
             dwCandidatPathType = PATHTYPE_ABSOLUTE_UNC | PATHTYPE_IS_LONGPATH;
         }
-        else if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, WSTR_LONG_PATH_PREFIX, SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX) - 1, SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX) - 1 ) )
+        else if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, SAL_U(WSTR_LONG_PATH_PREFIX), SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX) - 1, SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX) - 1 ) )
         {
             /* This is long path */
             lpComponent = lpszPath + SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX) - 1;
@@ -281,7 +281,7 @@ DWORD IsValidFilePath(rtl_uString *path, LPCWSTR *lppError, DWORD dwFlags, rtl_u
                 sal_Int32 i = lpComponent - lpszPath;
                 rtl_uString_newReplaceStrAt(corrected, path, i, 1, nullptr);
                     //TODO: handle out-of-memory
-                lpszPath = (*corrected)->buffer;
+                lpszPath = SAL_W((*corrected)->buffer);
                 lpComponent = lpszPath + i;
             }
 
@@ -672,7 +672,7 @@ oslFileError osl_getSystemPathFromFileURL_( rtl_uString *strURL, rtl_uString **p
 
             /* Indicates local root */
             if ( nDecodedLen == nSkip )
-                rtl_uString_newFromStr_WithLength( &strTempPath, WSTR_SYSTEM_ROOT_PATH, SAL_N_ELEMENTS(WSTR_SYSTEM_ROOT_PATH) - 1 );
+                rtl_uString_newFromStr_WithLength( &strTempPath, SAL_U(WSTR_SYSTEM_ROOT_PATH), SAL_N_ELEMENTS(WSTR_SYSTEM_ROOT_PATH) - 1 );
             else
             {
                 /* do not separate the directory and file case, so the maximal path length without prefix is MAX_PATH-12 */
@@ -683,14 +683,14 @@ oslFileError osl_getSystemPathFromFileURL_( rtl_uString *strURL, rtl_uString **p
                 else
                 {
                     ::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH );
-                    sal_uInt32 nNewLen = GetCaseCorrectPathName( pDecodedURL + nSkip,
+                    sal_uInt32 nNewLen = GetCaseCorrectPathName( SAL_W(pDecodedURL) + nSkip,
                                                                  ::osl::mingw_reinterpret_cast<LPWSTR>(aBuf),
                                                                  aBuf.getBufSizeInSymbols(),
                                                                  false );
 
                     if ( nNewLen <= MAX_PATH - 12
-                      || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, WSTR_SYSTEM_ROOT_PATH, SAL_N_ELEMENTS(WSTR_SYSTEM_ROOT_PATH) - 1, SAL_N_ELEMENTS(WSTR_SYSTEM_ROOT_PATH) - 1 )
-                      || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, WSTR_LONG_PATH_PREFIX, SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX) - 1, SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX) - 1 ) )
+                      || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, SAL_U(WSTR_SYSTEM_ROOT_PATH), SAL_N_ELEMENTS(WSTR_SYSTEM_ROOT_PATH) - 1, SAL_N_ELEMENTS(WSTR_SYSTEM_ROOT_PATH) - 1 )
+                      || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, SAL_U(WSTR_LONG_PATH_PREFIX), SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX) - 1, SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX) - 1 ) )
                     {
                         rtl_uString_newFromStr_WithLength( &strTempPath, aBuf, nNewLen );
                     }
@@ -699,7 +699,7 @@ oslFileError osl_getSystemPathFromFileURL_( rtl_uString *strURL, rtl_uString **p
                         /* it should be an UNC path, use the according prefix */
                         rtl_uString *strSuffix = nullptr;
                         rtl_uString *strPrefix = nullptr;
-                        rtl_uString_newFromStr_WithLength( &strPrefix, WSTR_LONG_PATH_PREFIX_UNC, SAL_N_ELEMENTS( WSTR_LONG_PATH_PREFIX_UNC ) - 1 );
+                        rtl_uString_newFromStr_WithLength( &strPrefix, SAL_U(WSTR_LONG_PATH_PREFIX_UNC), SAL_N_ELEMENTS( WSTR_LONG_PATH_PREFIX_UNC ) - 1 );
                         rtl_uString_newFromStr_WithLength( &strSuffix, aBuf + 2, nNewLen - 2 );
 
                         rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix );
@@ -711,7 +711,7 @@ oslFileError osl_getSystemPathFromFileURL_( rtl_uString *strURL, rtl_uString **p
                     {
                         rtl_uString *strSuffix = nullptr;
                         rtl_uString *strPrefix = nullptr;
-                        rtl_uString_newFromStr_WithLength( &strPrefix, WSTR_LONG_PATH_PREFIX, SAL_N_ELEMENTS( WSTR_LONG_PATH_PREFIX ) - 1 );
+                        rtl_uString_newFromStr_WithLength( &strPrefix, SAL_U(WSTR_LONG_PATH_PREFIX), SAL_N_ELEMENTS( WSTR_LONG_PATH_PREFIX ) - 1 );
                         rtl_uString_newFromStr_WithLength( &strSuffix, aBuf, nNewLen );
 
                         rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix );
@@ -903,8 +903,8 @@ oslFileError SAL_CALL osl_searchFileURL(
         do
         {
             /* If search path is empty use a nullptr pointer instead according to MSDN documentation of SearchPath */
-            LPCWSTR lpszSearchPath = ustrSystemSearchPath && ustrSystemSearchPath->length ? ustrSystemSearchPath->buffer : nullptr;
-            LPCWSTR lpszSearchFile = ustrSysPath->buffer;
+            LPCWSTR lpszSearchPath = ustrSystemSearchPath && ustrSystemSearchPath->length ? SAL_W(ustrSystemSearchPath->buffer) : nullptr;
+            LPCWSTR lpszSearchFile = SAL_W(ustrSysPath->buffer);
 
             /* Allocate space for buffer according to previous returned count of required chars */
             /* +1 is not necessary if we follow MSDN documentation but for robustness we do so */
@@ -921,7 +921,7 @@ oslFileError SAL_CALL osl_searchFileURL(
 
         if ( dwResult )
         {
-            rtl_uString_newFromStr( &ustrSysPath, lpBuffer );
+            rtl_uString_newFromStr( &ustrSysPath, SAL_U(lpBuffer) );
             error = osl_getFileURLFromSystemPath( ustrSysPath, pustrPath );
         }
         else
@@ -932,7 +932,7 @@ oslFileError SAL_CALL osl_searchFileURL(
             /* something went wrong, perhaps the path was absolute */
             error = oslTranslateFileError( GetLastError() );
 
-            hFind = FindFirstFile( ustrSysPath->buffer, &aFindFileData );
+            hFind = FindFirstFile( SAL_W(ustrSysPath->buffer), &aFindFileData );
 
             if ( IsValidHandle(hFind) )
             {
@@ -991,10 +991,10 @@ oslFileError SAL_CALL osl_getAbsoluteFileURL( rtl_uString* ustrBaseURL, rtl_uStr
             osl_acquireMutex( g_CurrentDirectoryMutex );
 
             GetCurrentDirectoryW( aCurrentDir.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aCurrentDir) );
-            SetCurrentDirectoryW( ustrBaseSysPath->buffer );
+            SetCurrentDirectoryW( SAL_W(ustrBaseSysPath->buffer) );
         }
 
-        dwResult = GetFullPathNameW( ustrRelSysPath->buffer, aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), &lpFilePart );
+        dwResult = GetFullPathNameW( SAL_W(ustrRelSysPath->buffer), aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), &lpFilePart );
 
         if ( ustrBaseSysPath )
         {
diff --git a/sal/osl/w32/module.cxx b/sal/osl/w32/module.cxx
index be193cb64f22..1c78a6fad33c 100644
--- a/sal/osl/w32/module.cxx
+++ b/sal/osl/w32/module.cxx
@@ -47,7 +47,7 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 /*nRtldM
     oslModule ret = nullptr;
     oslFileError    nError;
 
-    SAL_INFO( "sal.osl", "osl_loadModule: " << OUString(strModuleName->buffer, wcslen(strModuleName->buffer)) );
+    SAL_INFO( "sal.osl", "osl_loadModule: " << OUString(strModuleName->buffer, wcslen(SAL_W(strModuleName->buffer))) );
     OSL_ASSERT(strModuleName);
 
     nError = osl_getSystemPathFromFileURL(strModuleName, &Module);
diff --git a/sal/osl/w32/nlsupport.cxx b/sal/osl/w32/nlsupport.cxx
index 8656d55a7571..d1cd73800963 100644
--- a/sal/osl/w32/nlsupport.cxx
+++ b/sal/osl/w32/nlsupport.cxx
@@ -189,10 +189,10 @@ rtl_TextEncoding SAL_CALL osl_getTextEncodingFromLocale( rtl_Locale * pLocale )
     /* copy in parameters to structure */
     if( pLocale && pLocale->Language && pLocale->Language->length < ELP_LANGUAGE_FIELD_LENGTH )
     {
-        wcscpy( params.Language, pLocale->Language->buffer );
+        wcscpy( params.Language, SAL_W(pLocale->Language->buffer) );
 
         if( pLocale->Country && pLocale->Country->length < ELP_COUNTRY_FIELD_LENGTH )
-            wcscpy( params.Country, pLocale->Country->buffer );
+            wcscpy( params.Country, SAL_W(pLocale->Country->buffer) );
 
         /* save pointer to local structure in TLS */
         TlsSetValue( g_dwTLSLocaleEncId, &params );
@@ -226,11 +226,11 @@ void imp_getProcessLocale( rtl_Locale ** ppLocale )
     if( GetLocaleInfo( localeId, LOCALE_SISO639LANGNAME , langCode, ELP_LANGUAGE_FIELD_LENGTH )  &&
         GetLocaleInfo( localeId, LOCALE_SISO3166CTRYNAME , ctryCode, ELP_COUNTRY_FIELD_LENGTH ) )
     {
-        *ppLocale = rtl_locale_register( langCode, ctryCode, L"" );
+        *ppLocale = rtl_locale_register( SAL_U(langCode), SAL_U(ctryCode), u"" );
     }
     else
     {
-        *ppLocale = rtl_locale_register( L"C", L"", L"" );
+        *ppLocale = rtl_locale_register( u"C", u"", u"" );
     }
 }
 
diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx
index 532e931e4f21..73e26a9c76ed 100644
--- a/sal/osl/w32/pipe.cxx
+++ b/sal/osl/w32/pipe.cxx
@@ -173,7 +173,7 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options
     {
         SetLastError( ERROR_SUCCESS );
 
-        pPipe->m_NamedObject = CreateMutexW( nullptr, FALSE, name->buffer );
+        pPipe->m_NamedObject = CreateMutexW( nullptr, FALSE, SAL_W(name->buffer) );
 
         if ( pPipe->m_NamedObject != INVALID_HANDLE_VALUE && pPipe->m_NamedObject != nullptr )
         {
@@ -184,7 +184,7 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options
 
                 /* try to open system pipe */
                 pPipe->m_File = CreateNamedPipeW(
-                    path->buffer,
+                    SAL_W(path->buffer),
                     PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
                     PIPE_WAIT | PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE,
                     PIPE_UNLIMITED_INSTANCES,
@@ -214,13 +214,13 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options
         do
         {
             /* free instance should be available first */
-            fPipeAvailable = WaitNamedPipeW(path->buffer, NMPWAIT_WAIT_FOREVER);
+            fPipeAvailable = WaitNamedPipeW(SAL_W(path->buffer), NMPWAIT_WAIT_FOREVER);
 
             /* first try to open system pipe */
             if ( fPipeAvailable )
             {
                 pPipe->m_File = CreateFileW(
-                    path->buffer,
+                    SAL_W(path->buffer),
                     GENERIC_READ|GENERIC_WRITE,
                     FILE_SHARE_READ | FILE_SHARE_WRITE,
                     nullptr,
@@ -353,7 +353,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
 
     // prepare for next accept
     pPipe->m_File =
-        CreateNamedPipeW(path->buffer,
+        CreateNamedPipeW(SAL_W(path->buffer),
             PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
             PIPE_WAIT | PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE,
             PIPE_UNLIMITED_INSTANCES,
diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx
index 965db4a1360d..23c08a197040 100644
--- a/sal/osl/w32/procimpl.cxx
+++ b/sal/osl/w32/procimpl.cxx
@@ -124,7 +124,7 @@ namespace /* private */
 
         while (size_t l = _tcslen(p))
         {
-            environment->push_back(p);
+            environment->push_back(SAL_U(p));
             p += l + 1;
         }
         FreeEnvironmentStrings(env);
@@ -291,7 +291,7 @@ namespace /* private */
             std::vector<sal_Unicode> vec(path.getLength() + 1);
             //GetShortPathNameW only works if the file can be found!
             const DWORD len = GetShortPathNameW(
-                path.getStr(), &vec[0], path.getLength() + 1);
+                SAL_W(path.getStr()), SAL_W(&vec[0]), path.getLength() + 1);
 
             if (!len && GetLastError() == ERROR_FILE_NOT_FOUND
                 && extension.getLength())
@@ -300,7 +300,7 @@ namespace /* private */
                 std::vector<sal_Unicode> vec2(
                     extPath.getLength() + 1);
                 const DWORD len2 = GetShortPathNameW(
-                    extPath.getStr(), &vec2[0], extPath.getLength() + 1);
+                    SAL_W(extPath.getStr()), SAL_W(&vec2[0]), extPath.getLength() + 1);
                 ret = rtl::OUString(&vec2[0], len2);
             }
             else
@@ -479,7 +479,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
     if (ustrDirectory && ustrDirectory->length && (osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(ustrDirectory, cwd)))
            return osl_Process_E_InvalidError;
 
-    LPCWSTR p_cwd = (cwd.getLength()) ? cwd.getStr() : nullptr;
+    LPCWSTR p_cwd = (cwd.getLength()) ? SAL_W(cwd.getStr()) : nullptr;
 
     if ((Options & osl_Process_DETACHED) && !(flags & CREATE_NEW_CONSOLE))
         flags |= DETACHED_PROCESS;
@@ -544,14 +544,14 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
     {
         bRet = CreateProcessAsUser(
             static_cast<oslSecurityImpl*>(Security)->m_hToken,
-            nullptr, const_cast<LPWSTR>(cmdline.getStr()), nullptr,  nullptr,
+            nullptr, const_cast<LPWSTR>(SAL_W(cmdline.getStr())), nullptr,  nullptr,
             b_inherit_handles, flags, p_environment, p_cwd,
             &startup_info, &process_info);
     }
     else
     {
         bRet = CreateProcess(
-            nullptr, const_cast<LPWSTR>(cmdline.getStr()), nullptr,  nullptr,
+            nullptr, const_cast<LPWSTR>(SAL_W(cmdline.getStr())), nullptr,  nullptr,
             b_inherit_handles, flags, p_environment, p_cwd,
             &startup_info, &process_info);
     }
diff --git a/sal/osl/w32/security.cxx b/sal/osl/w32/security.cxx
index 797feb7371dd..591e6b6b42c9 100644
--- a/sal/osl/w32/security.cxx
+++ b/sal/osl/w32/security.cxx
@@ -98,11 +98,11 @@ oslSecurityError SAL_CALL osl_loginUser( rtl_uString *strUserName, rtl_uString *
     oslSecurityError ret;
 
     sal_Unicode*    strUser;
-    sal_Unicode*    strDomain = _wcsdup(rtl_uString_getStr(strUserName));
+    sal_Unicode*    strDomain = SAL_U(_wcsdup(SAL_W(rtl_uString_getStr(strUserName))));
     HANDLE  hUserToken;
     LUID luid;
 
-    if (nullptr != (strUser = wcschr(strDomain, L'/')))
+    if (nullptr != (strUser = SAL_U(wcschr(SAL_W(strDomain), L'/'))))
         *strUser++ = L'\0';
     else
     {
@@ -114,7 +114,7 @@ oslSecurityError SAL_CALL osl_loginUser( rtl_uString *strUserName, rtl_uString *
     OSL_ASSERT(LookupPrivilegeValue(nullptr, SE_TCB_NAME, &luid));
     (void) luid;
 
-    if (LogonUserW(strUser, strDomain ? strDomain : L"", rtl_uString_getStr(strPasswd),
+    if (LogonUserW(SAL_W(strUser), strDomain ? SAL_W(strDomain) : L"", SAL_W(rtl_uString_getStr(strPasswd)),
                   LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT,
                    &hUserToken))
     {
@@ -123,7 +123,7 @@ oslSecurityError SAL_CALL osl_loginUser( rtl_uString *strUserName, rtl_uString *
         pSecImpl->m_pNetResource = nullptr;
         pSecImpl->m_hToken = hUserToken;
         pSecImpl->m_hProfile = nullptr;
-        wcscpy(pSecImpl->m_User, strUser);
+        wcscpy(SAL_W(pSecImpl->m_User), SAL_W(strUser));
 
         *pSecurity = pSecImpl;
         ret = osl_Security_E_None;
@@ -153,25 +153,25 @@ oslSecurityError SAL_CALL osl_loginUserOnFileServer(rtl_uString *strUserName,
     remoteName  = static_cast<sal_Unicode *>(malloc((rtl_uString_getLength(strFileServer) + rtl_uString_getLength(strUserName) + 4) * sizeof(sal_Unicode)));
     userName    = static_cast<sal_Unicode *>(malloc((rtl_uString_getLength(strFileServer) + rtl_uString_getLength(strUserName) + 2) * sizeof(sal_Unicode)));
 
-    wcscpy(remoteName, L"\\\\");
-    wcscat(remoteName, rtl_uString_getStr(strFileServer));
-    wcscat(remoteName, L"\\");
-    wcscat(remoteName, rtl_uString_getStr(strUserName));
+    wcscpy(SAL_W(remoteName), L"\\\\");
+    wcscat(SAL_W(remoteName), SAL_W(rtl_uString_getStr(strFileServer)));
+    wcscat(SAL_W(remoteName), L"\\");
+    wcscat(SAL_W(remoteName), SAL_W(rtl_uString_getStr(strUserName)));
 
-    wcscpy(userName, rtl_uString_getStr(strFileServer));
-    wcscat(userName, L"\\");
-    wcscat(userName, rtl_uString_getStr(strUserName));
+    wcscpy(SAL_W(userName), SAL_W(rtl_uString_getStr(strFileServer)));
+    wcscat(SAL_W(userName), L"\\");
+    wcscat(SAL_W(userName), SAL_W(rtl_uString_getStr(strUserName)));
 
     netResource.dwScope         = RESOURCE_GLOBALNET;
     netResource.dwType          = RESOURCETYPE_DISK;
     netResource.dwDisplayType   = RESOURCEDISPLAYTYPE_SHARE;
     netResource.dwUsage         = RESOURCEUSAGE_CONNECTABLE;
     netResource.lpLocalName     = nullptr;
-    netResource.lpRemoteName    = remoteName;
+    netResource.lpRemoteName    = SAL_W(remoteName);
     netResource.lpComment       = nullptr;
     netResource.lpProvider      = nullptr;
 
-    err = WNetAddConnection2W(&netResource, rtl_uString_getStr(strPasswd), userName, 0);
+    err = WNetAddConnection2W(&netResource, SAL_W(rtl_uString_getStr(strPasswd)), SAL_W(userName), 0);
 
     if ((err == NO_ERROR) || (err == ERROR_ALREADY_ASSIGNED))
     {
@@ -182,7 +182,7 @@ oslSecurityError SAL_CALL osl_loginUserOnFileServer(rtl_uString *strUserName,
 
         pSecImpl->m_hToken = nullptr;
         pSecImpl->m_hProfile = nullptr;
-        wcscpy(pSecImpl->m_User, rtl_uString_getStr(strUserName));
+        wcscpy(SAL_W(pSecImpl->m_User), SAL_W(rtl_uString_getStr(strUserName)));
 
         *pSecurity = pSecImpl;
 
@@ -402,9 +402,9 @@ sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent)
             }
             Ident=static_cast<sal_Unicode *>(malloc(needed*sizeof(sal_Unicode)));
 
-            if (WNetGetUserW(nullptr, Ident, &needed) != NO_ERROR)
+            if (WNetGetUserW(nullptr, SAL_W(Ident), &needed) != NO_ERROR)
             {
-                wcscpy(Ident, L"unknown");
+                wcscpy(SAL_W(Ident), L"unknown");
                 Ident[7] = L'\0';
             }
 
@@ -440,7 +440,7 @@ sal_Bool SAL_CALL osl_getHomeDir(oslSecurity Security, rtl_uString **pustrDirect
 
         if (pSecImpl->m_pNetResource != nullptr)
         {
-            rtl_uString_newFromStr( &ustrSysDir, pSecImpl->m_pNetResource->lpRemoteName);
+            rtl_uString_newFromStr( &ustrSysDir, SAL_U(pSecImpl->m_pNetResource->lpRemoteName));
 
             bSuccess = osl_File_E_None == osl_getFileURLFromSystemPath( ustrSysDir, pustrDirectory );
         }
@@ -469,7 +469,7 @@ sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString **pustrDire
         {
             rtl_uString *ustrSysDir = nullptr;
 
-            rtl_uString_newFromStr( &ustrSysDir, pSecImpl->m_pNetResource->lpRemoteName);
+            rtl_uString_newFromStr( &ustrSysDir, SAL_U(pSecImpl->m_pNetResource->lpRemoteName));
             bSuccess = osl_File_E_None == osl_getFileURLFromSystemPath( ustrSysDir, pustrDirectory);
 
             if ( ustrSysDir )
@@ -489,7 +489,7 @@ sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString **pustrDire
 
                 if ( !GetSpecialFolder( &ustrFile, CSIDL_APPDATA) )
                 {
-                    OSL_VERIFY(GetWindowsDirectoryW(sFile, _MAX_DIR) > 0);
+                    OSL_VERIFY(GetWindowsDirectoryW(SAL_W(sFile), _MAX_DIR) > 0);
 
                     rtl_uString_newFromStr( &ustrFile, sFile);
                 }
@@ -555,7 +555,7 @@ sal_Bool SAL_CALL osl_loadUserProfile(oslSecurity Security)
 
                 ZeroMemory( &pi, sizeof(pi) );
                   pi.dwSize = sizeof(pi);
-                pi.lpUserName = rtl_uString_getStr(buffer);
+                pi.lpUserName = SAL_W(rtl_uString_getStr(buffer));
                 pi.dwFlags = PI_NOUI;
 
                 if (fLoadUserProfile(hAccessToken, &pi))
@@ -657,7 +657,7 @@ static bool GetSpecialFolder(rtl_uString **strPath, int nFolder)
         }
         else if (pSHGetSpecialFolderPathW)
         {
-            if (pSHGetSpecialFolderPathW(GetActiveWindow(), PathW, nFolder, TRUE))
+            if (pSHGetSpecialFolderPathW(GetActiveWindow(), SAL_W(PathW), nFolder, TRUE))
             {
                 rtl_uString_newFromStr( strPath, PathW);
                 bRet = true;
@@ -720,11 +720,11 @@ static bool GetSpecialFolder(rtl_uString **strPath, int nFolder)
 
                 if (SUCCEEDED(hr))
                 {
-                    if (pSHGetPathFromIDListW && pSHGetPathFromIDListW(pidl, PathW))
+                    if (pSHGetPathFromIDListW && pSHGetPathFromIDListW(pidl, SAL_W(PathW)))
                        {
                         /* if directory does not exist, create it */
-                        if (_waccess(PathW, 0) < 0)
-                            CreateDirectoryW(PathW, nullptr);
+                        if (_waccess(SAL_W(PathW), 0) < 0)
+                            CreateDirectoryW(SAL_W(PathW), nullptr);
 
                         rtl_uString_newFromStr( strPath, PathW);
                         bRet = true;
@@ -833,18 +833,18 @@ static bool SAL_CALL getUserNameImpl(oslSecurity Security, rtl_uString **strName
                 SID_NAME_USE sUse;
 
                 if (LookupAccountSidW(nullptr, reinterpret_cast<PTOKEN_USER>(pInfoBuffer)->User.Sid,
-                                        UserName, &nUserName,
-                                        DomainName, &nDomainName, &sUse))
+                                        SAL_W(UserName), &nUserName,
+                                        SAL_W(DomainName), &nDomainName, &sUse))
                 {
                     if (bIncludeDomain)
                     {
-                        wcscpy(Name, DomainName);
-                        wcscat(Name, L"/");
-                        wcscat(Name, UserName);
+                        wcscpy(SAL_W(Name), SAL_W(DomainName));
+                        wcscat(SAL_W(Name), L"/");
+                        wcscat(SAL_W(Name), SAL_W(UserName));
                     }
                     else
                     {
-                        wcscpy(Name, UserName);
+                        wcscpy(SAL_W(Name), SAL_W(UserName));
                     }
                    }
                 rtl_uString_newFromStr( strName, Name);
@@ -862,7 +862,7 @@ static bool SAL_CALL getUserNameImpl(oslSecurity Security, rtl_uString **strName
             WNetGetUserW(nullptr, nullptr, &needed);
             pNameW = static_cast<sal_Unicode *>(malloc (needed*sizeof(sal_Unicode)));
 
-            if (WNetGetUserW(nullptr, pNameW, &needed) == NO_ERROR)
+            if (WNetGetUserW(nullptr, SAL_W(pNameW), &needed) == NO_ERROR)
             {
                 rtl_uString_newFromStr( strName, pNameW);
 
@@ -872,7 +872,7 @@ static bool SAL_CALL getUserNameImpl(oslSecurity Security, rtl_uString **strName
             }
             else if (pSecImpl->m_User[0] != '\0')
             {
-                rtl_uString_newFromStr(strName, pSecImpl->m_pNetResource->lpRemoteName);
+                rtl_uString_newFromStr(strName, SAL_U(pSecImpl->m_pNetResource->lpRemoteName));
 
                 if (pNameW)
                     free(pNameW);
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index 993da53bd28f..319f18b9c116 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -427,7 +427,7 @@ oslSocketAddr SAL_CALL osl_createInetBroadcastAddr (
 // the Win32 SDK 8.1 deprecates inet_addr()
 #if _WIN32_WINNT >= _WIN32_WINNT_VISTA
         IN_ADDR addr;
-        INT ret = InetPtonW(AF_INET, strDottedAddr->buffer, & addr);
+        INT ret = InetPtonW(AF_INET, SAL_W(strDottedAddr->buffer), & addr);
         if (1 == ret)
         {
             nAddr = addr.S_un.S_addr;
@@ -490,7 +490,7 @@ oslSocketAddr SAL_CALL osl_createInetSocketAddr (
 // the Win32 SDK 8.1 deprecates inet_addr()
 #if _WIN32_WINNT >= _WIN32_WINNT_VISTA
     IN_ADDR addr;
-    INT ret = InetPtonW(AF_INET, strDottedAddr->buffer, & addr);
+    INT ret = InetPtonW(AF_INET, SAL_W(strDottedAddr->buffer), & addr);
     Addr = ret == 1 ? addr.S_un.S_addr : OSL_INADDR_NONE;
 #else
     rtl_String  *pDottedAddr=NULL;
@@ -674,7 +674,7 @@ oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString *strHostname)
 #else
     PADDRINFOW pAddrInfo = nullptr;
     int ret = GetAddrInfoW(
-                strHostname->buffer, nullptr, nullptr, & pAddrInfo);
+                SAL_W(strHostname->buffer), nullptr, nullptr, & pAddrInfo);
     if (0 == ret)
     {
         oslHostAddr pRet = nullptr;
@@ -684,7 +684,7 @@ oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString *strHostname)
             {
                 pRet = static_cast<oslHostAddr>(
                     rtl_allocateZeroMemory(sizeof(struct oslHostAddrImpl)));
-                rtl_uString_newFromStr(&pRet->pHostName, pIter->ai_canonname);
+                rtl_uString_newFromStr(&pRet->pHostName, SAL_U(pIter->ai_canonname));
                 pRet->pSockAddr = osl_createSocketAddr_();
                 memcpy(& pRet->pSockAddr->m_sockaddr,
                        pIter->ai_addr, pIter->ai_addrlen);
@@ -1003,7 +1003,7 @@ oslSocketResult SAL_CALL osl_getDottedInetAddrOfSocketAddr (
         SAL_INFO("sal.osl", "InetNtopW failed: " << WSAGetLastError());
         return osl_Socket_Error;
     }
-    rtl_uString_newFromStr(strDottedInetAddr, ret);
+    rtl_uString_newFromStr(strDottedInetAddr, SAL_U(ret));
 #endif // _WIN32_WINNT
     OSL_ASSERT(*strDottedInetAddr != nullptr);
 
diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx
index d4f575122963..05ef80b62afc 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -403,7 +403,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
     SID_NAME_USE eSidType;
     DWORD dwErrorCode = 0;
 
-    LPCWSTR wszAccName = strUserName.getStr( );
+    LPCWSTR wszAccName = SAL_W(strUserName.getStr( ));
 
     // Create buffers for the SID and the domain name.
     PSID pSid = static_cast<PSID>(new BYTE[dwSidBufferSize]);
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_assign.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_assign.cxx
index 287b3a0b2892..0d9cd2b82083 100644
--- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_assign.cxx
+++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_assign.cxx
@@ -44,8 +44,6 @@ private:
         b2 = "1234567890123456";
         CPPUNIT_ASSERT_EQUAL(s3, b2.toString());
         CPPUNIT_ASSERT_EQUAL(sal_Int32(32), b2.getCapacity());
-#if !defined SAL_W32
-    // sal_Unicode is still wchar_t not char16_t even for MSVC 2015
         OUStringBuffer b3;
         b3 = u"123456789012345";
         CPPUNIT_ASSERT_EQUAL(s1, b3.toString());
@@ -56,7 +54,6 @@ private:
         b3 = u"1234567890123456";
         CPPUNIT_ASSERT_EQUAL(s3, b3.toString());
         CPPUNIT_ASSERT_EQUAL(sal_Int32(32), b3.getCapacity());
-#endif
         OUStringBuffer b4;
         b4 = OUStringLiteral("1") + "23456789012345";
         CPPUNIT_ASSERT_EQUAL(s1, b4.toString());
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index 49f2f16526d5..5b1b8ea83e04 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -353,8 +353,6 @@ void test::oustring::StringLiterals::checkOUStringLiteral1()
 }
 
 void test::oustring::StringLiterals::checkUtf16() {
-#if !defined SAL_W32
-        // sal_Unicode is still wchar_t not char16_t even for MSVC 2015
     rtl::OUString s1(u"abc");
     CPPUNIT_ASSERT_EQUAL(rtl::OUString("abc"), s1);
     s1 = u"de";
@@ -420,7 +418,6 @@ void test::oustring::StringLiterals::checkUtf16() {
     CPPUNIT_ASSERT_EQUAL(rtl::OUString("abgababcdef"), b.toString());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), b.indexOf(u"ab", 1));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(5), b.lastIndexOf(u"ab"));
-#endif
 }
 
 }} // namespace
diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx
index 81123828777b..2eb8e36af9e8 100644
--- a/sd/source/ui/remotecontrol/DiscoveryService.cxx
+++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx
@@ -126,7 +126,7 @@ void DiscoveryService::setupSockets()
 #if defined(_WIN32_WINNT) &&  _WIN32_WINNT >= _WIN32_WINNT_VISTA
     IN_ADDR addr;
     OUString const saddr("239.0.0.1");
-    INT ret = InetPtonW(AF_INET, saddr.getStr(), & addr);
+    INT ret = InetPtonW(AF_INET, SAL_W(saddr.getStr()), & addr);
     if (1 == ret)
     {
         multicastRequest.imr_multiaddr.s_addr = addr.S_un.S_addr;
diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx
index 069d5faf802f..cf8d1255d808 100644
--- a/sfx2/source/appl/shutdowniconw32.cxx
+++ b/sfx2/source/appl/shutdowniconw32.cxx
@@ -121,7 +121,7 @@ static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text
             mi.fType=MFT_STRING;
             mi.fState=MFS_ENABLED;
             mi.wID = id;
-            mi.dwTypeData = const_cast<sal_Unicode *>(text.getStr());
+            mi.dwTypeData = SAL_W(const_cast<sal_Unicode *>(text.getStr()));
             mi.cch = text.getLength();
         }
 
diff --git a/svl/source/svdde/ddestrg.cxx b/svl/source/svdde/ddestrg.cxx
index cebc93560246..366e6ada7cf7 100644
--- a/svl/source/svdde/ddestrg.cxx
+++ b/svl/source/svdde/ddestrg.cxx
@@ -26,14 +26,14 @@
 DdeString::DdeString( DWORD hDdeInst, const sal_Unicode* p )
     : m_aString(p)
 {
-    hString = DdeCreateStringHandle( hDdeInst, p, CP_WINUNICODE );
+    hString = DdeCreateStringHandle( hDdeInst, SAL_W(p), CP_WINUNICODE );
     hInst = hDdeInst;
 }
 
 DdeString::DdeString( DWORD hDdeInst, const OUString& r)
     : m_aString(r)
 {
-    hString = DdeCreateStringHandle( hDdeInst, r.getStr(), CP_WINUNICODE );
+    hString = DdeCreateStringHandle( hDdeInst, SAL_W(r.getStr()), CP_WINUNICODE );
     hInst = hDdeInst;
 }
 
diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index 19b5af00bf9c..8dfca479626b 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -113,7 +113,7 @@ bool GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, OUString& destS
                     wCharValue[strLen-1] = '\0';
 
                     if (isValid)
-                        destString = OUString(wCharValue);
+                        destString = OUString(SAL_U(wCharValue));
 
                 }
                 else
@@ -597,10 +597,10 @@ void WinOpenGLDeviceInfo::GetData()
     }
 
     // chop off DEVICE_KEY_PREFIX
-    maDeviceKey = displayDevice.DeviceKey + ArrayLength(DEVICE_KEY_PREFIX)-1;
+    maDeviceKey = SAL_U(displayDevice.DeviceKey) + ArrayLength(DEVICE_KEY_PREFIX)-1;
 
-    maDeviceID = displayDevice.DeviceID;
-    maDeviceString = displayDevice.DeviceString;
+    maDeviceID = SAL_U(displayDevice.DeviceID);
+    maDeviceString = SAL_U(displayDevice.DeviceString);
 
     if (maDeviceID.isEmpty() &&
         (maDeviceString == "RDPDD Chained DD" ||
@@ -613,7 +613,7 @@ void WinOpenGLDeviceInfo::GetData()
     }
 
     /* create a device information set composed of the current display device */
-    HDEVINFO devinfo = SetupDiGetClassDevsW(nullptr, maDeviceID.getStr(), nullptr,
+    HDEVINFO devinfo = SetupDiGetClassDevsW(nullptr, SAL_W(maDeviceID.getStr()), nullptr,
             DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES);
 
     if (devinfo != INVALID_HANDLE_VALUE)
@@ -640,8 +640,8 @@ void WinOpenGLDeviceInfo::GetData()
                         nullptr))
             {
                 OUString  driverKey(aDriverKeyPre);
-                driverKey += value;
-                result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey.getStr(), 0, KEY_QUERY_VALUE, &key);
+                driverKey += SAL_U(value);
+                result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, SAL_W(driverKey.getStr()), 0, KEY_QUERY_VALUE, &key);
                 if (result == ERROR_SUCCESS)
                 {
                     /* we've found the driver we're looking for */
@@ -650,7 +650,7 @@ void WinOpenGLDeviceInfo::GetData()
                             reinterpret_cast<LPBYTE>(value), &dwcbData);
                     if (result == ERROR_SUCCESS)
                     {
-                        maDriverVersion = OUString(value);
+                        maDriverVersion = OUString(SAL_U(value));
                     }
                     else
                     {
@@ -662,7 +662,7 @@ void WinOpenGLDeviceInfo::GetData()
                             reinterpret_cast<LPBYTE>(value), &dwcbData);
                     if (result == ERROR_SUCCESS)
                     {
-                        maDriverDate = value;
+                        maDriverDate = SAL_U(value);
                     }
                     else
                     {
@@ -729,8 +729,8 @@ void WinOpenGLDeviceInfo::GetData()
                             nullptr))
                 {
                     OUString driverKey2(aDriverKeyPre);
-                    driverKey2 += value;
-                    result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey2.getStr(), 0, KEY_QUERY_VALUE, &key);
+                    driverKey2 += SAL_U(value);
+                    result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, SAL_W(driverKey2.getStr()), 0, KEY_QUERY_VALUE, &key);
                     if (result == ERROR_SUCCESS)
                     {
                         dwcbData = sizeof(value);
@@ -740,7 +740,7 @@ void WinOpenGLDeviceInfo::GetData()
                         {
                             continue;
                         }
-                        aDeviceID2 = value;
+                        aDeviceID2 = SAL_U(value);
                         OUString aAdapterVendorID2String;
                         OUString aAdapterDeviceID2String;
                         adapterVendorID2 = ParseIDFromDeviceID(aDeviceID2, "VEN_", 4);
@@ -756,7 +756,7 @@ void WinOpenGLDeviceInfo::GetData()
 
                         // If this device is missing driver information, it is unlikely to
                         // be a real display adapter.
-                        if (!GetKeyValue(driverKey2.getStr(), L"InstalledDisplayDrivers",
+                        if (!GetKeyValue(SAL_W(driverKey2.getStr()), L"InstalledDisplayDrivers",
                                         aAdapterDriver2, REG_MULTI_SZ))
                         {
                             RegCloseKey(key);
@@ -770,7 +770,7 @@ void WinOpenGLDeviceInfo::GetData()
                             RegCloseKey(key);
                             continue;
                         }
-                        aDriverVersion2 = value;
+                        aDriverVersion2 = SAL_U(value);
                         dwcbData = sizeof(value);
                         result = RegQueryValueExW(key, L"DriverDate", nullptr, nullptr,
                                 reinterpret_cast<LPBYTE>(value), &dwcbData);
@@ -779,7 +779,7 @@ void WinOpenGLDeviceInfo::GetData()
                             RegCloseKey(key);
                             continue;
                         }
-                        aDriverDate2 = value;
+                        aDriverDate2 = SAL_U(value);
                         dwcbData = sizeof(value);
                         result = RegQueryValueExW(key, L"Device Description", nullptr,
                                 nullptr, reinterpret_cast<LPBYTE>(value), &dwcbData);
@@ -793,7 +793,7 @@ void WinOpenGLDeviceInfo::GetData()
                         if (result == ERROR_SUCCESS)
                         {
                             mbHasDualGPU = true;
-                            maDeviceString2 = value;
+                            maDeviceString2 = SAL_U(value);
                             maDeviceID2 = aDeviceID2;
                             maDeviceKey2 = driverKey2;
                             maDriverVersion2 = aDriverVersion2;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 8e6815db1fd3..f11ef8591f59 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -7104,7 +7104,7 @@ bool PDFWriter::Sign(PDFSignContext& rContext)
         aTsPara.cExtension = 0;
         aTsPara.rgExtension = nullptr;
 
-        if (!(*crts)(rContext.m_aSignTSA.getStr(),
+        if (!(*crts)(SAL_W(rContext.m_aSignTSA.getStr()),
                      0,
                      10000,
                      szOID_NIST_sha256,
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 4f270bc7845f..d0a8d01e5cca 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -920,7 +920,7 @@ void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUS
             {
                 IShellItem* pShellItem = nullptr;
 
-                HRESULT hr = pSHCreateItemFromParsingName ( system_path.getStr(), nullptr, IID_PPV_ARGS(&pShellItem) );
+                HRESULT hr = pSHCreateItemFromParsingName ( SAL_W(system_path.getStr()), nullptr, IID_PPV_ARGS(&pShellItem) );
 
                 if ( SUCCEEDED(hr) && pShellItem )
                 {
@@ -965,7 +965,7 @@ void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUS
 
                         DummyShardAppIDInfo info;
                         info.psi = pShellItem;
-                        info.pszAppID = sApplicationID.getStr();
+                        info.pszAppID = SAL_W(sApplicationID.getStr());
 
                         SHAddToRecentDocs ( SHARD_APPIDINFO, &info );
                         return;
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 544e6b6c2a3a..a66ef8fafc76 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1057,7 +1057,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
         {
             if ((nFontType & RASTER_FONTTYPE) && !(nFontType & DEVICE_FONTTYPE))
             {
-                SAL_INFO("vcl.gdi", "Unsupported printer font ignored: " << OUString(pLogFont->elfLogFont.lfFaceName));
+                SAL_INFO("vcl.gdi", "Unsupported printer font ignored: " << OUString(SAL_U(pLogFont->elfLogFont.lfFaceName)));
                 return 1;
             }
         }
@@ -1066,7 +1066,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
                  !(pMetric->ntmTm.ntmFlags & NTM_PS_OPENTYPE) &&
                  !(pMetric->ntmTm.ntmFlags & NTM_TT_OPENTYPE))
         {
-            SAL_INFO("vcl.gdi", "Unsupported font ignored: " << OUString(pLogFont->elfLogFont.lfFaceName));
+            SAL_INFO("vcl.gdi", "Unsupported font ignored: " << OUString(SAL_U(pLogFont->elfLogFont.lfFaceName)));
             return 1;
         }
 
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index bd3dd8a5f02f..00e88b09560a 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -409,13 +409,13 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
     // fill up string buffers with 0 so they do not influence a JobSetup's memcmp
     if( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmSize >= 64 )
     {
-        sal_Int32 nLen = rtl_ustr_getLength( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName );
+        sal_Int32 nLen = rtl_ustr_getLength( SAL_U(reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName) );
         if ( sal::static_int_cast<size_t>(nLen) < SAL_N_ELEMENTS( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName ) )
             memset( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName+nLen, 0, sizeof( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName )-(nLen*sizeof(sal_Unicode)) );
     }
     if( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmSize >= 166 )
     {
-        sal_Int32 nLen = rtl_ustr_getLength( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName );
+        sal_Int32 nLen = rtl_ustr_getLength( SAL_U(reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName) );
         if ( sal::static_int_cast<size_t>(nLen) < SAL_N_ELEMENTS( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName ) )
             memset( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName+nLen, 0, sizeof( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName )-(nLen*sizeof(sal_Unicode)) );
     }
@@ -1516,12 +1516,12 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
     DOCINFOW aInfo;
     memset( &aInfo, 0, sizeof( DOCINFOW ) );
     aInfo.cbSize = sizeof( aInfo );
-    aInfo.lpszDocName = rJobName.getStr();
+    aInfo.lpszDocName = SAL_W(rJobName.getStr());
     if ( pFileName || aOutFileName.getLength() )
     {
         if ( (pFileName && !pFileName->isEmpty()) || aOutFileName.getLength() )
         {
-            aInfo.lpszOutput = (pFileName && !pFileName->isEmpty()) ? pFileName->getStr() : aOutFileName.getStr();
+            aInfo.lpszOutput = SAL_W((pFileName && !pFileName->isEmpty()) ? pFileName->getStr() : aOutFileName.getStr());
         }
         else
             aInfo.lpszOutput = L"FILE:";
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index b37a95161045..a6e92e24b210 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1848,7 +1848,7 @@ void WinSalFrame::SetApplicationID( const OUString &rApplicationID )
                 PROPVARIANT pv;
                 if ( !rApplicationID.isEmpty() )
                 {
-                    hr = InitPropVariantFromString( rApplicationID.getStr(), &pv );
+                    hr = InitPropVariantFromString( SAL_W(rApplicationID.getStr()), &pv );
                     mbPropertiesStored = TRUE;
                 }
                 else
@@ -4467,7 +4467,7 @@ static int ImplMeasureItem( HWND hWnd, WPARAM wParam, LPARAM lParam )
             aStr += " ";
             aStr += pSalMenuItem->mAccelText;
         }
-        GetTextExtentPoint32W( hdc, aStr.getStr(),
+        GetTextExtentPoint32W( hdc, SAL_W(aStr.getStr()),
                                 aStr.getLength(), &strSize );
 
         // image
@@ -4604,7 +4604,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
 
         SIZE strSize;
         OUString aStr( pSalMenuItem->mText );
-        GetTextExtentPoint32W( pDI->hDC, aStr.getStr(),
+        GetTextExtentPoint32W( pDI->hDC, SAL_W(aStr.getStr()),
                                 aStr.getLength(), &strSize );
 
         if(!DrawStateW( pDI->hDC, nullptr, nullptr,
@@ -4617,7 +4617,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
         {
             SIZE strSizeA;
             aStr = pSalMenuItem->mAccelText;
-            GetTextExtentPoint32W( pDI->hDC, aStr.getStr(),
+            GetTextExtentPoint32W( pDI->hDC, SAL_W(aStr.getStr()),
                                     aStr.getLength(), &strSizeA );
             TEXTMETRIC tm;
             GetTextMetrics( pDI->hDC, &tm );
diff --git a/vcl/win/window/salmenu.cxx b/vcl/win/window/salmenu.cxx
index b357bcfdc004..5ca16c496829 100644
--- a/vcl/win/window/salmenu.cxx
+++ b/vcl/win/window/salmenu.cxx
@@ -93,7 +93,7 @@ SalMenuItem* WinSalInstance::CreateMenuItem( const SalItemParams* pItemData )
 
         pSalMenuItem->mInfo.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID | MIIM_DATA;
         pSalMenuItem->mInfo.fType = MFT_STRING;
-        pSalMenuItem->mInfo.dwTypeData = const_cast<sal_Unicode *>(pSalMenuItem->mText.getStr());
+        pSalMenuItem->mInfo.dwTypeData = SAL_W(const_cast<sal_Unicode *>(pSalMenuItem->mText.getStr()));
         pSalMenuItem->mInfo.cch = pSalMenuItem->mText.getLength();
 
         pSalMenuItem->mInfo.wID = pItemData->nId;
@@ -307,7 +307,7 @@ void WinSalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OU
         {
             aStr += "\t" + pWItem->mAccelText;
         }
-        pWItem->mInfo.dwTypeData = const_cast<sal_Unicode *>(aStr.getStr());
+        pWItem->mInfo.dwTypeData = SAL_W(const_cast<sal_Unicode *>(aStr.getStr()));
         pWItem->mInfo.cch = aStr.getLength();
 
         if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, &pWItem->mInfo ))
@@ -332,7 +332,7 @@ void WinSalMenu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const
         {
             aStr += "\t" + pWItem->mAccelText;
         }
-        pWItem->mInfo.dwTypeData = const_cast<sal_Unicode *>(aStr.getStr());
+        pWItem->mInfo.dwTypeData = SAL_W(const_cast<sal_Unicode *>(aStr.getStr()));
         pWItem->mInfo.cch = aStr.getLength();
 
         if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, &pWItem->mInfo ))
diff --git a/winaccessibility/source/UAccCOM/AccActionBase.cxx b/winaccessibility/source/UAccCOM/AccActionBase.cxx
index 485dc6b5da84..5610ba4f3627 100644
--- a/winaccessibility/source/UAccCOM/AccActionBase.cxx
+++ b/winaccessibility/source/UAccCOM/AccActionBase.cxx
@@ -117,7 +117,7 @@ STDMETHODIMP CAccActionBase::get_description(long actionIndex,BSTR __RPC_FAR *de
     // #CHECK#
 
     SAFE_SYSFREESTRING(*description);
-    *description = SysAllocString(ouStr.getStr());
+    *description = SysAllocString(SAL_W(ouStr.getStr()));
 
     return S_OK;
 
@@ -235,7 +235,7 @@ void CAccActionBase::GetkeyBindingStrByXkeyBinding( const Sequence< KeyStroke >
         KeyStroke stroke = keySet[iIndex];
         OLECHAR wString[64] = {NULL};
         wcscat(wString, OLESTR("\n"));
-        wcscat(wString, &stroke.KeyChar);
+        wcscat(wString, SAL_W(&stroke.KeyChar));
 
         wcscat( pString, wString);
     }
diff --git a/winaccessibility/source/UAccCOM/AccEditableText.cxx b/winaccessibility/source/UAccCOM/AccEditableText.cxx
index bf1fc69f6d3b..d676493ef58d 100644
--- a/winaccessibility/source/UAccCOM/AccEditableText.cxx
+++ b/winaccessibility/source/UAccCOM/AccEditableText.cxx
@@ -119,7 +119,7 @@ STDMETHODIMP CAccEditableText::insertText(long offset, BSTR * text)
     if( !pRXEdtTxt.is() )
         return E_FAIL;
 
-    ::rtl::OUString ouStr(*text);
+    ::rtl::OUString ouStr(SAL_U(*text));
 
     if( GetXInterface()->insertText( ouStr, offset ) )
         return S_OK;
@@ -196,7 +196,7 @@ STDMETHODIMP CAccEditableText::replaceText(long startOffset, long endOffset, BST
     if( !pRXEdtTxt.is() )
         return E_FAIL;
 
-    ::rtl::OUString ouStr(*text);
+    ::rtl::OUString ouStr(SAL_U(*text));
 
     if( GetXInterface()->replaceText( startOffset,endOffset, ouStr) )
         return S_OK;
@@ -225,7 +225,7 @@ STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset, B
     if( !pRXEdtTxt.is() )
         return E_FAIL;
 
-    ::rtl::OUString ouStr(*attributes);
+    ::rtl::OUString ouStr(SAL_U(*attributes));
 
     sal_Int32 nIndex = 0;
     sal_Unicode cTok = ';';
@@ -268,55 +268,55 @@ STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset, B
  */
 void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const ::rtl::OUString &ouValue, Any &rAny)
 {
-    if(ouName.equals(L"CharBackColor") ||
-            ouName.equals(L"CharColor") ||
-            ouName.equals(L"ParaAdjust") ||
-            ouName.equals(L"ParaFirstLineIndent") ||
-            ouName.equals(L"ParaLeftMargin") ||
-            ouName.equals(L"ParaRightMargin") ||
-            ouName.equals(L"ParaTopMargin") ||
-            ouName.equals(L"ParaBottomMargin") ||
-            ouName.equals(L"CharFontPitch") )
+    if(ouName.equals(u"CharBackColor") ||
+            ouName.equals(u"CharColor") ||
+            ouName.equals(u"ParaAdjust") ||
+            ouName.equals(u"ParaFirstLineIndent") ||
+            ouName.equals(u"ParaLeftMargin") ||
+            ouName.equals(u"ParaRightMargin") ||
+            ouName.equals(u"ParaTopMargin") ||
+            ouName.equals(u"ParaBottomMargin") ||
+            ouName.equals(u"CharFontPitch") )
     {
         // Convert to int.
         // NOTE: CharFontPitch is not implemented in java file.
         sal_Int32 nValue = ouValue.toInt32();
         rAny.setValue(&nValue, cppu::UnoType<sal_Int32>::get());
     }
-    else if(ouName.equals(L"CharShadowed") ||
-            ouName.equals(L"CharContoured") )
+    else if(ouName.equals(u"CharShadowed") ||
+            ouName.equals(u"CharContoured") )
     {
         // Convert to boolean.
         rAny <<= ouValue.toBoolean();
     }
-    else if(ouName.equals(L"CharEscapement") ||
-            ouName.equals(L"CharStrikeout")  ||
-            ouName.equals(L"CharUnderline") ||
-            ouName.equals(L"CharFontPitch") )
+    else if(ouName.equals(u"CharEscapement") ||
+            ouName.equals(u"CharStrikeout")  ||
+            ouName.equals(u"CharUnderline") ||
+            ouName.equals(u"CharFontPitch") )
     {
         // Convert to short.
         short nValue = (short)ouValue.toInt32();
         rAny.setValue(&nValue, cppu::UnoType<short>::get());
     }
-    else if(ouName.equals(L"CharHeight") ||
-            ouName.equals(L"CharWeight") )
+    else if(ouName.equals(u"CharHeight") ||
+            ouName.equals(u"CharWeight") )
     {
         // Convert to float.
         float fValue = ouValue.toFloat();
         rAny.setValue(&fValue, cppu::UnoType<float>::get());
     }
-    else if(ouName.equals(L"CharFontName") )
+    else if(ouName.equals(u"CharFontName") )
     {
         // Convert to string.
         rAny.setValue(&ouValue, cppu::UnoType<rtl::OUString>::get());
     }
-    else if(ouName.equals(L"CharPosture") )
+    else if(ouName.equals(u"CharPosture") )
     {
         // Convert to FontSlant.
         css::awt::FontSlant fontSlant = (css::awt::FontSlant)ouValue.toInt32();
         rAny.setValue(&fontSlant, cppu::UnoType<css::awt::FontSlant>::get());
     }
-    else if(ouName.equals(L"ParaTabStops") )
+    else if(ouName.equals(u"ParaTabStops") )
     {
 
         // Convert to the Sequence with TabStop element.
@@ -328,7 +328,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
         do
         {
             // Position.
-            pos = ouValue.indexOf(L"Position=", pos);
+            pos = ouValue.indexOf(u"Position=", pos);
             if(pos != -1)
             {
                 posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "Position=".
@@ -339,7 +339,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
                     pos = posComma + 1;
 
                     // TabAlign.
-                    pos = ouValue.indexOf(L"TabAlign=", pos);
+                    pos = ouValue.indexOf(u"TabAlign=", pos);
                     if(pos != -1)
                     {
                         posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=".
@@ -350,7 +350,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
                             pos = posComma + 1;
 
                             // DecimalChar.
-                            pos = ouValue.indexOf(L"DecimalChar=", pos);
+                            pos = ouValue.indexOf(u"DecimalChar=", pos);
                             if(pos != -1)
                             {
                                 posComma = ouValue.indexOf(',', pos + 11); // 11 = length of "TabAlign=".
@@ -361,7 +361,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
                                     pos = posComma + 1;
 
                                     // FillChar.
-                                    pos = ouValue.indexOf(L"FillChar=", pos);
+                                    pos = ouValue.indexOf(u"FillChar=", pos);
                                     if(pos != -1)
                                     {
                                         posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=".
@@ -425,14 +425,14 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
         // Assign to Any object.
         rAny.setValue(&seqTabStop, cppu::UnoType<Sequence< css::style::TabStop >>::get());
     }
-    else if(ouName.equals(L"ParaLineSpacing") )
+    else if(ouName.equals(u"ParaLineSpacing") )
     {
         // Parse value string.
         css::style::LineSpacing lineSpacing;
         ::rtl::OUString ouSubValue;
         sal_Int32 pos = 0, posComma = 0;
 
-        pos = ouValue.indexOf(L"Mode=", pos);
+        pos = ouValue.indexOf(u"Mode=", pos);
         if(pos != -1)
         {
             posComma = ouValue.indexOf(',', pos + 5); // 5 = length of "Mode=".
@@ -442,7 +442,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
                 lineSpacing.Mode = (sal_Int16)ouSubValue.toInt32();
                 pos = posComma + 1;
 
-                pos = ouValue.indexOf(L"Height=", pos);
+                pos = ouValue.indexOf(u"Height=", pos);
                 if(pos != -1)
                 {
                     ouSubValue = ouValue.copy(pos + 7, ouValue.getLength() - pos - 7);
diff --git a/winaccessibility/source/UAccCOM/AccImage.cxx b/winaccessibility/source/UAccCOM/AccImage.cxx
index b089dece8b14..5b0e88fd47d1 100644
--- a/winaccessibility/source/UAccCOM/AccImage.cxx
+++ b/winaccessibility/source/UAccCOM/AccImage.cxx
@@ -56,7 +56,7 @@ STDMETHODIMP CAccImage::get_description(BSTR * description)
 
     ::rtl::OUString ouStr = GetXInterface()->getAccessibleImageDescription();
     SAFE_SYSFREESTRING(*description);
-    *description = SysAllocString(ouStr.getStr());
+    *description = SysAllocString(SAL_W(ouStr.getStr()));
 
     return S_OK;
 
diff --git a/winaccessibility/source/UAccCOM/AccTable.cxx b/winaccessibility/source/UAccCOM/AccTable.cxx
index a1de13d69353..542a40ce9398 100644
--- a/winaccessibility/source/UAccCOM/AccTable.cxx
+++ b/winaccessibility/source/UAccCOM/AccTable.cxx
@@ -132,7 +132,7 @@ STDMETHODIMP CAccTable::get_columnDescription(long column, BSTR * description)
     // #CHECK#
 
     SAFE_SYSFREESTRING(*description);//??
-    *description = SysAllocString(ouStr.getStr());
+    *description = SysAllocString(SAL_W(ouStr.getStr()));
     if(description==nullptr)
         return E_FAIL;
     return S_OK;
@@ -351,7 +351,7 @@ STDMETHODIMP CAccTable::get_rowDescription(long row, BSTR * description)
     // #CHECK#
 
     SAFE_SYSFREESTRING(*description);
-    *description = SysAllocString(ouStr.getStr());
+    *description = SysAllocString(SAL_W(ouStr.getStr()));
     if(description==nullptr)
         return E_FAIL;
 
diff --git a/winaccessibility/source/UAccCOM/AccTextBase.cxx b/winaccessibility/source/UAccCOM/AccTextBase.cxx
index f67bb4aefbd6..6bed720c5389 100644
--- a/winaccessibility/source/UAccCOM/AccTextBase.cxx
+++ b/winaccessibility/source/UAccCOM/AccTextBase.cxx
@@ -163,7 +163,7 @@ STDMETHODIMP CAccTextBase::get_attributes(long offset, long * startOffset, long
         {
             strAttrs+=L";";
         }
-        strAttrs += pValue.Name.getStr();
+        strAttrs += SAL_W(pValue.Name.getStr());
         strAttrs += L":";
 
         OLECHAR pTemp[2048] = {0};
@@ -499,7 +499,7 @@ STDMETHODIMP CAccTextBase::get_text(long startOffset, long endOffset, BSTR * tex
     }
 
     SysFreeString(*text);
-    *text = SysAllocString(ouStr.getStr());
+    *text = SysAllocString(SAL_W(ouStr.getStr()));
     return S_OK;
 
     LEAVE_PROTECTED_BLOCK
@@ -584,7 +584,7 @@ STDMETHODIMP CAccTextBase::get_textBeforeOffset(long offset, IA2TextBoundaryType
     TextSegment segment = GetXInterface()->getTextBeforeIndex( offset, sal_Int16(lUnoBoundaryType));
     ::rtl::OUString ouStr = segment.SegmentText;
     SysFreeString(*text);
-    *text = SysAllocString(ouStr.getStr());
+    *text = SysAllocString(SAL_W(ouStr.getStr()));
     *startOffset = segment.SegmentStart;
     *endOffset = segment.SegmentEnd;
 
@@ -670,7 +670,7 @@ STDMETHODIMP CAccTextBase::get_textAfterOffset(long offset, IA2TextBoundaryType
     TextSegment segment = GetXInterface()->getTextBehindIndex( offset, sal_Int16(lUnoBoundaryType));
     ::rtl::OUString ouStr = segment.SegmentText;
     SysFreeString(*text);
-    *text = SysAllocString(ouStr.getStr());
+    *text = SysAllocString(SAL_W(ouStr.getStr()));
     *startOffset = segment.SegmentStart;
     *endOffset = segment.SegmentEnd;
 
@@ -757,7 +757,7 @@ STDMETHODIMP CAccTextBase::get_textAtOffset(long offset, IA2TextBoundaryType bou
     TextSegment segment = GetXInterface()->getTextAtIndex( offset, sal_Int16(lUnoBoundaryType));
     ::rtl::OUString ouStr = segment.SegmentText;
     SysFreeString(*text);
-    *text = SysAllocString(ouStr.getStr());
+    *text = SysAllocString(SAL_W(ouStr.getStr()));
     *startOffset = segment.SegmentStart;
     *endOffset = segment.SegmentEnd;
 
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx
index 3c34e30a766d..ec628099aab9 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -2736,7 +2736,7 @@ void CMAccessible::get_OLECHARFromAny(Any& pAny, OLECHAR* pChar)
         {
             ::rtl::OUString val;
             pAny >>= val;
-            wcscpy(pChar, val.getStr());
+            wcscpy(pChar, SAL_W(val.getStr()));
             break;
         }
     case TypeClass_SEQUENCE:
@@ -2754,7 +2754,7 @@ void CMAccessible::get_OLECHARFromAny(Any& pAny, OLECHAR* pChar)
                 {
                     pString += val[iIndex];
                 }
-                wcscpy(pChar, pString.getStr());
+                wcscpy(pChar, SAL_W(pString.getStr()));
             }
             else if (pAny.getValueType() == cppu::UnoType<Sequence< css::style::TabStop >>::get())
             {
@@ -2817,7 +2817,7 @@ void CMAccessible::get_OLECHARFromAny(Any& pAny, OLECHAR* pChar)
                 css::accessibility::TextSegment val;
                 pAny >>= val;
                 ::rtl::OUString realVal(val.SegmentText);
-                wcscpy(pChar, realVal.getStr());
+                wcscpy(pChar, SAL_W(realVal.getStr()));
             }
             break;
         }
@@ -2966,7 +2966,7 @@ void CMAccessible::ConvertAnyToVariant(const css::uno::Any &rAnyVal, VARIANT *pv
                 pvData->vt = VT_BSTR;
                 ::rtl::OUString val;
                 rAnyVal >>= val;
-                pvData->bstrVal = SysAllocString(val.getStr());
+                pvData->bstrVal = SysAllocString(SAL_W(val.getStr()));
                 break;
             }
 
@@ -3019,7 +3019,7 @@ void CMAccessible::ConvertAnyToVariant(const css::uno::Any &rAnyVal, VARIANT *pv
         case TypeClass::TypeClass_MAKE_FIXED_SIZE:
             // Output the type string, if there is other uno value type.
             pvData->vt = VT_BSTR;
-            pvData->bstrVal = SysAllocString(rAnyVal.getValueTypeName().getStr());
+            pvData->bstrVal = SysAllocString(SAL_W(rAnyVal.getValueTypeName().getStr()));
             break;
 
         default:
@@ -3133,9 +3133,9 @@ STDMETHODIMP CMAccessible:: get_locale( IA2Locale __RPC_FAR *locale  )
         return E_FAIL;
 
     css::lang::Locale unoLoc = m_xContext.get()->getLocale();
-    locale->language = SysAllocString(unoLoc.Language.getStr());
-    locale->country = SysAllocString(unoLoc.Country.getStr());
-    locale->variant = SysAllocString(unoLoc.Variant.getStr());

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list