Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
fc45189c
Kaydet (Commit)
fc45189c
authored
Kas 15, 2012
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Replace medDebug with sal/log.hxx functionality
Change-Id: I30bf94043b5b638260704629356d010c8ea6b4e0
üst
6adc24cd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
66 deletions
+78
-66
mediator.hxx
extensions/source/plugin/inc/plugin/unx/mediator.hxx
+0
-20
mediator.cxx
extensions/source/plugin/unx/mediator.cxx
+35
-14
npnapi.cxx
extensions/source/plugin/unx/npnapi.cxx
+0
-0
nppapi.cxx
extensions/source/plugin/unx/nppapi.cxx
+12
-5
npwrap.cxx
extensions/source/plugin/unx/npwrap.cxx
+28
-25
plugcon.cxx
extensions/source/plugin/unx/plugcon.cxx
+2
-2
log-areas.dox
sal/inc/sal/log-areas.dox
+1
-0
No files found.
extensions/source/plugin/inc/plugin/unx/mediator.hxx
Dosyayı görüntüle @
fc45189c
...
...
@@ -29,15 +29,11 @@
#define _MEDIATOR_HXX
#include <string.h>
#include <stdarg.h>
#include <tools/link.hxx>
#include <osl/pipe.hxx>
#include <osl/mutex.hxx>
#include <osl/conditn.hxx>
#include <osl/thread.hxx>
#if OSL_DEBUG_LEVEL > 1
#include <stdio.h>
#endif
#include <vector>
...
...
@@ -164,22 +160,6 @@ class MediatorListener : public osl::Thread
virtual
void
onTerminated
();
};
inline
void
medDebug
(
int
condition
,
const
char
*
pFormat
,
...
)
{
#if OSL_DEBUG_LEVEL > 1
if
(
condition
)
{
va_list
ap
;
va_start
(
ap
,
pFormat
);
vfprintf
(
stderr
,
pFormat
,
ap
);
va_end
(
ap
);
}
#else
(
void
)
condition
;
(
void
)
pFormat
;
#endif
}
#endif // _MEDIATOR_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
extensions/source/plugin/unx/mediator.cxx
Dosyayı görüntüle @
fc45189c
...
...
@@ -62,7 +62,7 @@ Mediator::~Mediator()
aHeader
[
2
]
=
MEDIATOR_MAGIC
;
ssize_t
nToWrite
=
sizeof
(
aHeader
);
bool
bSuccess
=
(
nToWrite
==
write
(
m_nSocket
,
aHeader
,
nToWrite
));
SAL_WARN_IF
(
!
bSuccess
,
"extensions
"
,
"short write"
);
SAL_WARN_IF
(
!
bSuccess
,
"extensions.plugin
"
,
"short write"
);
}
// kick the thread out of its run method; it deletes itself
close
(
m_nSocket
);
...
...
@@ -100,7 +100,7 @@ sal_uLong Mediator::SendMessage( sal_uLong nBytes, const char* pBytes, sal_uLong
memcpy
(
&
pBuffer
[
3
],
pBytes
,
(
size_t
)
nBytes
);
ssize_t
nToWrite
=
nBytes
+
3
*
sizeof
(
sal_uLong
);
bool
bSuccess
=
(
nToWrite
==
write
(
m_nSocket
,
pBuffer
,
nToWrite
));
SAL_WARN_IF
(
!
bSuccess
,
"extensions
"
,
"short write"
);
SAL_WARN_IF
(
!
bSuccess
,
"extensions.plugin
"
,
"short write"
);
delete
[]
pBuffer
;
return
nMessageID
;
...
...
@@ -222,16 +222,21 @@ void MediatorListener::run()
}
else
{
medDebug
(
1
,
"got incomplete MediatorMessage: { %d, %d, %*s }
\n
"
,
nHeader
[
0
],
nHeader
[
1
],
nHeader
[
1
],
pBuffer
);
SAL_WARN
(
"extensions.plugin"
,
"got incomplete MediatorMessage: { "
<<
nHeader
[
0
]
<<
", "
<<
nHeader
[
1
]
<<
", ... }"
);
bRun
=
false
;
}
delete
[]
pBuffer
;
}
else
{
medDebug
(
1
,
"got incomplete message header of %d bytes ( nHeader = [ %u, %u ] ), errno is %d
\n
"
,
nBytes
,
nHeader
[
0
],
nHeader
[
1
],
(
int
)
errno
);
SAL_WARN
(
"extensions.plugin"
,
"got incomplete message header of "
<<
nBytes
<<
" bytes (nHeader = ["
<<
nHeader
[
0
]
<<
", "
<<
nHeader
[
1
]
<<
"]), errno is "
<<
errno
);
bRun
=
false
;
}
}
...
...
@@ -252,7 +257,9 @@ sal_uLong MediatorMessage::ExtractULONG()
if
(
!
m_pRun
)
m_pRun
=
m_pBytes
;
medDebug
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"Overflow in MediatorMessage::ExtractULONG
\n
"
);
SAL_WARN_IF
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"extensions.plugin"
,
"overflow in MediatorMessage::ExtractULONG"
);
sal_uLong
nCount
;
memcpy
(
&
nCount
,
m_pRun
,
sizeof
(
sal_uLong
)
);
m_pRun
+=
sizeof
(
sal_uLong
);
...
...
@@ -264,13 +271,17 @@ void* MediatorMessage::GetBytes( sal_uLong& rBytes )
if
(
!
m_pRun
)
m_pRun
=
m_pBytes
;
medDebug
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"Overflow in MediatorMessage::GetBytes
\n
"
);
SAL_WARN_IF
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"extensions.plugin"
,
"overflow in MediatorMessage::GetBytes"
);
sal_uLong
nBytes
=
ExtractULONG
();
if
(
nBytes
==
0
)
return
NULL
;
medDebug
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"Overflow in MediatorMessage::GetBytes
\n
"
);
SAL_WARN_IF
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"extensions.plugin"
,
"overflow in MediatorMessage::GetBytes"
);
char
*
pBuffer
=
new
char
[
nBytes
];
memcpy
(
pBuffer
,
m_pRun
,
nBytes
);
m_pRun
+=
nBytes
;
...
...
@@ -283,13 +294,17 @@ char* MediatorMessage::GetString()
if
(
!
m_pRun
)
m_pRun
=
m_pBytes
;
medDebug
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"Overflow in MediatorMessage::GetString
\n
"
);
SAL_WARN_IF
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"extensions.plugin"
,
"overflow in MediatorMessage::GetString"
);
sal_uLong
nBytes
=
ExtractULONG
();
if
(
nBytes
==
0
)
return
NULL
;
medDebug
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"Overflow in MediatorMessage::GetString
\n
"
);
SAL_WARN_IF
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"extensions.plugin"
,
"overflow in MediatorMessage::GetString"
);
char
*
pBuffer
=
new
char
[
nBytes
+
1
];
memcpy
(
pBuffer
,
m_pRun
,
nBytes
);
pBuffer
[
nBytes
]
=
0
;
...
...
@@ -302,10 +317,16 @@ sal_uInt32 MediatorMessage::GetUINT32()
if
(
!
m_pRun
)
m_pRun
=
m_pBytes
;
medDebug
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"Overflow in MediatorMessage::GetUINT32
\n
"
);
SAL_WARN_IF
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"extensions.plugin"
,
"overflow in MediatorMessage::GetUINT32"
);
sal_uLong
nBytes
=
ExtractULONG
();
medDebug
(
nBytes
!=
sizeof
(
sal_uInt32
),
"No sal_uInt32 in MediatorMessage::GetUINT32
\n
"
);
medDebug
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"Overflow in MediatorMessage::GetUINT32
\n
"
);
SAL_WARN_IF
(
nBytes
!=
sizeof
(
sal_uInt32
),
"extensions.plugin"
,
"no sal_uInt32 in MediatorMessage::GetUINT32"
);
SAL_WARN_IF
(
(
sal_uLong
)(
m_pRun
-
m_pBytes
)
>=
m_nBytes
,
"extensions.plugin"
,
"overflow in MediatorMessage::GetUINT32"
);
sal_uInt32
nRet
;
memcpy
(
&
nRet
,
m_pRun
,
sizeof
(
nRet
)
);
m_pRun
+=
sizeof
(
sal_uInt32
);
...
...
extensions/source/plugin/unx/npnapi.cxx
Dosyayı görüntüle @
fc45189c
This diff is collapsed.
Click to expand it.
extensions/source/plugin/unx/nppapi.cxx
Dosyayı görüntüle @
fc45189c
...
...
@@ -96,7 +96,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ )
while
(
(
pMessage
=
GetNextMessage
(
sal_False
))
)
{
nCommand
=
(
CommandAtoms
)
pMessage
->
GetUINT32
();
medDebug
(
1
,
"%s
\n
"
,
GetCommandName
(
nCommand
)
);
SAL_INFO
(
"extensions.plugin"
,
GetCommandName
(
nCommand
)
);
switch
(
nCommand
)
{
case
eNPN_GetURL
:
...
...
@@ -146,11 +146,16 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ )
m_aNPWrapStreams
.
erase
(
m_aNPWrapStreams
.
begin
()
+
nFileID
);
}
else
medDebug
(
1
,
"StreamID %d has incoherent urls %s and %s
\n
"
,
nFileID
,
pUrl
,
m_aNPWrapStreams
[
nFileID
]
->
url
);
SAL_WARN
(
"extensions.plugin"
,
"StreamID "
<<
nFileID
<<
" has incoherent urls "
<<
pUrl
<<
" and "
<<
m_aNPWrapStreams
[
nFileID
]
->
url
);
}
else
medDebug
(
1
,
"Nonexistent StreamID %d
\n
"
,
nFileID
);
SAL_WARN
(
"extensions.plugin"
,
"nonexistent StreamID "
<<
nFileID
);
Respond
(
pMessage
->
m_nID
,
(
char
*
)(
&
aRet
),
sizeof
(
NPError
),
NULL
);
...
...
@@ -310,7 +315,9 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ )
}
break
;
default
:
medDebug
(
1
,
"caught unknown NPN request %d
\n
"
,
nCommand
);
SAL_WARN
(
"extensions.plugin"
,
"caught unknown NPN request "
<<
+
nCommand
);
}
delete
pMessage
;
...
...
extensions/source/plugin/unx/npwrap.cxx
Dosyayı görüntüle @
fc45189c
...
...
@@ -63,10 +63,10 @@ static bool bPluginAppQuit = false;
static
long
GlobalConnectionLostHdl
(
void
*
/*pInst*/
,
void
*
/*pArg*/
)
{
medDebug
(
1
,
"pluginapp exiting due to connection lost
\n
"
);
SAL_WARN
(
"extensions.plugin"
,
"pluginapp exiting due to connection lost"
);
bool
bSuccess
=
(
4
==
write
(
wakeup_fd
[
1
],
"xxxx"
,
4
));
SAL_WARN_IF
(
!
bSuccess
,
"extensions
"
,
"short write"
);
SAL_WARN_IF
(
!
bSuccess
,
"extensions.plugin
"
,
"short write"
);
return
0
;
}
...
...
@@ -95,7 +95,7 @@ extern "C"
// it seems you can use XtRemoveInput only
// safely from within the callback
// why is that ?
medDebug
(
1
,
"removing wakeup pipe
\n
"
);
SAL_INFO
(
"extensions.plugin"
,
"removing wakeup pipe"
);
XtRemoveInput
(
*
id
);
XtAppSetExitFlag
(
app_context
);
bPluginAppQuit
=
true
;
...
...
@@ -111,9 +111,9 @@ extern "C"
IMPL_LINK
(
PluginConnector
,
NewMessageHdl
,
Mediator
*
,
/*pMediator*/
)
{
medDebug
(
1
,
"new message handler
\n
"
);
SAL_INFO
(
"extensions.plugin"
,
"new message handler"
);
bool
bSuccess
=
(
4
==
write
(
wakeup_fd
[
1
],
"cccc"
,
4
));
SAL_WARN_IF
(
!
bSuccess
,
"extensions
"
,
"short write"
);
SAL_WARN_IF
(
!
bSuccess
,
"extensions.plugin
"
,
"short write"
);
return
0
;
}
...
...
@@ -135,7 +135,10 @@ Widget createSubWidget( char* /*pPluginText*/, Widget shell, XLIB_Window aParent
XtRealizeWidget
(
shell
);
XtRealizeWidget
(
newWidget
);
medDebug
(
1
,
"Reparenting new widget %x to %x
\n
"
,
XtWindow
(
newWidget
),
aParentWindow
);
SAL_INFO
(
"extensions.plugin"
,
"reparenting new widget "
<<
XtWindow
(
newWidget
)
<<
" to "
<<
aParentWindow
);
XReparentWindow
(
pXtAppDisplay
,
XtWindow
(
shell
),
aParentWindow
,
...
...
@@ -178,10 +181,7 @@ static oslModule LoadModule( const char* pPath )
osl_getFileURLFromSystemPath
(
sSystemPath
.
pData
,
&
sFileURL
.
pData
);
oslModule
pLib
=
osl_loadModule
(
sFileURL
.
pData
,
SAL_LOADMODULE_LAZY
);
if
(
!
pLib
)
{
medDebug
(
1
,
"could not open %s: %s
\n
"
,
pPath
,
dlerror
()
);
}
SAL_INFO_IF
(
!
pLib
,
"extensions.plugin"
,
"could not open "
<<
pPath
);
return
pLib
;
}
...
...
@@ -189,15 +189,18 @@ static oslModule LoadModule( const char* pPath )
static
void
CheckPlugin
(
const
char
*
pPath
)
{
oslModule
pLib
=
LoadModule
(
pPath
);
char
*
(
*
pNP_GetMIMEDescription
)()
=
(
char
*
(
*
)())
osl_getAsciiFunctionSymbol
(
pLib
,
"NP_GetMIMEDescription"
);
if
(
pNP_GetMIMEDescription
)
printf
(
"%s
\n
"
,
pNP_GetMIMEDescription
()
);
else
medDebug
(
1
,
"could not get symbol NP_GetMIMEDescription %s
\n
"
,
dlerror
()
);
osl_unloadModule
(
pLib
);
if
(
pLib
!=
0
)
{
char
*
(
*
pNP_GetMIMEDescription
)()
=
(
char
*
(
*
)())
osl_getAsciiFunctionSymbol
(
pLib
,
"NP_GetMIMEDescription"
);
if
(
pNP_GetMIMEDescription
)
printf
(
"%s
\n
"
,
pNP_GetMIMEDescription
()
);
else
SAL_WARN
(
"extensions.plugin"
,
"could not get symbol NP_GetMIMEDescription "
<<
dlerror
());
osl_unloadModule
(
pLib
);
}
}
#if OSL_DEBUG_LEVEL > 1 && defined LINUX
...
...
@@ -351,7 +354,7 @@ int main( int argc, char **argv)
if
(
pipe
(
wakeup_fd
)
)
{
medDebug
(
1
,
"could not pipe()
\n
"
);
SAL_WARN
(
"extensions.plugin"
,
"could not pipe()"
);
return
1
;
}
// initialize 'wakeup' pipe.
...
...
@@ -410,7 +413,7 @@ int main( int argc, char **argv)
GSource
*
pXTSource
=
g_source_new
(
&
aXtEventFuncs
,
sizeof
(
GSource
)
);
if
(
!
pXTSource
)
{
medDebug
(
1
,
"could not get Xt GSource"
);
SAL_WARN
(
"extensions.plugin"
,
"could not get Xt GSource"
);
return
1
;
}
...
...
@@ -427,7 +430,7 @@ int main( int argc, char **argv)
GSource
*
pWakeupSource
=
g_source_new
(
&
aWakeupEventFuncs
,
sizeof
(
GSource
)
);
if
(
pWakeupSource
==
NULL
)
{
medDebug
(
1
,
"could not get wakeup source"
);
SAL_WARN
(
"extensions.plugin"
,
"could not get wakeup source"
);
return
1
;
}
g_source_set_priority
(
pWakeupSource
,
GDK_PRIORITY_EVENTS
);
...
...
@@ -483,16 +486,16 @@ int main( int argc, char **argv)
#endif
}
while
(
!
XtAppGetExitFlag
(
app_context
)
&&
!
bPluginAppQuit
);
medDebug
(
1
,
"left plugin app main loop
\n
"
);
SAL_INFO
(
"extensions.plugin"
,
"left plugin app main loop"
);
#ifdef ENABLE_GTK
g_source_remove
(
xt_polling_timer_id
);
#endif
pNP_Shutdown
();
medDebug
(
1
,
"NP_Shutdown done
\n
"
);
SAL_INFO
(
"extensions.plugin"
,
"NP_Shutdown done"
);
osl_unloadModule
(
pPluginLib
);
medDebug
(
1
,
"plugin close
\n
"
);
SAL_INFO
(
"extensions.plugin"
,
"plugin close"
);
close
(
wakeup_fd
[
0
]
);
close
(
wakeup_fd
[
1
]
);
...
...
extensions/source/plugin/unx/plugcon.cxx
Dosyayı görüntüle @
fc45189c
...
...
@@ -44,7 +44,7 @@ sal_uInt32 PluginConnector::GetStreamID( NPStream* pStream )
for
(
size_t
i
=
0
;
i
<
nLen
;
i
++
)
if
(
m_aNPWrapStreams
[
i
]
==
pStream
)
return
static_cast
<
sal_uInt32
>
(
i
);
medDebug
(
1
,
"Error: NPStream has no ID
\n
"
);
SAL_WARN
(
"extensions.plugin"
,
"NPStream has no ID"
);
return
UnknownStreamID
;
}
...
...
@@ -54,7 +54,7 @@ sal_uInt32 PluginConnector::GetNPPID( NPP instance )
for
(
size_t
i
=
0
;
i
<
nLen
;
i
++
)
if
(
m_aInstances
[
i
]
->
instance
==
instance
)
return
static_cast
<
sal_uInt32
>
(
i
);
medDebug
(
1
,
"Error: NPP has no ID
\n
"
);
SAL_WARN
(
"extensions.plugin"
,
"NPP has no ID"
);
return
UnknownNPPID
;
}
...
...
sal/inc/sal/log-areas.dox
Dosyayı görüntüle @
fc45189c
...
...
@@ -74,6 +74,7 @@ certain functionality.
@section extensions
@li @c extensions.plugin
@li @c extensions.scanner
@section Filter
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment