summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-08-23 15:21:32 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-08-23 15:21:53 +0200
commita1c4ab09ddd669810a412e5ab40d7f06326b55cc (patch)
tree34a136fe4d183aa5e4c2caed42048d4dd1e76eda /vcl/unx
parent897c73740bbed6b95999f43839db8412c5753d10 (diff)
Properly mark callback functions as extern "C"
Change-Id: Ida0a62a438ee36ef1aaecb5ca4a072325b22636d
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/app/saldata.cxx75
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx6
2 files changed, 44 insertions, 37 deletions
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index 9b5e200ad221..7f460a239506 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -83,6 +83,43 @@ X11SalData* GetX11SalData()
return p2;
}
+extern "C" {
+
+static int XErrorHdl( Display *pDisplay, XErrorEvent *pEvent )
+{
+ GetX11SalData()->XError( pDisplay, pEvent );
+ return 0;
+}
+
+static int XIOErrorHdl( Display * )
+{
+ if (::osl::Thread::getCurrentIdentifier() == Application::GetMainThreadIdentifier())
+ {
+ /* #106197# hack: until a real shutdown procedure exists
+ * _exit ASAP
+ */
+ if( ImplGetSVData()->maAppData.mbAppQuit )
+ _exit(1);
+
+ // really bad hack
+ if( ! SessionManagerClient::checkDocumentsSaved() )
+ /* oslSignalAction eToDo = */ osl_raiseSignal (OSL_SIGNAL_USER_X11SUBSYSTEMERROR, NULL);
+ }
+
+ std::fprintf( stderr, "X IO Error\n" );
+ std::fflush( stdout );
+ std::fflush( stderr );
+
+ /* #106197# the same reasons to use _exit instead of exit in salmain
+ * do apply here. Since there is nothing to be done after an XIO
+ * error we have to _exit immediately.
+ */
+ _exit(1);
+ return 0;
+}
+
+}
+
static const struct timeval noyield__ = { 0, 0 };
static const struct timeval yield__ = { 0, 10000 };
@@ -224,7 +261,7 @@ X11SalData::X11SalData( SalGenericDataType t, SalInstance *pInstance )
pXLib_ = NULL;
m_pPlugin = NULL;
- m_aOrigXIOErrorHandler = XSetIOErrorHandler ( (XIOErrorHandler)XIOErrorHdl );
+ m_aOrigXIOErrorHandler = XSetIOErrorHandler ( XIOErrorHdl );
PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) );
}
@@ -287,7 +324,7 @@ void X11SalData::PushXErrorLevel( bool bIgnore )
rEnt.m_bWas = false;
rEnt.m_bIgnore = bIgnore;
rEnt.m_nLastErrorRequest = 0;
- rEnt.m_aHandler = XSetErrorHandler( (XErrorHandler)XErrorHdl );
+ rEnt.m_aHandler = XSetErrorHandler( XErrorHdl );
}
void X11SalData::PopXErrorLevel()
@@ -299,40 +336,6 @@ void X11SalData::PopXErrorLevel()
}
}
-int X11SalData::XErrorHdl( Display *pDisplay, XErrorEvent *pEvent )
-{
- GetX11SalData()->XError( pDisplay, pEvent );
- return 0;
-}
-
-int X11SalData::XIOErrorHdl( Display * )
-{
- if (::osl::Thread::getCurrentIdentifier() == Application::GetMainThreadIdentifier())
- {
- /* #106197# hack: until a real shutdown procedure exists
- * _exit ASAP
- */
- if( ImplGetSVData()->maAppData.mbAppQuit )
- _exit(1);
-
- // really bad hack
- if( ! SessionManagerClient::checkDocumentsSaved() )
- /* oslSignalAction eToDo = */ osl_raiseSignal (OSL_SIGNAL_USER_X11SUBSYSTEMERROR, NULL);
- }
-
- std::fprintf( stderr, "X IO Error\n" );
- std::fflush( stdout );
- std::fflush( stderr );
-
- /* #106197# the same reasons to use _exit instead of exit in salmain
- * do apply here. Since there is nothing to be done after an XIO
- * error we have to _exit immediately.
- */
- _exit(1);
- return 0;
-}
-
-
SalXLib::SalXLib()
{
m_aTimeout.tv_sec = 0;
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index c2ec520ff200..9761354c3969 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -511,7 +511,9 @@ GtkData::GtkData( SalInstance *pInstance )
XIOErrorHandler aOrigXIOErrorHandler = NULL;
-int XIOErrorHdl(Display *)
+extern "C" {
+
+static int XIOErrorHdl(Display *)
{
fprintf(stderr, "X IO Error\n");
_exit(1);
@@ -519,6 +521,8 @@ int XIOErrorHdl(Display *)
// handlers are in progress
}
+}
+
GtkData::~GtkData()
{
Yield( true, true );