diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-04-26 13:59:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-04-26 19:44:07 +0200 |
commit | 59ad8d6d15c893e8873f4afb55a24ab3e58fa2c1 (patch) | |
tree | aa43c239a8b91a6eef900264d2650cbe3d6505c6 /unoidl | |
parent | fe0d8555150949bb8729c656af62917ffc48bbf8 (diff) |
loplugin:ostr in codemaker,unoidl
Change-Id: I75f5531023f31da029491ce4a078005eebbfe59e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166738
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'unoidl')
-rw-r--r-- | unoidl/source/legacyprovider.cxx | 12 | ||||
-rw-r--r-- | unoidl/source/sourceprovider-parser.y | 134 | ||||
-rw-r--r-- | unoidl/source/sourcetreeprovider.cxx | 12 | ||||
-rw-r--r-- | unoidl/source/unoidl-check.cxx | 30 | ||||
-rw-r--r-- | unoidl/source/unoidlprovider.cxx | 120 |
5 files changed, 154 insertions, 154 deletions
diff --git a/unoidl/source/legacyprovider.cxx b/unoidl/source/legacyprovider.cxx index 9299ae7ce046..c5b92e942861 100644 --- a/unoidl/source/legacyprovider.cxx +++ b/unoidl/source/legacyprovider.cxx @@ -31,7 +31,7 @@ std::vector< OUString > translateAnnotations(std::u16string_view documentation) std::vector< OUString > ans; if (documentation.find(u"@deprecated") != std::u16string_view::npos) { //TODO: this check is somewhat crude - ans.push_back("deprecated"); + ans.push_back(u"deprecated"_ustr); } return ans; } @@ -104,7 +104,7 @@ Cursor::Cursor( if (!prefix_.endsWith("/")) { prefix_ += "/"; } - RegError e = key_.getKeyNames("", names_); + RegError e = key_.getKeyNames(u""_ustr, names_); if (e != RegError::NO_ERROR) { throw FileFormatException( key_.getRegistryName(), @@ -150,7 +150,7 @@ private: std::vector< OUString > Module::getMemberNames() const { RegistryKeyNames names; - RegError e = key_.getKeyNames("", names); + RegError e = key_.getKeyNames(u""_ustr, names); if (e != RegError::NO_ERROR) { throw FileFormatException( key_.getRegistryName(), @@ -168,7 +168,7 @@ typereg::Reader getReader(RegistryKey & key, std::vector< char > * buffer) { assert(buffer != nullptr); RegValueType type; sal_uInt32 size; - RegError e = key.getValueInfo("", &type, &size); + RegError e = key.getValueInfo(u""_ustr, &type, &size); if (e != RegError::NO_ERROR) { throw FileFormatException( key.getRegistryName(), @@ -190,7 +190,7 @@ typereg::Reader getReader(RegistryKey & key, std::vector< char > * buffer) { + " of key " + key.getName())); } buffer->resize(static_cast< std::vector< char >::size_type >(size)); - e = key.getValue("", buffer->data()); + e = key.getValue(u""_ustr, buffer->data()); if (e != RegError::NO_ERROR) { throw FileFormatException( key.getRegistryName(), @@ -799,7 +799,7 @@ LegacyProvider::LegacyProvider(Manager & manager, OUString const & uri): throw FileFormatException( uri, "legacy format: cannot open root key: " + OUString::number(static_cast<int>(e))); } - e = root.openKey("UCR", ucr_); + e = root.openKey(u"UCR"_ustr, ucr_); switch (e) { case RegError::NO_ERROR: case RegError::KEY_NOT_EXISTS: // such effectively empty files exist in the wild diff --git a/unoidl/source/sourceprovider-parser.y b/unoidl/source/sourceprovider-parser.y index f3510cb17b7e..1300ecd15605 100644 --- a/unoidl/source/sourceprovider-parser.y +++ b/unoidl/source/sourceprovider-parser.y @@ -84,27 +84,27 @@ void error(YYLTYPE location, yyscan_t yyscanner, OUString const & message) { OUString flagName(unoidl::detail::SourceProviderFlags flag) { switch (flag) { case unoidl::detail::FLAG_ATTRIBUTE: - return "attribute"; + return u"attribute"_ustr; case unoidl::detail::FLAG_BOUND: - return "bound"; + return u"bound"_ustr; case unoidl::detail::FLAG_CONSTRAINED: - return "constrained"; + return u"constrained"_ustr; case unoidl::detail::FLAG_MAYBEAMBIGUOUS: - return "maybeambiguous"; + return u"maybeambiguous"_ustr; case unoidl::detail::FLAG_MAYBEDEFAULT: - return "maybedefault"; + return u"maybedefault"_ustr; case unoidl::detail::FLAG_MAYBEVOID: - return "maybevoid"; + return u"maybevoid"_ustr; case unoidl::detail::FLAG_OPTIONAL: - return "optional"; + return u"optional"_ustr; case unoidl::detail::FLAG_PROPERTY: - return "property"; + return u"property"_ustr; case unoidl::detail::FLAG_READONLY: - return "readonly"; + return u"readonly"_ustr; case unoidl::detail::FLAG_REMOVABLE: - return "removable"; + return u"removable"_ustr; case unoidl::detail::FLAG_TRANSIENT: - return "transient"; + return u"transient"_ustr; default: assert(false && "this cannot happen"); for (;;) { std::abort(); } } @@ -267,7 +267,7 @@ bool coerce( break; } if (!ok) { - error(location, yyscanner, "cannot coerce binary expression arguments"); + error(location, yyscanner, u"cannot coerce binary expression arguments"_ustr); } return ok; } @@ -835,7 +835,7 @@ bool checkTypeArgument( case unoidl::detail::SourceProviderType::TYPE_PARAMETER: //TODO? error( location, yyscanner, - "bad instantiated polymorphic struct type argument"); + u"bad instantiated polymorphic struct type argument"_ustr); return false; case unoidl::detail::SourceProviderType::TYPE_SEQUENCE: return checkTypeArgument(location, yyscanner, type.subtypes.front()); @@ -864,7 +864,7 @@ bool checkInstantiatedPolymorphicStructTypeArgument( std::vector<OUString> annotations(bool deprecated) { std::vector<OUString> ann; if (deprecated) { - ann.push_back("deprecated"); + ann.push_back(u"deprecated"_ustr); } return ann; } @@ -1574,7 +1574,7 @@ interfaceDefn: if (pad->directMandatoryBases.empty() && data->currentName != "com.sun.star.uno.XInterface") { - OUString base(".com.sun.star.uno.XInterface"); + OUString base(u".com.sun.star.uno.XInterface"_ustr); unoidl::detail::SourceProviderEntity const * p; if (findEntity(@4, yyscanner, data, true, &base, &p, nullptr, nullptr) == FOUND_ERROR) @@ -1641,13 +1641,13 @@ interfaceBase: if (pad->singleBase) { error( @3, yyscanner, - "single-inheritance interface cannot have additional bases"); + u"single-inheritance interface cannot have additional bases"_ustr); YYERROR; } if (($2 & ~unoidl::detail::FLAG_OPTIONAL) != 0) { error( @2, yyscanner, - "interface base can only be flagged as [optional]"); + u"interface base can only be flagged as [optional]"_ustr); YYERROR; } bool opt = ($2 & unoidl::detail::FLAG_OPTIONAL) != 0; @@ -1705,7 +1705,7 @@ interfaceAttribute: if (($2 & unoidl::detail::FLAG_ATTRIBUTE) == 0) { error( @2, yyscanner, - "interface attribute must be flagged as [attribute]"); + u"interface attribute must be flagged as [attribute]"_ustr); YYERROR; } if (($2 @@ -1715,8 +1715,8 @@ interfaceAttribute: { error( @2, yyscanner, - ("interface attribute can only be flagged as [attribute," - " bound, readonly]")); + (u"interface attribute can only be flagged as [attribute," + " bound, readonly]"_ustr)); YYERROR; } switch (t.type) { @@ -1755,7 +1755,7 @@ attributeAccessDecls: { if (($1 & $2) != 0) { error( - @2, yyscanner, "duplicate get/set attribute access declaration"); + @2, yyscanner, u"duplicate get/set attribute access declaration"_ustr); YYERROR; } $$ = unoidl::detail::SourceProviderAccessDecls($1 | $2); @@ -1910,7 +1910,7 @@ typedefDefn: case unoidl::detail::SourceProviderType::TYPE_VOID: case unoidl::detail::SourceProviderType::TYPE_EXCEPTION: case unoidl::detail::SourceProviderType::TYPE_INSTANTIATED_POLYMORPHIC_STRUCT: - error(@4, yyscanner, "bad typedef type"); + error(@4, yyscanner, u"bad typedef type"_ustr); YYERROR; break; case unoidl::detail::SourceProviderType::TYPE_ENUM: @@ -2596,7 +2596,7 @@ serviceBase: if (($2 & ~unoidl::detail::FLAG_OPTIONAL) != 0) { error( @2, yyscanner, - "service base can only be flagged as [optional]"); + u"service base can only be flagged as [optional]"_ustr); YYERROR; } bool opt = ($2 & unoidl::detail::FLAG_OPTIONAL) != 0; @@ -2654,7 +2654,7 @@ serviceInterfaceBase: if (($2 & ~unoidl::detail::FLAG_OPTIONAL) != 0) { error( @2, yyscanner, - "interface base can only be flagged as [optional]"); + u"interface base can only be flagged as [optional]"_ustr); YYERROR; } bool opt = ($2 & unoidl::detail::FLAG_OPTIONAL) != 0; @@ -2730,8 +2730,8 @@ serviceProperty: if (($2 & unoidl::detail::FLAG_PROPERTY) == 0) { error( @2, yyscanner, - ("accumulation-based service property must be flagged as" - " [property]")); + (u"accumulation-based service property must be flagged as" + " [property]"_ustr)); YYERROR; } if (($2 @@ -2746,9 +2746,9 @@ serviceProperty: { error( @2, yyscanner, - ("accumulation-based service property can only be flagged as" + (u"accumulation-based service property can only be flagged as" " [property, bound, constrained, maybeambiguous, maybedefault," - " maybevoid, optional, readonly, removable, transient]")); + " maybevoid, optional, readonly, removable, transient]"_ustr)); YYERROR; } int att = 0; @@ -3120,7 +3120,7 @@ orExpr: $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval | $3.uval); break; default: - error(@1, yyscanner, "arguments of non-integer type to \"|\""); + error(@1, yyscanner, u"arguments of non-integer type to \"|\""_ustr); YYERROR; break; } @@ -3142,7 +3142,7 @@ xorExpr: $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval ^ $3.uval); break; default: - error(@1, yyscanner, "arguments of non-integer type to \"^\""); + error(@1, yyscanner, u"arguments of non-integer type to \"^\""_ustr); YYERROR; break; } @@ -3164,7 +3164,7 @@ andExpr: $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval & $3.uval); break; default: - error(@1, yyscanner, "arguments of non-integer type to \"&\""); + error(@1, yyscanner, u"arguments of non-integer type to \"&\""_ustr); YYERROR; break; } @@ -3198,7 +3198,7 @@ shiftExpr: n = static_cast<int>($3.uval); break; default: - error(@3, yyscanner, "right argument of non-integer type to \"<<\""); + error(@3, yyscanner, u"right argument of non-integer type to \"<<\""_ustr); YYERROR; } switch ($1.type) { @@ -3216,7 +3216,7 @@ shiftExpr: $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval << n); break; default: - error(@1, yyscanner, "left argument of non-integer type to \"<<\""); + error(@1, yyscanner, u"left argument of non-integer type to \"<<\""_ustr); YYERROR; break; } @@ -3246,7 +3246,7 @@ shiftExpr: n = static_cast<int>($3.uval); break; default: - error(@3, yyscanner, "right argument of non-integer type to \">>\""); + error(@3, yyscanner, u"right argument of non-integer type to \">>\""_ustr); YYERROR; break; } @@ -3258,7 +3258,7 @@ shiftExpr: $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval >> n); break; default: - error(@1, yyscanner, "left argument of non-integer type to \">>\""); + error(@1, yyscanner, u"left argument of non-integer type to \">>\""_ustr); YYERROR; break; } @@ -3274,7 +3274,7 @@ addExpr: } switch ($1.type) { case unoidl::detail::SourceProviderExpr::TYPE_BOOL: - error(@1, yyscanner, "arguments of boolean type to binary \"+\""); + error(@1, yyscanner, u"arguments of boolean type to binary \"+\""_ustr); YYERROR; break; case unoidl::detail::SourceProviderExpr::TYPE_INT: @@ -3295,7 +3295,7 @@ addExpr: } switch ($1.type) { case unoidl::detail::SourceProviderExpr::TYPE_BOOL: - error(@1, yyscanner, "arguments of boolean type to binary \"-\""); + error(@1, yyscanner, u"arguments of boolean type to binary \"-\""_ustr); YYERROR; break; case unoidl::detail::SourceProviderExpr::TYPE_INT: @@ -3320,7 +3320,7 @@ multExpr: } switch ($1.type) { case unoidl::detail::SourceProviderExpr::TYPE_BOOL: - error(@1, yyscanner, "arguments of boolean type to \"*\""); + error(@1, yyscanner, u"arguments of boolean type to \"*\""_ustr); YYERROR; break; case unoidl::detail::SourceProviderExpr::TYPE_INT: @@ -3341,26 +3341,26 @@ multExpr: } switch ($1.type) { case unoidl::detail::SourceProviderExpr::TYPE_BOOL: - error(@1, yyscanner, "arguments of boolean type to \"/\""); + error(@1, yyscanner, u"arguments of boolean type to \"/\""_ustr); YYERROR; break; case unoidl::detail::SourceProviderExpr::TYPE_INT: if ($3.ival == 0) { - error(@3, yyscanner, "cannot divide by zero"); + error(@3, yyscanner, u"cannot divide by zero"_ustr); YYERROR; } $$ = unoidl::detail::SourceProviderExpr::Int($1.ival / $3.ival); break; case unoidl::detail::SourceProviderExpr::TYPE_UINT: if ($3.uval == 0) { - error(@3, yyscanner, "cannot divide by zero"); + error(@3, yyscanner, u"cannot divide by zero"_ustr); YYERROR; } $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval / $3.uval); break; case unoidl::detail::SourceProviderExpr::TYPE_FLOAT: if ($3.fval == 0) { - error(@3, yyscanner, "cannot divide by zero"); + error(@3, yyscanner, u"cannot divide by zero"_ustr); YYERROR; } $$ = unoidl::detail::SourceProviderExpr::Float($1.fval - $3.fval); @@ -3375,20 +3375,20 @@ multExpr: switch ($1.type) { case unoidl::detail::SourceProviderExpr::TYPE_INT: if ($3.ival == 0) { - error(@3, yyscanner, "cannot divide by zero"); + error(@3, yyscanner, u"cannot divide by zero"_ustr); YYERROR; } $$ = unoidl::detail::SourceProviderExpr::Int($1.ival % $3.ival); break; case unoidl::detail::SourceProviderExpr::TYPE_UINT: if ($3.uval == 0) { - error(@3, yyscanner, "cannot divide by zero"); + error(@3, yyscanner, u"cannot divide by zero"_ustr); YYERROR; } $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval % $3.uval); break; default: - error(@1, yyscanner, "arguments of non-integer type to \"%\""); + error(@1, yyscanner, u"arguments of non-integer type to \"%\""_ustr); YYERROR; break; } @@ -3400,7 +3400,7 @@ unaryExpr: '+' primaryExpr { if ($2.type == unoidl::detail::SourceProviderExpr::TYPE_BOOL) { - error(@2, yyscanner, "argument of boolean type to unary \"+\""); + error(@2, yyscanner, u"argument of boolean type to unary \"+\""_ustr); YYERROR; } $$ = $2; @@ -3409,12 +3409,12 @@ unaryExpr: { switch ($2.type) { case unoidl::detail::SourceProviderExpr::TYPE_BOOL: - error(@2, yyscanner, "argument of boolean type to unary \"-\""); + error(@2, yyscanner, u"argument of boolean type to unary \"-\""_ustr); YYERROR; break; case unoidl::detail::SourceProviderExpr::TYPE_INT: if ($2.ival == SAL_MIN_INT64) { - error(@2, yyscanner, "cannot negate -2^63"); + error(@2, yyscanner, u"cannot negate -2^63"_ustr); YYERROR; } $$ = unoidl::detail::SourceProviderExpr::Int(-$2.ival); @@ -3449,7 +3449,7 @@ unaryExpr: $$ = unoidl::detail::SourceProviderExpr::Uint(~$2.uval); break; default: - error(@2, yyscanner, "argument of non-integer type to \"~\""); + error(@2, yyscanner, u"argument of non-integer type to \"~\""_ustr); YYERROR; break; } @@ -3705,7 +3705,7 @@ type: case unoidl::detail::SourceProviderType::TYPE_VOID: case unoidl::detail::SourceProviderType::TYPE_EXCEPTION: case unoidl::detail::SourceProviderType::TYPE_PARAMETER: //TODO? - error(@3, yyscanner, "illegal sequence type component type"); + error(@3, yyscanner, u"illegal sequence type component type"_ustr); YYERROR; break; default: @@ -3987,35 +3987,35 @@ OUString SourceProviderType::getName() const { } switch (type) { case unoidl::detail::SourceProviderType::TYPE_VOID: - return "void"; + return u"void"_ustr; case unoidl::detail::SourceProviderType::TYPE_BOOLEAN: - return "boolean"; + return u"boolean"_ustr; case unoidl::detail::SourceProviderType::TYPE_BYTE: - return "byte"; + return u"byte"_ustr; case unoidl::detail::SourceProviderType::TYPE_SHORT: - return "short"; + return u"short"_ustr; case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_SHORT: - return "unsigned short"; + return u"unsigned short"_ustr; case unoidl::detail::SourceProviderType::TYPE_LONG: - return "long"; + return u"long"_ustr; case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_LONG: - return "unsigned long"; + return u"unsigned long"_ustr; case unoidl::detail::SourceProviderType::TYPE_HYPER: - return "hyper"; + return u"hyper"_ustr; case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_HYPER: - return "unsigned hyper"; + return u"unsigned hyper"_ustr; case unoidl::detail::SourceProviderType::TYPE_FLOAT: - return "float"; + return u"float"_ustr; case unoidl::detail::SourceProviderType::TYPE_DOUBLE: - return "double"; + return u"double"_ustr; case unoidl::detail::SourceProviderType::TYPE_CHAR: - return "char"; + return u"char"_ustr; case unoidl::detail::SourceProviderType::TYPE_STRING: - return "string"; + return u"string"_ustr; case unoidl::detail::SourceProviderType::TYPE_TYPE: - return "type"; + return u"type"_ustr; case unoidl::detail::SourceProviderType::TYPE_ANY: - return "any"; + return u"any"_ustr; case unoidl::detail::SourceProviderType::TYPE_SEQUENCE: assert(subtypes.size() == 1); return "[]" + subtypes.front().getName(); @@ -4374,7 +4374,7 @@ bool SourceProviderInterfaceTypeEntityPad::addOptionalBaseMembers( } for (auto & i: entity->getDirectAttributes()) { Member & m( - allMembers.emplace(i.name, Member("")) + allMembers.emplace(i.name, Member(u""_ustr)) .first->second); if (m.mandatory.isEmpty()) { m.optional.insert(name); @@ -4382,7 +4382,7 @@ bool SourceProviderInterfaceTypeEntityPad::addOptionalBaseMembers( } for (auto & i: entity->getDirectMethods()) { Member & m( - allMembers.emplace(i.name, Member("")) + allMembers.emplace(i.name, Member(u""_ustr)) .first->second); if (m.mandatory.isEmpty()) { m.optional.insert(name); diff --git a/unoidl/source/sourcetreeprovider.cxx b/unoidl/source/sourcetreeprovider.cxx index 852a5a9bb30d..c5df8e9f3395 100644 --- a/unoidl/source/sourcetreeprovider.cxx +++ b/unoidl/source/sourcetreeprovider.cxx @@ -201,7 +201,7 @@ rtl::Reference<Entity> Cursor::getNext(OUString * name) { } if (ent != data.entities.end()) { throw FileFormatException( - stat.getFileURL(), "source file defines more than one entity"); + stat.getFileURL(), u"source file defines more than one entity"_ustr); } ent = j; } @@ -259,7 +259,7 @@ rtl::Reference<Entity> SourceTreeProvider::findEntity(OUString const & name) assert(i == start || i != 0); if (i == start || name[i - 1] == '_') { throw FileFormatException( //TODO - "", "Illegal UNOIDL identifier \"" + name + "\""); + u""_ustr, "Illegal UNOIDL identifier \"" + name + "\""); } buf[i] = '/'; start = i + 1; @@ -269,21 +269,21 @@ rtl::Reference<Entity> SourceTreeProvider::findEntity(OUString const & name) || !rtl::isAsciiUpperCase(name[start])) { throw FileFormatException( //TODO - "", "Illegal UNOIDL identifier \"" + name + "\""); + u""_ustr, "Illegal UNOIDL identifier \"" + name + "\""); } } else if (rtl::isAsciiDigit(c)) { if (i == start) { throw FileFormatException( //TODO - "", "Illegal UNOIDL identifier \"" + name + "\""); + u""_ustr, "Illegal UNOIDL identifier \"" + name + "\""); } } else if (!rtl::isAsciiAlpha(c)) { throw FileFormatException( //TODO - "", "Illegal UNOIDL identifier \"" + name + "\""); + u""_ustr, "Illegal UNOIDL identifier \"" + name + "\""); } } if (i == start) { throw FileFormatException( //TODO - "", "Illegal UNOIDL identifier \"" + name + "\""); + u""_ustr, "Illegal UNOIDL identifier \"" + name + "\""); } OUString uri(uri_ + buf); rtl::Reference<Entity> ent; diff --git a/unoidl/source/unoidl-check.cxx b/unoidl/source/unoidl-check.cxx index fdeb74441fc1..cfd691a2f2e9 100644 --- a/unoidl/source/unoidl-check.cxx +++ b/unoidl/source/unoidl-check.cxx @@ -140,11 +140,11 @@ OUString showDirection( { switch (direction) { case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN: - return "[in]"; + return u"[in]"_ustr; case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_OUT: - return "[out]"; + return u"[out]"_ustr; case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN_OUT: - return "[inout]"; + return u"[inout]"_ustr; default: assert(false && "this cannot happen"); for (;;) { std::abort(); } } @@ -251,10 +251,10 @@ void checkMap( << "plain struct type " << name << " direct base changed from " << (ent2A->getDirectBase().isEmpty() - ? OUString("none") : ent2A->getDirectBase()) + ? u"none"_ustr : ent2A->getDirectBase()) << " to " << (ent2B->getDirectBase().isEmpty() - ? OUString("none") : ent2B->getDirectBase()) + ? u"none"_ustr : ent2B->getDirectBase()) << std::endl; std::exit(EXIT_FAILURE); } @@ -345,11 +345,11 @@ void checkMap( << i - ent2A->getMembers().begin() + 1 << " changed from " << (i->parameterized - ? OUString("parameterized ") : OUString()) + ? u"parameterized "_ustr : OUString()) << i->type << " " << i->name << " to " << (j->parameterized - ? OUString("parameterized ") : OUString()) + ? u"parameterized "_ustr : OUString()) << j->type << " " << j->name << std::endl; std::exit(EXIT_FAILURE); @@ -368,10 +368,10 @@ void checkMap( << "exception type " << name << " direct base changed from " << (ent2A->getDirectBase().isEmpty() - ? OUString("none") : ent2A->getDirectBase()) + ? u"none"_ustr : ent2A->getDirectBase()) << " to " << (ent2B->getDirectBase().isEmpty() - ? OUString("none") : ent2B->getDirectBase()) + ? u"none"_ustr : ent2B->getDirectBase()) << std::endl; std::exit(EXIT_FAILURE); } @@ -489,14 +489,14 @@ void checkMap( << " direct attribute #" << i - ent2A->getDirectAttributes().begin() + 1 << " changed from " - << (i->bound ? OUString("bound ") : OUString()) + << (i->bound ? u"bound "_ustr : OUString()) << (i->readOnly - ? OUString("read-only ") : OUString()) + ? u"read-only "_ustr : OUString()) << i->type << " " << i->name //TODO: exceptions << " to " - << (j->bound ? OUString("bound ") : OUString()) + << (j->bound ? u"bound "_ustr : OUString()) << (j->readOnly - ? OUString("read-only ") : OUString()) + ? u"read-only "_ustr : OUString()) << j->type << " " << j->name //TODO: exceptions << std::endl; std::exit(EXIT_FAILURE); @@ -661,10 +661,10 @@ void checkMap( << i - ent2A->getConstructors().begin() + 1 << " changed from " << (i->defaultConstructor - ? OUString("default ") : i->name) //TODO: parameters, exceptions + ? u"default "_ustr : i->name) //TODO: parameters, exceptions << " to " << (j->defaultConstructor - ? OUString("default ") : j->name) //TODO: parameters, exceptions + ? u"default "_ustr : j->name) //TODO: parameters, exceptions << std::endl; std::exit(EXIT_FAILURE); } diff --git a/unoidl/source/unoidlprovider.cxx b/unoidl/source/unoidlprovider.cxx index d6f4d4ddd51a..a0bd744d3c42 100644 --- a/unoidl/source/unoidlprovider.cxx +++ b/unoidl/source/unoidlprovider.cxx @@ -287,7 +287,7 @@ sal_uInt8 MappedFile::read8(sal_uInt32 offset) const { assert(size >= 8); if (offset > size - 1) { throw FileFormatException( - uri, "UNOIDL format: offset for 8-bit value too large"); + uri, u"UNOIDL format: offset for 8-bit value too large"_ustr); } return get8(offset); } @@ -296,7 +296,7 @@ sal_uInt16 MappedFile::read16(sal_uInt32 offset) const { assert(size >= 8); if (offset > size - 2) { throw FileFormatException( - uri, "UNOIDL format: offset for 16-bit value too large"); + uri, u"UNOIDL format: offset for 16-bit value too large"_ustr); } return get16(offset); } @@ -305,7 +305,7 @@ sal_uInt32 MappedFile::read32(sal_uInt32 offset) const { assert(size >= 8); if (offset > size - 4) { throw FileFormatException( - uri, "UNOIDL format: offset for 32-bit value too large"); + uri, u"UNOIDL format: offset for 32-bit value too large"_ustr); } return get32(offset); } @@ -314,7 +314,7 @@ sal_uInt64 MappedFile::read64(sal_uInt32 offset) const { assert(size >= 8); if (offset > size - 8) { throw FileFormatException( - uri, "UNOIDL format: offset for 64-bit value too large"); + uri, u"UNOIDL format: offset for 64-bit value too large"_ustr); } return get64(offset); } @@ -323,7 +323,7 @@ float MappedFile::readIso60599Binary32(sal_uInt32 offset) const { assert(size >= 8); if (offset > size - 4) { throw FileFormatException( - uri, "UNOIDL format: offset for 32-bit value too large"); + uri, u"UNOIDL format: offset for 32-bit value too large"_ustr); } return getIso60599Binary32(offset); } @@ -332,7 +332,7 @@ double MappedFile::readIso60599Binary64(sal_uInt32 offset) const { assert(size >= 8); if (offset > size - 8) { throw FileFormatException( - uri, "UNOIDL format: offset for 64-bit value too large"); + uri, u"UNOIDL format: offset for 64-bit value too large"_ustr); } return getIso60599Binary64(offset); } @@ -340,20 +340,20 @@ double MappedFile::readIso60599Binary64(sal_uInt32 offset) const { OUString MappedFile::readNulName(sal_uInt32 offset) { if (offset > size) { throw FileFormatException( - uri, "UNOIDL format: offset for string too large"); + uri, u"UNOIDL format: offset for string too large"_ustr); } sal_uInt64 end = offset; for (;; ++end) { if (end == size) { throw FileFormatException( - uri, "UNOIDL format: string misses trailing NUL"); + uri, u"UNOIDL format: string misses trailing NUL"_ustr); } if (static_cast< char const * >(address)[end] == 0) { break; } } if (end - offset > SAL_MAX_INT32) { - throw FileFormatException(uri, "UNOIDL format: string too long"); + throw FileFormatException(uri, u"UNOIDL format: string too long"_ustr); } OUString name; if (!rtl_convertStringToUString( @@ -363,7 +363,7 @@ OUString MappedFile::readNulName(sal_uInt32 offset) { | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) { - throw FileFormatException(uri, "UNOIDL format: name is not ASCII"); + throw FileFormatException(uri, u"UNOIDL format: name is not ASCII"_ustr); } checkEntityName(this, name); return name; @@ -432,12 +432,12 @@ OUString MappedFile::readIdxString( len = read32(off); if ((len & 0x80000000) != 0) { throw FileFormatException( - uri, "UNOIDL format: string length high bit set"); + uri, u"UNOIDL format: string length high bit set"_ustr); } } if (len > SAL_MAX_INT32 || len > size - off - 4) { throw FileFormatException( - uri, "UNOIDL format: size of string is too large"); + uri, u"UNOIDL format: size of string is too large"_ustr); } OUString name; if (!rtl_convertStringToUString( @@ -448,7 +448,7 @@ OUString MappedFile::readIdxString( | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) { throw FileFormatException( - uri, "UNOIDL format: string bytes do not match encoding"); + uri, u"UNOIDL format: string bytes do not match encoding"_ustr); } return name; } @@ -477,7 +477,7 @@ Compare compare( sal_uInt32 off = entry->name.getUnsigned32(); if (off > file->size - 1) { // at least a trailing NUL throw FileFormatException( - file->uri, "UNOIDL format: string offset too large"); + file->uri, u"UNOIDL format: string offset too large"_ustr); } assert(nameLength >= 0); sal_uInt64 min = std::min( @@ -497,7 +497,7 @@ Compare compare( if (static_cast< sal_uInt64 >(nameLength) == min) { if (file->size - off == min) { throw FileFormatException( - file->uri, "UNOIDL format: string misses trailing NUL"); + file->uri, u"UNOIDL format: string misses trailing NUL"_ustr); } return static_cast< unsigned char const * >(file->address)[off + min] == 0 @@ -529,7 +529,7 @@ sal_uInt32 findInMap( sal_uInt32 off = mapBegin[n].data.getUnsigned32(); if (off == 0) { throw FileFormatException( - file->uri, "UNOIDL format: map entry data offset is null"); + file->uri, u"UNOIDL format: map entry data offset is null"_ustr); } return off; } @@ -704,7 +704,7 @@ public: map_.trace = std::move(trace); if (!map_.trace.insert(map_.map).second) { throw FileFormatException( - file_->uri, "UNOIDL format: recursive map"); + file_->uri, u"UNOIDL format: recursive map"_ustr); } } @@ -754,14 +754,14 @@ rtl::Reference< Entity > readEntity( sal_uInt32 n = file->read32(offset + 1); if (n > SAL_MAX_INT32) { throw FileFormatException( - file->uri, "UNOIDL format: too many items in module"); + file->uri, u"UNOIDL format: too many items in module"_ustr); } if (sal_uInt64(offset) + 5 + 8 * sal_uInt64(n) > file->size) // cannot overflow { throw FileFormatException( file->uri, - "UNOIDL format: module map offset + size too large"); + u"UNOIDL format: module map offset + size too large"_ustr); } return new UnoidlModuleEntity(file, offset + 5, n, std::move(trace)); } @@ -770,11 +770,11 @@ rtl::Reference< Entity > readEntity( sal_uInt32 n = file->read32(offset + 1); if (n == 0) { throw FileFormatException( - file->uri, "UNOIDL format: enum type with no members"); + file->uri, u"UNOIDL format: enum type with no members"_ustr); } if (n > SAL_MAX_INT32) { throw FileFormatException( - file->uri, "UNOIDL format: too many members of enum type"); + file->uri, u"UNOIDL format: too many members of enum type"_ustr); } offset += 5; std::vector< EnumTypeEntity::Member > mems; @@ -805,8 +805,8 @@ rtl::Reference< Entity > readEntity( if (base.isEmpty()) { throw FileFormatException( file->uri, - ("UNOIDL format: empty base type name of plain struct" - " type")); + (u"UNOIDL format: empty base type name of plain struct" + " type"_ustr)); } checkTypeName(file, base); } @@ -814,8 +814,8 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many direct members of plain struct" - " type")); + (u"UNOIDL format: too many direct members of plain struct" + " type"_ustr)); } offset += 4; std::vector< PlainStructTypeEntity::Member > mems; @@ -839,8 +839,8 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many type parameters of polymorphic" - " struct type template")); + (u"UNOIDL format: too many type parameters of polymorphic" + " struct type template"_ustr)); } offset += 5; std::vector< OUString > params; @@ -854,8 +854,8 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many members of polymorphic struct" - " type template")); + (u"UNOIDL format: too many members of polymorphic struct" + " type template"_ustr)); } offset += 4; std::vector< PolymorphicStructTypeTemplateEntity::Member > mems; @@ -892,8 +892,8 @@ rtl::Reference< Entity > readEntity( if (base.isEmpty()) { throw FileFormatException( file->uri, - ("UNOIDL format: empty base type name of exception" - " type")); + (u"UNOIDL format: empty base type name of exception" + " type"_ustr)); } checkTypeName(file, base); } @@ -901,7 +901,7 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - "UNOIDL format: too many direct members of exception type"); + u"UNOIDL format: too many direct members of exception type"_ustr); } offset += 4; std::vector< ExceptionTypeEntity::Member > mems; @@ -925,8 +925,8 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many direct mandatory bases of" - " interface type")); + (u"UNOIDL format: too many direct mandatory bases of" + " interface type"_ustr)); } offset += 5; std::vector< AnnotatedReference > mandBases; @@ -941,8 +941,8 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many direct optional bases of" - " interface type")); + (u"UNOIDL format: too many direct optional bases of" + " interface type"_ustr)); } offset += 4; std::vector< AnnotatedReference > optBases; @@ -957,8 +957,8 @@ rtl::Reference< Entity > readEntity( if (nAttrs > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many direct attributes of interface" - " type")); + (u"UNOIDL format: too many direct attributes of interface" + " type"_ustr)); } offset += 4; std::vector< InterfaceTypeEntity::Attribute > attrs; @@ -1018,8 +1018,8 @@ rtl::Reference< Entity > readEntity( if (nMeths > SAL_MAX_INT32 - nAttrs) { throw FileFormatException( file->uri, - ("UNOIDL format: too many direct attributes and methods of" - " interface type")); + (u"UNOIDL format: too many direct attributes and methods of" + " interface type"_ustr)); } offset += 4; std::vector< InterfaceTypeEntity::Method > meths; @@ -1107,15 +1107,15 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - "UNOIDL format: too many constants in constant group"); + u"UNOIDL format: too many constants in constant group"_ustr); } if (sal_uInt64(offset) + 5 + 8 * sal_uInt64(n) > file->size) // cannot overflow { throw FileFormatException( file->uri, - ("UNOIDL format: constant group map offset + size too" - " large")); + (u"UNOIDL format: constant group map offset + size too" + " large"_ustr)); } MapEntry const * p = reinterpret_cast< MapEntry const * >( static_cast< char const * >(file->address) + offset + 5); @@ -1148,8 +1148,8 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many constructors of" - " single-interface--based service")); + (u"UNOIDL format: too many constructors of" + " single-interface--based service"_ustr)); } offset += 4; ctors.reserve(n); @@ -1226,8 +1226,8 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many direct mandatory service bases of" - " accumulation-based service")); + (u"UNOIDL format: too many direct mandatory service bases of" + " accumulation-based service"_ustr)); } offset += 5; std::vector< AnnotatedReference > mandServs; @@ -1242,8 +1242,8 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many direct optional service bases of" - " accumulation-based service")); + (u"UNOIDL format: too many direct optional service bases of" + " accumulation-based service"_ustr)); } offset += 4; std::vector< AnnotatedReference > optServs; @@ -1258,8 +1258,8 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many direct mandatory interface bases" - " of accumulation-based service")); + (u"UNOIDL format: too many direct mandatory interface bases" + " of accumulation-based service"_ustr)); } offset += 4; std::vector< AnnotatedReference > mandIfcs; @@ -1274,8 +1274,8 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many direct optional interface bases" - " of accumulation-based service")); + (u"UNOIDL format: too many direct optional interface bases" + " of accumulation-based service"_ustr)); } offset += 4; std::vector< AnnotatedReference > optIfcs; @@ -1290,8 +1290,8 @@ rtl::Reference< Entity > readEntity( if (n > SAL_MAX_INT32) { throw FileFormatException( file->uri, - ("UNOIDL format: too many direct properties of" - " accumulation-based service")); + (u"UNOIDL format: too many direct properties of" + " accumulation-based service"_ustr)); } offset += 4; std::vector< AccumulationBasedServiceEntity::Property > props; @@ -1351,14 +1351,14 @@ UnoidlProvider::UnoidlProvider(OUString const & uri): file_(new MappedFile(uri)) { throw FileFormatException( file_->uri, - "UNOIDL format: does not begin with magic UNOIDL\\xFF and version" - " 0"); + u"UNOIDL format: does not begin with magic UNOIDL\\xFF and version" + " 0"_ustr); } sal_uInt32 off = file_->read32(8); map_.map.size = file_->read32(12); if (off + 8 * sal_uInt64(map_.map.size) > file_->size) { // cannot overflow throw FileFormatException( - file_->uri, "UNOIDL format: root map offset + size too large"); + file_->uri, u"UNOIDL format: root map offset + size too large"_ustr); } map_.map.begin = reinterpret_cast< MapEntry const * >( static_cast< char const * >(file_->address) + off); @@ -1412,13 +1412,13 @@ rtl::Reference< Entity > UnoidlProvider::findEntity(OUString const & name) const // cannot overflow { throw FileFormatException( - file_->uri, "UNOIDL format: map offset + size too large"); + file_->uri, u"UNOIDL format: map offset + size too large"_ustr); } map.map.begin = reinterpret_cast< MapEntry const * >( static_cast< char const * >(file_->address) + off + 5); if (!map.trace.insert(map.map).second) { throw FileFormatException( - file_->uri, "UNOIDL format: recursive map"); + file_->uri, u"UNOIDL format: recursive map"_ustr); } i = j + 1; } |