[Libreoffice-commits] core.git: Branch 'feature/cib_contract57b' - sal/osl sal/qa
sal/osl/all/log.cxx | 10 +- sal/qa/osl/file/osl_File.cxx |2 +- 2 files changed, 6 insertions(+), 6 deletions(-) New commits: commit 32d67237f41f91baea5cc61a59619a125c7780ac Author: Thorsten Behrens Date: Tue Jun 5 14:23:08 2018 +0200 sal: WNT -> _WIN32 Still some holdouts from that bad old habit it seems. Change-Id: Ib0fe2c7eb006649b121668c549ff8e0bb060e120 diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx index b231b94591bf..18c0e3e124fc 100644 --- a/sal/osl/all/log.cxx +++ b/sal/osl/all/log.cxx @@ -31,7 +31,7 @@ #if defined ANDROID #include -#elif defined WNT +#elif defined _WIN32 #include #include #define OSL_DETAIL_GETPID _getpid() @@ -101,7 +101,7 @@ char const * getEnvironmentVariable(const char* env) { return p2; } -#ifdef WNT +#ifdef _WIN32 # define INI_STRINGBUF_SIZE 1024 bool getValueFromLoggingIniFile(const char* key, char* value) { @@ -144,7 +144,7 @@ char const * getLogLevel() { if (env != nullptr) return env; -#ifdef WNT +#ifdef _WIN32 static char logLevel[INI_STRINGBUF_SIZE]; if (getValueFromLoggingIniFile("LogLevel", logLevel)) return logLevel; @@ -159,7 +159,7 @@ std::ofstream * getLogFile() { if (!logFile) { -#ifdef WNT +#ifdef _WIN32 static char logFilePath[INI_STRINGBUF_SIZE]; if (getValueFromLoggingIniFile("LogFilePath", logFilePath)) logFile = logFilePath; @@ -334,7 +334,7 @@ void sal_detail_log( *logFile << s.str() << std::endl; } else { -#ifdef WNT +#ifdef _WIN32 // write to Windows debugger console, too OutputDebugStringA(s.str().c_str()); #endif diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 6ba45804f706..f89b6db6c86c 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -5003,7 +5003,7 @@ namespace osl_Directory rc != FileBase::E_None ); } -#endif /* WNT */ +#endif /* _WIN32 */ CPPUNIT_TEST_SUITE(createPath); CPPUNIT_TEST(with_relative_path); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/cib_contract57b' - sal/osl
sal/osl/all/log.cxx | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) New commits: commit 1619d92d5eb11156032fbd7c31bcfb87e8a287e2 Author: Thorsten Behrens Date: Mon Jun 4 13:41:22 2018 +0200 sal: fix logfile path retrieval from logging.ini Change-Id: I39803413533ae5b291d2e1abf4aa1bfe1f5900b5 diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx index 4d60536f71dd..b231b94591bf 100644 --- a/sal/osl/all/log.cxx +++ b/sal/osl/all/log.cxx @@ -156,14 +156,19 @@ char const * getLogLevel() { std::ofstream * getLogFile() { // First check the environment variable, then the setting in logging.ini static char const * logFile = getEnvironmentVariable("SAL_LOG_FILE"); -if (!logFile) -return nullptr; +if (!logFile) +{ #ifdef WNT -static char logFilePath[INI_STRINGBUF_SIZE]; -if (getValueFromLoggingIniFile("LogFilePath", logFilePath)) -logFile = logFilePath; +static char logFilePath[INI_STRINGBUF_SIZE]; +if (getValueFromLoggingIniFile("LogFilePath", logFilePath)) +logFile = logFilePath; +else +return nullptr; +#else +return nullptr; #endif +} // stays until process exits static std::ofstream file(logFile, std::ios::app | std::ios::out); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/cib_contract57b' - sal/osl
sal/osl/w32/file_dirvol.cxx | 28 1 file changed, 12 insertions(+), 16 deletions(-) New commits: commit 85c640f19f6a5b0ea34236141db37f2967b986ea Author: Samuel MehrbrodtDate: Thu Feb 22 09:03:08 2018 +0100 Use long path prefix in osl_getFileStatus Follow-up fixes after 51afd886e59e519be0546c980dcc724d771fd245 Change-Id: I29ce4af850978322cab60743119a02d47305e739 diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index ed6adb974365..bf9e88abf84c 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -43,8 +43,6 @@ static const wchar_t UNC_PREFIX[] = L""; static const wchar_t BACKSLASH = '\\'; static const wchar_t SLASH = '/'; -#define STR_LONG_PATH_PREFIX "?\\" - extern "C" BOOL TimeValueToFileTime(const TimeValue *cpTimeVal, FILETIME *pFTime) { SYSTEMTIME BaseSysTime; @@ -1587,14 +1585,6 @@ oslFileError SAL_CALL osl_getFileStatus( if ( !pItemImpl ) return osl_File_E_INVAL; -// Provide a long path version of the file name, because when -// the path is longer than 255 chars, windows api calls expect this prefix. -rtl_uString* sPrefix = nullptr; -rtl_uString* sLongPath = nullptr; -rtl_uString_newFromAscii( , STR_LONG_PATH_PREFIX ); -rtl_uString_newConcat( , sPrefix, pItemImpl->m_pFullPath ); -rtl_uString_release( sPrefix ); - switch ( pItemImpl->uType ) { case DIRECTORYITEM_DRIVE: @@ -1605,9 +1595,16 @@ oslFileError SAL_CALL osl_getFileStatus( break; } +// Provide a long path version of the file name, because when +// the path is longer than 255 chars, windows api calls expect this prefix. +OUString sFullPath(pItemImpl->m_pFullPath); + +if (sFullPath.getLength() >= MAX_PATH && isalpha(sFullPath[0]) && sFullPath[1] == ':') +sFullPath = "?\\" + sFullPath; + if ( uFieldMask & osl_FileStatus_Mask_Validate ) { -HANDLE hFind = FindFirstFile( rtl_uString_getStr( sLongPath ), >FindData ); +HANDLE hFind = FindFirstFile( sFullPath.getStr(), >FindData ); if ( hFind != INVALID_HANDLE_VALUE ) FindClose( hFind ); @@ -1667,7 +1664,7 @@ oslFileError SAL_CALL osl_getFileStatus( if ( uFieldMask & osl_FileStatus_Mask_LinkTargetURL ) { -oslFileError error = osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, >ustrLinkTargetURL ); +oslFileError error = osl_getFileURLFromSystemPath( sFullPath.pData, >ustrLinkTargetURL ); if (error != osl_File_E_None) return error; @@ -1679,7 +1676,7 @@ oslFileError SAL_CALL osl_getFileStatus( if ( !pItemImpl->bFullPathNormalized ) { ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH ); -sal_uInt32 nNewLen = GetCaseCorrectPathName( rtl_uString_getStr( sLongPath ), +sal_uInt32 nNewLen = GetCaseCorrectPathName( sFullPath.getStr(), ::osl::mingw_reinterpret_cast( aBuffer ), aBuffer.getBufSizeInSymbols(), sal_True ); @@ -1687,18 +1684,17 @@ oslFileError SAL_CALL osl_getFileStatus( if ( nNewLen ) { rtl_uString_newFromStr( >m_pFullPath, aBuffer ); +sFullPath = OUString( pItemImpl->m_pFullPath ); pItemImpl->bFullPathNormalized = TRUE; } } -oslFileError error = osl_getFileURLFromSystemPath( sLongPath, >ustrFileURL ); +oslFileError error = osl_getFileURLFromSystemPath( sFullPath.pData, >ustrFileURL ); if (error != osl_File_E_None) return error; pStatus->uValidFields |= osl_FileStatus_Mask_FileURL; } -rtl_uString_release( sLongPath ); - return osl_File_E_None; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/cib_contract57b' - sal/osl
sal/osl/w32/file_dirvol.cxx | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) New commits: commit 51afd886e59e519be0546c980dcc724d771fd245 Author: Samuel MehrbrodtDate: Wed Feb 21 09:27:25 2018 +0100 Use long path prefix in osl_getFileStatus When installing an extension e.g., paths can get very long and they hit the 255 char limit, thus the installation fails. So we need to prefix the path with the long file name prefix for windows api calls to succeed. Change-Id: Ie62644192ba40a9d4802772cd9837fc84fae947a diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index 04a62d163083..ed6adb974365 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -43,6 +43,8 @@ static const wchar_t UNC_PREFIX[] = L""; static const wchar_t BACKSLASH = '\\'; static const wchar_t SLASH = '/'; +#define STR_LONG_PATH_PREFIX "?\\" + extern "C" BOOL TimeValueToFileTime(const TimeValue *cpTimeVal, FILETIME *pFTime) { SYSTEMTIME BaseSysTime; @@ -1585,6 +1587,14 @@ oslFileError SAL_CALL osl_getFileStatus( if ( !pItemImpl ) return osl_File_E_INVAL; +// Provide a long path version of the file name, because when +// the path is longer than 255 chars, windows api calls expect this prefix. +rtl_uString* sPrefix = nullptr; +rtl_uString* sLongPath = nullptr; +rtl_uString_newFromAscii( , STR_LONG_PATH_PREFIX ); +rtl_uString_newConcat( , sPrefix, pItemImpl->m_pFullPath ); +rtl_uString_release( sPrefix ); + switch ( pItemImpl->uType ) { case DIRECTORYITEM_DRIVE: @@ -1597,7 +1607,7 @@ oslFileError SAL_CALL osl_getFileStatus( if ( uFieldMask & osl_FileStatus_Mask_Validate ) { -HANDLE hFind = FindFirstFile( rtl_uString_getStr( pItemImpl->m_pFullPath ), >FindData ); +HANDLE hFind = FindFirstFile( rtl_uString_getStr( sLongPath ), >FindData ); if ( hFind != INVALID_HANDLE_VALUE ) FindClose( hFind ); @@ -1669,7 +1679,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( rtl_uString_getStr( sLongPath ), ::osl::mingw_reinterpret_cast( aBuffer ), aBuffer.getBufSizeInSymbols(), sal_True ); @@ -1681,12 +1691,14 @@ oslFileError SAL_CALL osl_getFileStatus( } } -oslFileError error = osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, >ustrFileURL ); +oslFileError error = osl_getFileURLFromSystemPath( sLongPath, >ustrFileURL ); if (error != osl_File_E_None) return error; pStatus->uValidFields |= osl_FileStatus_Mask_FileURL; } +rtl_uString_release( sLongPath ); + return osl_File_E_None; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits