loplugin:ostr in binaryurp

Change-Id: I8fbb3a64cd101f219408103a771e1197e1e69776
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167203
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2024-05-06 15:15:34 +02:00
parent 171f984c90
commit 14cca2c88f
8 changed files with 77 additions and 77 deletions

View File

@@ -178,28 +178,28 @@ Bridge::Bridge(
css::uno::Reference< css::bridge::XInstanceProvider > provider): css::uno::Reference< css::bridge::XInstanceProvider > provider):
factory_(factory), name_(std::move(name)), connection_(connection), factory_(factory), name_(std::move(name)), connection_(connection),
provider_(std::move(provider)), provider_(std::move(provider)),
binaryUno_(UNO_LB_UNO), binaryUno_(u"" UNO_LB_UNO ""_ustr),
cppToBinaryMapping_(CPPU_CURRENT_LANGUAGE_BINDING_NAME, UNO_LB_UNO), cppToBinaryMapping_(CPPU_CURRENT_LANGUAGE_BINDING_NAME, u"" UNO_LB_UNO ""_ustr),
binaryToCppMapping_(UNO_LB_UNO, CPPU_CURRENT_LANGUAGE_BINDING_NAME), binaryToCppMapping_(u"" UNO_LB_UNO ""_ustr, 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")),
protPropOid_("UrpProtocolProperties"), protPropOid_(u"UrpProtocolProperties"_ustr),
protPropType_( protPropType_(
cppu::UnoType< cppu::UnoType<
css::uno::Reference< css::bridge::XProtocolProperties > >::get()), css::uno::Reference< css::bridge::XProtocolProperties > >::get()),
protPropRequest_("com.sun.star.bridge.XProtocolProperties::requestChange"), protPropRequest_(u"com.sun.star.bridge.XProtocolProperties::requestChange"_ustr),
protPropCommit_("com.sun.star.bridge.XProtocolProperties::commitChange"), protPropCommit_(u"com.sun.star.bridge.XProtocolProperties::commitChange"_ustr),
state_(STATE_INITIAL), threadPool_(nullptr), currentContextMode_(false), state_(STATE_INITIAL), threadPool_(nullptr), currentContextMode_(false),
proxies_(0), calls_(0), normalCall_(false), activeCalls_(0), proxies_(0), calls_(0), normalCall_(false), activeCalls_(0),
mode_(MODE_REQUESTED) mode_(MODE_REQUESTED)
{ {
assert(factory.is() && connection.is()); assert(factory.is() && connection.is());
if (!binaryUno_.is()) { if (!binaryUno_.is()) {
throw css::uno::RuntimeException("URP: no binary UNO environment"); throw css::uno::RuntimeException(u"URP: no binary UNO environment"_ustr);
} }
if (!(cppToBinaryMapping_.is() && binaryToCppMapping_.is())) { if (!(cppToBinaryMapping_.is() && binaryToCppMapping_.is())) {
throw css::uno::RuntimeException("URP: no C++ UNO mapping"); throw css::uno::RuntimeException(u"URP: no C++ UNO mapping"_ustr);
} }
passive_.set(); passive_.set();
// coverity[uninit_member] - random_ is set in due course by the reader_ thread's state machine // coverity[uninit_member] - random_ is set in due course by the reader_ thread's state machine
@@ -448,7 +448,7 @@ OUString Bridge::registerOutgoingInterface(
assert(stub != &newStub); assert(stub != &newStub);
if (j->second.references == SAL_MAX_UINT32) { if (j->second.references == SAL_MAX_UINT32) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: stub reference count overflow"); u"URP: stub reference count overflow"_ustr);
} }
++j->second.references; ++j->second.references;
} }
@@ -489,11 +489,11 @@ void Bridge::releaseStub(
std::lock_guard g(mutex_); std::lock_guard g(mutex_);
Stubs::iterator i(stubs_.find(oid)); Stubs::iterator i(stubs_.find(oid));
if (i == stubs_.end()) { if (i == stubs_.end()) {
throw css::uno::RuntimeException("URP: release unknown stub"); throw css::uno::RuntimeException(u"URP: release unknown stub"_ustr);
} }
Stub::iterator j(i->second.find(type)); Stub::iterator j(i->second.find(type));
if (j == i->second.end()) { if (j == i->second.end()) {
throw css::uno::RuntimeException("URP: release unknown stub"); throw css::uno::RuntimeException(u"URP: release unknown stub"_ustr);
} }
assert(j->second.references > 0); assert(j->second.references > 0);
--j->second.references; --j->second.references;
@@ -611,7 +611,7 @@ bool Bridge::makeCall(
if (resp == nullptr) if (resp == nullptr)
{ {
throw css::lang::DisposedException( throw css::lang::DisposedException(
"Binary URP bridge disposed during call", u"Binary URP bridge disposed during call"_ustr,
getXWeak()); getXWeak());
} }
*returnValue = resp->returnValue; *returnValue = resp->returnValue;
@@ -674,7 +674,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 received", u"URP: requestChange reply with unexpected return value received"_ustr,
getXWeak()); getXWeak());
} }
decrementCalls(); decrementCalls();
@@ -757,7 +757,7 @@ void Bridge::handleRequestChangeRequest(
} }
default: default:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: unexpected requestChange request received", u"URP: unexpected requestChange request received"_ustr,
getXWeak()); getXWeak());
} }
} }
@@ -781,7 +781,7 @@ void Bridge::handleCommitChangeRequest(
ret = mapCppToBinaryAny( ret = mapCppToBinaryAny(
css::uno::Any( css::uno::Any(
css::bridge::InvalidProtocolChangeException( css::bridge::InvalidProtocolChangeException(
"InvalidProtocolChangeException", u"InvalidProtocolChangeException"_ustr,
css::uno::Reference< css::uno::XInterface >(), pp, css::uno::Reference< css::uno::XInterface >(), pp,
1))); 1)));
break; break;
@@ -808,7 +808,7 @@ void Bridge::handleCommitChangeRequest(
break; break;
default: default:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: unexpected commitChange request received", u"URP: unexpected commitChange request received"_ustr,
getXWeak()); getXWeak());
} }
} }
@@ -853,14 +853,14 @@ css::uno::Reference< css::uno::XInterface > Bridge::getInstance(
{ {
if (sInstanceName.isEmpty()) { if (sInstanceName.isEmpty()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"XBridge::getInstance sInstanceName must be non-empty", u"XBridge::getInstance sInstanceName must be non-empty"_ustr,
getXWeak()); getXWeak());
} }
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::uno::RuntimeException( throw css::uno::RuntimeException(
"XBridge::getInstance sInstanceName contains non-ASCII" u"XBridge::getInstance sInstanceName contains non-ASCII"
" character"); " character"_ustr);
} }
} }
css::uno::TypeDescription ifc(cppu::UnoType<css::uno::XInterface>::get()); css::uno::TypeDescription ifc(cppu::UnoType<css::uno::XInterface>::get());
@@ -874,7 +874,7 @@ css::uno::Reference< css::uno::XInterface > Bridge::getInstance(
bool bExc = makeCall( bool bExc = makeCall(
sInstanceName, sInstanceName,
css::uno::TypeDescription( css::uno::TypeDescription(
"com.sun.star.uno.XInterface::queryInterface"), u"com.sun.star.uno.XInterface::queryInterface"_ustr),
false, std::move(inArgs), &ret, &outArgs); false, std::move(inArgs), &ret, &outArgs);
throwException(bExc, ret); throwException(bExc, ret);
auto const t = ret.getType(); auto const t = ret.getType();
@@ -997,7 +997,7 @@ void Bridge::makeReleaseCall(
}(); }();
sendRequest( sendRequest(
tid, oid, type, tid, oid, type,
css::uno::TypeDescription("com.sun.star.uno.XInterface::release"), css::uno::TypeDescription(u"com.sun.star.uno.XInterface::release"_ustr),
std::vector< BinaryAny >()); std::vector< BinaryAny >());
} }
@@ -1044,7 +1044,7 @@ void Bridge::checkDisposed() {
assert(state_ != STATE_INITIAL); assert(state_ != STATE_INITIAL);
if (state_ != STATE_STARTED) { if (state_ != STATE_STARTED) {
throw css::lang::DisposedException( throw css::lang::DisposedException(
"Binary URP bridge already disposed", u"Binary URP bridge already disposed"_ustr,
getXWeak()); getXWeak());
} }
} }

