config_host/config_features.h.in | 3 configure.ac | 1 sal/Library_sal.mk | 4 sal/osl/unx/file_path_helper.cxx | 11 sal/osl/unx/file_path_helper.h | 228 -------- sal/osl/unx/file_path_helper.hxx | 194 ++++++ sal/osl/unx/file_url.cxx | 9 sal/osl/unx/file_url.hxx | 8 sal/osl/unx/process.cxx | 119 +--- sal/osl/unx/process_impl.cxx | 2 sal/osl/unx/signal.c | 1088 -------------------------------------- sal/osl/unx/signal.cxx | 1091 +++++++++++++++++++++++++++++++++++++++ svx/source/svdraw/svdobj.cxx | 6 13 files changed, 1350 insertions(+), 1414 deletions(-)
New commits: commit 4123c2bac37821584b354e016ac4f5c5bc598d02 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Nov 19 15:43:51 2014 +0100 loplugin:unreffun Change-Id: I648b91e1124fcdad16ccd5d619192b72e4c8ec3f diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 9c251bc..d5f0c6e 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -235,7 +235,6 @@ public: ~SdrObjUserDataList(); size_t GetUserDataCount() const; - const SdrObjUserData* GetUserData(size_t nNum) const; SdrObjUserData* GetUserData(size_t nNum); void AppendUserData(SdrObjUserData* pData); void DeleteUserData(size_t nNum); @@ -249,11 +248,6 @@ size_t SdrObjUserDataList::GetUserDataCount() const return static_cast<sal_uInt16>(maList.size()); } -const SdrObjUserData* SdrObjUserDataList::GetUserData(size_t nNum) const -{ - return &maList.at(nNum); -} - SdrObjUserData* SdrObjUserDataList::GetUserData(size_t nNum) { return &maList.at(nNum); commit bb05f1128fa073b35788a73ff6e8a5d8366b7710 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Nov 19 14:51:29 2014 +0100 Remove obsolete osl_searchPath_impl (obsoleting cid#983584) Change-Id: Icbf25bd364fdabb208abe201ddc146daa60f9b62 diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx index 6b1cca2..1ce6424 100644 --- a/sal/osl/unx/file_url.cxx +++ b/sal/osl/unx/file_url.cxx @@ -621,9 +621,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* u return oslFileError(rc); } -namespace -{ - +namespace osl { namespace detail { /********************************************* No separate error code if unicode to text conversion or getenv fails because for the @@ -642,7 +640,10 @@ namespace return bfound; } +} } +namespace +{ /********************************************* No separate error code if unicode to text conversion or getcwd fails because for the @@ -689,7 +690,7 @@ oslFileError osl_searchFileURL(rtl_uString* ustrFilePath, rtl_uString* ustrSearc rtl::OUString result; if (find_in_searchPath(file_path, ustrSearchPath, result) || - find_in_PATH(file_path, result) || + osl::detail::find_in_PATH(file_path, result) || find_in_CWD(file_path, result)) { rtl::OUString resolved; diff --git a/sal/osl/unx/file_url.hxx b/sal/osl/unx/file_url.hxx index d087638..eceaabd 100644 --- a/sal/osl/unx/file_url.hxx +++ b/sal/osl/unx/file_url.hxx @@ -22,6 +22,8 @@ #include "osl/file.h" +namespace rtl { class OUString; } + oslFileError osl_getSystemPathFromFileURL_Ex(rtl_uString *ustrFileURL, rtl_uString **pustrSystemPath); oslFileError FileURLToPath(char * buffer, size_t bufLen, rtl_uString* ustrFileURL); @@ -30,6 +32,12 @@ int UnicodeToText(char * buffer, size_t bufLen, const sal_Unicode * uniText, sal int TextToUnicode(const char* text, size_t text_buffer_size, sal_Unicode* unic_text, sal_Int32 unic_text_buffer_size); +namespace osl { namespace detail { + +bool find_in_PATH(const rtl::OUString& file_path, rtl::OUString& result); + +} } + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx index 57af42b..537b1eb 100644 --- a/sal/osl/unx/process.cxx +++ b/sal/osl/unx/process.cxx @@ -50,6 +50,7 @@ #include <osl/conditn.h> #include <osl/thread.h> #include <osl/file.h> +#include <osl/file.hxx> #include <osl/signal.h> #include <rtl/alloc.h> #include <sal/log.hxx> @@ -94,69 +95,6 @@ struct ProcessData static oslProcessImpl* ChildList; static oslMutex ChildListMutex; -/****************************************************************************** - Deprecated - Old and buggy implementation of osl_searchPath used only by - osl_psz_executeProcess. - A new implementation is in file_path_helper.cxx - *****************************************************************************/ - -static oslProcessError SAL_CALL osl_searchPath_impl(const sal_Char* pszName, - sal_Char *pszBuffer, sal_uInt32 Max) -{ - sal_Char path[PATH_MAX + 1]; - sal_Char *pchr; - - path[0] = '\0'; - - OSL_ASSERT(pszName != NULL); - - if ( pszName == 0 ) - { - return osl_Process_E_NotFound; - } - - if ( (pchr = getenv("PATH")) != 0 ) - { - sal_Char *pstr; - - while (*pchr != '\0') - { - pstr = path; - - while ((*pchr != '\0') && (*pchr != ':')) - *pstr++ = *pchr++; - - if ((pstr > path) && ((*(pstr - 1) != '/'))) - *pstr++ = '/'; - - *pstr = '\0'; - size_t reminder = PATH_MAX - strlen(path); - if(reminder > strlen(pszName)) - { - strncat(path, pszName, reminder); - - if (access(path, 0) == 0) - { - char szRealPathBuf[PATH_MAX + 1] = ""; - - if( NULL == realpath(path, szRealPathBuf) || (strlen(szRealPathBuf) >= (sal_uInt32)Max)) - return osl_Process_E_Unknown; - - strcpy(pszBuffer, path); - - return osl_Process_E_None; - } - - if (*pchr == ':') - pchr++; - } - } - } - - return osl_Process_E_NotFound; -} - } //Anonymous namespace oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName, @@ -480,6 +418,38 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( oslFileHandle *pErrorRead ) { + rtl::OUString image; + if (ustrImageName == nullptr) + { + if (nArguments == 0) + { + return osl_Process_E_InvalidError; + } + image = rtl::OUString::unacquired(ustrArguments); + } + else + { + osl::FileBase::RC e = osl::FileBase::getSystemPathFromFileURL( + rtl::OUString::unacquired(&ustrImageName), image); + if (e != osl::FileBase::E_None) + { + SAL_INFO( + "sal.osl", + "getSystemPathFromFileURL(" + << rtl::OUString::unacquired(&ustrImageName) + << ") failed with " << e); + return osl_Process_E_Unknown; + } + } + + if ((Options & osl_Process_SEARCHPATH) != 0) + { + rtl::OUString path; + if (osl::detail::find_in_PATH(image, path)) + { + image = path; + } + } oslProcessError Error; sal_Char* pszWorkDir=0; @@ -488,13 +458,18 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( unsigned int idx; char szImagePath[PATH_MAX] = ""; - char szWorkDir[PATH_MAX] = ""; - - if ( ustrImageName && ustrImageName->length ) + if (!image.isEmpty() + && (UnicodeToText( + szImagePath, SAL_N_ELEMENTS(szImagePath), image.getStr(), + image.getLength()) + == 0)) { - FileURLToPath( szImagePath, PATH_MAX, ustrImageName ); + int e = errno; + SAL_INFO("sal.osl", "UnicodeToText(" << image << ") failed with " << e); + return osl_Process_E_Unknown; } + char szWorkDir[PATH_MAX] = ""; if ( ustrWorkDir != 0 && ustrWorkDir->length ) { FileURLToPath( szWorkDir, PATH_MAX, ustrWorkDir ); @@ -621,20 +596,14 @@ oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName, ) { int i; - sal_Char path[PATH_MAX + 1]; ProcessData Data; oslThread hThread; - path[0] = '\0'; - memset(&Data,0,sizeof(ProcessData)); Data.m_pInputWrite = pInputWrite; Data.m_pOutputRead = pOutputRead; Data.m_pErrorRead = pErrorRead; - if (pszImageName == NULL) - pszImageName = pszArguments[0]; - OSL_ASSERT(pszImageName != NULL); if ( pszImageName == 0 ) @@ -642,10 +611,6 @@ oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName, return osl_Process_E_NotFound; } - if ((Options & osl_Process_SEARCHPATH) && - (osl_searchPath_impl(pszImageName, path, sizeof(path)) == osl_Process_E_None)) - pszImageName = path; - Data.m_pszArgs[0] = strdup(pszImageName); Data.m_pszArgs[1] = 0; commit 7fe2a3fd370049d7599c301d2af71ca61fec1431 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Nov 19 14:33:46 2014 +0100 Fold file_path_helper.h into file_path_helper.hxx Change-Id: Ifad9594eb6fa396e32818b6d2bafc16adb478994 diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx index ae3781e..1ccd9be 100644 --- a/sal/osl/unx/file_path_helper.cxx +++ b/sal/osl/unx/file_path_helper.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "file_path_helper.h" #include "file_path_helper.hxx" #include "uunxapi.hxx" @@ -79,7 +78,7 @@ void SAL_CALL osl_systemPathEnsureSeparator(rtl_uString** ppustrPath) } } -sal_Bool SAL_CALL osl_systemPathIsRelativePath(const rtl_uString* pustrPath) +bool SAL_CALL osl_systemPathIsRelativePath(const rtl_uString* pustrPath) { OSL_PRECOND(0 != pustrPath, "osl_systemPathIsRelativePath: Invalid parameter"); return ((0 == pustrPath) || (0 == pustrPath->length) || (pustrPath->buffer[0] != FPH_CHAR_PATH_SEPARATOR)); @@ -124,12 +123,12 @@ void SAL_CALL osl_systemPathGetFileNameOrLastDirectoryPart( rtl_uString_assign(ppustrFileNameOrLastDirPart, last_part.pData); } -sal_Bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry( +bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry( const rtl_uString* pustrPath) { OSL_PRECOND(0 != pustrPath, "osl_systemPathIsHiddenFileOrDirectoryEntry: Invalid parameter"); if ((0 == pustrPath) || (0 == pustrPath->length)) - return sal_False; + return false; rtl::OUString fdp; osl_systemPathGetFileNameOrLastDirectoryPart(pustrPath, &fdp.pData); @@ -139,7 +138,7 @@ sal_Bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry( !osl_systemPathIsLocalOrParentDirectoryEntry(fdp.pData)); } -sal_Bool SAL_CALL osl_systemPathIsLocalOrParentDirectoryEntry( +bool SAL_CALL osl_systemPathIsLocalOrParentDirectoryEntry( const rtl_uString* pustrPath) { OSL_PRECOND(pustrPath, "osl_systemPathIsLocalOrParentDirectoryEntry: Invalid parameter"); @@ -219,7 +218,7 @@ private: const sal_Unicode* m_path_segment_end; }; -sal_Bool SAL_CALL osl_searchPath( +bool SAL_CALL osl_searchPath( const rtl_uString* pustrFilePath, const rtl_uString* pustrSearchPathList, rtl_uString** ppustrPathFound) diff --git a/sal/osl/unx/file_path_helper.h b/sal/osl/unx/file_path_helper.h deleted file mode 100644 index 799f497..0000000 --- a/sal/osl/unx/file_path_helper.h +++ /dev/null @@ -1,228 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SAL_OSL_UNX_FILE_PATH_HELPER_H -#define INCLUDED_SAL_OSL_UNX_FILE_PATH_HELPER_H - -#include <sal/types.h> -#include <rtl/ustring.h> - -#ifdef __cplusplus -extern "C" -{ -#endif - -/******************************************* - osl_systemPathRemoveSeparator - Removes the last separator from the - given system path if any and if the path - is not the root path '/' - - @param ppustrPath [inout] a system path - if the path is not the root path - and the last character is a - path separator it will be cut off - ppustrPath must not be NULL and - must point to a valid rtl_uString - - @returns nothing - - ******************************************/ - -void SAL_CALL osl_systemPathRemoveSeparator( - /*inout*/ rtl_uString* pustrPath); - -/******************************************* - osl_systemPathEnsureSeparator - Adds a trailing path separator to the - given system path if not already there - and if the path is not the root path '/' - - @param pustrPath [inout] a system path - if the path is not the root path - '/' and has no trailing separator - a separator will be added - ppustrPath must not be NULL and - must point to a valid rtl_uString - - @returns nothing - - ******************************************/ - -void SAL_CALL osl_systemPathEnsureSeparator( - rtl_uString** ppustrPath); - -/******************************************* - osl_systemPathIsRelativePath - Returns true if the given path is a - relative path and so starts not with '/' - - @param pustrPath [in] a system path - pustrPath must not be NULL - - @returns sal_True if the given path - doesn't start with a separator - else sal_False will be returned - - ******************************************/ - -sal_Bool SAL_CALL osl_systemPathIsRelativePath( - const rtl_uString* pustrPath); - -/****************************************** - osl_systemPathMakeAbsolutePath - Append a relative path to a base path - - @param pustrBasePath [in] a system - path that will be considered as - base path - pustrBasePath must not be NULL - - @param pustrRelPath [in] a system path - that will be considered as - relative path - pustrBasePath must not be NULL - - @param ppustrAbsolutePath [out] the - resulting path which is a - concatination of the base and - the relative path - if base path is empty the - resulting absolute path is the - relative path - if relative path is empty the - resulting absolute path is the - base path - if base and relative path are - empty the resulting absolute - path is also empty - ppustrAbsolutePath must not be - NULL and *ppustrAbsolutePath - must be 0 or point to a valid - rtl_uString - - *****************************************/ - -void SAL_CALL osl_systemPathMakeAbsolutePath( - const rtl_uString* pustrBasePath, - const rtl_uString* pustrRelPath, - rtl_uString** ppustrAbsolutePath); - -/***************************************** - osl_systemPathGetFileOrLastDirectoryPart - Returns the file or the directory part - of the given path - - @param pustrPath [in] a system path, - must not be NULL - - @param ppustrFileOrDirPart [out] on - return receives the last part - of the given directory or the - file name - if pustrPath is the root path - '/' an empty string will be - returned - if pustrPath has a trailing - '/' the last part before the - '/' will be returned else - the part after the last '/' - will be returned - - @returns nothing - - ****************************************/ - -void SAL_CALL osl_systemPathGetFileNameOrLastDirectoryPart( - const rtl_uString* pustrPath, - rtl_uString** ppustrFileNameOrLastDirPart); - -/******************************************** - osl_systemPathIsHiddenFileOrDirectoryEntry - Returns sal_True if the last part of - given system path is not '.' or '..' - alone and starts with a '.' - - @param pustrPath [in] a system path, - must not be NULL - - @returns sal_True if the last part of - the given system path starts - with '.' or sal_False the last - part is '.' or '..' alone or - doesn't start with a dot - -*********************************************/ - -sal_Bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry( - const rtl_uString* pustrPath); - -/************************************************ - osl_systemPathIsLocalOrParentDirectoryEntry - Returns sal_True if the last part of the given - system path is the local directory entry '.' - or the parent directory entry '..' - - @param pustrPath [in] a system path, - must not be NULL - - @returns sal_True if the last part of the - given system path is '.' or '..' - else sal_False - -************************************************/ - -sal_Bool SAL_CALL osl_systemPathIsLocalOrParentDirectoryEntry( - const rtl_uString* pustrPath); - -/************************************************ - osl_searchPath - Searches for a file name or path name in all - directories specified by a given path list. - Symbolic links in the resulting path will not be - resolved, it's up to the caller to do this. - - @param pustrFilePath [in] a file name or - directory name to search for, the name must - be provided as system path not as a file URL - - @param pustrSearchPathList [in] a ':' - separated list of paths in which to search for - the file or directory name - - @param ppustrPathFound [out] on success receives the - complete path of the file or directory found - as a system path - - @returns sal_True if the specified file or - directory was found else sal_False - ***********************************************/ - -sal_Bool SAL_CALL osl_searchPath( - const rtl_uString* pustrFilePath, - const rtl_uString* pustrSearchPathList, - rtl_uString** ppustrPathFound); - -#ifdef __cplusplus -} -#endif - -#endif /* #ifndef _OSL_PATH_HELPER_H_ */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/unx/file_path_helper.hxx b/sal/osl/unx/file_path_helper.hxx index 6396ddbe..9e72bf5 100644 --- a/sal/osl/unx/file_path_helper.hxx +++ b/sal/osl/unx/file_path_helper.hxx @@ -20,9 +20,201 @@ #ifndef INCLUDED_SAL_OSL_UNX_FILE_PATH_HELPER_HXX #define INCLUDED_SAL_OSL_UNX_FILE_PATH_HELPER_HXX -#include "file_path_helper.h" +#include <sal/types.h> +#include <rtl/ustring.h> #include <rtl/ustring.hxx> +/******************************************* + osl_systemPathRemoveSeparator + Removes the last separator from the + given system path if any and if the path + is not the root path '/' + + @param ppustrPath [inout] a system path + if the path is not the root path + and the last character is a + path separator it will be cut off + ppustrPath must not be NULL and + must point to a valid rtl_uString + + @returns nothing + + ******************************************/ + +void SAL_CALL osl_systemPathRemoveSeparator( + /*inout*/ rtl_uString* pustrPath); + +/******************************************* + osl_systemPathEnsureSeparator + Adds a trailing path separator to the + given system path if not already there + and if the path is not the root path '/' + + @param pustrPath [inout] a system path + if the path is not the root path + '/' and has no trailing separator + a separator will be added + ppustrPath must not be NULL and + must point to a valid rtl_uString + + @returns nothing + + ******************************************/ + +void SAL_CALL osl_systemPathEnsureSeparator( + rtl_uString** ppustrPath); + +/******************************************* + osl_systemPathIsRelativePath + Returns true if the given path is a + relative path and so starts not with '/' + + @param pustrPath [in] a system path + pustrPath must not be NULL + + @returns sal_True if the given path + doesn't start with a separator + else sal_False will be returned + + ******************************************/ + +bool SAL_CALL osl_systemPathIsRelativePath( + const rtl_uString* pustrPath); + +/****************************************** + osl_systemPathMakeAbsolutePath + Append a relative path to a base path + + @param pustrBasePath [in] a system + path that will be considered as + base path + pustrBasePath must not be NULL + + @param pustrRelPath [in] a system path + that will be considered as + relative path + pustrBasePath must not be NULL + + @param ppustrAbsolutePath [out] the + resulting path which is a + concatination of the base and + the relative path + if base path is empty the + resulting absolute path is the + relative path + if relative path is empty the + resulting absolute path is the + base path + if base and relative path are + empty the resulting absolute + path is also empty + ppustrAbsolutePath must not be + NULL and *ppustrAbsolutePath + must be 0 or point to a valid + rtl_uString + + *****************************************/ + +void SAL_CALL osl_systemPathMakeAbsolutePath( + const rtl_uString* pustrBasePath, + const rtl_uString* pustrRelPath, + rtl_uString** ppustrAbsolutePath); + +/***************************************** + osl_systemPathGetFileOrLastDirectoryPart + Returns the file or the directory part + of the given path + + @param pustrPath [in] a system path, + must not be NULL + + @param ppustrFileOrDirPart [out] on + return receives the last part + of the given directory or the + file name + if pustrPath is the root path + '/' an empty string will be + returned + if pustrPath has a trailing + '/' the last part before the + '/' will be returned else + the part after the last '/' + will be returned + + @returns nothing + + ****************************************/ + +void SAL_CALL osl_systemPathGetFileNameOrLastDirectoryPart( + const rtl_uString* pustrPath, + rtl_uString** ppustrFileNameOrLastDirPart); + +/******************************************** + osl_systemPathIsHiddenFileOrDirectoryEntry + Returns sal_True if the last part of + given system path is not '.' or '..' + alone and starts with a '.' + + @param pustrPath [in] a system path, + must not be NULL + + @returns sal_True if the last part of + the given system path starts + with '.' or sal_False the last + part is '.' or '..' alone or + doesn't start with a dot + +*********************************************/ + +bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry( + const rtl_uString* pustrPath); + +/************************************************ + osl_systemPathIsLocalOrParentDirectoryEntry + Returns sal_True if the last part of the given + system path is the local directory entry '.' + or the parent directory entry '..' + + @param pustrPath [in] a system path, + must not be NULL + + @returns sal_True if the last part of the + given system path is '.' or '..' + else sal_False + +************************************************/ + +bool SAL_CALL osl_systemPathIsLocalOrParentDirectoryEntry( + const rtl_uString* pustrPath); + +/************************************************ + osl_searchPath + Searches for a file name or path name in all + directories specified by a given path list. + Symbolic links in the resulting path will not be + resolved, it's up to the caller to do this. + + @param pustrFilePath [in] a file name or + directory name to search for, the name must + be provided as system path not as a file URL + + @param pustrSearchPathList [in] a ':' + separated list of paths in which to search for + the file or directory name + + @param ppustrPathFound [out] on success receives the + complete path of the file or directory found + as a system path + + @returns sal_True if the specified file or + directory was found else sal_False + ***********************************************/ + +bool SAL_CALL osl_searchPath( + const rtl_uString* pustrFilePath, + const rtl_uString* pustrSearchPathList, + rtl_uString** ppustrPathFound); + namespace osl { diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 749bfc0..56c4925 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -31,7 +31,7 @@ #include "rtl/ustring.hxx" #include "rtl/strbuf.h" -#include "file_path_helper.h" +#include "file_path_helper.hxx" #include "uunxapi.hxx" #include "getexecutablefile.hxx" diff --git a/sal/osl/unx/signal.cxx b/sal/osl/unx/signal.cxx index 49f0e11..75d3329 100644 --- a/sal/osl/unx/signal.cxx +++ b/sal/osl/unx/signal.cxx @@ -75,7 +75,7 @@ #include <rtl/bootstrap.h> #include <rtl/digest.h> -#include "file_path_helper.h" +#include "file_path_helper.hxx" #define ACT_IGNORE 1 #define ACT_EXIT 2 commit 656bd9f942e13a2c63ccaea458132bca7d1ccceb Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Nov 19 14:29:54 2014 +0100 signal.c -> signal.cxx Change-Id: I1d7f47b81e558a071a6beb52999d0bca185f02d5 diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk index 1469f82..dbca766 100644 --- a/sal/Library_sal.mk +++ b/sal/Library_sal.mk @@ -169,6 +169,7 @@ $(eval $(call gb_Library_add_exception_objects,sal,\ sal/osl/unx/profile \ sal/osl/unx/readwrite_helper \ sal/osl/unx/security \ + sal/osl/unx/signal \ sal/osl/unx/socket \ sal/osl/unx/system \ sal/osl/unx/tempfile \ @@ -176,9 +177,6 @@ $(eval $(call gb_Library_add_exception_objects,sal,\ sal/osl/unx/time \ $(if $(filter DESKTOP,$(BUILD_TYPE)), sal/osl/unx/salinit) \ )) -$(eval $(call gb_Library_add_cobjects,sal, \ - sal/osl/unx/signal \ -)) # Note that the uunxapi.mm file just includes the uunxapi.cxx one ifeq ($(OS),MACOSX) diff --git a/sal/osl/unx/signal.c b/sal/osl/unx/signal.cxx similarity index 97% rename from sal/osl/unx/signal.c rename to sal/osl/unx/signal.cxx index a2bd05a..49f0e11 100644 --- a/sal/osl/unx/signal.c +++ b/sal/osl/unx/signal.cxx @@ -158,13 +158,13 @@ what looks like a bug in the new handler*/ }; const int NoSignals = sizeof(Signals) / sizeof(struct SignalAction); -static sal_Bool bErrorReportingEnabled = sal_True; -static sal_Bool bInitSignal = sal_False; +static bool bErrorReportingEnabled = true; +static bool bInitSignal = false; static oslMutex SignalListMutex; static oslSignalHandlerImpl* SignalList; -static sal_Bool bSetSEGVHandler = sal_False; -static sal_Bool bSetWINCHHandler = sal_False; -static sal_Bool bSetILLHandler = sal_False; +static bool bSetSEGVHandler = false; +static bool bSetWINCHHandler = false; +static bool bSetILLHandler = false; static void SignalHandlerFunction(int); @@ -189,7 +189,7 @@ static void getExecutableName_Impl (rtl_String ** ppstrProgName) } } -static sal_Bool is_soffice_Impl (void) +static bool is_soffice_Impl (void) { sal_Int32 idx = -1; rtl_String * strProgName = 0; @@ -203,7 +203,7 @@ static sal_Bool is_soffice_Impl (void) return (idx != -1); } -static sal_Bool InitSignal(void) +static bool InitSignal(void) { int i; struct sigaction act; @@ -220,17 +220,17 @@ static sal_Bool InitSignal(void) // TEMPORARY SOLUTION: // the office sets the signal handler during startup // java can than overwrite it, if needed - bSetSEGVHandler = sal_True; + bSetSEGVHandler = true; // WORKAROUND FOR WINCH HANDLER (SEE ABOVE) - bSetWINCHHandler = sal_True; + bSetWINCHHandler = true; // WORKAROUND FOR ILLEGAL INSTRUCTION HANDLER (SEE ABOVE) - bSetILLHandler = sal_True; + bSetILLHandler = true; } #ifdef DBG_UTIL - bSetSEGVHandler = bSetWINCHHandler = bSetILLHandler = sal_False; + bSetSEGVHandler = bSetWINCHHandler = bSetILLHandler = false; #endif SignalListMutex = osl_createMutex(); @@ -289,10 +289,10 @@ static sal_Bool InitSignal(void) OSL_TRACE("sigemptyset or pthread_sigmask failed"); } - return sal_True; + return true; } -static sal_Bool DeInitSignal(void) +static bool DeInitSignal(void) { int i; struct sigaction act; @@ -311,7 +311,7 @@ static sal_Bool DeInitSignal(void) osl_destroyMutex(SignalListMutex); - return sal_False; + return false; } #if HAVE_FEATURE_CRASHDUMP && defined(INCLUDE_BACKTRACE) @@ -883,7 +883,7 @@ void CallSystemHandler(int Signal) break; default: /* should never happen */ - OSL_ASSERT(0); + OSL_ASSERT(false); } } else @@ -1082,7 +1082,7 @@ oslSignalAction SAL_CALL osl_raiseSignal(sal_Int32 UserSignal, void* UserData) sal_Bool SAL_CALL osl_setErrorReporting( sal_Bool bEnable ) { - sal_Bool bOld = bErrorReportingEnabled; + bool bOld = bErrorReportingEnabled; bErrorReportingEnabled = bEnable; return bOld; commit f4680be8e39d4e4411c0afd704ebdcb2045dee43 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Nov 19 14:24:06 2014 +0100 HAVE_FEATURE_CRASHDUMP instead of manual SAL_ENABLE_CRASH_REPORT Change-Id: Ifaf971d77f11cef207706989bba11dbe2028ca79 diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in index 74ce234..886542e 100644 --- a/config_host/config_features.h.in +++ b/config_host/config_features.h.in @@ -146,4 +146,7 @@ */ #define HAVE_FEATURE_COLLADA 0 +/* see --enable-crashdump: */ +#define HAVE_FEATURE_CRASHDUMP 0 + #endif diff --git a/configure.ac b/configure.ac index 8ee0ab4..e716ad0 100644 --- a/configure.ac +++ b/configure.ac @@ -4537,6 +4537,7 @@ if test "$enable_crashdump" = "yes"; then ENABLE_CRASHDUMP="TRUE" BUILD_TYPE="$BUILD_TYPE CRASHREP" AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_FEATURE_CRASHDUMP) else ENABLE_CRASHDUMP="" AC_MSG_RESULT([no]) diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk index a5ac8bc..1469f82 100644 --- a/sal/Library_sal.mk +++ b/sal/Library_sal.mk @@ -176,8 +176,8 @@ $(eval $(call gb_Library_add_exception_objects,sal,\ sal/osl/unx/time \ $(if $(filter DESKTOP,$(BUILD_TYPE)), sal/osl/unx/salinit) \ )) -$(eval $(call gb_Library_add_cobject,sal,sal/osl/unx/signal, \ - $(if $(ENABLE_CRASHDUMP),-DSAL_ENABLE_CRASH_REPORT) \ +$(eval $(call gb_Library_add_cobjects,sal, \ + sal/osl/unx/signal \ )) # Note that the uunxapi.mm file just includes the uunxapi.cxx one diff --git a/sal/osl/unx/signal.c b/sal/osl/unx/signal.c index 6b73d50..a2bd05a 100644 --- a/sal/osl/unx/signal.c +++ b/sal/osl/unx/signal.c @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <config_features.h> + /* system headers */ #include "system.h" @@ -25,7 +29,7 @@ #if defined( INTEL ) #include "backtrace.h" #define INCLUDE_BACKTRACE -#ifdef SAL_ENABLE_CRASH_REPORT +#if HAVE_FEATURE_CRASHDUMP #define STACKTYPE "MacOsX_X86" #endif #endif /* INTEL */ @@ -36,7 +40,7 @@ #include <execinfo.h> #include <link.h> #define INCLUDE_BACKTRACE -#if defined SAL_ENABLE_CRASH_REPORT +#if HAVE_FEATURE_CRASHDUMP #define STACKTYPE "Linux" #endif #endif @@ -46,7 +50,7 @@ #include "backtrace.h" #define INCLUDE_BACKTRACE -#if defined SAL_ENABLE_CRASH_REPORT +#if HAVE_FEATURE_CRASHDUMP #if defined( SPARC ) #define STACKTYPE "Solaris_Sparc" #elif defined( INTEL ) @@ -77,7 +81,7 @@ #define ACT_EXIT 2 #define ACT_SYSTEM 3 #define ACT_HIDE 4 -#ifdef SAL_ENABLE_CRASH_REPORT +#if HAVE_FEATURE_CRASHDUMP # define ACT_ABORT 5 #else # define ACT_ABORT ACT_SYSTEM @@ -310,7 +314,7 @@ static sal_Bool DeInitSignal(void) return sal_False; } -#if defined (SAL_ENABLE_CRASH_REPORT) && defined(INCLUDE_BACKTRACE) +#if HAVE_FEATURE_CRASHDUMP && defined(INCLUDE_BACKTRACE) static sal_uInt32 calc_md5_checksum( const char *filename, sal_uInt8 *pChecksum, sal_uInt32 nChecksumLen ) { @@ -389,8 +393,7 @@ static int fputs_xml( const char *string, FILE *stream ) /* Create intermediate files and run crash reporter */ -#if defined SAL_ENABLE_CRASH_REPORT && defined INCLUDE_BACKTRACE && \ - defined LINUX +#if HAVE_FEATURE_CRASHDUMP && defined INCLUDE_BACKTRACE && defined LINUX typedef struct { @@ -473,7 +476,7 @@ dynamic_section_offset(const char *name) static int ReportCrash( int Signal ) { -#ifdef SAL_ENABLE_CRASH_REPORT +#if HAVE_FEATURE_CRASHDUMP #define REPORTENV_PARAM "-crashreportenv:" @@ -794,12 +797,12 @@ static int ReportCrash( int Signal ) } return 1; -#else /* defined SAL_ENABLE_CRASH_REPORT */ +#else /* HAVE_FEATURE_CRASHDUMP */ /* the utility crash_report is not build, so do the same as when the option -nocrashreport is used */ (void) Signal; // avoid warnings return -1; -#endif /* defined SAL_ENABLE_CRASH_REPORT */ +#endif /* HAVE_FEATURE_CRASHDUMP */ } static void PrintStack( int sig ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits