summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-04-04 14:57:45 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-04-04 16:12:11 +0000
commit9ac98e6e3488e434bf4864ecfb13a121784f640b (patch)
treeb3c9cbf52126fee5864be12e9109f7413e7a0878 /vcl
parent6f995da5a652d993ab253b3363188cd18e289728 (diff)
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@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/opengl/win/WinDeviceInfo.cxx32
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx2
-rw-r--r--vcl/win/app/salinst.cxx4
-rw-r--r--vcl/win/gdi/salfont.cxx4
-rw-r--r--vcl/win/gdi/salprn.cxx8
-rw-r--r--vcl/win/window/salframe.cxx8
-rw-r--r--vcl/win/window/salmenu.cxx6
7 files changed, 32 insertions, 32 deletions
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 ))