View File

@@ -68,7 +68,7 @@ BridgeFactory::~BridgeFactory() {}
OUString BridgeFactory::getImplementationName() OUString BridgeFactory::getImplementationName()
{ {
return "com.sun.star.comp.bridge.BridgeFactory"; return u"com.sun.star.comp.bridge.BridgeFactory"_ustr;
} }
sal_Bool BridgeFactory::supportsService(OUString const & ServiceName) sal_Bool BridgeFactory::supportsService(OUString const & ServiceName)
@@ -78,7 +78,7 @@ sal_Bool BridgeFactory::supportsService(OUString const & ServiceName)
css::uno::Sequence< OUString > BridgeFactory::getSupportedServiceNames() css::uno::Sequence< OUString > BridgeFactory::getSupportedServiceNames()
{ {
return { "com.sun.star.bridge.BridgeFactory" }; return { u"com.sun.star.bridge.BridgeFactory"_ustr };
} }
css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge( css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge(
@@ -92,7 +92,7 @@ css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge(
osl::MutexGuard g(m_aMutex); osl::MutexGuard g(m_aMutex);
if (rBHelper.bDisposed) { if (rBHelper.bDisposed) {
throw css::lang::DisposedException( throw css::lang::DisposedException(
"BridgeFactory disposed", u"BridgeFactory disposed"_ustr,
getXWeak()); getXWeak());
} }
if (named_.find(sName) != named_.end()) { if (named_.find(sName) != named_.end()) {
@@ -101,8 +101,8 @@ css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge(
} }
if (sProtocol != "urp" || !aConnection.is()) { if (sProtocol != "urp" || !aConnection.is()) {
throw css::lang::IllegalArgumentException( throw css::lang::IllegalArgumentException(
("BridgeFactory::createBridge: sProtocol != urp ||" (u"BridgeFactory::createBridge: sProtocol != urp ||"
" aConnection == null"), " aConnection == null"_ustr),
getXWeak(), -1); getXWeak(), -1);
} }
b.set(new Bridge(this, sName, aConnection, anInstanceProvider)); b.set(new Bridge(this, sName, aConnection, anInstanceProvider));
@@ -130,13 +130,13 @@ BridgeFactory::getExistingBridges() {
osl::MutexGuard g(m_aMutex); osl::MutexGuard g(m_aMutex);
if (unnamed_.size() > SAL_MAX_INT32) { if (unnamed_.size() > SAL_MAX_INT32) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"BridgeFactory::getExistingBridges: too many", u"BridgeFactory::getExistingBridges: too many"_ustr,
getXWeak()); getXWeak());
} }
sal_Int32 n = static_cast< sal_Int32 >(unnamed_.size()); sal_Int32 n = static_cast< sal_Int32 >(unnamed_.size());
if (named_.size() > o3tl::make_unsigned(SAL_MAX_INT32 - n)) { if (named_.size() > o3tl::make_unsigned(SAL_MAX_INT32 - n)) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"BridgeFactory::getExistingBridges: too many", u"BridgeFactory::getExistingBridges: too many"_ustr,
getXWeak()); getXWeak());
} }
n = static_cast< sal_Int32 >(n + named_.size()); n = static_cast< sal_Int32 >(n + named_.size());

View File

@@ -33,9 +33,9 @@ css::uno::UnoInterfaceReference get() {
css::uno::UnoInterfaceReference cc; css::uno::UnoInterfaceReference cc;
if (!uno_getCurrentContext( if (!uno_getCurrentContext(
reinterpret_cast< void ** >(&cc.m_pUnoI), reinterpret_cast< void ** >(&cc.m_pUnoI),
OUString(UNO_LB_UNO).pData, nullptr)) u"" UNO_LB_UNO ""_ustr.pData, nullptr))
{ {
throw css::uno::RuntimeException("uno_getCurrentContext failed"); throw css::uno::RuntimeException(u"uno_getCurrentContext failed"_ustr);
} }
return cc; return cc;
} }
@@ -44,9 +44,9 @@ void set(css::uno::UnoInterfaceReference const & value) {
css::uno::UnoInterfaceReference cc(value); css::uno::UnoInterfaceReference cc(value);
if (!uno_setCurrentContext( if (!uno_setCurrentContext(
cc.m_pUnoI, cc.m_pUnoI,
OUString(UNO_LB_UNO).pData, nullptr)) u"" UNO_LB_UNO ""_ustr.pData, nullptr))
{ {
throw css::uno::RuntimeException("uno_setCurrentContext failed"); throw css::uno::RuntimeException(u"uno_setCurrentContext failed"_ustr);
} }
} }

View File

@@ -78,7 +78,7 @@ void writeString(
RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
{ {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"UNO string contains invalid UTF-16 sequence"); u"UNO string contains invalid UTF-16 sequence"_ustr);
} }
writeCompressed(buffer, static_cast< sal_uInt32 >(v.getLength())); writeCompressed(buffer, static_cast< sal_uInt32 >(v.getLength()));
buffer->insert(buffer->end(), v.getStr(), v.getStr() + v.getLength()); buffer->insert(buffer->end(), v.getStr(), v.getStr() + v.getLength());

View File

@@ -46,7 +46,7 @@ OutgoingRequest OutgoingRequests::top(rtl::ByteSequence const & tid) {
Map::iterator i(map_.find(tid)); Map::iterator i(map_.find(tid));
if (i == map_.end()) { if (i == map_.end()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: reply for unknown TID"); u"URP: reply for unknown TID"_ustr);
} }
assert(!i->second.empty()); assert(!i->second.empty());
return i->second.back(); return i->second.back();

View File

@@ -64,7 +64,7 @@ css::uno::Sequence< sal_Int8 > read(
assert(connection.is()); assert(connection.is());
if (size > SAL_MAX_INT32) { if (size > SAL_MAX_INT32) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"binaryurp::Reader: block size too large"); u"binaryurp::Reader: block size too large"_ustr);
} }
css::uno::Sequence< sal_Int8 > buf; css::uno::Sequence< sal_Int8 > buf;
sal_Int32 n = connection->read(buf, static_cast< sal_Int32 >(size)); sal_Int32 n = connection->read(buf, static_cast< sal_Int32 >(size));
@@ -73,7 +73,7 @@ css::uno::Sequence< sal_Int8 > read(
} }
if (o3tl::make_unsigned(n) != size) { if (o3tl::make_unsigned(n) != size) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Reader: premature end of input"); u"binaryurp::Reader: premature end of input"_ustr);
} }
assert(o3tl::make_unsigned(buf.getLength()) == size); assert(o3tl::make_unsigned(buf.getLength()) == size);
return buf; return buf;
@@ -112,7 +112,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 received"); u"binaryurp::Reader: block with zero message count received"_ustr);
} }
Unmarshal block(bridge_, state_, read(con, size, false)); Unmarshal block(bridge_, state_, read(con, size, false));
for (sal_uInt32 i = 0; i != count; ++i) { for (sal_uInt32 i = 0; i != count; ++i) {
@@ -150,8 +150,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" u"URP: request message with MUSTREPLY != SYNCHRONOUS"
" received"); " received"_ustr);
} }
} else { } else {
forceSynchronous = false; forceSynchronous = false;
@@ -173,8 +173,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" u"URP: request message with NEWTYPE received when last"
" interface type has not yet been set"); " interface type has not yet been set"_ustr);
} }
type = lastType_; type = lastType_;
} }
@@ -183,14 +183,14 @@ void Reader::readMessage(Unmarshal & unmarshal) {
oid = unmarshal.readOid(); oid = unmarshal.readOid();
if (oid.isEmpty()) { if (oid.isEmpty()) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: empty OID"); u"binaryurp::Unmarshal: empty OID"_ustr);
} }
lastOid_ = oid; lastOid_ = oid;
} else { } else {
if (lastOid_.isEmpty()) { if (lastOid_.isEmpty()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: request message with NEWOID received when last OID has" u"URP: request message with NEWOID received when last OID has"
" not yet been set"); " not yet been set"_ustr);
} }
oid = lastOid_; oid = lastOid_;
} }
@@ -199,13 +199,13 @@ 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 received"); u"URP: request message with non-interface interface type received"_ustr);
} }
typelib_InterfaceTypeDescription * itd = typelib_InterfaceTypeDescription * itd =
reinterpret_cast< typelib_InterfaceTypeDescription * >(type.get()); reinterpret_cast< typelib_InterfaceTypeDescription * >(type.get());
if (functionId >= itd->nMapFunctionIndexToMemberIndex) { if (functionId >= itd->nMapFunctionIndexToMemberIndex) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: request message with unknown function ID received"); u"URP: request message with unknown function ID received"_ustr);
} }
sal_Int32 memberId = itd->pMapFunctionIndexToMemberIndex[functionId]; sal_Int32 memberId = itd->pMapFunctionIndexToMemberIndex[functionId];
css::uno::TypeDescription memberTd(itd->ppAllMembers[memberId]); css::uno::TypeDescription memberTd(itd->ppAllMembers[memberId]);
@@ -280,8 +280,8 @@ void Reader::readMessage(Unmarshal & unmarshal) {
break; break;
default: default:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: request message with UrpProtocolProperties OID and" u"URP: request message with UrpProtocolProperties OID and"
" unknown function ID received"); " unknown function ID received"_ustr);
} }
} else { } else {
css::uno::UnoInterfaceReference obj; css::uno::UnoInterfaceReference obj;
@@ -317,14 +317,14 @@ void Reader::readMessage(Unmarshal & unmarshal) {
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 received"); u"URP: request message with unknown function ID 1 received"_ustr);
case SPECIAL_FUNCTION_ID_RELEASE: case SPECIAL_FUNCTION_ID_RELEASE:
break; break;
default: default:
obj = bridge_->findStub(oid, type); obj = bridge_->findStub(oid, type);
if (!obj.is()) { if (!obj.is()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: request message with unknown OID received"); u"URP: request message with unknown OID received"_ustr);
} }
break; break;
} }
@@ -401,7 +401,7 @@ void Reader::readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1) {
} }
if (!bOk) { if (!bOk) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: reply message with bad exception type received"); u"URP: reply message with bad exception type received"_ustr);
} }
} }
} else { } else {
@@ -471,8 +471,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 yet been" u"URP: message with NEWTID received when last TID has not yet been"
" set"); " set"_ustr);
} }
return lastTid_; return lastTid_;
} }

View File

@@ -141,7 +141,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 set"); u"binaryurp::Unmarshal: cache flag of simple type is set"_ustr);
} }
return css::uno::TypeDescription( return css::uno::TypeDescription(
*typelib_static_type_getByTypeClass(tc)); *typelib_static_type_getByTypeClass(tc));
@@ -155,7 +155,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 index"); u"binaryurp::Unmarshal: unknown type cache index"_ustr);
} }
return state_.typeCache[idx]; return state_.typeCache[idx];
} else { } else {
@@ -175,15 +175,15 @@ 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 unknown" u"binaryurp::Unmarshal: sequence type with unknown"
" component type"); " component type"_ustr);
} }
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 bad" u"binaryurp::Unmarshal: sequence type with bad"
" component type"); " component type"_ustr);
default: default:
break; break;
} }
@@ -196,7 +196,7 @@ css::uno::TypeDescription Unmarshal::readType() {
} }
default: default:
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: type of unknown type class"); u"binaryurp::Unmarshal: type of unknown type class"_ustr);
} }
} }
@@ -205,14 +205,14 @@ 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 character"); u"binaryurp::Unmarshal: OID contains non-ASCII character"_ustr);
} }
} }
sal_uInt16 idx = readCacheIndex(); sal_uInt16 idx = readCacheIndex();
if (oid.isEmpty() && idx != cache::ignore) { if (oid.isEmpty() && idx != cache::ignore) {
if (state_.oidCache[idx].isEmpty()) { if (state_.oidCache[idx].isEmpty()) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: unknown OID cache index"); u"binaryurp::Unmarshal: unknown OID cache index"_ustr);
} }
return state_.oidCache[idx]; return state_.oidCache[idx];
} }
@@ -235,7 +235,7 @@ rtl::ByteSequence Unmarshal::readTid() {
if (tid.getLength() == 0) { if (tid.getLength() == 0) {
if (idx == cache::ignore || state_.tidCache[idx].getLength() == 0) { if (idx == cache::ignore || state_.tidCache[idx].getLength() == 0) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: unknown TID cache index"); u"binaryurp::Unmarshal: unknown TID cache index"_ustr);
} }
return state_.tidCache[idx]; return state_.tidCache[idx];
} }
@@ -258,7 +258,7 @@ BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) {
sal_uInt8 v = read8(); sal_uInt8 v = read8();
if (v > 1) { if (v > 1) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: boolean of unknown value"); u"binaryurp::Unmarshal: boolean of unknown value"_ustr);
} }
return BinaryAny(type, &v); return BinaryAny(type, &v);
} }
@@ -304,7 +304,7 @@ BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) {
css::uno::TypeDescription t(readType()); css::uno::TypeDescription t(readType());
if (t.get()->eTypeClass == typelib_TypeClass_ANY) { if (t.get()->eTypeClass == typelib_TypeClass_ANY) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: any of type ANY"); u"binaryurp::Unmarshal: any of type ANY"_ustr);
} }
return readValue(t); return readValue(t);
} }
@@ -326,7 +326,7 @@ BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) {
} }
if (!bFound) { if (!bFound) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: unknown enum value"); u"binaryurp::Unmarshal: unknown enum value"_ustr);
} }
return BinaryAny(type, &v); return BinaryAny(type, &v);
} }
@@ -356,14 +356,14 @@ BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) {
void Unmarshal::done() const { void Unmarshal::done() const {
if (data_ != end_) { if (data_ != end_) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: block contains excess data"); u"binaryurp::Unmarshal: block contains excess data"_ustr);
} }
} }
void Unmarshal::check(sal_Int32 size) const { void Unmarshal::check(sal_Int32 size) const {
if (end_ - data_ < size) { if (end_ - data_ < size) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: trying to read past end of block"); u"binaryurp::Unmarshal: trying to read past end of block"_ustr);
} }
} }
@@ -376,7 +376,7 @@ sal_uInt16 Unmarshal::readCacheIndex() {
sal_uInt16 idx = read16(); sal_uInt16 idx = read16();
if (idx >= cache::size && idx != cache::ignore) { if (idx >= cache::size && idx != cache::ignore) {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: cache index out of range"); u"binaryurp::Unmarshal: cache index out of range"_ustr);
} }
return idx; return idx;
} }
@@ -397,7 +397,7 @@ OUString Unmarshal::readString() {
sal_uInt32 n = readCompressed(); sal_uInt32 n = readCompressed();
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"binaryurp::Unmarshal: string size too large"); u"binaryurp::Unmarshal: string size too large"_ustr);
} }
check(static_cast< sal_Int32 >(n)); check(static_cast< sal_Int32 >(n));
OUString s; OUString s;
@@ -409,7 +409,7 @@ OUString Unmarshal::readString() {
RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
{ {
throw css::io::IOException( throw css::io::IOException(
"binaryurp::Unmarshal: string does not contain UTF-8"); u"binaryurp::Unmarshal: string does not contain UTF-8"_ustr);
} }
data_ += n; data_ += n;
return s; return s;
@@ -420,7 +420,7 @@ BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) {
sal_uInt32 n = readCompressed(); sal_uInt32 n = readCompressed();
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"binaryurp::Unmarshal: sequence size too large"); u"binaryurp::Unmarshal: sequence size too large"_ustr);
} }
if (n == 0) { if (n == 0) {
return BinaryAny(type, nullptr); return BinaryAny(type, nullptr);
@@ -448,7 +448,7 @@ BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) {
// sal_uInt32 * sal_Int32 -> sal_uInt64 cannot overflow // sal_uInt32 * sal_Int32 -> sal_uInt64 cannot overflow
if (size > SAL_MAX_SIZE - SAL_SEQUENCE_HEADER_SIZE) { if (size > SAL_MAX_SIZE - SAL_SEQUENCE_HEADER_SIZE) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"binaryurp::Unmarshal: sequence size too large"); u"binaryurp::Unmarshal: sequence size too large"_ustr);
} }
void * buf = allocate( void * buf = allocate(
SAL_SEQUENCE_HEADER_SIZE + static_cast< sal_Size >(size)); SAL_SEQUENCE_HEADER_SIZE + static_cast< sal_Size >(size));

View File

@@ -168,7 +168,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::release")) && u"com.sun.star.uno.XInterface::release"_ustr)) &&
bridge_->isCurrentContextMode()), bridge_->isCurrentContextMode()),
item.currentContext); item.currentContext);
} else { } else {
@@ -243,7 +243,7 @@ void Writer::sendRequest(
} }
assert(functionId >= 0); assert(functionId >= 0);
if (functionId > SAL_MAX_UINT16) { if (functionId > SAL_MAX_UINT16) {
throw css::uno::RuntimeException("function ID too large for URP"); throw css::uno::RuntimeException(u"function ID too large for URP"_ustr);
} }
std::vector< unsigned char > buf; std::vector< unsigned char > buf;
bool newType = !(lastType_.is() && t.equals(lastType_)); bool newType = !(lastType_.is() && t.equals(lastType_));
@@ -411,7 +411,7 @@ void Writer::sendMessage(std::vector< unsigned char > const & buffer) {
std::vector< unsigned char > header; std::vector< unsigned char > header;
if (buffer.size() > SAL_MAX_UINT32) { if (buffer.size() > SAL_MAX_UINT32) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"message too large for URP"); u"message too large for URP"_ustr);
} }
Marshal::write32(&header, static_cast< sal_uInt32 >(buffer.size())); Marshal::write32(&header, static_cast< sal_uInt32 >(buffer.size()));
Marshal::write32(&header, 1); Marshal::write32(&header, 1);