sal/osl/w32/file_url.cxx | 87 ----------------------------------------------- 1 file changed, 87 deletions(-)
New commits: commit 0d22aa485110df0ada7761e2c7930f704fbc4bfa Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Mar 24 07:51:56 2022 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Thu Mar 24 10:43:31 2022 +0100 -Werror,-Wunused-function ...after 92e835dbf00590c9c29509d2995cc7918a9bbb90 "tdf#98705 Replace GetCaseCorrectPathName with GetLongPathNameW" Change-Id: If7fc8b656f7f0736edeb3b7617044a032d1481f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132017 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx index 1fcdc1728696..c452a3624977 100644 --- a/sal/osl/w32/file_url.cxx +++ b/sal/osl/w32/file_url.cxx @@ -455,93 +455,6 @@ DWORD IsValidFilePath(rtl_uString *path, DWORD dwFlags, rtl_uString **corrected) return bValid ? dwPathType : PATHTYPE_ERROR; } -// Expects a proper absolute or relative path -static sal_Int32 PathRemoveFileSpec(LPWSTR lpPath, LPWSTR lpFileName, sal_Int32 nFileBufLen ) -{ - sal_Int32 nRemoved = 0; - - if (nFileBufLen && wcscmp(lpPath, L"\\\\") != 0) // tdf#98343 do not remove leading UNC backslashes! - { - lpFileName[0] = 0; - LPWSTR lpLastBkSlash = wcsrchr( lpPath, '\\' ); - LPWSTR lpLastSlash = wcsrchr( lpPath, '/' ); - LPWSTR lpLastDelimiter = std::max(lpLastSlash, lpLastBkSlash); - - if ( lpLastDelimiter ) - { - sal_Int32 nDelLen = wcslen( lpLastDelimiter ); - if ( 1 == nDelLen ) - { - if ( lpLastDelimiter > lpPath && *(lpLastDelimiter - 1) != ':' ) - { - *lpLastDelimiter = 0; - *lpFileName = 0; - nRemoved = nDelLen; - } - } - else if ( nDelLen && nDelLen - 1 < nFileBufLen ) - { - wcscpy( lpFileName, lpLastDelimiter + 1 ); - *(++lpLastDelimiter) = 0; - nRemoved = nDelLen - 1; - } - } - } - - return nRemoved; -} - -// Undocumented in SHELL32.DLL ordinal 32 -static LPWSTR PathAddBackslash(LPWSTR lpPath, sal_uInt32 nBufLen) -{ - LPWSTR lpEndPath = nullptr; - - if ( lpPath ) - { - std::size_t nLen = wcslen(lpPath); - - if ( !nLen || ( lpPath[nLen-1] != '\\' && lpPath[nLen-1] != '/' && nLen < nBufLen - 1 ) ) - { - lpEndPath = lpPath + nLen; - *lpEndPath++ = '\\'; - *lpEndPath = 0; - } - } - return lpEndPath; -} - -// True if the szPath + szFile is just a special prefix, not a path which we may test for existence. -// E.g., \\ or \\server or \\server\share or \\? or \\?\UNC or \\?\UNC\server or \\?\UNC\server\share -static bool IsPathSpecialPrefix(LPWSTR szPath, LPWSTR szFile) -{ - if (szPath[0] == '\\' && szPath[1] == '\\') - { - if (szPath[2] == 0) - return true; // "\\" -> now the server name or "." or "?" will append - else if (szPath[2] == '?' && szPath[3] == '\\') - { - if (szPath[4] == 0) - return wcscmp(szFile, L"UNC") == 0; // "\\?\" -> now "UNC" will append - else - { - if (wcsncmp(szPath + 4, L"UNC\\", 4) == 0) - { - if (szPath[8] == 0) - return true; // "\\?\UNC\" -> now the server name will append - else if (const wchar_t* pBackSlash = wcschr(szPath + 8, '\\')) - return *(pBackSlash + 1) == 0; // "\\?\UNC\Server\" -> now share name will append - } - } - } - else if (szPath[2] != '.') - { - if (const wchar_t* pBackSlash = wcschr(szPath + 2, '\\')) - return *(pBackSlash + 1) == 0; // "\\Server\" -> now share name will append - } - } - return false; -} - static std::optional<OUString> osl_decodeURL_(const OString& sUTF8) { const char *pSrcEnd;