diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-04-04 14:57:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-04-04 16:12:11 +0000 |
commit | 9ac98e6e3488e434bf4864ecfb13a121784f640b (patch) | |
tree | b3c9cbf52126fee5864be12e9109f7413e7a0878 /sal | |
parent | 6f995da5a652d993ab253b3363188cd18e289728 (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 'sal')
-rw-r--r-- | sal/osl/w32/file.cxx | 12 | ||||
-rw-r--r-- | sal/osl/w32/file_dirvol.cxx | 62 | ||||
-rw-r--r-- | sal/osl/w32/file_url.cxx | 32 | ||||
-rw-r--r-- | sal/osl/w32/module.cxx | 2 | ||||
-rw-r--r-- | sal/osl/w32/nlsupport.cxx | 8 | ||||
-rw-r--r-- | sal/osl/w32/pipe.cxx | 10 | ||||
-rw-r--r-- | sal/osl/w32/procimpl.cxx | 12 | ||||
-rw-r--r-- | sal/osl/w32/security.cxx | 64 | ||||
-rw-r--r-- | sal/osl/w32/socket.cxx | 10 | ||||
-rw-r--r-- | sal/qa/osl/security/osl_Security.cxx | 2 | ||||
-rw-r--r-- | sal/qa/rtl/oustringbuffer/test_oustringbuffer_assign.cxx | 3 | ||||
-rw-r--r-- | sal/qa/rtl/strings/test_oustring_stringliterals.cxx | 3 |
12 files changed, 107 insertions, 113 deletions
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, ¶ms ); @@ -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 |