From da147a4e64847f62007d3d01f82c8dc59e2f4366 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 7 Feb 2017 19:24:38 +0100 Subject: Clean up C-style interface nonsense Change-Id: Ie9a1e106f5270fd307d211fa334449c698acf25d Reviewed-on: https://gerrit.libreoffice.org/34010 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sal/inc/backtraceasstring.hxx | 25 +++++++++++++++++++++++++ sal/inc/misc.hxx | 18 ------------------ sal/osl/all/log.cxx | 7 +++---- sal/osl/unx/backtraceapi.cxx | 11 ++++------- sal/osl/w32/backtrace.cxx | 10 +++++----- 5 files changed, 37 insertions(+), 34 deletions(-) create mode 100644 sal/inc/backtraceasstring.hxx delete mode 100644 sal/inc/misc.hxx (limited to 'sal') diff --git a/sal/inc/backtraceasstring.hxx b/sal/inc/backtraceasstring.hxx new file mode 100644 index 000000000000..d15065a48ce8 --- /dev/null +++ b/sal/inc/backtraceasstring.hxx @@ -0,0 +1,25 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_SAL_INC_BACKTRACEASSTRING_HXX +#define INCLUDED_SAL_INC_BACKTRACEASSTRING_HXX + +#include + +#include + +namespace osl { namespace detail { + +/// Build a debugging backtrace from current PC location. +OUString backtraceAsString(int maxNoStackFramesToDisplay); + +} } + +#endif // INCLUDED_SAL_INC_INTERNAL_MISC_H + diff --git a/sal/inc/misc.hxx b/sal/inc/misc.hxx deleted file mode 100644 index 440c00ce2548..000000000000 --- a/sal/inc/misc.hxx +++ /dev/null @@ -1,18 +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/. - */ -#ifndef INCLUDED_SAL_INC_INTERNAL_MISC_H -#define INCLUDED_SAL_INC_INTERNAL_MISC_H - -#include - -/// Build a debugging backtrace from current PC location. -rtl_uString *osl_backtraceAsString(int maxNoStackFramesToDisplay); - -#endif // INCLUDED_SAL_INC_INTERNAL_MISC_H - diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx index 5e4497fac24b..7a6c3072b940 100644 --- a/sal/osl/all/log.cxx +++ b/sal/osl/all/log.cxx @@ -26,7 +26,7 @@ #include "sal/detail/log.h" #include "sal/log.hxx" #include "sal/types.h" -#include "misc.hxx" +#include "backtraceasstring.hxx" #include "salusesyslog.hxx" #if defined ANDROID @@ -277,9 +277,8 @@ void log_backtrace( sal_detail_LogLevel level, char const * area, char const * where, char const * message, int maxNoStackFramesToDisplay) { - OUString buff = OUString::createFromAscii(message) + - " at:\n" + - OUString(osl_backtraceAsString(maxNoStackFramesToDisplay), SAL_NO_ACQUIRE); + OUString buff = OUString::createFromAscii(message) + " at:\n" + + osl::detail::backtraceAsString(maxNoStackFramesToDisplay); log(level, area, where, buff.toUtf8().getStr()); } diff --git a/sal/osl/unx/backtraceapi.cxx b/sal/osl/unx/backtraceapi.cxx index d42fe674adb9..c212184ceb55 100644 --- a/sal/osl/unx/backtraceapi.cxx +++ b/sal/osl/unx/backtraceapi.cxx @@ -9,16 +9,13 @@ #include -#include -#include "misc.hxx" +#include +#include "backtraceasstring.hxx" // FIXME: no-op for now; it needs implementing, cf. above. -rtl_uString *osl_backtraceAsString(int /*maxNoStackFramesToDisplay*/) +OUString osl::detail::backtraceAsString(int /*maxNoStackFramesToDisplay*/) { - OUStringBuffer aBuf; - OUString aStr = aBuf.makeStringAndClear(); - rtl_uString_acquire( aStr.pData ); - return aStr.pData; + return OUString(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/w32/backtrace.cxx b/sal/osl/w32/backtrace.cxx index 6c24698b1aa3..78d9e0aed9e5 100644 --- a/sal/osl/w32/backtrace.cxx +++ b/sal/osl/w32/backtrace.cxx @@ -7,7 +7,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "misc.hxx" +#include + +#include "backtraceasstring.hxx" #include #include @@ -18,7 +20,7 @@ #include #include -rtl_uString *osl_backtraceAsString(int maxNoStackFramesToDisplay) +OUString osl::detail::backtraceAsString(int maxNoStackFramesToDisplay) { OUStringBuffer aBuf; @@ -46,9 +48,7 @@ rtl_uString *osl_backtraceAsString(int maxNoStackFramesToDisplay) free( pSymbol ); - OUString aStr = aBuf.makeStringAndClear(); - rtl_uString_acquire( aStr.pData ); - return aStr.pData; + return aBuf.makeStringAndClear(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit