summaryrefslogtreecommitdiffstats
path: root/binaryurp/source/unmarshal.cxx
diff options
context:
space:
mode:
authorRicardo Montania <ricardo@linuxafundo.com.br>2012-09-05 00:15:25 -0300
committerStephan Bergmann <sbergman@redhat.com>2012-09-05 09:26:10 +0200
commita60f9112146b23566a6a0ff3a5109889f4b7c0b1 (patch)
tree174f64efee745533f2ffa8f6c9b56cbb823462c3 /binaryurp/source/unmarshal.cxx
parentfdo#38913: Prevent invalid parameter handler crashes (diff)
downloadcore-a60f9112146b23566a6a0ff3a5109889f4b7c0b1.tar.gz
core-a60f9112146b23566a6a0ff3a5109889f4b7c0b1.zip
OUString and RTL_CONSTASCII cleanup
Change-Id: Ic56451b2c13d8561bb6e6ee92bf9147b35640a5c
Diffstat (limited to 'binaryurp/source/unmarshal.cxx')
-rw-r--r--binaryurp/source/unmarshal.cxx88
1 files changed, 25 insertions, 63 deletions
diff --git a/binaryurp/source/unmarshal.cxx b/binaryurp/source/unmarshal.cxx
index 13cd07ca1d45..59b37e74347a 100644
--- a/binaryurp/source/unmarshal.cxx
+++ b/binaryurp/source/unmarshal.cxx
@@ -146,10 +146,8 @@ css::uno::TypeDescription Unmarshal::readType() {
case typelib_TypeClass_ANY:
if ((flags & 0x80) != 0) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: cache flag of simple type is"
- " set")),
+ "binaryurp::Unmarshal: cache flag of simple type is"
+ " set",
css::uno::Reference< css::uno::XInterface >());
}
return css::uno::TypeDescription(
@@ -165,10 +163,8 @@ css::uno::TypeDescription Unmarshal::readType() {
if ((flags & 0x80) == 0) {
if (idx == cache::ignore || !state_.typeCache[idx].is()) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: unknown type cache"
- " index")),
+ "binaryurp::Unmarshal: unknown type cache"
+ " index",
css::uno::Reference< css::uno::XInterface >());
}
return state_.typeCache[idx];
@@ -180,10 +176,8 @@ css::uno::TypeDescription Unmarshal::readType() {
{
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: type with unknown"
- " name: ")) + str,
+ "binaryurp::Unmarshal: type with unknown"
+ " name: " + str,
css::uno::Reference< css::uno::XInterface >());
}
for (css::uno::TypeDescription t2(t);
@@ -195,20 +189,16 @@ css::uno::TypeDescription Unmarshal::readType() {
t2.get())->pType);
if (!t2.is()) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: sequence type with"
- " unknown component type")),
+ "binaryurp::Unmarshal: sequence type with"
+ " unknown component type",
css::uno::Reference< css::uno::XInterface >());
}
switch (t2.get()->eTypeClass) {
case typelib_TypeClass_VOID:
case typelib_TypeClass_EXCEPTION:
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: sequence type with"
- " bad component type")),
+ "binaryurp::Unmarshal: sequence type with"
+ " bad component type",
css::uno::Reference< css::uno::XInterface >());
default:
break;
@@ -222,9 +212,7 @@ css::uno::TypeDescription Unmarshal::readType() {
}
default:
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: type of unknown type class")),
+ "binaryurp::Unmarshal: type of unknown type class",
css::uno::Reference< css::uno::XInterface >());
}
}
@@ -234,10 +222,8 @@ OUString Unmarshal::readOid() {
for (sal_Int32 i = 0; i != oid.getLength(); ++i) {
if (oid[i] > 0x7F) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: OID contains non-ASCII"
- " character")),
+ "binaryurp::Unmarshal: OID contains non-ASCII"
+ " character",
css::uno::Reference< css::uno::XInterface >());
}
}
@@ -245,9 +231,7 @@ OUString Unmarshal::readOid() {
if (oid.isEmpty() && idx != cache::ignore) {
if (state_.oidCache[idx].isEmpty()) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: unknown OID cache index")),
+ "binaryurp::Unmarshal: unknown OID cache index",
css::uno::Reference< css::uno::XInterface >());
}
return state_.oidCache[idx];
@@ -271,9 +255,7 @@ rtl::ByteSequence Unmarshal::readTid() {
if (tid.getLength() == 0) {
if (idx == cache::ignore || state_.tidCache[idx].getLength() == 0) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: unknown TID cache index")),
+ "binaryurp::Unmarshal: unknown TID cache index",
css::uno::Reference< css::uno::XInterface >());
}
return state_.tidCache[idx];
@@ -297,9 +279,7 @@ BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) {
sal_uInt8 v = read8();
if (v > 1) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: boolean of unknown value")),
+ "binaryurp::Unmarshal: boolean of unknown value",
css::uno::Reference< css::uno::XInterface >());
}
return BinaryAny(type, &v);
@@ -346,9 +326,7 @@ BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) {
css::uno::TypeDescription t(readType());
if (t.get()->eTypeClass == typelib_TypeClass_ANY) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: any of type ANY")),
+ "binaryurp::Unmarshal: any of type ANY",
css::uno::Reference< css::uno::XInterface >());
}
return readValue(t);
@@ -371,9 +349,7 @@ BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) {
}
if (!found) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: unknown enum value")),
+ "binaryurp::Unmarshal: unknown enum value",
css::uno::Reference< css::uno::XInterface >());
}
return BinaryAny(type, &v);
@@ -404,9 +380,7 @@ BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) {
void Unmarshal::done() const {
if (data_ != end_) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: block contains excess data")),
+ "binaryurp::Unmarshal: block contains excess data",
css::uno::Reference< css::uno::XInterface >());
}
}
@@ -414,9 +388,7 @@ void Unmarshal::done() const {
void Unmarshal::check(sal_Int32 size) const {
if (end_ - data_ < size) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: trying to read past end of block")),
+ "binaryurp::Unmarshal: trying to read past end of block",
css::uno::Reference< css::uno::XInterface >());
}
}
@@ -430,9 +402,7 @@ sal_uInt16 Unmarshal::readCacheIndex() {
sal_uInt16 idx = read16();
if (idx >= cache::size && idx != cache::ignore) {
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: cache index out of range")),
+ "binaryurp::Unmarshal: cache index out of range",
css::uno::Reference< css::uno::XInterface >());
}
return idx;
@@ -454,9 +424,7 @@ OUString Unmarshal::readString() {
sal_uInt32 n = readCompressed();
if (n > SAL_MAX_INT32) {
throw css::uno::RuntimeException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: string size too large")),
+ "binaryurp::Unmarshal: string size too large",
css::uno::Reference< css::uno::XInterface >());
}
check(static_cast< sal_Int32 >(n));
@@ -469,9 +437,7 @@ OUString Unmarshal::readString() {
RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
{
throw css::io::IOException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: string does not contain UTF-8")),
+ "binaryurp::Unmarshal: string does not contain UTF-8",
css::uno::Reference< css::uno::XInterface >());
}
data_ += n;
@@ -483,9 +449,7 @@ BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) {
sal_uInt32 n = readCompressed();
if (n > SAL_MAX_INT32) {
throw css::uno::RuntimeException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: sequence size too large")),
+ "binaryurp::Unmarshal: sequence size too large",
css::uno::Reference< css::uno::XInterface >());
}
if (n == 0) {
@@ -513,9 +477,7 @@ BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) {
// sal_uInt32 * sal_Int32 -> sal_uInt64 cannot overflow
if (size > SAL_MAX_SIZE - SAL_SEQUENCE_HEADER_SIZE) {
throw css::uno::RuntimeException(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "binaryurp::Unmarshal: sequence size too large")),
+ "binaryurp::Unmarshal: sequence size too large",
css::uno::Reference< css::uno::XInterface >());
}
void * buf = allocate(