Kaydet (Commit) 7a7a2c54 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Cosmetics

Change-Id: I7b217c4fb48bbee4a2872d15cf23a955b464ffca
üst a60f9112
...@@ -180,12 +180,8 @@ Bridge::Bridge( ...@@ -180,12 +180,8 @@ Bridge::Bridge(
factory_(factory), name_(name), connection_(connection), factory_(factory), name_(name), connection_(connection),
provider_(provider), provider_(provider),
binaryUno_(UNO_LB_UNO), binaryUno_(UNO_LB_UNO),
cppToBinaryMapping_( cppToBinaryMapping_(CPPU_CURRENT_LANGUAGE_BINDING_NAME, UNO_LB_UNO),
CPPU_CURRENT_LANGUAGE_BINDING_NAME, binaryToCppMapping_(UNO_LB_UNO, CPPU_CURRENT_LANGUAGE_BINDING_NAME),
UNO_LB_UNO),
binaryToCppMapping_(
UNO_LB_UNO,
CPPU_CURRENT_LANGUAGE_BINDING_NAME),
protPropTid_( protPropTid_(
reinterpret_cast< sal_Int8 const * >(".UrpProtocolPropertiesTid"), reinterpret_cast< sal_Int8 const * >(".UrpProtocolPropertiesTid"),
RTL_CONSTASCII_LENGTH(".UrpProtocolPropertiesTid")), RTL_CONSTASCII_LENGTH(".UrpProtocolPropertiesTid")),
...@@ -193,10 +189,8 @@ Bridge::Bridge( ...@@ -193,10 +189,8 @@ Bridge::Bridge(
protPropType_( protPropType_(
cppu::UnoType< cppu::UnoType<
css::uno::Reference< css::bridge::XProtocolProperties > >::get()), css::uno::Reference< css::bridge::XProtocolProperties > >::get()),
protPropRequest_( protPropRequest_("com.sun.star.bridge.XProtocolProperties::requestChange"),
"com.sun.star.bridge.XProtocolProperties::requestChange"), protPropCommit_("com.sun.star.bridge.XProtocolProperties::commitChange"),
protPropCommit_(
"com.sun.star.bridge.XProtocolProperties::commitChange"),
state_(STATE_INITIAL), threadPool_(0), currentContextMode_(false), state_(STATE_INITIAL), threadPool_(0), currentContextMode_(false),
proxies_(0), calls_(0), normalCall_(false), activeCalls_(0), proxies_(0), calls_(0), normalCall_(false), activeCalls_(0),
mode_(MODE_REQUESTED) mode_(MODE_REQUESTED)
...@@ -696,8 +690,7 @@ void Bridge::handleRequestChangeReply( ...@@ -696,8 +690,7 @@ void Bridge::handleRequestChangeReply(
} }
if (n != exp) { if (n != exp) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: requestChange reply with unexpected return value" "URP: requestChange reply with unexpected return value received",
" received",
static_cast< cppu::OWeakObject * >(this)); static_cast< cppu::OWeakObject * >(this));
} }
decrementCalls(); decrementCalls();
...@@ -797,8 +790,7 @@ void Bridge::handleCommitChangeRequest( ...@@ -797,8 +790,7 @@ void Bridge::handleCommitChangeRequest(
assert(ok); assert(ok);
(void) ok; // avoid warnings (void) ok; // avoid warnings
for (sal_Int32 i = 0; i != s.getLength(); ++i) { for (sal_Int32 i = 0; i != s.getLength(); ++i) {
if ( s[i].Name == "CurrentContext" ) if (s[i].Name == "CurrentContext") {
{
ccMode = true; ccMode = true;
} else { } else {
ccMode = false; ccMode = false;
...@@ -883,8 +875,8 @@ css::uno::Reference< css::uno::XInterface > Bridge::getInstance( ...@@ -883,8 +875,8 @@ css::uno::Reference< css::uno::XInterface > Bridge::getInstance(
for (sal_Int32 i = 0; i != sInstanceName.getLength(); ++i) { for (sal_Int32 i = 0; i != sInstanceName.getLength(); ++i) {
if (sInstanceName[i] > 0x7F) { if (sInstanceName[i] > 0x7F) {
throw css::io::IOException( throw css::io::IOException(
"XBridge::getInstance sInstanceName contains non-ASCII" ("XBridge::getInstance sInstanceName contains non-ASCII"
" character", " character"),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} }
...@@ -997,8 +989,7 @@ void Bridge::makeReleaseCall( ...@@ -997,8 +989,7 @@ void Bridge::makeReleaseCall(
AttachThread att(getThreadPool()); AttachThread att(getThreadPool());
sendRequest( sendRequest(
att.getTid(), oid, type, att.getTid(), oid, type,
css::uno::TypeDescription( css::uno::TypeDescription("com.sun.star.uno.XInterface::release"),
"com.sun.star.uno.XInterface::release"),
std::vector< BinaryAny >()); std::vector< BinaryAny >());
} }
......
...@@ -52,14 +52,12 @@ css::uno::Reference< css::uno::XInterface > BridgeFactory::static_create( ...@@ -52,14 +52,12 @@ css::uno::Reference< css::uno::XInterface > BridgeFactory::static_create(
} }
OUString BridgeFactory::static_getImplementationName() { OUString BridgeFactory::static_getImplementationName() {
return OUString( return OUString("com.sun.star.comp.bridge.BridgeFactory");
"com.sun.star.comp.bridge.BridgeFactory");
} }
css::uno::Sequence< OUString > css::uno::Sequence< OUString >
BridgeFactory::static_getSupportedServiceNames() { BridgeFactory::static_getSupportedServiceNames() {
OUString name( OUString name("com.sun.star.bridge.BridgeFactory");
"com.sun.star.bridge.BridgeFactory");
return css::uno::Sequence< OUString >(&name, 1); return css::uno::Sequence< OUString >(&name, 1);
} }
...@@ -132,11 +130,10 @@ css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge( ...@@ -132,11 +130,10 @@ css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge(
throw css::bridge::BridgeExistsException( throw css::bridge::BridgeExistsException(
sName, static_cast< cppu::OWeakObject * >(this)); sName, static_cast< cppu::OWeakObject * >(this));
} }
if ( sProtocol != "urp" || !aConnection.is() ) if (sProtocol != "urp" || !aConnection.is()) {
{
throw css::lang::IllegalArgumentException( throw css::lang::IllegalArgumentException(
"BridgeFactory::createBridge: sProtocol != urp ||" ("BridgeFactory::createBridge: sProtocol != urp ||"
" aConnection == null", " aConnection == null"),
static_cast< cppu::OWeakObject * >(this), -1); static_cast< cppu::OWeakObject * >(this), -1);
} }
b.set(new Bridge(this, sName, aConnection, anInstanceProvider)); b.set(new Bridge(this, sName, aConnection, anInstanceProvider));
......
...@@ -81,8 +81,8 @@ void IncomingRequest::execute() const { ...@@ -81,8 +81,8 @@ void IncomingRequest::execute() const {
} catch (const std::exception & e) { } catch (const std::exception & e) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
("caught C++ exception: " + ("caught C++ exception: " +
rtl::OStringToOUString( OStringToOUString(
rtl::OString(e.what()), RTL_TEXTENCODING_ASCII_US)), OString(e.what()), RTL_TEXTENCODING_ASCII_US)),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
// best-effort string conversion // best-effort string conversion
} }
...@@ -156,10 +156,8 @@ bool IncomingRequest::execute_throw( ...@@ -156,10 +156,8 @@ bool IncomingRequest::execute_throw(
OSL_TRACE( OSL_TRACE(
(OSL_LOG_PREFIX "initial element '%s':" (OSL_LOG_PREFIX "initial element '%s':"
" NoSuchElementException '%s'"), " NoSuchElementException '%s'"),
(OUStringToOString(oid_, RTL_TEXTENCODING_UTF8). OUStringToOString(oid_, RTL_TEXTENCODING_UTF8).getStr(),
getStr()), (OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).
(OUStringToOString(
e.Message, RTL_TEXTENCODING_UTF8).
getStr())); getStr()));
} }
} }
......
...@@ -76,7 +76,7 @@ void writeString( ...@@ -76,7 +76,7 @@ void writeString(
std::vector< unsigned char > * buffer, OUString const & value) std::vector< unsigned char > * buffer, OUString const & value)
{ {
assert(buffer != 0); assert(buffer != 0);
rtl::OString v; OString v;
if (!value.convertToString( if (!value.convertToString(
&v, RTL_TEXTENCODING_UTF8, &v, RTL_TEXTENCODING_UTF8,
(RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
......
...@@ -110,8 +110,8 @@ void Proxy::do_dispatch( ...@@ -110,8 +110,8 @@ void Proxy::do_dispatch(
} catch (const std::exception & e) { } catch (const std::exception & e) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
("caught C++ exception: " + ("caught C++ exception: " +
rtl::OStringToOUString( OStringToOUString(
rtl::OString(e.what()), RTL_TEXTENCODING_ASCII_US)), OString(e.what()), RTL_TEXTENCODING_ASCII_US)),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
// best-effort string conversion // best-effort string conversion
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "boost/scoped_ptr.hpp"
#include "com/sun/star/connection/XConnection.hpp" #include "com/sun/star/connection/XConnection.hpp"
#include "com/sun/star/io/IOException.hpp" #include "com/sun/star/io/IOException.hpp"
#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Any.hxx"
...@@ -54,8 +55,6 @@ ...@@ -54,8 +55,6 @@
#include "specialfunctionids.hxx" #include "specialfunctionids.hxx"
#include "unmarshal.hxx" #include "unmarshal.hxx"
#include <boost/scoped_ptr.hpp>
namespace binaryurp { namespace binaryurp {
namespace { namespace {
...@@ -119,8 +118,7 @@ void Reader::execute() { ...@@ -119,8 +118,7 @@ void Reader::execute() {
header.done(); header.done();
if (count == 0) { if (count == 0) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Reader: block with zero message count" "binaryurp::Reader: block with zero message count received",
" received",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
Unmarshal block(bridge_, state_, read(con, size, false)); Unmarshal block(bridge_, state_, read(con, size, false));
...@@ -158,8 +156,8 @@ void Reader::readMessage(Unmarshal & unmarshal) { ...@@ -158,8 +156,8 @@ void Reader::readMessage(Unmarshal & unmarshal) {
if (((flags2 & 0x40) != 0) != forceSynchronous) { if (((flags2 & 0x40) != 0) != forceSynchronous) {
// bit 6: SYNCHRONOUS // bit 6: SYNCHRONOUS
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: request message with MUSTREPLY != SYNCHRONOUS" ("URP: request message with MUSTREPLY != SYNCHRONOUS"
" received", " received"),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} else { } else {
...@@ -182,8 +180,8 @@ void Reader::readMessage(Unmarshal & unmarshal) { ...@@ -182,8 +180,8 @@ void Reader::readMessage(Unmarshal & unmarshal) {
} else { } else {
if (!lastType_.is()) { if (!lastType_.is()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: request message with NEWTYPE received when last" ("URP: request message with NEWTYPE received when last"
" interface type has not yet been set", " interface type has not yet been set"),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
type = lastType_; type = lastType_;
...@@ -200,8 +198,8 @@ void Reader::readMessage(Unmarshal & unmarshal) { ...@@ -200,8 +198,8 @@ void Reader::readMessage(Unmarshal & unmarshal) {
} else { } else {
if (lastOid_.isEmpty()) { if (lastOid_.isEmpty()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: request message with NEWOID received when last" ("URP: request message with NEWOID received when last OID has"
" OID has not yet been set", " not yet been set"),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
oid = lastOid_; oid = lastOid_;
...@@ -211,8 +209,7 @@ void Reader::readMessage(Unmarshal & unmarshal) { ...@@ -211,8 +209,7 @@ void Reader::readMessage(Unmarshal & unmarshal) {
type.makeComplete(); type.makeComplete();
if (type.get()->eTypeClass != typelib_TypeClass_INTERFACE) { if (type.get()->eTypeClass != typelib_TypeClass_INTERFACE) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: request message with non-interface interface type" "URP: request message with non-interface interface type received",
" received",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
typelib_InterfaceTypeDescription * itd = typelib_InterfaceTypeDescription * itd =
...@@ -248,8 +245,8 @@ void Reader::readMessage(Unmarshal & unmarshal) { ...@@ -248,8 +245,8 @@ void Reader::readMessage(Unmarshal & unmarshal) {
} else { } else {
if (forceSynchronous) { if (forceSynchronous) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: synchronous request message with non-oneway" ("URP: synchronous request message with non-oneway function ID"
" function ID received", " received"),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
synchronous = true; synchronous = true;
...@@ -302,8 +299,8 @@ void Reader::readMessage(Unmarshal & unmarshal) { ...@@ -302,8 +299,8 @@ void Reader::readMessage(Unmarshal & unmarshal) {
break; break;
default: default:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: request message with UrpProtocolProperties OID" ("URP: request message with UrpProtocolProperties OID and"
" and unknown function ID received", " unknown function ID received"),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} else { } else {
...@@ -333,16 +330,15 @@ void Reader::readMessage(Unmarshal & unmarshal) { ...@@ -333,16 +330,15 @@ void Reader::readMessage(Unmarshal & unmarshal) {
css::uno::XInterface > >::get()))))) css::uno::XInterface > >::get())))))
{ {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: queryInterface request message with" ("URP: queryInterface request message with unknown OID"
" unknown OID received", " received"),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} }
break; break;
case SPECIAL_FUNCTION_ID_RESERVED: case SPECIAL_FUNCTION_ID_RESERVED:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: request message with unknown function ID 1" "URP: request message with unknown function ID 1 received",
" received",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
case SPECIAL_FUNCTION_ID_RELEASE: case SPECIAL_FUNCTION_ID_RELEASE:
break; break;
...@@ -429,8 +425,7 @@ void Reader::readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1) { ...@@ -429,8 +425,7 @@ void Reader::readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1) {
} }
if (!ok) { if (!ok) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: reply message with bad exception type" "URP: reply message with bad exception type received",
" received",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} }
...@@ -502,8 +497,8 @@ rtl::ByteSequence Reader::getTid(Unmarshal & unmarshal, bool newTid) const { ...@@ -502,8 +497,8 @@ rtl::ByteSequence Reader::getTid(Unmarshal & unmarshal, bool newTid) const {
} }
if (lastTid_.getLength() == 0) { if (lastTid_.getLength() == 0) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: message with NEWTID received when last TID has not" ("URP: message with NEWTID received when last TID has not yet been"
" yet been set", " set"),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
return lastTid_; return lastTid_;
......
...@@ -146,8 +146,7 @@ css::uno::TypeDescription Unmarshal::readType() { ...@@ -146,8 +146,7 @@ css::uno::TypeDescription Unmarshal::readType() {
case typelib_TypeClass_ANY: case typelib_TypeClass_ANY:
if ((flags & 0x80) != 0) { if ((flags & 0x80) != 0) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: cache flag of simple type is" "binaryurp::Unmarshal: cache flag of simple type is set",
" set",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
return css::uno::TypeDescription( return css::uno::TypeDescription(
...@@ -163,8 +162,7 @@ css::uno::TypeDescription Unmarshal::readType() { ...@@ -163,8 +162,7 @@ css::uno::TypeDescription Unmarshal::readType() {
if ((flags & 0x80) == 0) { if ((flags & 0x80) == 0) {
if (idx == cache::ignore || !state_.typeCache[idx].is()) { if (idx == cache::ignore || !state_.typeCache[idx].is()) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: unknown type cache" "binaryurp::Unmarshal: unknown type cache index",
" index",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
return state_.typeCache[idx]; return state_.typeCache[idx];
...@@ -176,8 +174,7 @@ css::uno::TypeDescription Unmarshal::readType() { ...@@ -176,8 +174,7 @@ css::uno::TypeDescription Unmarshal::readType() {
{ {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: type with unknown" "binaryurp::Unmarshal: type with unknown name: " + str,
" name: " + str,
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
for (css::uno::TypeDescription t2(t); for (css::uno::TypeDescription t2(t);
...@@ -189,16 +186,16 @@ css::uno::TypeDescription Unmarshal::readType() { ...@@ -189,16 +186,16 @@ css::uno::TypeDescription Unmarshal::readType() {
t2.get())->pType); t2.get())->pType);
if (!t2.is()) { if (!t2.is()) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: sequence type with" ("binaryurp::Unmarshal: sequence type with unknown"
" unknown component type", " component type"),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
switch (t2.get()->eTypeClass) { switch (t2.get()->eTypeClass) {
case typelib_TypeClass_VOID: case typelib_TypeClass_VOID:
case typelib_TypeClass_EXCEPTION: case typelib_TypeClass_EXCEPTION:
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: sequence type with" ("binaryurp::Unmarshal: sequence type with bad"
" bad component type", " component type"),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
default: default:
break; break;
...@@ -222,8 +219,7 @@ OUString Unmarshal::readOid() { ...@@ -222,8 +219,7 @@ OUString Unmarshal::readOid() {
for (sal_Int32 i = 0; i != oid.getLength(); ++i) { for (sal_Int32 i = 0; i != oid.getLength(); ++i) {
if (oid[i] > 0x7F) { if (oid[i] > 0x7F) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: OID contains non-ASCII" "binaryurp::Unmarshal: OID contains non-ASCII character",
" character",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} }
......
...@@ -163,8 +163,7 @@ void Writer::execute() { ...@@ -163,8 +163,7 @@ void Writer::execute() {
(item.oid != "UrpProtocolProperties" && (item.oid != "UrpProtocolProperties" &&
!item.member.equals( !item.member.equals(
css::uno::TypeDescription( css::uno::TypeDescription(
"com.sun.star.uno.XInterface::" "com.sun.star.uno.XInterface::release")) &&
"release")) &&
bridge_->isCurrentContextMode()), bridge_->isCurrentContextMode()),
item.currentContext); item.currentContext);
} else { } else {
...@@ -431,8 +430,7 @@ void Writer::sendMessage(std::vector< unsigned char > const & buffer) { ...@@ -431,8 +430,7 @@ void Writer::sendMessage(std::vector< unsigned char > const & buffer) {
} catch (const css::io::IOException & e) { } catch (const css::io::IOException & e) {
css::uno::Any exc(cppu::getCaughtException()); css::uno::Any exc(cppu::getCaughtException());
throw css::lang::WrappedTargetRuntimeException( throw css::lang::WrappedTargetRuntimeException(
("Binary URP write raised IO exception: " + "Binary URP write raised IO exception: " + e.Message,
e.Message),
css::uno::Reference< css::uno::XInterface >(), exc); css::uno::Reference< css::uno::XInterface >(), exc);
} }
n = static_cast< std::vector< unsigned char >::size_type >(n - k); n = static_cast< std::vector< unsigned char >::size_type >(n - k);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment