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
0ba00ee1
Kaydet (Commit)
0ba00ee1
authored
Eyl 16, 2016
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Replace remaining OSL_ASSERT etc. in binaryurp
Change-Id: I6f013cacbefe9c681baa3e91f73f4fc05c99ba78
üst
e488d3c9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
48 deletions
+54
-48
incomingrequest.cxx
binaryurp/source/incomingrequest.cxx
+26
-25
outgoingrequests.cxx
binaryurp/source/outgoingrequests.cxx
+4
-2
writer.cxx
binaryurp/source/writer.cxx
+24
-21
No files found.
binaryurp/source/incomingrequest.cxx
Dosyayı görüntüle @
0ba00ee1
...
...
@@ -19,6 +19,7 @@
#include "sal/config.h"
#include <cassert>
#include <list>
#include <vector>
...
...
@@ -27,6 +28,7 @@
#include "rtl/byteseq.hxx"
#include "rtl/ref.hxx"
#include "rtl/ustring.hxx"
#include "sal/log.hxx"
#include "sal/types.h"
#include "typelib/typedescription.hxx"
#include "uno/dispatcher.hxx"
...
...
@@ -51,7 +53,9 @@ IncomingRequest::IncomingRequest(
setter_
(
setter
),
inArguments_
(
inArguments
),
currentContextMode_
(
currentContextMode
),
currentContext_
(
currentContext
)
{
OSL_ASSERT
(
bridge
.
is
()
&&
member
.
is
()
&&
member
.
get
()
->
bComplete
);
assert
(
bridge
.
is
());
assert
(
member
.
is
());
assert
(
member
.
get
()
->
bComplete
);
}
IncomingRequest
::~
IncomingRequest
()
{}
...
...
@@ -98,17 +102,14 @@ void IncomingRequest::execute() const {
tid_
,
member_
,
setter_
,
isExc
,
ret
,
outArgs
,
false
);
return
;
}
catch
(
const
css
::
uno
::
RuntimeException
&
e
)
{
OSL_TRACE
(
"caught UNO runtime exception '%s'"
,
(
OUStringToOString
(
e
.
Message
,
RTL_TEXTENCODING_UTF8
).
getStr
()));
SAL_INFO
(
"binaryurp"
,
"caught UNO runtime exception "
<<
e
.
Message
);
}
catch
(
const
std
::
exception
&
e
)
{
OSL_TRACE
(
"caught C++ exception '%s'"
,
e
.
what
());
SAL_INFO
(
"binaryurp"
,
"caught C++ exception "
<<
e
.
what
());
}
bridge_
->
terminate
(
false
);
}
else
{
if
(
isExc
)
{
OSL_TRACE
(
"oneway method raised exception"
);
SAL_INFO
(
"binaryurp"
,
"oneway method raised exception"
);
}
bridge_
->
decrementCalls
();
}
...
...
@@ -122,15 +123,16 @@ static size_t size_t_round(size_t val)
bool
IncomingRequest
::
execute_throw
(
BinaryAny
*
returnValue
,
std
::
vector
<
BinaryAny
>
*
outArguments
)
const
{
OSL_ASSERT
(
returnValue
!=
nullptr
&&
assert
(
returnValue
!=
nullptr
);
assert
(
returnValue
->
getType
().
equals
(
css
::
uno
::
TypeDescription
(
cppu
::
UnoType
<
void
>::
get
()))
&&
outArguments
!=
nullptr
&&
outArguments
->
empty
());
css
::
uno
::
TypeDescription
(
cppu
::
UnoType
<
void
>::
get
())));
assert
(
outArguments
!=
nullptr
);
assert
(
outArguments
->
empty
());
bool
isExc
=
false
;
switch
(
functionId_
)
{
case
SPECIAL_FUNCTION_ID_RESERVED
:
OSL_ASSERT
(
false
);
// this cannot happen
assert
(
false
);
// this cannot happen
break
;
case
SPECIAL_FUNCTION_ID_RELEASE
:
bridge_
->
releaseStub
(
oid_
,
type_
);
...
...
@@ -144,11 +146,10 @@ bool IncomingRequest::execute_throw(
try
{
ifc
=
prov
->
getInstance
(
oid_
);
}
catch
(
const
css
::
container
::
NoSuchElementException
&
e
)
{
OSL_TRACE
(
"initial element '%s': NoSuchElementException '%s'"
,
OUStringToOString
(
oid_
,
RTL_TEXTENCODING_UTF8
).
getStr
(),
(
OUStringToOString
(
e
.
Message
,
RTL_TEXTENCODING_UTF8
).
getStr
()));
SAL_INFO
(
"binaryurp"
,
"initial element "
<<
oid_
<<
": NoSuchElementException "
<<
e
.
Message
);
}
}
if
(
ifc
.
is
())
{
...
...
@@ -174,7 +175,7 @@ bool IncomingRequest::execute_throw(
SAL_FALLTHROUGH
;
default
:
{
OSL_ASSERT
(
object_
.
is
());
assert
(
object_
.
is
());
css
::
uno
::
TypeDescription
retType
;
std
::
list
<
std
::
vector
<
char
>
>
outBufs
;
std
::
vector
<
void
*
>
args
;
...
...
@@ -187,10 +188,10 @@ bool IncomingRequest::execute_throw(
member_
.
get
())
->
pAttributeTypeRef
);
if
(
setter_
)
{
OSL_ASSERT
(
inArguments_
.
size
()
==
1
);
assert
(
inArguments_
.
size
()
==
1
);
args
.
push_back
(
inArguments_
[
0
].
getValue
(
t
));
}
else
{
OSL_ASSERT
(
inArguments_
.
empty
());
assert
(
inArguments_
.
empty
());
retType
=
t
;
}
break
;
...
...
@@ -223,11 +224,11 @@ bool IncomingRequest::execute_throw(
outArguments
->
push_back
(
BinaryAny
());
}
}
OSL_ASSERT
(
i
==
inArguments_
.
end
());
assert
(
i
==
inArguments_
.
end
());
break
;
}
default
:
OSL_ASSERT
(
false
);
// this cannot happen
assert
(
false
);
// this cannot happen
break
;
}
size_t
nSize
=
0
;
...
...
@@ -252,7 +253,7 @@ bool IncomingRequest::execute_throw(
uno_destructData
(
&
retBuf
[
0
],
retType
.
get
(),
nullptr
);
}
if
(
!
outArguments
->
empty
())
{
OSL_ASSERT
(
assert
(
member_
.
get
()
->
eTypeClass
==
typelib_TypeClass_INTERFACE_METHOD
);
typelib_InterfaceMethodTypeDescription
*
mtd
=
...
...
@@ -274,8 +275,8 @@ bool IncomingRequest::execute_throw(
&
(
*
j
++
)[
0
],
mtd
->
pParams
[
k
].
pTypeRef
,
nullptr
);
}
}
OSL_ASSERT
(
i
==
outArguments
->
end
());
OSL_ASSERT
(
j
==
outBufs
.
end
());
assert
(
i
==
outArguments
->
end
());
assert
(
j
==
outBufs
.
end
());
}
}
break
;
...
...
binaryurp/source/outgoingrequests.cxx
Dosyayı görüntüle @
0ba00ee1
...
...
@@ -19,6 +19,8 @@
#include "sal/config.h"
#include <cassert>
#include "com/sun/star/uno/RuntimeException.hpp"
#include "rtl/byteseq.hxx"
#include "osl/mutex.hxx"
...
...
@@ -48,14 +50,14 @@ OutgoingRequest OutgoingRequests::top(rtl::ByteSequence const & tid) {
throw
css
::
uno
::
RuntimeException
(
"URP: reply for unknown TID"
);
}
OSL_ASSERT
(
!
i
->
second
.
empty
());
assert
(
!
i
->
second
.
empty
());
return
i
->
second
.
back
();
}
void
OutgoingRequests
::
pop
(
rtl
::
ByteSequence
const
&
tid
)
throw
()
{
osl
::
MutexGuard
g
(
mutex_
);
Map
::
iterator
i
(
map_
.
find
(
tid
));
OSL_ASSERT
(
i
!=
map_
.
end
());
assert
(
i
!=
map_
.
end
());
i
->
second
.
pop_back
();
if
(
i
->
second
.
empty
())
{
map_
.
erase
(
i
);
...
...
binaryurp/source/writer.cxx
Dosyayı görüntüle @
0ba00ee1
...
...
@@ -31,6 +31,7 @@
#include "com/sun/star/uno/XCurrentContext.hpp"
#include "cppuhelper/exc_hlp.hxx"
#include "osl/mutex.hxx"
#include "sal/log.hxx"
#include "uno/dispatcher.hxx"
#include "binaryany.hxx"
...
...
@@ -74,7 +75,7 @@ Writer::Writer(rtl::Reference< Bridge > const & bridge):
Thread
(
"binaryurpWriter"
),
bridge_
(
bridge
),
marshal_
(
bridge
,
state_
),
stop_
(
false
)
{
OSL_ASSERT
(
bridge
.
is
());
assert
(
bridge
.
is
());
}
void
Writer
::
sendDirectRequest
(
...
...
@@ -83,7 +84,7 @@ void Writer::sendDirectRequest(
css
::
uno
::
TypeDescription
const
&
member
,
std
::
vector
<
BinaryAny
>
const
&
inArguments
)
{
OSL_ASSERT
(
!
unblocked_
.
check
());
assert
(
!
unblocked_
.
check
());
sendRequest
(
tid
,
oid
,
type
,
member
,
inArguments
,
false
,
css
::
uno
::
UnoInterfaceReference
());
...
...
@@ -94,7 +95,7 @@ void Writer::sendDirectReply(
bool
exception
,
BinaryAny
const
&
returnValue
,
std
::
vector
<
BinaryAny
>
const
&
outArguments
)
{
OSL_ASSERT
(
!
unblocked_
.
check
());
assert
(
!
unblocked_
.
check
());
sendReply
(
tid
,
member
,
false
,
exception
,
returnValue
,
outArguments
);
}
...
...
@@ -153,7 +154,7 @@ void Writer::execute() {
if
(
stop_
)
{
return
;
}
OSL_ASSERT
(
!
queue_
.
empty
());
assert
(
!
queue_
.
empty
());
item
=
queue_
.
front
();
queue_
.
pop_front
();
if
(
queue_
.
empty
())
{
...
...
@@ -179,11 +180,9 @@ void Writer::execute() {
}
}
}
catch
(
const
css
::
uno
::
Exception
&
e
)
{
OSL_TRACE
(
"caught UNO exception '%s'"
,
OUStringToOString
(
e
.
Message
,
RTL_TEXTENCODING_UTF8
).
getStr
());
SAL_INFO
(
"binaryurp"
,
"caught UNO exception "
<<
e
.
Message
);
}
catch
(
const
std
::
exception
&
e
)
{
OSL_TRACE
(
"caught C++ exception '%s'"
,
e
.
what
());
SAL_INFO
(
"binaryurp"
,
"caught C++ exception "
<<
e
.
what
());
}
bridge_
->
terminate
(
false
);
bridge_
.
clear
();
...
...
@@ -196,7 +195,9 @@ void Writer::sendRequest(
std
::
vector
<
BinaryAny
>
const
&
inArguments
,
bool
currentContextMode
,
css
::
uno
::
UnoInterfaceReference
const
&
currentContext
)
{
OSL_ASSERT
(
tid
.
getLength
()
!=
0
&&
!
oid
.
isEmpty
()
&&
member
.
is
());
assert
(
tid
.
getLength
()
!=
0
);
assert
(
!
oid
.
isEmpty
());
assert
(
member
.
is
());
css
::
uno
::
TypeDescription
t
(
type
);
sal_Int32
functionId
=
0
;
bool
bForceSynchronous
=
false
;
...
...
@@ -207,7 +208,7 @@ void Writer::sendRequest(
typelib_InterfaceAttributeTypeDescription
*
atd
=
reinterpret_cast
<
typelib_InterfaceAttributeTypeDescription
*
>
(
member
.
get
());
OSL_ASSERT
(
atd
->
pInterface
!=
nullptr
);
assert
(
atd
->
pInterface
!=
nullptr
);
if
(
!
t
.
is
())
{
t
=
css
::
uno
::
TypeDescription
(
&
atd
->
pInterface
->
aBase
);
}
...
...
@@ -236,10 +237,10 @@ void Writer::sendRequest(
break
;
}
default
:
OSL_ASSERT
(
false
);
// this cannot happen
assert
(
false
);
// this cannot happen
break
;
}
OSL_ASSERT
(
functionId
>=
0
);
assert
(
functionId
>=
0
);
if
(
functionId
>
SAL_MAX_UINT16
)
{
throw
css
::
uno
::
RuntimeException
(
"function ID too large for URP"
);
}
...
...
@@ -300,7 +301,7 @@ void Writer::sendRequest(
switch
(
member
.
get
()
->
eTypeClass
)
{
case
typelib_TypeClass_INTERFACE_ATTRIBUTE
:
if
(
!
inArguments
.
empty
())
{
// setter
OSL_ASSERT
(
inArguments
.
size
()
==
1
);
assert
(
inArguments
.
size
()
==
1
);
marshal_
.
writeValue
(
&
buf
,
css
::
uno
::
TypeDescription
(
...
...
@@ -325,11 +326,11 @@ void Writer::sendRequest(
*
i
++
);
}
}
OSL_ASSERT
(
i
==
inArguments
.
end
());
assert
(
i
==
inArguments
.
end
());
break
;
}
default
:
OSL_ASSERT
(
false
);
// this cannot happen
assert
(
false
);
// this cannot happen
break
;
}
sendMessage
(
buf
);
...
...
@@ -344,7 +345,9 @@ void Writer::sendReply(
bool
exception
,
BinaryAny
const
&
returnValue
,
std
::
vector
<
BinaryAny
>
const
&
outArguments
)
{
OSL_ASSERT
(
tid
.
getLength
()
!=
0
&&
member
.
is
()
&&
member
.
get
()
->
bComplete
);
assert
(
tid
.
getLength
()
!=
0
);
assert
(
member
.
is
());
assert
(
member
.
get
()
->
bComplete
);
std
::
vector
<
unsigned
char
>
buf
;
bool
newTid
=
tid
!=
lastTid_
;
Marshal
::
write8
(
&
buf
,
0x80
|
(
exception
?
0x20
:
0
)
|
(
newTid
?
0x08
:
0
));
...
...
@@ -390,11 +393,11 @@ void Writer::sendReply(
*
i
++
);
}
}
OSL_ASSERT
(
i
==
outArguments
.
end
());
assert
(
i
==
outArguments
.
end
());
break
;
}
default
:
OSL_ASSERT
(
false
);
// this cannot happen
assert
(
false
);
// this cannot happen
break
;
}
}
...
...
@@ -411,17 +414,17 @@ void Writer::sendMessage(std::vector< unsigned char > const & buffer) {
}
Marshal
::
write32
(
&
header
,
static_cast
<
sal_uInt32
>
(
buffer
.
size
()));
Marshal
::
write32
(
&
header
,
1
);
OSL_ASSERT
(
!
buffer
.
empty
());
assert
(
!
buffer
.
empty
());
unsigned
char
const
*
p
=
&
buffer
[
0
];
std
::
vector
<
unsigned
char
>::
size_type
n
=
buffer
.
size
();
OSL_ASSERT
(
header
.
size
()
<=
SAL_MAX_INT32
);
assert
(
header
.
size
()
<=
SAL_MAX_INT32
);
/*static_*/
assert
(
SAL_MAX_INT32
<=
std
::
numeric_limits
<
std
::
size_t
>::
max
());
std
::
size_t
k
=
SAL_MAX_INT32
-
header
.
size
();
if
(
n
<
k
)
{
k
=
n
;
}
css
::
uno
::
Sequence
<
sal_Int8
>
s
(
header
.
size
()
+
k
);
OSL_ASSERT
(
!
header
.
empty
());
assert
(
!
header
.
empty
());
std
::
memcpy
(
s
.
getArray
(),
&
header
[
0
],
header
.
size
());
for
(;;)
{
std
::
memcpy
(
s
.
getArray
()
+
s
.
getLength
()
-
k
,
p
,
k
);
...
...
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