summaryrefslogtreecommitdiff
path: root/sal/osl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-10-05 06:19:56 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-10-05 16:02:52 +0200
commit1944e3ddc0b2247de3138d2a441cd6999e21fd9a (patch)
treeb59f213e245e151ee792ca424fd06b5a11c88857 /sal/osl
parent81d404803f477eb71b74eb9c7a67bba6b1af95d1 (diff)
Rename and move SAL_U/W to o3tl::toU/W
Previosly (since commit 9ac98e6e3488e434bf4864ecfb13a121784f640b) it was expected to gradually remove SAL_U/W usage in Windows code by replacing with reinterpret_cast or changing to some bettertypes. But as it's useful to make use of fact that LibreOffice and Windows use compatible representation of strings, this commit puts these functions to a better-suited o3tl, and recommends that the functions be consistently used throughout Windows-specific code to reflect the compatibility and keep the casts safe. Change-Id: I2f7c65606d0e2d0c01a00f08812bb4ab7659c5f6 Reviewed-on: https://gerrit.libreoffice.org/43150 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sal/osl')
-rw-r--r--sal/osl/w32/file.cxx13
-rw-r--r--sal/osl/w32/file_dirvol.cxx73
-rw-r--r--sal/osl/w32/file_url.cxx39
-rw-r--r--sal/osl/w32/module.cxx23
-rw-r--r--sal/osl/w32/nlsupport.cxx7
-rw-r--r--sal/osl/w32/pipe.cxx11
-rw-r--r--sal/osl/w32/process.cxx19
-rw-r--r--sal/osl/w32/procimpl.cxx13
-rw-r--r--sal/osl/w32/profile.cxx47
-rw-r--r--sal/osl/w32/security.cxx77
-rw-r--r--sal/osl/w32/socket.cxx15
-rw-r--r--sal/osl/w32/tempfile.cxx9
12 files changed, 179 insertions, 167 deletions
diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx
index a211464aa2cd..e64e5b306277 100644
--- a/sal/osl/w32/file.cxx
+++ b/sal/osl/w32/file.cxx
@@ -22,6 +22,7 @@
#include <osl/file.hxx>
#include <rtl/alloc.h>
#include <rtl/byteseq.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include "file_url.hxx"
#include "file_error.hxx"
@@ -717,7 +718,7 @@ oslFileError SAL_CALL osl_openFile(
dwCreation |= OPEN_EXISTING;
HANDLE hFile = CreateFileW(
- SAL_W(rtl_uString_getStr(strSysPath)),
+ o3tl::toW(rtl_uString_getStr(strSysPath)),
dwAccess, dwShare, nullptr, dwCreation, 0, nullptr);
// @@@ ERROR HANDLING @@@
@@ -1073,7 +1074,7 @@ oslFileError SAL_CALL osl_removeFile(rtl_uString* strPath)
if (error == osl_File_E_None)
{
- if (DeleteFileW(SAL_W(rtl_uString_getStr(strSysPath))))
+ if (DeleteFileW(o3tl::toW(rtl_uString_getStr(strSysPath))))
error = osl_File_E_None;
else
error = oslTranslateFileError(GetLastError());
@@ -1093,8 +1094,8 @@ oslFileError SAL_CALL osl_copyFile(rtl_uString* strPath, rtl_uString *strDestPat
if (error == osl_File_E_None)
{
- LPCWSTR src = SAL_W(rtl_uString_getStr(strSysPath));
- LPCWSTR dst = SAL_W(rtl_uString_getStr(strSysDestPath));
+ LPCWSTR src = o3tl::toW(rtl_uString_getStr(strSysPath));
+ LPCWSTR dst = o3tl::toW(rtl_uString_getStr(strSysDestPath));
if (CopyFileW(src, dst, FALSE))
error = osl_File_E_None;
@@ -1120,8 +1121,8 @@ oslFileError SAL_CALL osl_moveFile(rtl_uString* strPath, rtl_uString *strDestPat
if (error == osl_File_E_None)
{
- LPCWSTR src = SAL_W(rtl_uString_getStr(strSysPath));
- LPCWSTR dst = SAL_W(rtl_uString_getStr(strSysDestPath));
+ LPCWSTR src = o3tl::toW(rtl_uString_getStr(strSysPath));
+ LPCWSTR dst = o3tl::toW(rtl_uString_getStr(strSysDestPath));
if (MoveFileExW(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 f94c91f5aaf4..3ef290140a0a 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -17,17 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "systools/win32/uwinapi.h"
+#include <systools/win32/uwinapi.h>
#include "file_url.hxx"
-#include <filetime.hxx>
+#include "filetime.hxx"
#include "file_error.hxx"
#include "path_helper.hxx"
-#include "rtl/alloc.h"
-#include "rtl/ustring.hxx"
+#include <rtl/alloc.h>
+#include <rtl/ustring.hxx>
#include <rtl/character.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
static const wchar_t UNC_PREFIX[] = L"\\\\";
static const wchar_t BACKSLASH = '\\';
@@ -119,7 +120,7 @@ namespace
};
inline bool is_UNC_path(const sal_Unicode* path)
- { return (0 == wcsncmp(UNC_PREFIX, SAL_W(path), SAL_N_ELEMENTS(UNC_PREFIX) - 1)); }
+ { return (0 == wcsncmp(UNC_PREFIX, o3tl::toW(path), SAL_N_ELEMENTS(UNC_PREFIX) - 1)); }
void parse_UNC_path(const sal_Unicode* path, UNCComponents* puncc)
{
@@ -344,7 +345,7 @@ static HANDLE WINAPI OpenDirectory( rtl_uString* pPath)
WCHAR* szFileMask = static_cast< WCHAR* >( rtl_allocateMemory( sizeof( WCHAR ) * ( nLen + nSuffLen + 1 ) ) );
- wcscpy( szFileMask, SAL_W(rtl_uString_getStr( pPath )) );
+ wcscpy( szFileMask, o3tl::toW(rtl_uString_getStr( pPath )) );
wcscat( szFileMask, pSuffix );
pDirectory = static_cast<LPDIRECTORY>(HeapAlloc(GetProcessHeap(), 0, sizeof(DIRECTORY)));
@@ -550,7 +551,7 @@ static oslFileError SAL_CALL osl_openNetworkServer(
ZeroMemory( &aNetResource, sizeof(aNetResource) );
- aNetResource.lpRemoteName = SAL_W(strSysDirPath->buffer);
+ aNetResource.lpRemoteName = o3tl::toW(strSysDirPath->buffer);
dwError = WNetOpenEnumW(
RESOURCE_GLOBALNET,
@@ -581,7 +582,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( SAL_W(rtl_uString_getStr( dir_path )), nullptr );
+ BOOL bCreated = CreateDirectoryW( o3tl::toW(rtl_uString_getStr( dir_path )), nullptr );
if ( bCreated )
{
@@ -681,7 +682,7 @@ oslFileError osl_createDirectoryWithFlags(rtl_uString * strPath, sal_uInt32)
if ( osl_File_E_None == error )
{
- BOOL bCreated = CreateDirectoryW( SAL_W(rtl_uString_getStr( strSysPath )), nullptr );
+ BOOL bCreated = CreateDirectoryW( o3tl::toW(rtl_uString_getStr( strSysPath )), nullptr );
if ( !bCreated )
{
@@ -716,7 +717,7 @@ oslFileError SAL_CALL osl_removeDirectory(rtl_uString* strPath)
if ( osl_File_E_None == error )
{
- if ( RemoveDirectoryW( SAL_W(rtl_uString_getStr( strSysPath ) )) )
+ if ( RemoveDirectoryW( o3tl::toW(rtl_uString_getStr( strSysPath ) )) )
error = osl_File_E_None;
else
error = oslTranslateFileError( GetLastError() );
@@ -869,7 +870,7 @@ static oslFileError SAL_CALL osl_getNextFileItem(
pItemImpl->nRefCount = 1;
rtl_uString* pTmpFileName = nullptr;
- rtl_uString_newFromStr( &pTmpFileName, SAL_U(pItemImpl->FindData.cFileName) );
+ rtl_uString_newFromStr( &pTmpFileName, o3tl::toU(pItemImpl->FindData.cFileName) );
rtl_uString_newConcat( &pItemImpl->m_pFullPath, pDirImpl->m_pDirectoryPath, pTmpFileName );
rtl_uString_release( pTmpFileName );
@@ -1040,7 +1041,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
osl_acquireDirectoryItem( static_cast<oslDirectoryItem>(pItemImpl) );
- wcscpy( pItemImpl->cDriveString, SAL_W(strSysFilePath->buffer) );
+ wcscpy( pItemImpl->cDriveString, o3tl::toW(strSysFilePath->buffer) );
pItemImpl->cDriveString[0] = rtl::toAsciiUpperCase( pItemImpl->cDriveString[0] );
if ( pItemImpl->cDriveString[wcslen(pItemImpl->cDriveString) - 1] != '\\' )
@@ -1060,7 +1061,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 = FindFirstFileW( SAL_W(rtl_uString_getStr(strSysFilePath)), &aFindData );
+ hFind = FindFirstFileW( o3tl::toW(rtl_uString_getStr(strSysFilePath)), &aFindData );
if ( hFind != INVALID_HANDLE_VALUE )
{
@@ -1158,7 +1159,7 @@ bool is_floppy_volume_mount_point(const rtl::OUString& path)
osl::systemPathEnsureSeparator(p);
WCHAR vn[51];
- if (GetVolumeNameForVolumeMountPointW(SAL_W(p.getStr()), vn, SAL_N_ELEMENTS(vn)))
+ if (GetVolumeNameForVolumeMountPointW(o3tl::toW(p.getStr()), vn, SAL_N_ELEMENTS(vn)))
{
WCHAR vnfloppy[51];
if (is_floppy_A_present() &&
@@ -1197,13 +1198,13 @@ static bool is_volume_mount_point(const rtl::OUString& path)
if (!is_floppy_drive(p))
{
- DWORD fattr = GetFileAttributesW(SAL_W(p.getStr()));
+ DWORD fattr = GetFileAttributesW(o3tl::toW(p.getStr()));
if ((INVALID_FILE_ATTRIBUTES != fattr) &&
(FILE_ATTRIBUTE_REPARSE_POINT & fattr))
{
WIN32_FIND_DATAW find_data;
- HANDLE h_find = FindFirstFileW(SAL_W(p.getStr()), &find_data);
+ HANDLE h_find = FindFirstFileW(o3tl::toW(p.getStr()), &find_data);
if (IsValidHandle(h_find) &&
(FILE_ATTRIBUTE_REPARSE_POINT & find_data.dwFileAttributes) &&
@@ -1227,7 +1228,7 @@ static UINT get_volume_mount_point_drive_type(const rtl::OUString& path)
osl::systemPathEnsureSeparator(p);
WCHAR vn[51];
- if (GetVolumeNameForVolumeMountPointW(SAL_W(p.getStr()), vn, SAL_N_ELEMENTS(vn)))
+ if (GetVolumeNameForVolumeMountPointW(o3tl::toW(p.getStr()), vn, SAL_N_ELEMENTS(vn)))
return GetDriveTypeW(vn);
return DRIVE_NO_ROOT_DIR;
@@ -1247,7 +1248,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 = GetDriveTypeW(SAL_W(path.getStr()));
+ drive_type = GetDriveTypeW(o3tl::toW(path.getStr()));
if (DRIVE_NO_ROOT_DIR == drive_type)
return oslTranslateFileError(ERROR_INVALID_DRIVE);
@@ -1296,7 +1297,7 @@ static void get_volume_space_information(
const rtl::OUString& path, oslVolumeInfo *pInfo)
{
BOOL ret = GetDiskFreeSpaceExW(
- SAL_W(path.getStr()),
+ o3tl::toW(path.getStr()),
reinterpret_cast<PULARGE_INTEGER>(&pInfo->uFreeSpace),
reinterpret_cast<PULARGE_INTEGER>(&pInfo->uTotalSpace),
nullptr);
@@ -1343,7 +1344,7 @@ static oslFileError get_filesystem_attributes(
DWORD mcl;
DWORD flags;
- LPCWSTR pszPath = SAL_W(path.getStr());
+ LPCWSTR pszPath = o3tl::toW(path.getStr());
if (GetVolumeInformationW(pszPath, vn, MAX_PATH+1, &serial, &mcl, &flags, fsn, MAX_PATH+1))
{
// Currently sal does not use this value, instead MAX_PATH is used
@@ -1355,7 +1356,7 @@ static oslFileError get_filesystem_attributes(
pInfo->uMaxPathLength = MAX_PATH;
pInfo->uValidFields |= osl_VolumeInfo_Mask_FileSystemName;
- rtl_uString_newFromStr(&pInfo->ustrFileSystemName, SAL_U(fsn));
+ rtl_uString_newFromStr(&pInfo->ustrFileSystemName, o3tl::toU(fsn));
// volumes (even NTFS) will always be considered case
// insensitive because the Win32 API is not able to
@@ -1459,9 +1460,9 @@ static oslFileError SAL_CALL osl_getDriveInfo(
LPCWSTR lpLastBkSlash = wcschr( &lpFirstBkSlash[1], '\\' );
if ( lpLastBkSlash )
- rtl_uString_newFromStr_WithLength( &pStatus->ustrFileName, SAL_U(&lpFirstBkSlash[1]), lpLastBkSlash - lpFirstBkSlash - 1 );
+ rtl_uString_newFromStr_WithLength( &pStatus->ustrFileName, o3tl::toU(&lpFirstBkSlash[1]), lpLastBkSlash - lpFirstBkSlash - 1 );
else
- rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(&lpFirstBkSlash[1]) );
+ rtl_uString_newFromStr( &pStatus->ustrFileName, o3tl::toU(&lpFirstBkSlash[1]) );
pStatus->uValidFields |= osl_FileStatus_Mask_FileName;
}
}
@@ -1479,10 +1480,10 @@ static oslFileError SAL_CALL osl_getDriveInfo(
WCHAR szFileName[dwBufsizeConst + 16];
swprintf( szFileName, L"%s [%s]", cDrive, szBuffer );
- rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(szFileName) );
+ rtl_uString_newFromStr( &pStatus->ustrFileName, o3tl::toU(szFileName) );
}
else
- rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(cDrive) );
+ rtl_uString_newFromStr( &pStatus->ustrFileName, o3tl::toU(cDrive) );
}
pStatus->uValidFields |= osl_FileStatus_Mask_FileName;
break;
@@ -1496,17 +1497,17 @@ static oslFileError SAL_CALL osl_getDriveInfo(
WCHAR szFileName[dwBufsizeConst + 16];
swprintf( szFileName, L"%s [%s]", cDrive, szVolumeNameBuffer );
- rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(szFileName) );
+ rtl_uString_newFromStr( &pStatus->ustrFileName, o3tl::toU(szFileName) );
}
else
- rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(cDrive) );
+ rtl_uString_newFromStr( &pStatus->ustrFileName, o3tl::toU(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, SAL_U(cRoot) );
+ rtl_uString_newFromStr( &pStatus->ustrFileName, o3tl::toU(cRoot) );
break;
case DRIVE_UNKNOWN:
default:
@@ -1521,7 +1522,7 @@ static oslFileError SAL_CALL osl_getDriveInfo(
{
rtl_uString *ustrSystemPath = nullptr;
- rtl_uString_newFromStr( &ustrSystemPath, SAL_U(pItemImpl->cDriveString) );
+ rtl_uString_newFromStr( &ustrSystemPath, o3tl::toU(pItemImpl->cDriveString) );
oslFileError error = osl_getFileURLFromSystemPath( ustrSystemPath, &pStatus->ustrFileURL );
rtl_uString_release( ustrSystemPath );
if (error != osl_File_E_None)
@@ -1574,7 +1575,7 @@ oslFileError SAL_CALL osl_getFileStatus(
if ( uFieldMask & osl_FileStatus_Mask_Validate )
{
- HANDLE hFind = FindFirstFileW( SAL_W(rtl_uString_getStr( pItemImpl->m_pFullPath )), &pItemImpl->FindData );
+ HANDLE hFind = FindFirstFileW( o3tl::toW(rtl_uString_getStr( pItemImpl->m_pFullPath )), &pItemImpl->FindData );
if ( hFind != INVALID_HANDLE_VALUE )
FindClose( hFind );
@@ -1613,7 +1614,7 @@ oslFileError SAL_CALL osl_getFileStatus(
/* Most of the fields are already set, regardless of requiered fields */
- rtl_uString_newFromStr( &pStatus->ustrFileName, SAL_U(pItemImpl->FindData.cFileName) );
+ rtl_uString_newFromStr( &pStatus->ustrFileName, o3tl::toU(pItemImpl->FindData.cFileName) );
pStatus->uValidFields |= osl_FileStatus_Mask_FileName;
if ((FILE_ATTRIBUTE_REPARSE_POINT & pItemImpl->FindData.dwFileAttributes) &&
@@ -1646,8 +1647,8 @@ oslFileError SAL_CALL osl_getFileStatus(
if ( !pItemImpl->bFullPathNormalized )
{
::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
- sal_uInt32 nNewLen = GetCaseCorrectPathName( SAL_W(rtl_uString_getStr( pItemImpl->m_pFullPath )),
- SAL_W( aBuffer ),
+ sal_uInt32 nNewLen = GetCaseCorrectPathName( o3tl::toW(rtl_uString_getStr( pItemImpl->m_pFullPath )),
+ o3tl::toW( aBuffer ),
aBuffer.getBufSizeInSymbols(),
true );
@@ -1682,7 +1683,7 @@ oslFileError SAL_CALL osl_setFileAttributes(
if ( osl_File_E_None != error )
return error;
- dwFileAttributes = GetFileAttributesW( SAL_W(rtl_uString_getStr(ustrSysPath)) );
+ dwFileAttributes = GetFileAttributesW( o3tl::toW(rtl_uString_getStr(ustrSysPath)) );
if ( (DWORD)-1 != dwFileAttributes )
{
@@ -1694,7 +1695,7 @@ oslFileError SAL_CALL osl_setFileAttributes(
if ( uAttributes & osl_File_Attribute_Hidden )
dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
- fSuccess = SetFileAttributesW( SAL_W(rtl_uString_getStr(ustrSysPath)), dwFileAttributes );
+ fSuccess = SetFileAttributesW( o3tl::toW(rtl_uString_getStr(ustrSysPath)), dwFileAttributes );
}
else
{
@@ -1731,7 +1732,7 @@ oslFileError SAL_CALL osl_setFileTime(
if (error==osl_File_E_INVAL)
return error;
- hFile=CreateFileW(SAL_W(rtl_uString_getStr(sysPath)), GENERIC_WRITE, 0, nullptr , OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
+ hFile=CreateFileW(o3tl::toW(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 88bd38bcac86..e5fac8590a53 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -22,9 +22,10 @@
#include "file_url.hxx"
#include "file_error.hxx"
-#include "rtl/alloc.h"
+#include <rtl/alloc.h>
#include <rtl/ustring.hxx>
-#include "osl/mutex.h"
+#include <osl/mutex.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include "path_helper.hxx"
@@ -165,13 +166,13 @@ DWORD IsValidFilePath(rtl_uString *path, DWORD dwFlags, rtl_uString **corrected)
DWORD dwCandidatPathType = PATHTYPE_ERROR;
- 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 ) )
+ if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, o3tl::toU(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, SAL_U(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, o3tl::toU(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;
@@ -663,7 +664,7 @@ oslFileError osl_getSystemPathFromFileURL_( rtl_uString *strURL, rtl_uString **p
/* Indicates local root */
if ( nDecodedLen == nSkip )
- rtl_uString_newFromStr_WithLength( &strTempPath, SAL_U(WSTR_SYSTEM_ROOT_PATH), SAL_N_ELEMENTS(WSTR_SYSTEM_ROOT_PATH) - 1 );
+ rtl_uString_newFromStr_WithLength( &strTempPath, o3tl::toU(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 */
@@ -674,14 +675,14 @@ oslFileError osl_getSystemPathFromFileURL_( rtl_uString *strURL, rtl_uString **p
else
{
::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH );
- sal_uInt32 nNewLen = GetCaseCorrectPathName( SAL_W(pDecodedURL) + nSkip,
- SAL_W(aBuf),
+ sal_uInt32 nNewLen = GetCaseCorrectPathName( o3tl::toW(pDecodedURL) + nSkip,
+ o3tl::toW(aBuf),
aBuf.getBufSizeInSymbols(),
false );
if ( nNewLen <= MAX_PATH - 12
- || 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 ) )
+ || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, o3tl::toU(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, o3tl::toU(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 );
}
@@ -690,7 +691,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, SAL_U(WSTR_LONG_PATH_PREFIX_UNC), SAL_N_ELEMENTS( WSTR_LONG_PATH_PREFIX_UNC ) - 1 );
+ rtl_uString_newFromStr_WithLength( &strPrefix, o3tl::toU(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 );
@@ -702,7 +703,7 @@ oslFileError osl_getSystemPathFromFileURL_( rtl_uString *strURL, rtl_uString **p
{
rtl_uString *strSuffix = nullptr;
rtl_uString *strPrefix = nullptr;
- rtl_uString_newFromStr_WithLength( &strPrefix, SAL_U(WSTR_LONG_PATH_PREFIX), SAL_N_ELEMENTS( WSTR_LONG_PATH_PREFIX ) - 1 );
+ rtl_uString_newFromStr_WithLength( &strPrefix, o3tl::toU(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 );
@@ -888,8 +889,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 ? SAL_W(ustrSystemSearchPath->buffer) : nullptr;
- LPCWSTR lpszSearchFile = SAL_W(ustrSysPath->buffer);
+ LPCWSTR lpszSearchPath = ustrSystemSearchPath && ustrSystemSearchPath->length ? o3tl::toW(ustrSystemSearchPath->buffer) : nullptr;
+ LPCWSTR lpszSearchFile = o3tl::toW(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 */
@@ -906,7 +907,7 @@ oslFileError SAL_CALL osl_searchFileURL(
if ( dwResult )
{
- rtl_uString_newFromStr( &ustrSysPath, SAL_U(lpBuffer) );
+ rtl_uString_newFromStr( &ustrSysPath, o3tl::toU(lpBuffer) );
error = osl_getFileURLFromSystemPath( ustrSysPath, pustrPath );
}
else
@@ -917,7 +918,7 @@ oslFileError SAL_CALL osl_searchFileURL(
/* something went wrong, perhaps the path was absolute */
error = oslTranslateFileError( GetLastError() );
- hFind = FindFirstFileW( SAL_W(ustrSysPath->buffer), &aFindFileData );
+ hFind = FindFirstFileW( o3tl::toW(ustrSysPath->buffer), &aFindFileData );
if ( IsValidHandle(hFind) )
{
@@ -975,15 +976,15 @@ oslFileError SAL_CALL osl_getAbsoluteFileURL( rtl_uString* ustrBaseURL, rtl_uStr
{
osl_acquireMutex( g_CurrentDirectoryMutex );
- GetCurrentDirectoryW( aCurrentDir.getBufSizeInSymbols(), SAL_W(aCurrentDir) );
- SetCurrentDirectoryW( SAL_W(ustrBaseSysPath->buffer) );
+ GetCurrentDirectoryW( aCurrentDir.getBufSizeInSymbols(), o3tl::toW(aCurrentDir) );
+ SetCurrentDirectoryW( o3tl::toW(ustrBaseSysPath->buffer) );
}
- dwResult = GetFullPathNameW( SAL_W(ustrRelSysPath->buffer), aBuffer.getBufSizeInSymbols(), SAL_W(aBuffer), &lpFilePart );
+ dwResult = GetFullPathNameW( o3tl::toW(ustrRelSysPath->buffer), aBuffer.getBufSizeInSymbols(), o3tl::toW(aBuffer), &lpFilePart );
if ( ustrBaseSysPath )
{
- SetCurrentDirectoryW( SAL_W(aCurrentDir) );
+ SetCurrentDirectoryW( o3tl::toW(aCurrentDir) );
osl_releaseMutex( g_CurrentDirectoryMutex );
}
diff --git a/sal/osl/w32/module.cxx b/sal/osl/w32/module.cxx
index 6ba859263ac1..c6f11d2a1cf7 100644
--- a/sal/osl/w32/module.cxx
+++ b/sal/osl/w32/module.cxx
@@ -27,6 +27,7 @@
#include <osl/diagnose.h>
#include <osl/thread.h>
#include <osl/file.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <vector>
/*
@@ -44,7 +45,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(SAL_W(strModuleName->buffer))) );
+ SAL_INFO( "sal.osl", "osl_loadModule: " << OUString(strModuleName->buffer, wcslen(o3tl::toW(strModuleName->buffer))) );
OSL_ASSERT(strModuleName);
nError = osl_getSystemPathFromFileURL(strModuleName, &Module);
@@ -52,10 +53,10 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 /*nRtldM
if ( osl_File_E_None != nError )
rtl_uString_assign(&Module, strModuleName);
- h = LoadLibraryW(SAL_W(Module->buffer));
+ h = LoadLibraryW(o3tl::toW(Module->buffer));
if (h == nullptr)
- h = LoadLibraryExW(SAL_W(Module->buffer), nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);
+ h = LoadLibraryExW(o3tl::toW(Module->buffer), nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);
// In case of long path names (\\?\c:\...) try to shorten the filename.
// LoadLibrary cannot handle file names which exceed 260 letters.
@@ -65,7 +66,7 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 /*nRtldM
if (h == nullptr && Module->length > 260)
{
std::vector<WCHAR> vec(Module->length + 1);
- DWORD len = GetShortPathNameW(SAL_W(Module->buffer), &vec[0], Module->length + 1);
+ DWORD len = GetShortPathNameW(o3tl::toW(Module->buffer), &vec[0], Module->length + 1);
if (len )
{
h = LoadLibraryW(&vec[0]);
@@ -113,7 +114,7 @@ oslModule osl_loadModuleRelativeAscii(
sal_Bool SAL_CALL
osl_getModuleHandle(rtl_uString *pModuleName, oslModule *pResult)
{
- LPCWSTR pName = pModuleName ? SAL_W(pModuleName->buffer) : nullptr;
+ LPCWSTR pName = pModuleName ? o3tl::toW(pModuleName->buffer) : nullptr;
HMODULE h = GetModuleHandleW(pName);
if( h )
{
@@ -254,19 +255,19 @@ static bool SAL_CALL osl_addressGetModuleURL_NT4_( void *pv, rtl_uString **pustr
::osl::LongPathBuffer< sal_Unicode > aModuleFileName( MAX_LONG_PATH );
LPWSTR lpSearchPath = nullptr;
- if ( GetModuleFileNameW( nullptr, SAL_W(aModuleFileName), aModuleFileName.getBufSizeInSymbols() ) )
+ if ( GetModuleFileNameW( nullptr, o3tl::toW(aModuleFileName), aModuleFileName.getBufSizeInSymbols() ) )
{
- wchar_t *pLastBkSlash = wcsrchr( SAL_W(aModuleFileName), L'\\' );
+ wchar_t *pLastBkSlash = wcsrchr( o3tl::toW(aModuleFileName), L'\\' );
if (
pLastBkSlash &&
- pLastBkSlash > SAL_W(aModuleFileName)
+ pLastBkSlash > o3tl::toW(aModuleFileName)
&& *(pLastBkSlash - 1) != L':'
&& *(pLastBkSlash - 1) != L'\\'
)
{
*pLastBkSlash = 0;
- lpSearchPath = SAL_W(aModuleFileName);
+ lpSearchPath = o3tl::toW(aModuleFileName);
}
}
@@ -288,7 +289,7 @@ static bool SAL_CALL osl_addressGetModuleURL_NT4_( void *pv, rtl_uString **pustr
{
rtl_uString *ustrSysPath = nullptr;
- rtl_uString_newFromStr( &ustrSysPath, SAL_U(ModuleInfo.LoadedImageName) );
+ rtl_uString_newFromStr( &ustrSysPath, o3tl::toU(ModuleInfo.LoadedImageName) );
OSL_ASSERT(ustrSysPath != nullptr);
osl_getFileURLFromSystemPath( ustrSysPath, pustrURL );
rtl_uString_release( ustrSysPath );
@@ -365,7 +366,7 @@ static bool SAL_CALL osl_addressGetModuleURL_NT_( void *pv, rtl_uString **pustrU
::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
rtl_uString *ustrSysPath = nullptr;
- GetModuleFileNameW( lpModules[iModule], SAL_W(aBuffer), aBuffer.getBufSizeInSymbols() );
+ GetModuleFileNameW( lpModules[iModule], o3tl::toW(aBuffer), aBuffer.getBufSizeInSymbols() );
rtl_uString_newFromStr( &ustrSysPath, aBuffer );
osl_getFileURLFromSystemPath( ustrSysPath, pustrURL );
diff --git a/sal/osl/w32/nlsupport.cxx b/sal/osl/w32/nlsupport.cxx
index 8721804fd0b2..9a7c41040c26 100644
--- a/sal/osl/w32/nlsupport.cxx
+++ b/sal/osl/w32/nlsupport.cxx
@@ -34,6 +34,7 @@
#include <osl/diagnose.h>
#include <osl/process.h>
#include <rtl/tencinfo.h>
+#include <o3tl/char16_t2wchar_t.hxx>
/* XXX NOTE:
* http://msdn.microsoft.com/en-us/library/windows/desktop/dd373848.aspx
@@ -167,10 +168,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, SAL_W(pLocale->Language->buffer) );
+ wcscpy( params.Language, o3tl::toW(pLocale->Language->buffer) );
if( pLocale->Country && pLocale->Country->length < ELP_COUNTRY_FIELD_LENGTH )
- wcscpy( params.Country, SAL_W(pLocale->Country->buffer) );
+ wcscpy( params.Country, o3tl::toW(pLocale->Country->buffer) );
/* save pointer to local structure in TLS */
TlsSetValue( g_dwTLSLocaleEncId, &params );
@@ -200,7 +201,7 @@ void imp_getProcessLocale( rtl_Locale ** ppLocale )
if( GetLocaleInfoW( localeId, LOCALE_SISO639LANGNAME , langCode, ELP_LANGUAGE_FIELD_LENGTH ) &&
GetLocaleInfoW( localeId, LOCALE_SISO3166CTRYNAME , ctryCode, ELP_COUNTRY_FIELD_LENGTH ) )
{
- *ppLocale = rtl_locale_register( SAL_U(langCode), SAL_U(ctryCode), u"" );
+ *ppLocale = rtl_locale_register( o3tl::toU(langCode), o3tl::toU(ctryCode), u"" );
}
else
{
diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx
index 2240ade36b6f..febc4f19c562 100644
--- a/sal/osl/w32/pipe.cxx
+++ b/sal/osl/w32/pipe.cxx
@@ -28,6 +28,7 @@
#include <osl/process.h>
#include <rtl/alloc.h>
#include <sal/log.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <cassert>
#include <string.h>
@@ -167,7 +168,7 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options
{
SetLastError(ERROR_SUCCESS);
- pPipe->m_NamedObject = CreateMutexW(nullptr, FALSE, SAL_W(name->buffer));
+ pPipe->m_NamedObject = CreateMutexW(nullptr, FALSE, o3tl::toW(name->buffer));
if (pPipe->m_NamedObject)
{
@@ -178,7 +179,7 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options
/* try to open system pipe */
pPipe->m_File = CreateNamedPipeW(
- SAL_W(path->buffer),
+ o3tl::toW(path->buffer),
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
PIPE_WAIT | PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE,
PIPE_UNLIMITED_INSTANCES,
@@ -208,13 +209,13 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options
do
{
/* free instance should be available first */
- bPipeAvailable = WaitNamedPipeW(SAL_W(path->buffer), NMPWAIT_WAIT_FOREVER);
+ bPipeAvailable = WaitNamedPipeW(o3tl::toW(path->buffer), NMPWAIT_WAIT_FOREVER);
/* first try to open system pipe */
if (bPipeAvailable)
{
pPipe->m_File = CreateFileW(
- SAL_W(path->buffer),
+ o3tl::toW(path->buffer),
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr,
@@ -344,7 +345,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
// prepare for next accept
pPipe->m_File =
- CreateNamedPipeW(SAL_W(path->buffer),
+ CreateNamedPipeW(o3tl::toW(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/process.cxx b/sal/osl/w32/process.cxx
index 7d989d548477..0fe42bbdbe27 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -31,6 +31,7 @@
#include <memory>
#include <osl/nlsupport.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <filetime.hxx>
#include <nlsupport.hxx>
@@ -286,7 +287,7 @@ oslProcessError bootstrap_getExecutableFile(rtl_uString ** ppFileURL)
::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
DWORD buflen = 0;
- if ((buflen = GetModuleFileNameW (nullptr, SAL_W(aBuffer), aBuffer.getBufSizeInSymbols())) > 0)
+ if ((buflen = GetModuleFileNameW (nullptr, o3tl::toW(aBuffer), aBuffer.getBufSizeInSymbols())) > 0)
{
rtl_uString * pAbsPath = nullptr;
rtl_uString_newFromStr_WithLength (&pAbsPath, aBuffer, buflen);
@@ -336,7 +337,7 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char **)
for (i = 0; i < nArgs; i++)
{
/* Convert to unicode */
- rtl_uString_newFromStr( &(ppArgs[i]), SAL_U(wargv[i]) );
+ rtl_uString_newFromStr( &(ppArgs[i]), o3tl::toU(wargv[i]) );
}
if (ppArgs[0] != nullptr)
{
@@ -345,7 +346,7 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char **)
DWORD dwResult = 0;
dwResult = SearchPathW (
- nullptr, SAL_W(ppArgs[0]->buffer), L".exe", aBuffer.getBufSizeInSymbols(), SAL_W(aBuffer), nullptr);
+ nullptr, o3tl::toW(ppArgs[0]->buffer), L".exe", aBuffer.getBufSizeInSymbols(), o3tl::toW(aBuffer), nullptr);
if ((0 < dwResult) && (dwResult < aBuffer.getBufSizeInSymbols()))
{
/* Replace argv[0] with its absolute path */
@@ -445,9 +446,9 @@ oslProcessError SAL_CALL osl_getEnvironment(rtl_uString *ustrVar, rtl_uString **
{
WCHAR buff[ENV_BUFFER_SIZE];
- if (GetEnvironmentVariableW(SAL_W(ustrVar->buffer), buff, ENV_BUFFER_SIZE) > 0)
+ if (GetEnvironmentVariableW(o3tl::toW(ustrVar->buffer), buff, ENV_BUFFER_SIZE) > 0)
{
- rtl_uString_newFromStr(ustrValue, SAL_U(buff));
+ rtl_uString_newFromStr(ustrValue, o3tl::toU(buff));
return osl_Process_E_None;
}
return osl_Process_E_Unknown;
@@ -456,8 +457,8 @@ oslProcessError SAL_CALL osl_getEnvironment(rtl_uString *ustrVar, rtl_uString **
oslProcessError SAL_CALL osl_setEnvironment(rtl_uString *ustrVar, rtl_uString *ustrValue)
{
// set Windows environment variable
- LPCWSTR lpName = SAL_W(ustrVar->buffer);
- LPCWSTR lpValue = SAL_W(ustrValue->buffer);
+ LPCWSTR lpName = o3tl::toW(ustrVar->buffer);
+ LPCWSTR lpValue = o3tl::toW(ustrValue->buffer);
if (SetEnvironmentVariableW(lpName, lpValue))
{
auto buffer = std::unique_ptr<wchar_t[]>(
@@ -475,7 +476,7 @@ oslProcessError SAL_CALL osl_clearEnvironment(rtl_uString *ustrVar)
{
// delete the variable from the current process environment
// by setting SetEnvironmentVariable's second parameter to NULL
- LPCWSTR lpName = SAL_W(ustrVar->buffer);
+ LPCWSTR lpName = o3tl::toW(ustrVar->buffer);
if (SetEnvironmentVariableW(lpName, nullptr))
{
auto buffer = std::unique_ptr<wchar_t[]>(
@@ -494,7 +495,7 @@ oslProcessError SAL_CALL osl_getProcessWorkingDir( rtl_uString **pustrWorkingDir
DWORD dwLen = 0;
osl_acquireMutex( g_CurrentDirectoryMutex );
- dwLen = GetCurrentDirectoryW( aBuffer.getBufSizeInSymbols(), SAL_W(aBuffer) );
+ dwLen = GetCurrentDirectoryW( aBuffer.getBufSizeInSymbols(), o3tl::toW(aBuffer) );
osl_releaseMutex( g_CurrentDirectoryMutex );
if ( dwLen && dwLen < aBuffer.getBufSizeInSymbols() )
diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx
index 0cdc6a2eefbc..da48691685fc 100644
--- a/sal/osl/w32/procimpl.cxx
+++ b/sal/osl/w32/procimpl.cxx
@@ -35,6 +35,7 @@
#include <rtl/ustrbuf.hxx>
#include "secimpl.hxx"
#include <osl/file.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <vector>
#include <algorithm>
@@ -112,7 +113,7 @@ namespace /* private */
while (size_t l = wcslen(p))
{
- environment->push_back(SAL_U(p));
+ environment->push_back(o3tl::toU(p));
p += l + 1;
}
FreeEnvironmentStringsW(env);
@@ -279,7 +280,7 @@ namespace /* private */
std::vector<sal_Unicode> vec(path.getLength() + 1);
//GetShortPathNameW only works if the file can be found!
const DWORD len = GetShortPathNameW(
- SAL_W(path.getStr()), SAL_W(&vec[0]), path.getLength() + 1);
+ o3tl::toW(path.getStr()), o3tl::toW(&vec[0]), path.getLength() + 1);
if (!len && GetLastError() == ERROR_FILE_NOT_FOUND
&& extension.getLength())
@@ -288,7 +289,7 @@ namespace /* private */
std::vector<sal_Unicode> vec2(
extPath.getLength() + 1);
const DWORD len2 = GetShortPathNameW(
- SAL_W(extPath.getStr()), SAL_W(&vec2[0]), extPath.getLength() + 1);
+ o3tl::toW(extPath.getStr()), o3tl::toW(&vec2[0]), extPath.getLength() + 1);
ret = rtl::OUString(&vec2[0], len2);
}
else
@@ -468,7 +469,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()) ? SAL_W(cwd.getStr()) : nullptr;
+ LPCWSTR p_cwd = (cwd.getLength()) ? o3tl::toW(cwd.getStr()) : nullptr;
if ((Options & osl_Process_DETACHED) && !(flags & CREATE_NEW_CONSOLE))
flags |= DETACHED_PROCESS;
@@ -533,14 +534,14 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
{
bRet = CreateProcessAsUserW(
static_cast<oslSecurityImpl*>(Security)->m_hToken,
- nullptr, const_cast<LPWSTR>(SAL_W(cmdline.getStr())), nullptr, nullptr,
+ nullptr, const_cast<LPWSTR>(o3tl::toW(cmdline.getStr())), nullptr, nullptr,
b_inherit_handles, flags, p_environment, p_cwd,
&startup_info, &process_info);
}
else
{
bRet = CreateProcessW(
- nullptr, const_cast<LPWSTR>(SAL_W(cmdline.getStr())), nullptr, nullptr,
+ nullptr, const_cast<LPWSTR>(o3tl::toW(cmdline.getStr())), nullptr, nullptr,
b_inherit_handles, flags, p_environment, p_cwd,
&startup_info, &process_info);
}
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx
index 2de8f4d0e5ed..e9d573411d64 100644
--- a/sal/osl/w32/profile.cxx
+++ b/sal/osl/w32/profile.cxx
@@ -30,6 +30,7 @@
#include <osl/file.h>
#include <rtl/alloc.h>
#include <sal/macros.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <algorithm>
#include <vector>
using std::min;
@@ -382,12 +383,12 @@ DWORD GetPrivateProfileStringWrapper(const osl_TProfileImpl* pProfile,
OSL_ASSERT(pDefault);
}
- LPCWSTR pWSection = (pSection ? SAL_W(rtl_uString_getStr(pSection)) : nullptr),
- pWEntry = (pEntry ? SAL_W(rtl_uString_getStr(pEntry)) : nullptr),
- pWDefault = (pDefault ? SAL_W(rtl_uString_getStr(pDefault)) : nullptr);
+ LPCWSTR pWSection = (pSection ? o3tl::toW(rtl_uString_getStr(pSection)) : nullptr),
+ pWEntry = (pEntry ? o3tl::toW(rtl_uString_getStr(pEntry)) : nullptr),
+ pWDefault = (pDefault ? o3tl::toW(rtl_uString_getStr(pDefault)) : nullptr);
std::vector<wchar_t> aBuf(MaxLen + 1);
- GetPrivateProfileStringW(pWSection, pWEntry, pWDefault, &aBuf[0], MaxLen, SAL_W(rtl_uString_getStr(pProfile->m_strFileName)));
+ GetPrivateProfileStringW(pWSection, pWEntry, pWDefault, &aBuf[0], MaxLen, o3tl::toW(rtl_uString_getStr(pProfile->m_strFileName)));
if (pDefault)
rtl_uString_release(pDefault);
@@ -419,11 +420,11 @@ BOOL WritePrivateProfileStringWrapper(const osl_TProfileImpl* pProfile,
OSL_ASSERT(pString);
}
- LPCWSTR pWSection = SAL_W(pSection->buffer),
- pWEntry = (pEntry ? SAL_W(rtl_uString_getStr(pEntry)) : nullptr),
- pWString = (pString ? SAL_W(rtl_uString_getStr(pString)) : nullptr);
+ LPCWSTR pWSection = o3tl::toW(pSection->buffer),
+ pWEntry = (pEntry ? o3tl::toW(rtl_uString_getStr(pEntry)) : nullptr),
+ pWString = (pString ? o3tl::toW(rtl_uString_getStr(pString)) : nullptr);
- BOOL bResult = WritePrivateProfileStringW(pWSection, pWEntry, pWString, SAL_W(rtl_uString_getStr(pProfile->m_strFileName)));
+ BOOL bResult = WritePrivateProfileStringW(pWSection, pWEntry, pWString, o3tl::toW(rtl_uString_getStr(pProfile->m_strFileName)));
if (pString)
rtl_uString_release(pString);
@@ -897,7 +898,7 @@ bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, rtl
else if ((rtl_ustr_ascii_compare_WithLength(pPath, RTL_CONSTASCII_LENGTH(STR_INI_METASYS), STR_INI_METASYS) == 0) &&
((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METASYS)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METASYS)] == '/')))
{
- if (((nPathLen = GetWindowsDirectoryW(SAL_W(aPath), aPath.getBufSizeInSymbols())) == 0) || (nPathLen >= aPath.getBufSizeInSymbols()))
+ if (((nPathLen = GetWindowsDirectoryW(o3tl::toW(aPath), aPath.getBufSizeInSymbols())) == 0) || (nPathLen >= aPath.getBufSizeInSymbols()))
return false;
if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METASYS))
@@ -1008,7 +1009,7 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff
else
{
std::vector<wchar_t> aBuf(MaxLen + 1);
- GetPrivateProfileSectionNamesW(&aBuf[0], MaxLen, SAL_W(rtl_uString_getStr(pProfile->m_strFileName)));
+ GetPrivateProfileSectionNamesW(&aBuf[0], MaxLen, o3tl::toW(rtl_uString_getStr(pProfile->m_strFileName)));
n = WideCharToMultiByte(CP_ACP, 0, &aBuf[0], -1, pszBuffer, MaxLen, nullptr, nullptr);
}
@@ -1076,7 +1077,7 @@ static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption Profi
if (! bWriteable)
{
- pFile->m_Handle = CreateFileW( SAL_W(rtl_uString_getStr( strFileName )), GENERIC_READ,
+ pFile->m_Handle = CreateFileW( o3tl::toW(rtl_uString_getStr( strFileName )), GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
@@ -1089,7 +1090,7 @@ static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption Profi
SAL_INFO("sal.osl", "opening read/write " << pszFilename);
#endif
- if ((pFile->m_Handle = CreateFileW( SAL_W(rtl_uString_getStr( strFileName )), GENERIC_READ | GENERIC_WRITE,
+ if ((pFile->m_Handle = CreateFileW( o3tl::toW(rtl_uString_getStr( strFileName )), GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr))
== INVALID_HANDLE_VALUE)
@@ -1819,13 +1820,13 @@ static bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
ustrExtension=nullptr;
/* unlink bak */
- DeleteFileW( SAL_W(rtl_uString_getStr( ustrBakFile )) );
+ DeleteFileW( o3tl::toW(rtl_uString_getStr( ustrBakFile )) );
/* rename ini bak */
- MoveFileExW( SAL_W(rtl_uString_getStr( ustrIniFile )), SAL_W(rtl_uString_getStr( ustrBakFile )), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
+ MoveFileExW( o3tl::toW(rtl_uString_getStr( ustrIniFile )), o3tl::toW(rtl_uString_getStr( ustrBakFile )), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
/* rename tmp ini */
- MoveFileExW( SAL_W(rtl_uString_getStr( ustrTmpFile )), SAL_W(rtl_uString_getStr( ustrIniFile )), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
+ MoveFileExW( o3tl::toW(rtl_uString_getStr( ustrTmpFile )), o3tl::toW(rtl_uString_getStr( ustrIniFile )), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
return false;
}
@@ -1975,7 +1976,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
while ((strPath[i] != L'"') && (strPath[i] != L'\0'))
i++;
- WideCharToMultiByte(CP_ACP,0, SAL_W(strPath), i, Product, sizeof(Product), nullptr, nullptr);
+ WideCharToMultiByte(CP_ACP,0, o3tl::toW(strPath), i, Product, sizeof(Product), nullptr, nullptr);
Product[i] = '\0';
strPath += i;
@@ -2124,7 +2125,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
/* if we have no product identification use the executable file name */
if (*Product == 0)
{
- WideCharToMultiByte(CP_ACP,0, SAL_W(strExecutable->buffer + nPos + 1), -1, Product, sizeof(Product), nullptr, nullptr);
+ WideCharToMultiByte(CP_ACP,0, o3tl::toW(strExecutable->buffer + nPos + 1), -1, Product, sizeof(Product), nullptr, nullptr);
/* remove extension */
if ((pChr = strrchr(Product, '.')) != nullptr)
@@ -2147,7 +2148,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
{
::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, SAL_W(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr);
+ WideCharToMultiByte(CP_ACP,0, o3tl::toW(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr);
/* if file not exists, remove any specified subdirectories
like "bin" or "program" */
@@ -2171,7 +2172,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
}
else
{
- dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, SAL_W(aPath + nPos + 1), aPath.getBufSizeInSymbols() - (nPos + 1) );
+ dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, o3tl::toW(aPath + nPos + 1), aPath.getBufSizeInSymbols() - (nPos + 1) );
}
}
else
@@ -2196,7 +2197,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
{
::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, SAL_W(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr);
+ WideCharToMultiByte(CP_ACP,0, o3tl::toW(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr);
if ((access(aTmpPath, 0) < 0) && (Product[0] != '\0'))
{
@@ -2245,7 +2246,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
if (Buffer[0] != '\0')
{
dwPathLen = MultiByteToWideChar(
- CP_ACP, 0, Buffer, -1, SAL_W(aPath), aPath.getBufSizeInSymbols() );
+ CP_ACP, 0, Buffer, -1, o3tl::toW(aPath), aPath.getBufSizeInSymbols() );
dwPathLen -=1;
/* build full path */
@@ -2266,7 +2267,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
int n;
if ((n = WideCharToMultiByte(
- CP_ACP,0, SAL_W(aPath), -1, aTmpPath2,
+ CP_ACP,0, o3tl::toW(aPath), -1, aTmpPath2,
aTmpPath2.getBufSizeInSymbols(), nullptr, nullptr))
> 0)
{
@@ -2275,7 +2276,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
{
dwPathLen += MultiByteToWideChar(
CP_ACP, 0, SVERSION_USER, -1,
- SAL_W(aPath + dwPathLen),
+ o3tl::toW(aPath + dwPathLen),
aPath.getBufSizeInSymbols() - dwPathLen );
}
}
diff --git a/sal/osl/w32/security.cxx b/sal/osl/w32/security.cxx
index b25e3076af70..120b5c98258d 100644
--- a/sal/osl/w32/security.cxx
+++ b/sal/osl/w32/security.cxx
@@ -25,6 +25,7 @@
#include <osl/file.h>
#include <systools/win32/uwinapi.h>
#include <sal/macros.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include "secimpl.hxx"
/* Data for use in (un)LoadProfile Functions */
@@ -88,11 +89,11 @@ oslSecurityError SAL_CALL osl_loginUser( rtl_uString *strUserName, rtl_uString *
oslSecurityError ret;
sal_Unicode* strUser;
- sal_Unicode* strDomain = SAL_U(_wcsdup(SAL_W(rtl_uString_getStr(strUserName))));
+ sal_Unicode* strDomain = o3tl::toU(_wcsdup(o3tl::toW(rtl_uString_getStr(strUserName))));
HANDLE hUserToken;
LUID luid;
- if (nullptr != (strUser = SAL_U(wcschr(SAL_W(strDomain), L'/'))))
+ if (nullptr != (strUser = o3tl::toU(wcschr(o3tl::toW(strDomain), L'/'))))
*strUser++ = L'\0';
else
{
@@ -104,7 +105,7 @@ oslSecurityError SAL_CALL osl_loginUser( rtl_uString *strUserName, rtl_uString *
OSL_ASSERT(LookupPrivilegeValue(nullptr, SE_TCB_NAME, &luid));
(void) luid;
- if (LogonUserW(SAL_W(strUser), strDomain ? SAL_W(strDomain) : L"", SAL_W(rtl_uString_getStr(strPasswd)),
+ if (LogonUserW(o3tl::toW(strUser), strDomain ? o3tl::toW(strDomain) : L"", o3tl::toW(rtl_uString_getStr(strPasswd)),
LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT,
&hUserToken))
{
@@ -113,7 +114,7 @@ oslSecurityError SAL_CALL osl_loginUser( rtl_uString *strUserName, rtl_uString *
pSecImpl->m_pNetResource = nullptr;
pSecImpl->m_hToken = hUserToken;
pSecImpl->m_hProfile = nullptr;
- wcscpy(SAL_W(pSecImpl->m_User), SAL_W(strUser));
+ wcscpy(o3tl::toW(pSecImpl->m_User), o3tl::toW(strUser));
*pSecurity = pSecImpl;
ret = osl_Security_E_None;
@@ -145,25 +146,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(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(o3tl::toW(remoteName), L"\\\\");
+ wcscat(o3tl::toW(remoteName), o3tl::toW(rtl_uString_getStr(strFileServer)));
+ wcscat(o3tl::toW(remoteName), L"\\");
+ wcscat(o3tl::toW(remoteName), o3tl::toW(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)));
+ wcscpy(o3tl::toW(userName), o3tl::toW(rtl_uString_getStr(strFileServer)));
+ wcscat(o3tl::toW(userName), L"\\");
+ wcscat(o3tl::toW(userName), o3tl::toW(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 = SAL_W(remoteName);
+ netResource.lpRemoteName = o3tl::toW(remoteName);
netResource.lpComment = nullptr;
netResource.lpProvider = nullptr;
- err = WNetAddConnection2W(&netResource, SAL_W(rtl_uString_getStr(strPasswd)), SAL_W(userName), 0);
+ err = WNetAddConnection2W(&netResource, o3tl::toW(rtl_uString_getStr(strPasswd)), o3tl::toW(userName), 0);
if ((err == NO_ERROR) || (err == ERROR_ALREADY_ASSIGNED))
{
@@ -174,7 +175,7 @@ oslSecurityError SAL_CALL osl_loginUserOnFileServer(rtl_uString *strUserName,
pSecImpl->m_hToken = nullptr;
pSecImpl->m_hProfile = nullptr;
- wcscpy(SAL_W(pSecImpl->m_User), SAL_W(rtl_uString_getStr(strUserName)));
+ wcscpy(o3tl::toW(pSecImpl->m_User), o3tl::toW(rtl_uString_getStr(strUserName)));
*pSecurity = pSecImpl;
@@ -346,12 +347,12 @@ sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent)
sal_Unicode *Ident=static_cast<sal_Unicode *>(malloc(88*sizeof(sal_Unicode)));
/* prepare S-SID_REVISION- */
- dwSidSize=wsprintfW(SAL_W(Ident), L"S-%lu-", SID_REVISION);
+ dwSidSize=wsprintfW(o3tl::toW(Ident), L"S-%lu-", SID_REVISION);
/* prepare SidIdentifierAuthority */
if ((psia->Value[0] != 0) || (psia->Value[1] != 0))
{
- dwSidSize+=wsprintfW(SAL_W(Ident) + wcslen(SAL_W(Ident)),
+ dwSidSize+=wsprintfW(o3tl::toW(Ident) + wcslen(o3tl::toW(Ident)),
L"0x%02hx%02hx%02hx%02hx%02hx%02hx",
(USHORT)psia->Value[0],
(USHORT)psia->Value[1],
@@ -362,7 +363,7 @@ sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent)
}
else
{
- dwSidSize+=wsprintfW(SAL_W(Ident) + wcslen(SAL_W(Ident)),
+ dwSidSize+=wsprintfW(o3tl::toW(Ident) + wcslen(o3tl::toW(Ident)),
L"%lu",
(ULONG)(psia->Value[5] ) +
(ULONG)(psia->Value[4] << 8) +
@@ -373,7 +374,7 @@ sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent)
/* loop through SidSubAuthorities */
for (dwCounter=0; dwCounter < dwSubAuthorities; dwCounter++)
{
- dwSidSize+=wsprintfW(SAL_W(Ident) + dwSidSize, L"-%lu",
+ dwSidSize+=wsprintfW(o3tl::toW(Ident) + dwSidSize, L"-%lu",
*GetSidSubAuthority(pSid, dwCounter) );
}
@@ -396,9 +397,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, SAL_W(Ident), &needed) != NO_ERROR)
+ if (WNetGetUserW(nullptr, o3tl::toW(Ident), &needed) != NO_ERROR)
{
- wcscpy(SAL_W(Ident), L"unknown");
+ wcscpy(o3tl::toW(Ident), L"unknown");
Ident[7] = L'\0';
}
@@ -434,7 +435,7 @@ sal_Bool SAL_CALL osl_getHomeDir(oslSecurity Security, rtl_uString **pustrDirect
if (pSecImpl->m_pNetResource != nullptr)
{
- rtl_uString_newFromStr( &ustrSysDir, SAL_U(pSecImpl->m_pNetResource->lpRemoteName));
+ rtl_uString_newFromStr( &ustrSysDir, o3tl::toU(pSecImpl->m_pNetResource->lpRemoteName));
bSuccess = osl_File_E_None == osl_getFileURLFromSystemPath( ustrSysDir, pustrDirectory );
}
@@ -463,7 +464,7 @@ sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString **pustrDire
{
rtl_uString *ustrSysDir = nullptr;
- rtl_uString_newFromStr( &ustrSysDir, SAL_U(pSecImpl->m_pNetResource->lpRemoteName));
+ rtl_uString_newFromStr( &ustrSysDir, o3tl::toU(pSecImpl->m_pNetResource->lpRemoteName));
bSuccess = osl_File_E_None == osl_getFileURLFromSystemPath( ustrSysDir, pustrDirectory);
if ( ustrSysDir )
@@ -483,7 +484,7 @@ sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString **pustrDire
if ( !GetSpecialFolder( &ustrFile, CSIDL_APPDATA) )
{
- OSL_VERIFY(GetWindowsDirectoryW(SAL_W(sFile), _MAX_DIR) > 0);
+ OSL_VERIFY(GetWindowsDirectoryW(o3tl::toW(sFile), _MAX_DIR) > 0);
rtl_uString_newFromStr( &ustrFile, sFile);
}
@@ -549,7 +550,7 @@ sal_Bool SAL_CALL osl_loadUserProfile(oslSecurity Security)
ZeroMemory(&pi, sizeof(pi));
pi.dwSize = sizeof(pi);
- pi.lpUserName = SAL_W(rtl_uString_getStr(buffer));
+ pi.lpUserName = o3tl::toW(rtl_uString_getStr(buffer));
pi.dwFlags = PI_NOUI;
if (fLoadUserProfile(hAccessToken, &pi))
@@ -627,7 +628,7 @@ static bool GetSpecialFolder(rtl_uString **strPath, int nFolder)
if (pSHGetSpecialFolderPathW)
{
- if (pSHGetSpecialFolderPathW(GetActiveWindow(), SAL_W(PathW), nFolder, TRUE))
+ if (pSHGetSpecialFolderPathW(GetActiveWindow(), o3tl::toW(PathW), nFolder, TRUE))
{
rtl_uString_newFromStr( strPath, PathW);
bRet = true;
@@ -677,8 +678,8 @@ static bool GetSpecialFolder(rtl_uString **strPath, int nFolder)
if ((lRet == ERROR_SUCCESS) && (Type == REG_SZ))
{
- if (_waccess(SAL_W(PathW), 0) < 0)
- CreateDirectoryW(SAL_W(PathW), nullptr);
+ if (_waccess(o3tl::toW(PathW), 0) < 0)
+ CreateDirectoryW(o3tl::toW(PathW), nullptr);
hr = pSHGetSpecialFolderLocation(GetActiveWindow(), nFolder, &pidl);
}
@@ -689,11 +690,11 @@ static bool GetSpecialFolder(rtl_uString **strPath, int nFolder)
if (SUCCEEDED(hr))
{
- if (pSHGetPathFromIDListW(pidl, SAL_W(PathW)))
+ if (pSHGetPathFromIDListW(pidl, o3tl::toW(PathW)))
{
/* if directory does not exist, create it */
- if (_waccess(SAL_W(PathW), 0) < 0)
- CreateDirectoryW(SAL_W(PathW), nullptr);
+ if (_waccess(o3tl::toW(PathW), 0) < 0)
+ CreateDirectoryW(o3tl::toW(PathW), nullptr);
rtl_uString_newFromStr( strPath, PathW);
bRet = true;
@@ -790,18 +791,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,
- SAL_W(UserName), &nUserName,
- SAL_W(DomainName), &nDomainName, &sUse))
+ o3tl::toW(UserName), &nUserName,
+ o3tl::toW(DomainName), &nDomainName, &sUse))
{
if (bIncludeDomain)
{
- wcscpy(SAL_W(Name), SAL_W(DomainName));
- wcscat(SAL_W(Name), L"/");
- wcscat(SAL_W(Name), SAL_W(UserName));
+ wcscpy(o3tl::toW(Name), o3tl::toW(DomainName));
+ wcscat(o3tl::toW(Name), L"/");
+ wcscat(o3tl::toW(Name), o3tl::toW(UserName));
}
else
{
- wcscpy(SAL_W(Name), SAL_W(UserName));
+ wcscpy(o3tl::toW(Name), o3tl::toW(UserName));
}
}
@@ -820,7 +821,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, SAL_W(pNameW), &needed) == NO_ERROR)
+ if (WNetGetUserW(nullptr, o3tl::toW(pNameW), &needed) == NO_ERROR)
{
rtl_uString_newFromStr( strName, pNameW);
@@ -830,7 +831,7 @@ static bool SAL_CALL getUserNameImpl(oslSecurity Security, rtl_uString **strName
}
else if (pSecImpl->m_User[0] != '\0')
{
- rtl_uString_newFromStr(strName, SAL_U(pSecImpl->m_pNetResource->lpRemoteName));
+ rtl_uString_newFromStr(strName, o3tl::toU(pSecImpl->m_pNetResource->lpRemoteName));
if (pNameW)
free(pNameW);
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index 6cd8c8efe244..9c6715be2627 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -23,6 +23,7 @@
#include <osl/diagnose.h>
#include <rtl/alloc.h>
#include <sal/log.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
#include "sockimpl.hxx"
@@ -357,7 +358,7 @@ oslSocketAddr SAL_CALL osl_createInetBroadcastAddr (
if (strDottedAddr && strDottedAddr->length)
{
IN_ADDR addr;
- INT ret = InetPtonW(AF_INET, SAL_W(strDottedAddr->buffer), & addr);
+ INT ret = InetPtonW(AF_INET, o3tl::toW(strDottedAddr->buffer), & addr);
if (1 == ret)
{
nAddr = addr.S_un.S_addr;
@@ -403,7 +404,7 @@ oslSocketAddr SAL_CALL osl_createInetSocketAddr (
sal_uInt32 Addr;
IN_ADDR addr;
- INT ret = InetPtonW(AF_INET, SAL_W(strDottedAddr->buffer), & addr);
+ INT ret = InetPtonW(AF_INET, o3tl::toW(strDottedAddr->buffer), & addr);
Addr = ret == 1 ? addr.S_un.S_addr : OSL_INADDR_NONE;
oslSocketAddr pAddr = nullptr;
@@ -493,7 +494,7 @@ oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString *strHostname)
PADDRINFOW pAddrInfo = nullptr;
int ret = GetAddrInfoW(
- SAL_W(strHostname->buffer), nullptr, nullptr, & pAddrInfo);
+ o3tl::toW(strHostname->buffer), nullptr, nullptr, & pAddrInfo);
if (0 == ret)
{
oslHostAddr pRet = nullptr;
@@ -503,7 +504,7 @@ oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString *strHostname)
{
pRet = static_cast<oslHostAddr>(
rtl_allocateZeroMemory(sizeof(struct oslHostAddrImpl)));
- rtl_uString_newFromStr(&pRet->pHostName, SAL_U(pIter->ai_canonname));
+ rtl_uString_newFromStr(&pRet->pHostName, o3tl::toU(pIter->ai_canonname));
pRet->pSockAddr = createSocketAddr();
memcpy(& pRet->pSockAddr->m_sockaddr,
pIter->ai_addr, pIter->ai_addrlen);
@@ -541,7 +542,7 @@ oslHostAddr SAL_CALL osl_createHostAddrByAddr(const oslSocketAddr pAddr)
{
oslHostAddr pRet = static_cast<oslHostAddr>(
rtl_allocateZeroMemory(sizeof(struct oslHostAddrImpl)));
- rtl_uString_newFromStr(&pRet->pHostName, SAL_U(buf));
+ rtl_uString_newFromStr(&pRet->pHostName, o3tl::toU(buf));
pRet->pSockAddr = createSocketAddr();
memcpy(& pRet->pSockAddr->m_sockaddr,
& pAddr->m_sockaddr, sizeof(struct sockaddr));
@@ -764,7 +765,7 @@ oslSocketResult SAL_CALL osl_getDottedInetAddrOfSocketAddr (
SAL_INFO("sal.osl", "InetNtopW failed: " << WSAGetLastError());
return osl_Socket_Error;
}
- rtl_uString_newFromStr(strDottedInetAddr, SAL_U(ret));
+ rtl_uString_newFromStr(strDottedInetAddr, o3tl::toU(ret));
OSL_ASSERT(*strDottedInetAddr != nullptr);
return osl_Socket_Ok;
@@ -1602,7 +1603,7 @@ void SAL_CALL osl_getLastSocketErrorDescription (
{
sal_Unicode message[128];
- wsprintfW(SAL_W(message), L"Unknown WinSock Error Number %d", error);
+ wsprintfW(o3tl::toW(message), L"Unknown WinSock Error Number %d", error);
rtl_uString_newFromStr (strError, message);
}
diff --git a/sal/osl/w32/tempfile.cxx b/sal/osl/w32/tempfile.cxx
index f59107214aa4..a538b5dd9720 100644
--- a/sal/osl/w32/tempfile.cxx
+++ b/sal/osl/w32/tempfile.cxx
@@ -20,6 +20,7 @@
#include "systools/win32/uwinapi.h"
#include "osl/file.h"
+#include <o3tl/char16_t2wchar_t.hxx>
#include <file-impl.hxx>
#include "file_error.hxx"
@@ -95,7 +96,7 @@ static oslFileError osl_win32_GetTempFileName_impl_(
oslFileError osl_error = osl_File_E_None;
if (GetTempFileNameW(
- SAL_W(rtl_uString_getStr(base_directory)),
+ o3tl::toW(rtl_uString_getStr(base_directory)),
L"",
0,
temp_file_name) == 0)
@@ -157,7 +158,7 @@ static oslFileError osl_createTempFile_impl_(
if ((osl_error == osl_File_E_None) && !b_delete_on_close)
{
rtl_uString* pustr = nullptr;
- rtl_uString_newFromStr(&pustr, SAL_U(tmp_name));
+ rtl_uString_newFromStr(&pustr, o3tl::toU(tmp_name));
osl_getFileURLFromSystemPath(pustr, ppustrTempFileURL);
rtl_uString_release(pustr);
}
@@ -211,7 +212,7 @@ oslFileError SAL_CALL osl_createTempFile(
oslFileError SAL_CALL osl_getTempDirURL(rtl_uString** pustrTempDir)
{
::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
- LPWSTR lpBuffer = SAL_W(aBuffer);
+ LPWSTR lpBuffer = o3tl::toW(aBuffer);
DWORD nBufferLength = aBuffer.getBufSizeInSymbols() - 1;
DWORD nLength;
@@ -231,7 +232,7 @@ oslFileError SAL_CALL osl_getTempDirURL(rtl_uString** pustrTempDir)
if ( '\\' == lpBuffer[nLength-1] )
lpBuffer[nLength-1] = 0;
- rtl_uString_newFromStr( &ustrTempPath, SAL_U(lpBuffer) );
+ rtl_uString_newFromStr( &ustrTempPath, o3tl::toU(lpBuffer) );
error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir );