[Libreoffice-commits] core.git: 3 commits - include/sal qadevOOo/tests sc/source vcl/unx
Stephan Bergmann
sbergman at redhat.com
Wed Aug 28 04:27:13 PDT 2013
include/sal/log-areas.dox | 1
qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java | 34 +++--
sc/source/core/tool/scmatrix.cxx | 2
vcl/unx/generic/plugadapt/salplug.cxx | 105 +++++++---------
4 files changed, 72 insertions(+), 70 deletions(-)
New commits:
commit fc1f68d5b9f3ce7a77a13b959692a1027c6e2ada
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Aug 28 13:26:39 2013 +0200
Clean up logging and string handling
Change-Id: I39823e303097ef32f3cc394b0d9215ae351a88f3
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index f888b8c..83b3ac0 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -325,6 +325,7 @@ certain functionality.
@li @c vcl.kde - KDE
@li @c vcl.kde4 - KDE4
@li @c vcl.layout - Widget layout
+ at li @c vcl.plugadapt - the Unix/X11 backend plugin mechanism
@li @c vcl.scrollbar - Scroll Bars
@li @c vcl.sm - Session Manager
@li @c vcl.window
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index 4cb49f9..1e0b0db 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -20,7 +20,6 @@
#include "osl/module.h"
#include "osl/process.h"
-#include "rtl/ustrbuf.hxx"
#include "rtl/bootstrap.hxx"
#include "salinst.hxx"
@@ -50,11 +49,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = fals
{
return NULL;
}
- OUStringBuffer aModName( 128 );
- aModName.appendAscii( SAL_DLLPREFIX"vclplug_" );
- aModName.append( rModuleBase );
- aModName.appendAscii( SAL_DLLPOSTFIX );
- OUString aModule = aModName.makeStringAndClear();
+ OUString aModule(SAL_DLLPREFIX "vclplug_" + rModuleBase + SAL_DLLPOSTFIX);
oslModule aMod = osl_loadModuleRelative(
reinterpret_cast< oslGenericFunction >( &tryInstance ), aModule.pData,
@@ -65,11 +60,9 @@ static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = fals
if( aProc )
{
pInst = aProc( aMod );
-#if OSL_DEBUG_LEVEL > 1
- std::fprintf( stderr, "sal plugin %s produced instance %p\n",
- OUStringToOString( aModule, RTL_TEXTENCODING_ASCII_US ).getStr(),
- pInst );
-#endif
+ SAL_INFO(
+ "vcl.plugadapt",
+ "sal plugin " << aModule << " produced instance " << pInst);
if( pInst )
{
pCloseModule = aMod;
@@ -81,7 +74,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = fals
* So make sure libgtk+ & co are still mapped into memory when
* atk-bridge's atexit handler gets called.
* #i109007# KDE3 seems to have the same problem.
- * And same applies for KDE4.
+ * And same applies for KDE4.
*/
if( rModuleBase == "gtk" || rModuleBase == "gtk3" || rModuleBase == "tde" || rModuleBase == "kde" || rModuleBase == "kde4" )
{
@@ -95,19 +88,21 @@ static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = fals
}
else
{
-#if OSL_DEBUG_LEVEL > 1
- std::fprintf( stderr, "could not load symbol %s from shared object %s\n",
- "create_SalInstance",
- OUStringToOString( aModule, RTL_TEXTENCODING_ASCII_US ).getStr() );
-#endif
+ SAL_WARN(
+ "vcl.plugadapt",
+ "could not load symbol create_SalInstance from shared object "
+ << aModule);
osl_unloadModule( aMod );
}
}
-#if OSL_DEBUG_LEVEL > 1
+ else if (bForce)
+ {
+ SAL_WARN("vcl.plugadapt", "could not load shared object " << aModule);
+ }
else
- std::fprintf( stderr, "could not load shared object %s\n",
- OUStringToOString( aModule, RTL_TEXTENCODING_ASCII_US ).getStr() );
-#endif
+ {
+ SAL_INFO("vcl.plugadapt", "could not load shared object " << aModule);
+ }
return pInst;
}
@@ -116,14 +111,14 @@ static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = fals
static DesktopType get_desktop_environment()
{
- OUStringBuffer aModName( 128 );
- #ifdef LIBO_MERGELIBS
- aModName.appendAscii( SAL_DLLPREFIX"merged" );
- #else
- aModName.appendAscii( SAL_DLLPREFIX"desktop_detector" );
- #endif
- aModName.appendAscii( SAL_DLLPOSTFIX );
- OUString aModule = aModName.makeStringAndClear();
+ OUString aModule(
+ SAL_DLLPREFIX
+#if defined LIBO_MERGELIBS
+ "merged"
+#else
+ "desktop_detector"
+#endif
+ SAL_DLLPOSTFIX);
oslModule aMod = osl_loadModuleRelative(
reinterpret_cast< oslGenericFunction >( &tryInstance ), aModule.pData,
@@ -148,7 +143,7 @@ static DesktopType get_desktop_environment()
static SalInstance* autodetect_plugin()
{
- static const char* pTDEFallbackList[] =
+ static const char* const pTDEFallbackList[] =
{
"tde",
#if ENABLE_KDE4
@@ -160,7 +155,7 @@ static SalInstance* autodetect_plugin()
"gtk3", "gtk", "gen", 0
};
- static const char* pKDEFallbackList[] =
+ static const char* const pKDEFallbackList[] =
{
#if ENABLE_KDE4
"kde4",
@@ -171,18 +166,18 @@ static SalInstance* autodetect_plugin()
"gtk3", "gtk", "gen", 0
};
- static const char* pStandardFallbackList[] =
+ static const char* const pStandardFallbackList[] =
{
"gtk3", "gtk", "gen", 0
};
- static const char* pHeadlessFallbackList[] =
+ static const char* const pHeadlessFallbackList[] =
{
"svp", 0
};
DesktopType desktop = get_desktop_environment();
- const char ** pList = pStandardFallbackList;
+ const char * const * pList = pStandardFallbackList;
int nListEntry = 0;
// no server at all: dummy plugin
@@ -207,10 +202,9 @@ static SalInstance* autodetect_plugin()
{
OUString aTry( OUString::createFromAscii( pList[nListEntry] ) );
pInst = tryInstance( aTry );
- #if OSL_DEBUG_LEVEL > 1
- if( pInst )
- std::fprintf( stderr, "plugin autodetection: %s\n", pList[nListEntry] );
- #endif
+ SAL_INFO_IF(
+ pInst, "vcl.plugadapt",
+ "plugin autodetection: " << pList[nListEntry]);
nListEntry++;
}
@@ -222,14 +216,16 @@ SalInstance *CreateSalInstance()
SalInstance *pInst = NULL;
OUString aUsePlugin;
- static const char* pUsePlugin = getenv( "SAL_USE_VCLPLUGIN" );
- if( pUsePlugin )
- aUsePlugin = OUString::createFromAscii( pUsePlugin );
- else
- rtl::Bootstrap::get( "SAL_USE_VCLPLUGIN", aUsePlugin );
-
if( Application::IsHeadlessModeRequested() )
aUsePlugin = "svp";
+ else
+ {
+ static const char* pUsePlugin = getenv( "SAL_USE_VCLPLUGIN" );
+ if( pUsePlugin )
+ aUsePlugin = OUString::createFromAscii( pUsePlugin );
+ else
+ rtl::Bootstrap::get( "SAL_USE_VCLPLUGIN", aUsePlugin );
+ }
if( !aUsePlugin.isEmpty() )
pInst = tryInstance( aUsePlugin, true );
@@ -238,9 +234,10 @@ SalInstance *CreateSalInstance()
pInst = autodetect_plugin();
// fallback, try everything
- const char* pPlugin[] = { "gtk3", "gtk", "kde4", "kde", "tde", "gen", 0 };
+ static const char* const pPlugin[] = {
+ "gtk3", "gtk", "kde4", "kde", "tde", "gen" };
- for ( int i = 0; !pInst && pPlugin[ i ]; ++i )
+ for ( int i = 0; !pInst && i != SAL_N_ELEMENTS(pPlugin); ++i )
pInst = tryInstance( OUString::createFromAscii( pPlugin[ i ] ) );
if( ! pInst )
@@ -289,20 +286,18 @@ void SalAbort( const OUString& rErrorText, bool bDumpCore )
_exit(1);
}
-// Order to match desktops.hxx' DesktopType
-static const char * desktop_strings[] = {
- "none", "unknown", "GNOME",
- "XFCE", "MATE", "TDE",
- "KDE", "KDE4" };
-
const OUString& SalGetDesktopEnvironment()
{
+ // Order to match desktops.hxx' DesktopType
+ static const char * const desktop_strings[] = {
+ "none", "unknown", "GNOME",
+ "XFCE", "MATE", "TDE",
+ "KDE", "KDE4" };
static OUString aRet;
if( aRet.isEmpty())
{
- OUStringBuffer buf( 8 );
- buf.appendAscii( desktop_strings[ get_desktop_environment() ] );
- aRet = buf.makeStringAndClear();
+ aRet = OUString::createFromAscii(
+ desktop_strings[get_desktop_environment()]);
}
return aRet;
}
commit 5b5c52a3a4d048bba8c18dfb06ffca25c670d099
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Aug 28 13:23:45 2013 +0200
Try make this more robust in slow environments
...where the previous .uno:PrintPreview request has not yet been processed and
xRoot/oObj would still be null. Hopefully, it does not introduce infinite
loops, though.
Change-Id: Ie79e0b0a3185528ab4036ed7a33de81117c02c83
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java
index fb18312..5c595c1 100644
--- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java
@@ -90,8 +90,6 @@ public class ScAccessiblePageHeader extends TestCase {
protected TestEnvironment createTestEnvironment(
TestParameters Param, PrintWriter log) {
- XInterface oObj = null;
-
// inserting some content to have non-empty page preview
XCell xCell = null;
try {
@@ -137,20 +135,28 @@ public class ScAccessiblePageHeader extends TestCase {
throw new StatusException(Status.failed("Couldn't change mode"));
}
- try {
- Thread.sleep(500);
- } catch (InterruptedException ex) {}
-
AccessibilityTools at = new AccessibilityTools();
- XWindow xWindow = AccessibilityTools.getCurrentWindow( (XMultiServiceFactory) Param.getMSF(), aModel);
- XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
-
- oObj = AccessibilityTools.getAccessibleObjectForRole
- (xRoot, AccessibleRole.HEADER, "");
-
- log.println("ImplementationName " + utils.getImplName(oObj));
- AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+ XInterface oObj = null;
+ for (;;) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ XWindow xWindow = AccessibilityTools.getCurrentWindow( (XMultiServiceFactory) Param.getMSF(), aModel);
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
+ if (xRoot != null) {
+ oObj = AccessibilityTools.getAccessibleObjectForRole
+ (xRoot, AccessibleRole.HEADER, "");
+ if (oObj != null) {
+ log.println("ImplementationName " + utils.getImplName(oObj));
+ AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+ break;
+ }
+ }
+ log.println("No HEADER found yet, retrying");
+ }
TestEnvironment tEnv = new TestEnvironment(oObj);
commit 09c09fa20b93a236c639a2ce957fc634c8688ce5
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Aug 28 13:21:16 2013 +0200
warning C4805: == : unsafe mix of type[s]
Change-Id: I1bbcfbbab6e077d4516a22c2e0c0d4ec4dd12aca
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 2640bfb..1147efd 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1009,7 +1009,7 @@ size_t WalkAndMatchElements<double>::compare(const MatrixImplType::element_block
MatrixImplType::boolean_block_type::const_iterator itEnd = MatrixImplType::boolean_block_type::end(*node.data);
for (; it != itEnd; ++it, ++nCount)
{
- if (*it == maMatchValue)
+ if (int(*it) == maMatchValue)
{
return mnIndex + nCount;
}
More information about the Libreoffice-commits
mailing list