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
This commit is contained in:
Noel Grandin
2024-04-26 13:59:49 +02:00
parent fe0d855515
commit 59ad8d6d15
12 changed files with 252 additions and 252 deletions

View File

@@ -36,7 +36,7 @@ OString convertString(OUString const & string) {
| RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
{ {
throw CannotDumpException( throw CannotDumpException(
"Failure converting string from UTF-16 to UTF-8"); u"Failure converting string from UTF-16 to UTF-8"_ustr);
} }
return s; return s;
} }

View File

@@ -62,7 +62,7 @@ codemaker::UnoType::Sort TypeManager::getSort(
{ {
if (name.isEmpty()) { if (name.isEmpty()) {
if (cursor != nullptr) { if (cursor != nullptr) {
*cursor = manager_->createCursor(""); *cursor = manager_->createCursor(u""_ustr);
} }
return codemaker::UnoType::Sort::Module; return codemaker::UnoType::Sort::Module;
} }

View File

@@ -70,7 +70,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
} }
} }
} else { } else {
produce("", typeMgr, generated, options); produce(u""_ustr, typeMgr, generated, options);
} }
if (!options.isValid("-nD"_ostr)) { if (!options.isValid("-nD"_ostr)) {
// C++ header files generated for the following UNO types are // C++ header files generated for the following UNO types are
@@ -78,12 +78,12 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
// Reference.hxx, Type.h), so it seems best to always generate those // Reference.hxx, Type.h), so it seems best to always generate those
// C++ header files: // C++ header files:
produce( produce(
"com.sun.star.uno.RuntimeException", typeMgr, generated, u"com.sun.star.uno.RuntimeException"_ustr, typeMgr, generated,
options); options);
produce( produce(
"com.sun.star.uno.TypeClass", typeMgr, generated, options); u"com.sun.star.uno.TypeClass"_ustr, typeMgr, generated, options);
produce( produce(
"com.sun.star.uno.XInterface", typeMgr, generated, options); u"com.sun.star.uno.XInterface"_ustr, typeMgr, generated, options);
} }
} catch (CannotDumpException & e) { } catch (CannotDumpException & e) {
std::cerr << "ERROR: " << e.getMessage() << '\n'; std::cerr << "ERROR: " << e.getMessage() << '\n';

View File

@@ -419,7 +419,7 @@ void CppuType::dump(CppuOptions const & options)
m_cppuTypeDynamic = false; m_cppuTypeDynamic = false;
} }
dumpFiles( dumpFiles(
options.isValid("-O"_ostr) ? b2u(options.getOption("-O"_ostr)) : "", options); options.isValid("-O"_ostr) ? b2u(options.getOption("-O"_ostr)) : u""_ustr, options);
} }
void CppuType::dumpFile( void CppuType::dumpFile(
@@ -670,86 +670,86 @@ OUString CppuType::getTypeClass(OUString const & name, bool cStyle)
switch (m_typeMgr->getSort(name, &ent)) { switch (m_typeMgr->getSort(name, &ent)) {
case codemaker::UnoType::Sort::Void: case codemaker::UnoType::Sort::Void:
return cStyle return cStyle
? OUString("typelib_TypeClass_VOID") ? u"typelib_TypeClass_VOID"_ustr
: OUString("::css::uno::TypeClass_VOID"); : u"::css::uno::TypeClass_VOID"_ustr;
case codemaker::UnoType::Sort::Boolean: case codemaker::UnoType::Sort::Boolean:
return cStyle return cStyle
? OUString("typelib_TypeClass_BOOLEAN") ? u"typelib_TypeClass_BOOLEAN"_ustr
: OUString("::css::uno::TypeClass_BOOLEAN"); : u"::css::uno::TypeClass_BOOLEAN"_ustr;
case codemaker::UnoType::Sort::Byte: case codemaker::UnoType::Sort::Byte:
return cStyle return cStyle
? OUString("typelib_TypeClass_BYTE") ? u"typelib_TypeClass_BYTE"_ustr
: OUString("::css::uno::TypeClass_BYTE"); : u"::css::uno::TypeClass_BYTE"_ustr;
case codemaker::UnoType::Sort::Short: case codemaker::UnoType::Sort::Short:
return cStyle return cStyle
? OUString("typelib_TypeClass_SHORT") ? u"typelib_TypeClass_SHORT"_ustr
: OUString("::css::uno::TypeClass_SHORT"); : u"::css::uno::TypeClass_SHORT"_ustr;
case codemaker::UnoType::Sort::UnsignedShort: case codemaker::UnoType::Sort::UnsignedShort:
return cStyle return cStyle
? OUString("typelib_TypeClass_UNSIGNED_SHORT") ? u"typelib_TypeClass_UNSIGNED_SHORT"_ustr
: OUString("::css::uno::TypeClass_UNSIGNED_SHORT"); : u"::css::uno::TypeClass_UNSIGNED_SHORT"_ustr;
case codemaker::UnoType::Sort::Long: case codemaker::UnoType::Sort::Long:
return cStyle return cStyle
? OUString("typelib_TypeClass_LONG") ? u"typelib_TypeClass_LONG"_ustr
: OUString("::css::uno::TypeClass_LONG"); : u"::css::uno::TypeClass_LONG"_ustr;
case codemaker::UnoType::Sort::UnsignedLong: case codemaker::UnoType::Sort::UnsignedLong:
return cStyle return cStyle
? OUString("typelib_TypeClass_UNSIGNED_LONG") ? u"typelib_TypeClass_UNSIGNED_LONG"_ustr
: OUString("::css::uno::TypeClass_UNSIGNED_LONG"); : u"::css::uno::TypeClass_UNSIGNED_LONG"_ustr;
case codemaker::UnoType::Sort::Hyper: case codemaker::UnoType::Sort::Hyper:
return cStyle return cStyle
? OUString("typelib_TypeClass_HYPER") ? u"typelib_TypeClass_HYPER"_ustr
: OUString("::css::uno::TypeClass_HYPER"); : u"::css::uno::TypeClass_HYPER"_ustr;
case codemaker::UnoType::Sort::UnsignedHyper: case codemaker::UnoType::Sort::UnsignedHyper:
return cStyle return cStyle
? OUString("typelib_TypeClass_UNSIGNED_HYPER") ? u"typelib_TypeClass_UNSIGNED_HYPER"_ustr
: OUString("::css::uno::TypeClass_UNSIGNED_HYPER"); : u"::css::uno::TypeClass_UNSIGNED_HYPER"_ustr;
case codemaker::UnoType::Sort::Float: case codemaker::UnoType::Sort::Float:
return cStyle return cStyle
? OUString("typelib_TypeClass_FLOAT") ? u"typelib_TypeClass_FLOAT"_ustr
: OUString("::css::uno::TypeClass_FLOAT"); : u"::css::uno::TypeClass_FLOAT"_ustr;
case codemaker::UnoType::Sort::Double: case codemaker::UnoType::Sort::Double:
return cStyle return cStyle
? OUString("typelib_TypeClass_DOUBLE") ? u"typelib_TypeClass_DOUBLE"_ustr
: OUString("::css::uno::TypeClass_DOUBLE"); : u"::css::uno::TypeClass_DOUBLE"_ustr;
case codemaker::UnoType::Sort::Char: case codemaker::UnoType::Sort::Char:
return cStyle return cStyle
? OUString("typelib_TypeClass_CHAR") ? u"typelib_TypeClass_CHAR"_ustr
: OUString("::css::uno::TypeClass_CHAR"); : u"::css::uno::TypeClass_CHAR"_ustr;
case codemaker::UnoType::Sort::String: case codemaker::UnoType::Sort::String:
return cStyle return cStyle
? OUString("typelib_TypeClass_STRING") ? u"typelib_TypeClass_STRING"_ustr
: OUString("::css::uno::TypeClass_STRING"); : u"::css::uno::TypeClass_STRING"_ustr;
case codemaker::UnoType::Sort::Type: case codemaker::UnoType::Sort::Type:
return cStyle return cStyle
? OUString("typelib_TypeClass_TYPE") ? u"typelib_TypeClass_TYPE"_ustr
: OUString("::css::uno::TypeClass_TYPE"); : u"::css::uno::TypeClass_TYPE"_ustr;
case codemaker::UnoType::Sort::Any: case codemaker::UnoType::Sort::Any:
return cStyle return cStyle
? OUString("typelib_TypeClass_ANY") ? u"typelib_TypeClass_ANY"_ustr
: OUString("::css::uno::TypeClass_ANY"); : u"::css::uno::TypeClass_ANY"_ustr;
case codemaker::UnoType::Sort::Sequence: case codemaker::UnoType::Sort::Sequence:
return cStyle return cStyle
? OUString("typelib_TypeClass_SEQUENCE") ? u"typelib_TypeClass_SEQUENCE"_ustr
: OUString("::css::uno::TypeClass_SEQUENCE"); : u"::css::uno::TypeClass_SEQUENCE"_ustr;
case codemaker::UnoType::Sort::Enum: case codemaker::UnoType::Sort::Enum:
return cStyle return cStyle
? OUString("typelib_TypeClass_ENUM") ? u"typelib_TypeClass_ENUM"_ustr
: OUString("::css::uno::TypeClass_ENUM"); : u"::css::uno::TypeClass_ENUM"_ustr;
case codemaker::UnoType::Sort::PlainStruct: case codemaker::UnoType::Sort::PlainStruct:
case codemaker::UnoType::Sort::PolymorphicStructTemplate: case codemaker::UnoType::Sort::PolymorphicStructTemplate:
case codemaker::UnoType::Sort::InstantiatedPolymorphicStruct: case codemaker::UnoType::Sort::InstantiatedPolymorphicStruct:
return cStyle return cStyle
? OUString("typelib_TypeClass_STRUCT") ? u"typelib_TypeClass_STRUCT"_ustr
: OUString("::css::uno::TypeClass_STRUCT"); : u"::css::uno::TypeClass_STRUCT"_ustr;
case codemaker::UnoType::Sort::Exception: case codemaker::UnoType::Sort::Exception:
return cStyle return cStyle
? OUString("typelib_TypeClass_EXCEPTION") ? u"typelib_TypeClass_EXCEPTION"_ustr
: OUString("::css::uno::TypeClass_EXCEPTION"); : u"::css::uno::TypeClass_EXCEPTION"_ustr;
case codemaker::UnoType::Sort::Interface: case codemaker::UnoType::Sort::Interface:
return cStyle return cStyle
? OUString("typelib_TypeClass_INTERFACE") ? u"typelib_TypeClass_INTERFACE"_ustr
: OUString("::css::uno::TypeClass_INTERFACE"); : u"::css::uno::TypeClass_INTERFACE"_ustr;
case codemaker::UnoType::Sort::Typedef: case codemaker::UnoType::Sort::Typedef:
return getTypeClass(dynamic_cast<unoidl::TypedefEntity&>(*ent).getType(), cStyle); return getTypeClass(dynamic_cast<unoidl::TypedefEntity&>(*ent).getType(), cStyle);
default: default:
@@ -1397,7 +1397,7 @@ void InterfaceType::dumpComprehensiveGetCppuType(FileStream & out)
<< indent() << "bInitStarted = true;\n"; << indent() << "bInitStarted = true;\n";
std::set< OUString > seen; std::set< OUString > seen;
// Type for RuntimeException is always needed: // Type for RuntimeException is always needed:
seen.insert("com.sun.star.uno.RuntimeException"); seen.insert(u"com.sun.star.uno.RuntimeException"_ustr);
dumpCppuGetType(out, u"com.sun.star.uno.RuntimeException"); dumpCppuGetType(out, u"com.sun.star.uno.RuntimeException");
dumpAttributesCppuDecl(out, &seen); dumpAttributesCppuDecl(out, &seen);
dumpMethodsCppuDecl(out, &seen); dumpMethodsCppuDecl(out, &seen);
@@ -2818,21 +2818,21 @@ void ExceptionType::dumpHdlFile(
{ {
if (name_ == "com.sun.star.uno.Exception") if (name_ == "com.sun.star.uno.Exception")
{ {
includes.addCustom("#if defined(LIBO_INTERNAL_ONLY)"); includes.addCustom(u"#if defined(LIBO_INTERNAL_ONLY)"_ustr);
includes.addCustom("#if __has_include(<version>)"); includes.addCustom(u"#if __has_include(<version>)"_ustr);
includes.addCustom("#include <version>"); includes.addCustom(u"#include <version>"_ustr);
includes.addCustom("#endif"); includes.addCustom(u"#endif"_ustr);
includes.addCustom("#if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907"); includes.addCustom(u"#if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907"_ustr);
includes.addCustom("#include <source_location>"); includes.addCustom(u"#include <source_location>"_ustr);
includes.addCustom("#define LIBO_USE_SOURCE_LOCATION std"); includes.addCustom(u"#define LIBO_USE_SOURCE_LOCATION std"_ustr);
includes.addCustom("#elif __has_include(<experimental/source_location>)"); includes.addCustom(u"#elif __has_include(<experimental/source_location>)"_ustr);
includes.addCustom("#include <experimental/source_location>"); includes.addCustom(u"#include <experimental/source_location>"_ustr);
includes.addCustom("#define LIBO_USE_SOURCE_LOCATION std::experimental"); includes.addCustom(u"#define LIBO_USE_SOURCE_LOCATION std::experimental"_ustr);
includes.addCustom("#endif"); includes.addCustom(u"#endif"_ustr);
includes.addCustom("#endif"); includes.addCustom(u"#endif"_ustr);
includes.addCustom("#if defined LIBO_USE_SOURCE_LOCATION"); includes.addCustom(u"#if defined LIBO_USE_SOURCE_LOCATION"_ustr);
includes.addCustom("#include <o3tl/runtimetooustring.hxx>"); includes.addCustom(u"#include <o3tl/runtimetooustring.hxx>"_ustr);
includes.addCustom("#endif"); includes.addCustom(u"#endif"_ustr);
} }
dumpHFileContent(out, includes); dumpHFileContent(out, includes);
} }

View File

@@ -73,7 +73,7 @@ void appendStream(
void write(FileStream & file, void const * buffer, sal_uInt64 size) { void write(FileStream & file, void const * buffer, sal_uInt64 size) {
if (!file.write(buffer, size)) if (!file.write(buffer, size))
throw CannotDumpException("Error writing file"); throw CannotDumpException(u"Error writing file"_ustr);
} }
void writeU2(FileStream & file, sal_uInt16 data) { void writeU2(FileStream & file, sal_uInt16 data) {
@@ -234,7 +234,7 @@ void ClassFile::Code::instrLookupswitch(
// <match--offset pairs...>: // <match--offset pairs...>:
std::vector< std::pair< sal_Int32, Code * > >::size_type size = blocks.size(); std::vector< std::pair< sal_Int32, Code * > >::size_type size = blocks.size();
if (size > SAL_MAX_INT32) { if (size > SAL_MAX_INT32) {
throw CannotDumpException("Lookup-switch too large for Java class file format"); throw CannotDumpException(u"Lookup-switch too large for Java class file format"_ustr);
} }
Position pos1 = m_code.size(); Position pos1 = m_code.size();
appendU1(m_code, 0xAB); appendU1(m_code, 0xAB);
@@ -408,7 +408,7 @@ void ClassFile::Code::addException(
{ {
OSL_ASSERT(start < end && end <= m_code.size() && handler <= m_code.size()); OSL_ASSERT(start < end && end <= m_code.size() && handler <= m_code.size());
if (m_exceptionTableLength == SAL_MAX_UINT16) { if (m_exceptionTableLength == SAL_MAX_UINT16) {
throw CannotDumpException("Too many exception handlers for Java class file format"); throw CannotDumpException(u"Too many exception handlers for Java class file format"_ustr);
} }
++m_exceptionTableLength; ++m_exceptionTableLength;
appendU2(m_exceptionTable, static_cast< sal_uInt16 >(start)); appendU2(m_exceptionTable, static_cast< sal_uInt16 >(start));
@@ -549,7 +549,7 @@ sal_uInt16 ClassFile::addDoubleInfo(double value) {
void ClassFile::addInterface(OString const & interface) { void ClassFile::addInterface(OString const & interface) {
if (m_interfacesCount == SAL_MAX_UINT16) { if (m_interfacesCount == SAL_MAX_UINT16) {
throw CannotDumpException("Too many interfaces for Java class file format"); throw CannotDumpException(u"Too many interfaces for Java class file format"_ustr);
} }
++m_interfacesCount; ++m_interfacesCount;
appendU2(m_interfaces, addClassInfo(interface)); appendU2(m_interfaces, addClassInfo(interface));
@@ -561,7 +561,7 @@ void ClassFile::addField(
OString const & signature) OString const & signature)
{ {
if (m_fieldsCount == SAL_MAX_UINT16) { if (m_fieldsCount == SAL_MAX_UINT16) {
throw CannotDumpException("Too many fields for Java class file format"); throw CannotDumpException(u"Too many fields for Java class file format"_ustr);
} }
++m_fieldsCount; ++m_fieldsCount;
appendU2(m_fields, static_cast< sal_uInt16 >(accessFlags)); appendU2(m_fields, static_cast< sal_uInt16 >(accessFlags));
@@ -586,7 +586,7 @@ void ClassFile::addMethod(
OString const & signature) OString const & signature)
{ {
if (m_methodsCount == SAL_MAX_UINT16) { if (m_methodsCount == SAL_MAX_UINT16) {
throw CannotDumpException("Too many methods for Java class file format"); throw CannotDumpException(u"Too many methods for Java class file format"_ustr);
} }
++m_methodsCount; ++m_methodsCount;
appendU2(m_methods, static_cast< sal_uInt16 >(accessFlags)); appendU2(m_methods, static_cast< sal_uInt16 >(accessFlags));
@@ -594,7 +594,7 @@ void ClassFile::addMethod(
appendU2(m_methods, addUtf8Info(descriptor)); appendU2(m_methods, addUtf8Info(descriptor));
std::vector< OString >::size_type excs = exceptions.size(); std::vector< OString >::size_type excs = exceptions.size();
if (excs > SAL_MAX_UINT16) { if (excs > SAL_MAX_UINT16) {
throw CannotDumpException("Too many exception specifications for Java class file format"); throw CannotDumpException(u"Too many exception specifications for Java class file format"_ustr);
} }
appendU2( appendU2(
m_methods, m_methods,
@@ -609,7 +609,7 @@ void ClassFile::addMethod(
> (SAL_MAX_UINT32 - (2 + 2 + 4 + 2 + 2) > (SAL_MAX_UINT32 - (2 + 2 + 4 + 2 + 2)
- static_cast< sal_uInt32 >(codeSize)))) - static_cast< sal_uInt32 >(codeSize))))
{ {
throw CannotDumpException("Code block is too big for Java class file format"); throw CannotDumpException(u"Code block is too big for Java class file format"_ustr);
} }
appendU2(m_methods, addUtf8Info("Code"_ostr)); appendU2(m_methods, addUtf8Info("Code"_ostr));
appendU4( appendU4(
@@ -660,7 +660,7 @@ void ClassFile::write(FileStream & file) const {
sal_uInt16 ClassFile::nextConstantPoolIndex(sal_uInt16 width) { sal_uInt16 ClassFile::nextConstantPoolIndex(sal_uInt16 width) {
OSL_ASSERT(width == 1 || width == 2); OSL_ASSERT(width == 1 || width == 2);
if (m_constantPoolCount > SAL_MAX_UINT16 - width) { if (m_constantPoolCount > SAL_MAX_UINT16 - width) {
throw CannotDumpException("Too many constant pool items for Java class file format"); throw CannotDumpException(u"Too many constant pool items for Java class file format"_ustr);
} }
sal_uInt16 index = m_constantPoolCount; sal_uInt16 index = m_constantPoolCount;
m_constantPoolCount = m_constantPoolCount + width; m_constantPoolCount = m_constantPoolCount + width;
@@ -673,7 +673,7 @@ sal_uInt16 ClassFile::addUtf8Info(OString const & value) {
return i->second; return i->second;
} }
if (value.getLength() > SAL_MAX_UINT16) { if (value.getLength() > SAL_MAX_UINT16) {
throw CannotDumpException("UTF-8 string too long for Java class file format"); throw CannotDumpException(u"UTF-8 string too long for Java class file format"_ustr);
} }
sal_uInt16 index = nextConstantPoolIndex(1); sal_uInt16 index = nextConstantPoolIndex(1);
appendU1(m_constantPool, 1); appendU1(m_constantPool, 1);

View File

@@ -70,7 +70,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
} }
} }
} else { } else {
produce("", typeMgr, generated, options); produce(u""_ustr, typeMgr, generated, options);
} }
} }
catch (CannotDumpException & e) { catch (CannotDumpException & e) {

View File

@@ -153,7 +153,7 @@ SpecialType translateUnoTypeToDescriptor(
!= codemaker::UnoType::Sort::InstantiatedPolymorphicStruct)); != codemaker::UnoType::Sort::InstantiatedPolymorphicStruct));
if (rank > 0xFF - (array ? 1 : 0)) { if (rank > 0xFF - (array ? 1 : 0)) {
throw CannotDumpException( throw CannotDumpException(
"Too many array dimensions for Java class file format"); u"Too many array dimensions for Java class file format"_ustr);
} }
if (array) { if (array) {
++rank; ++rank;
@@ -592,7 +592,7 @@ void TypeInfo::generatePolymorphicUnoTypeCode(
"com/sun/star/uno/TypeClass"_ostr, "SEQUENCE"_ostr, "com/sun/star/uno/TypeClass"_ostr, "SEQUENCE"_ostr,
"Lcom/sun/star/uno/TypeClass;"_ostr); "Lcom/sun/star/uno/TypeClass;"_ostr);
} }
dependencies->insert("com.sun.star.uno.TypeClass"); dependencies->insert(u"com.sun.star.uno.TypeClass"_ustr);
code.instrInvokespecial( code.instrInvokespecial(
"com/sun/star/uno/Type"_ostr, "<init>"_ostr, "com/sun/star/uno/Type"_ostr, "<init>"_ostr,
"(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"_ostr); "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"_ostr);
@@ -648,7 +648,7 @@ void addTypeInfo(
std::vector< TypeInfo >::size_type typeInfos = typeInfo.size(); std::vector< TypeInfo >::size_type typeInfos = typeInfo.size();
if (typeInfos > SAL_MAX_INT32) { if (typeInfos > SAL_MAX_INT32) {
throw CannotDumpException( throw CannotDumpException(
"UNOTYPEINFO array too big for Java class file format"); u"UNOTYPEINFO array too big for Java class file format"_ustr);
} }
if (typeInfos == 0) if (typeInfos == 0)
return; return;
@@ -677,7 +677,7 @@ void addTypeInfo(
code->instrReturn(); code->instrReturn();
if (stack > SAL_MAX_UINT16 - 4) { if (stack > SAL_MAX_UINT16 - 4) {
throw CannotDumpException( throw CannotDumpException(
"Stack too big for Java class file format"); u"Stack too big for Java class file format"_ustr);
} }
code->setMaxStackAndLocals(static_cast< sal_uInt16 >(stack + 4), 0); code->setMaxStackAndLocals(static_cast< sal_uInt16 >(stack + 4), 0);
classFile->addMethod( classFile->addMethod(
@@ -1194,7 +1194,7 @@ sal_uInt16 addLoadLocal(
code->instrGetstatic( code->instrGetstatic(
"com/sun/star/uno/TypeClass"_ostr, "STRUCT"_ostr, "com/sun/star/uno/TypeClass"_ostr, "STRUCT"_ostr,
"Lcom/sun/star/uno/TypeClass;"_ostr); "Lcom/sun/star/uno/TypeClass;"_ostr);
dependencies->insert("com.sun.star.uno.TypeClass"); dependencies->insert(u"com.sun.star.uno.TypeClass"_ustr);
code->instrInvokespecial( code->instrInvokespecial(
"com/sun/star/uno/Type"_ostr, "<init>"_ostr, "com/sun/star/uno/Type"_ostr, "<init>"_ostr,
"(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"_ostr); "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"_ostr);
@@ -1219,7 +1219,7 @@ sal_uInt16 addLoadLocal(
code->instrGetstatic( code->instrGetstatic(
"com/sun/star/uno/TypeClass"_ostr, "INTERFACE"_ostr, "com/sun/star/uno/TypeClass"_ostr, "INTERFACE"_ostr,
"Lcom/sun/star/uno/TypeClass;"_ostr); "Lcom/sun/star/uno/TypeClass;"_ostr);
dependencies->insert("com.sun.star.uno.TypeClass"); dependencies->insert(u"com.sun.star.uno.TypeClass"_ustr);
code->instrInvokespecial( code->instrInvokespecial(
"com/sun/star/uno/Type"_ostr, "<init>"_ostr, "com/sun/star/uno/Type"_ostr, "<init>"_ostr,
"(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"_ostr); "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"_ostr);
@@ -1305,7 +1305,7 @@ sal_uInt16 addLoadLocal(
} }
if (*index > SAL_MAX_UINT16 - size) { if (*index > SAL_MAX_UINT16 - size) {
throw CannotDumpException( throw CannotDumpException(
"Too many local variables for Java class file format"); u"Too many local variables for Java class file format"_ustr);
} }
*index = *index + size; *index = *index + size;
return stack; return stack;
@@ -1455,7 +1455,7 @@ void handlePolyStructType(
sig.append(codemaker::convertString(param) + ":Ljava/lang/Object;"); sig.append(codemaker::convertString(param) + ":Ljava/lang/Object;");
if (!typeParameters.emplace(param, index++).second) if (!typeParameters.emplace(param, index++).second)
{ {
throw CannotDumpException("Bad type information"); //TODO throw CannotDumpException(u"Bad type information"_ustr); //TODO
} }
} }
sig.append(">Ljava/lang/Object;"); sig.append(">Ljava/lang/Object;");
@@ -1473,7 +1473,7 @@ void handlePolyStructType(
std::map< OUString, sal_Int32 >::iterator it( std::map< OUString, sal_Int32 >::iterator it(
typeParameters.find(member.type)); typeParameters.find(member.type));
if (it == typeParameters.end()) { if (it == typeParameters.end()) {
throw CannotDumpException("Bad type information"); //TODO throw CannotDumpException(u"Bad type information"_ustr); //TODO
} }
typeParameterIndex = it->second; typeParameterIndex = it->second;
} else { } else {
@@ -1593,7 +1593,7 @@ void handleExceptionType(
if (baseRuntimeException) { if (baseRuntimeException) {
addField( addField(
manager, dependencies, cf.get(), &typeInfo, -1, manager, dependencies, cf.get(), &typeInfo, -1,
"com.sun.star.uno.XInterface", "Context", index++); u"com.sun.star.uno.XInterface"_ustr, u"Context"_ustr, index++);
} }
for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
entity->getDirectMembers().begin()); entity->getDirectMembers().begin());
@@ -1615,7 +1615,7 @@ void handleExceptionType(
stack = std::max( stack = std::max(
stack, stack,
addFieldInit( addFieldInit(
manager, className, "Context", false, manager, className, u"Context"_ustr, false,
u"com.sun.star.uno.XInterface", dependencies, code.get())); u"com.sun.star.uno.XInterface", dependencies, code.get()));
} }
for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
@@ -1647,7 +1647,7 @@ void handleExceptionType(
stack = std::max( stack = std::max(
stack, stack,
addFieldInit( addFieldInit(
manager, className, "Context", false, manager, className, u"Context"_ustr, false,
u"com.sun.star.uno.XInterface", dependencies, code.get())); u"com.sun.star.uno.XInterface", dependencies, code.get()));
} }
for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
@@ -1685,7 +1685,7 @@ void handleExceptionType(
stack = std::max( stack = std::max(
stack, stack,
addFieldInit( addFieldInit(
manager, className, "Context", false, manager, className, u"Context"_ustr, false,
u"com.sun.star.uno.XInterface", dependencies, code.get())); u"com.sun.star.uno.XInterface", dependencies, code.get()));
} }
for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
@@ -1716,7 +1716,7 @@ void handleExceptionType(
stack = std::max( stack = std::max(
stack, stack,
addFieldInit( addFieldInit(
manager, className, "Context", false, manager, className, u"Context"_ustr, false,
u"com.sun.star.uno.XInterface", dependencies, code.get())); u"com.sun.star.uno.XInterface", dependencies, code.get()));
} }
for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
@@ -1757,7 +1757,7 @@ void handleExceptionType(
maxSize, maxSize,
addDirectArgument( addDirectArgument(
manager, dependencies, &desc1, code.get(), &index2, className, manager, dependencies, &desc1, code.get(), &index2, className,
"Context"_ostr, false, "com.sun.star.uno.XInterface")); "Context"_ostr, false, u"com.sun.star.uno.XInterface"_ustr));
} }
for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
entity->getDirectMembers().begin()); entity->getDirectMembers().begin());
@@ -1804,7 +1804,7 @@ void handleExceptionType(
maxSize2, maxSize2,
addDirectArgument( addDirectArgument(
manager, dependencies, &desc2, code.get(), &index3, className, manager, dependencies, &desc2, code.get(), &index3, className,
"Context"_ostr, false, "com.sun.star.uno.XInterface")); "Context"_ostr, false, u"com.sun.star.uno.XInterface"_ustr));
} }
for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
entity->getDirectMembers().begin()); entity->getDirectMembers().begin());
@@ -2220,7 +2220,7 @@ void addConstructor(
&tree.getRoot(), tryStart, tryEnd, pos2, code.get()); &tree.getRoot(), tryStart, tryEnd, pos2, code.get());
code->addException( code->addException(
tryStart, tryEnd, pos1, "com/sun/star/uno/Exception"_ostr); tryStart, tryEnd, pos1, "com/sun/star/uno/Exception"_ostr);
dependencies->insert("com.sun.star.uno.Exception"); dependencies->insert(u"com.sun.star.uno.Exception"_ustr);
stack = std::max< sal_uInt16 >(stack, 4); stack = std::max< sal_uInt16 >(stack, 4);
} }
code->setMaxStackAndLocals(stack, localIndex); code->setMaxStackAndLocals(stack, localIndex);
@@ -2254,10 +2254,10 @@ void handleService(
OString realJavaBaseName( OString realJavaBaseName(
codemaker::convertString(entity->getBase())); codemaker::convertString(entity->getBase()));
dependencies->insert(entity->getBase()); dependencies->insert(entity->getBase());
dependencies->insert("com.sun.star.lang.XMultiComponentFactory"); dependencies->insert(u"com.sun.star.lang.XMultiComponentFactory"_ustr);
dependencies->insert("com.sun.star.uno.DeploymentException"); dependencies->insert(u"com.sun.star.uno.DeploymentException"_ustr);
dependencies->insert("com.sun.star.uno.TypeClass"); dependencies->insert(u"com.sun.star.uno.TypeClass"_ustr);
dependencies->insert("com.sun.star.uno.XComponentContext"); dependencies->insert(u"com.sun.star.uno.XComponentContext"_ustr);
for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor& cons : for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor& cons :
entity->getConstructors()) entity->getConstructors())
{ {
@@ -2340,9 +2340,9 @@ void handleSingleton(
OString unoName(codemaker::convertString(name)); OString unoName(codemaker::convertString(name));
OString className( OString className(
translateUnoidlEntityNameToJavaFullyQualifiedName(name, "singleton")); translateUnoidlEntityNameToJavaFullyQualifiedName(name, "singleton"));
dependencies->insert("com.sun.star.uno.DeploymentException"); dependencies->insert(u"com.sun.star.uno.DeploymentException"_ustr);
dependencies->insert("com.sun.star.uno.TypeClass"); dependencies->insert(u"com.sun.star.uno.TypeClass"_ustr);
dependencies->insert("com.sun.star.uno.XComponentContext"); dependencies->insert(u"com.sun.star.uno.XComponentContext"_ustr);
std::unique_ptr< ClassFile > cf( std::unique_ptr< ClassFile > cf(
new ClassFile( new ClassFile(
static_cast< ClassFile::AccessFlags >( static_cast< ClassFile::AccessFlags >(

View File

@@ -31,7 +31,7 @@ std::vector< OUString > translateAnnotations(std::u16string_view documentation)
std::vector< OUString > ans; std::vector< OUString > ans;
if (documentation.find(u"@deprecated") != std::u16string_view::npos) { if (documentation.find(u"@deprecated") != std::u16string_view::npos) {
//TODO: this check is somewhat crude //TODO: this check is somewhat crude
ans.push_back("deprecated"); ans.push_back(u"deprecated"_ustr);
} }
return ans; return ans;
} }
@@ -104,7 +104,7 @@ Cursor::Cursor(
if (!prefix_.endsWith("/")) { if (!prefix_.endsWith("/")) {
prefix_ += "/"; prefix_ += "/";
} }
RegError e = key_.getKeyNames("", names_); RegError e = key_.getKeyNames(u""_ustr, names_);
if (e != RegError::NO_ERROR) { if (e != RegError::NO_ERROR) {
throw FileFormatException( throw FileFormatException(
key_.getRegistryName(), key_.getRegistryName(),
@@ -150,7 +150,7 @@ private:
std::vector< OUString > Module::getMemberNames() const { std::vector< OUString > Module::getMemberNames() const {
RegistryKeyNames names; RegistryKeyNames names;
RegError e = key_.getKeyNames("", names); RegError e = key_.getKeyNames(u""_ustr, names);
if (e != RegError::NO_ERROR) { if (e != RegError::NO_ERROR) {
throw FileFormatException( throw FileFormatException(
key_.getRegistryName(), key_.getRegistryName(),
@@ -168,7 +168,7 @@ typereg::Reader getReader(RegistryKey & key, std::vector< char > * buffer) {
assert(buffer != nullptr); assert(buffer != nullptr);
RegValueType type; RegValueType type;
sal_uInt32 size; sal_uInt32 size;
RegError e = key.getValueInfo("", &type, &size); RegError e = key.getValueInfo(u""_ustr, &type, &size);
if (e != RegError::NO_ERROR) { if (e != RegError::NO_ERROR) {
throw FileFormatException( throw FileFormatException(
key.getRegistryName(), key.getRegistryName(),
@@ -190,7 +190,7 @@ typereg::Reader getReader(RegistryKey & key, std::vector< char > * buffer) {
+ " of key " + key.getName())); + " of key " + key.getName()));
} }
buffer->resize(static_cast< std::vector< char >::size_type >(size)); 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) { if (e != RegError::NO_ERROR) {
throw FileFormatException( throw FileFormatException(
key.getRegistryName(), key.getRegistryName(),
@@ -799,7 +799,7 @@ LegacyProvider::LegacyProvider(Manager & manager, OUString const & uri):
throw FileFormatException( throw FileFormatException(
uri, "legacy format: cannot open root key: " + OUString::number(static_cast<int>(e))); 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) { switch (e) {
case RegError::NO_ERROR: case RegError::NO_ERROR:
case RegError::KEY_NOT_EXISTS: // such effectively empty files exist in the wild case RegError::KEY_NOT_EXISTS: // such effectively empty files exist in the wild

View File

@@ -84,27 +84,27 @@ void error(YYLTYPE location, yyscan_t yyscanner, OUString const & message) {
OUString flagName(unoidl::detail::SourceProviderFlags flag) { OUString flagName(unoidl::detail::SourceProviderFlags flag) {
switch (flag) { switch (flag) {
case unoidl::detail::FLAG_ATTRIBUTE: case unoidl::detail::FLAG_ATTRIBUTE:
return "attribute"; return u"attribute"_ustr;
case unoidl::detail::FLAG_BOUND: case unoidl::detail::FLAG_BOUND:
return "bound"; return u"bound"_ustr;
case unoidl::detail::FLAG_CONSTRAINED: case unoidl::detail::FLAG_CONSTRAINED:
return "constrained"; return u"constrained"_ustr;
case unoidl::detail::FLAG_MAYBEAMBIGUOUS: case unoidl::detail::FLAG_MAYBEAMBIGUOUS:
return "maybeambiguous"; return u"maybeambiguous"_ustr;
case unoidl::detail::FLAG_MAYBEDEFAULT: case unoidl::detail::FLAG_MAYBEDEFAULT:
return "maybedefault"; return u"maybedefault"_ustr;
case unoidl::detail::FLAG_MAYBEVOID: case unoidl::detail::FLAG_MAYBEVOID:
return "maybevoid"; return u"maybevoid"_ustr;
case unoidl::detail::FLAG_OPTIONAL: case unoidl::detail::FLAG_OPTIONAL:
return "optional"; return u"optional"_ustr;
case unoidl::detail::FLAG_PROPERTY: case unoidl::detail::FLAG_PROPERTY:
return "property"; return u"property"_ustr;
case unoidl::detail::FLAG_READONLY: case unoidl::detail::FLAG_READONLY:
return "readonly"; return u"readonly"_ustr;
case unoidl::detail::FLAG_REMOVABLE: case unoidl::detail::FLAG_REMOVABLE:
return "removable"; return u"removable"_ustr;
case unoidl::detail::FLAG_TRANSIENT: case unoidl::detail::FLAG_TRANSIENT:
return "transient"; return u"transient"_ustr;
default: default:
assert(false && "this cannot happen"); for (;;) { std::abort(); } assert(false && "this cannot happen"); for (;;) { std::abort(); }
} }
@@ -267,7 +267,7 @@ bool coerce(
break; break;
} }
if (!ok) { if (!ok) {
error(location, yyscanner, "cannot coerce binary expression arguments"); error(location, yyscanner, u"cannot coerce binary expression arguments"_ustr);
} }
return ok; return ok;
} }
@@ -835,7 +835,7 @@ bool checkTypeArgument(
case unoidl::detail::SourceProviderType::TYPE_PARAMETER: //TODO? case unoidl::detail::SourceProviderType::TYPE_PARAMETER: //TODO?
error( error(
location, yyscanner, location, yyscanner,
"bad instantiated polymorphic struct type argument"); u"bad instantiated polymorphic struct type argument"_ustr);
return false; return false;
case unoidl::detail::SourceProviderType::TYPE_SEQUENCE: case unoidl::detail::SourceProviderType::TYPE_SEQUENCE:
return checkTypeArgument(location, yyscanner, type.subtypes.front()); return checkTypeArgument(location, yyscanner, type.subtypes.front());
@@ -864,7 +864,7 @@ bool checkInstantiatedPolymorphicStructTypeArgument(
std::vector<OUString> annotations(bool deprecated) { std::vector<OUString> annotations(bool deprecated) {
std::vector<OUString> ann; std::vector<OUString> ann;
if (deprecated) { if (deprecated) {
ann.push_back("deprecated"); ann.push_back(u"deprecated"_ustr);
} }
return ann; return ann;
} }
@@ -1574,7 +1574,7 @@ interfaceDefn:
if (pad->directMandatoryBases.empty() if (pad->directMandatoryBases.empty()
&& data->currentName != "com.sun.star.uno.XInterface") && 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; unoidl::detail::SourceProviderEntity const * p;
if (findEntity(@4, yyscanner, data, true, &base, &p, nullptr, nullptr) if (findEntity(@4, yyscanner, data, true, &base, &p, nullptr, nullptr)
== FOUND_ERROR) == FOUND_ERROR)
@@ -1641,13 +1641,13 @@ interfaceBase:
if (pad->singleBase) { if (pad->singleBase) {
error( error(
@3, yyscanner, @3, yyscanner,
"single-inheritance interface cannot have additional bases"); u"single-inheritance interface cannot have additional bases"_ustr);
YYERROR; YYERROR;
} }
if (($2 & ~unoidl::detail::FLAG_OPTIONAL) != 0) { if (($2 & ~unoidl::detail::FLAG_OPTIONAL) != 0) {
error( error(
@2, yyscanner, @2, yyscanner,
"interface base can only be flagged as [optional]"); u"interface base can only be flagged as [optional]"_ustr);
YYERROR; YYERROR;
} }
bool opt = ($2 & unoidl::detail::FLAG_OPTIONAL) != 0; bool opt = ($2 & unoidl::detail::FLAG_OPTIONAL) != 0;
@@ -1705,7 +1705,7 @@ interfaceAttribute:
if (($2 & unoidl::detail::FLAG_ATTRIBUTE) == 0) { if (($2 & unoidl::detail::FLAG_ATTRIBUTE) == 0) {
error( error(
@2, yyscanner, @2, yyscanner,
"interface attribute must be flagged as [attribute]"); u"interface attribute must be flagged as [attribute]"_ustr);
YYERROR; YYERROR;
} }
if (($2 if (($2
@@ -1715,8 +1715,8 @@ interfaceAttribute:
{ {
error( error(
@2, yyscanner, @2, yyscanner,
("interface attribute can only be flagged as [attribute," (u"interface attribute can only be flagged as [attribute,"
" bound, readonly]")); " bound, readonly]"_ustr));
YYERROR; YYERROR;
} }
switch (t.type) { switch (t.type) {
@@ -1755,7 +1755,7 @@ attributeAccessDecls:
{ {
if (($1 & $2) != 0) { if (($1 & $2) != 0) {
error( error(
@2, yyscanner, "duplicate get/set attribute access declaration"); @2, yyscanner, u"duplicate get/set attribute access declaration"_ustr);
YYERROR; YYERROR;
} }
$$ = unoidl::detail::SourceProviderAccessDecls($1 | $2); $$ = unoidl::detail::SourceProviderAccessDecls($1 | $2);
@@ -1910,7 +1910,7 @@ typedefDefn:
case unoidl::detail::SourceProviderType::TYPE_VOID: case unoidl::detail::SourceProviderType::TYPE_VOID:
case unoidl::detail::SourceProviderType::TYPE_EXCEPTION: case unoidl::detail::SourceProviderType::TYPE_EXCEPTION:
case unoidl::detail::SourceProviderType::TYPE_INSTANTIATED_POLYMORPHIC_STRUCT: case unoidl::detail::SourceProviderType::TYPE_INSTANTIATED_POLYMORPHIC_STRUCT:
error(@4, yyscanner, "bad typedef type"); error(@4, yyscanner, u"bad typedef type"_ustr);
YYERROR; YYERROR;
break; break;
case unoidl::detail::SourceProviderType::TYPE_ENUM: case unoidl::detail::SourceProviderType::TYPE_ENUM:
@@ -2596,7 +2596,7 @@ serviceBase:
if (($2 & ~unoidl::detail::FLAG_OPTIONAL) != 0) { if (($2 & ~unoidl::detail::FLAG_OPTIONAL) != 0) {
error( error(
@2, yyscanner, @2, yyscanner,
"service base can only be flagged as [optional]"); u"service base can only be flagged as [optional]"_ustr);
YYERROR; YYERROR;
} }
bool opt = ($2 & unoidl::detail::FLAG_OPTIONAL) != 0; bool opt = ($2 & unoidl::detail::FLAG_OPTIONAL) != 0;
@@ -2654,7 +2654,7 @@ serviceInterfaceBase:
if (($2 & ~unoidl::detail::FLAG_OPTIONAL) != 0) { if (($2 & ~unoidl::detail::FLAG_OPTIONAL) != 0) {
error( error(
@2, yyscanner, @2, yyscanner,
"interface base can only be flagged as [optional]"); u"interface base can only be flagged as [optional]"_ustr);
YYERROR; YYERROR;
} }
bool opt = ($2 & unoidl::detail::FLAG_OPTIONAL) != 0; bool opt = ($2 & unoidl::detail::FLAG_OPTIONAL) != 0;
@@ -2730,8 +2730,8 @@ serviceProperty:
if (($2 & unoidl::detail::FLAG_PROPERTY) == 0) { if (($2 & unoidl::detail::FLAG_PROPERTY) == 0) {
error( error(
@2, yyscanner, @2, yyscanner,
("accumulation-based service property must be flagged as" (u"accumulation-based service property must be flagged as"
" [property]")); " [property]"_ustr));
YYERROR; YYERROR;
} }
if (($2 if (($2
@@ -2746,9 +2746,9 @@ serviceProperty:
{ {
error( error(
@2, yyscanner, @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," " [property, bound, constrained, maybeambiguous, maybedefault,"
" maybevoid, optional, readonly, removable, transient]")); " maybevoid, optional, readonly, removable, transient]"_ustr));
YYERROR; YYERROR;
} }
int att = 0; int att = 0;
@@ -3120,7 +3120,7 @@ orExpr:
$$ = unoidl::detail::SourceProviderExpr::Uint($1.uval | $3.uval); $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval | $3.uval);
break; break;
default: default:
error(@1, yyscanner, "arguments of non-integer type to \"|\""); error(@1, yyscanner, u"arguments of non-integer type to \"|\""_ustr);
YYERROR; YYERROR;
break; break;
} }
@@ -3142,7 +3142,7 @@ xorExpr:
$$ = unoidl::detail::SourceProviderExpr::Uint($1.uval ^ $3.uval); $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval ^ $3.uval);
break; break;
default: default:
error(@1, yyscanner, "arguments of non-integer type to \"^\""); error(@1, yyscanner, u"arguments of non-integer type to \"^\""_ustr);
YYERROR; YYERROR;
break; break;
} }
@@ -3164,7 +3164,7 @@ andExpr:
$$ = unoidl::detail::SourceProviderExpr::Uint($1.uval & $3.uval); $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval & $3.uval);
break; break;
default: default:
error(@1, yyscanner, "arguments of non-integer type to \"&\""); error(@1, yyscanner, u"arguments of non-integer type to \"&\""_ustr);
YYERROR; YYERROR;
break; break;
} }
@@ -3198,7 +3198,7 @@ shiftExpr:
n = static_cast<int>($3.uval); n = static_cast<int>($3.uval);
break; break;
default: default:
error(@3, yyscanner, "right argument of non-integer type to \"<<\""); error(@3, yyscanner, u"right argument of non-integer type to \"<<\""_ustr);
YYERROR; YYERROR;
} }
switch ($1.type) { switch ($1.type) {
@@ -3216,7 +3216,7 @@ shiftExpr:
$$ = unoidl::detail::SourceProviderExpr::Uint($1.uval << n); $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval << n);
break; break;
default: default:
error(@1, yyscanner, "left argument of non-integer type to \"<<\""); error(@1, yyscanner, u"left argument of non-integer type to \"<<\""_ustr);
YYERROR; YYERROR;
break; break;
} }
@@ -3246,7 +3246,7 @@ shiftExpr:
n = static_cast<int>($3.uval); n = static_cast<int>($3.uval);
break; break;
default: default:
error(@3, yyscanner, "right argument of non-integer type to \">>\""); error(@3, yyscanner, u"right argument of non-integer type to \">>\""_ustr);
YYERROR; YYERROR;
break; break;
} }
@@ -3258,7 +3258,7 @@ shiftExpr:
$$ = unoidl::detail::SourceProviderExpr::Uint($1.uval >> n); $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval >> n);
break; break;
default: default:
error(@1, yyscanner, "left argument of non-integer type to \">>\""); error(@1, yyscanner, u"left argument of non-integer type to \">>\""_ustr);
YYERROR; YYERROR;
break; break;
} }
@@ -3274,7 +3274,7 @@ addExpr:
} }
switch ($1.type) { switch ($1.type) {
case unoidl::detail::SourceProviderExpr::TYPE_BOOL: 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; YYERROR;
break; break;
case unoidl::detail::SourceProviderExpr::TYPE_INT: case unoidl::detail::SourceProviderExpr::TYPE_INT:
@@ -3295,7 +3295,7 @@ addExpr:
} }
switch ($1.type) { switch ($1.type) {
case unoidl::detail::SourceProviderExpr::TYPE_BOOL: 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; YYERROR;
break; break;
case unoidl::detail::SourceProviderExpr::TYPE_INT: case unoidl::detail::SourceProviderExpr::TYPE_INT:
@@ -3320,7 +3320,7 @@ multExpr:
} }
switch ($1.type) { switch ($1.type) {
case unoidl::detail::SourceProviderExpr::TYPE_BOOL: 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; YYERROR;
break; break;
case unoidl::detail::SourceProviderExpr::TYPE_INT: case unoidl::detail::SourceProviderExpr::TYPE_INT:
@@ -3341,26 +3341,26 @@ multExpr:
} }
switch ($1.type) { switch ($1.type) {
case unoidl::detail::SourceProviderExpr::TYPE_BOOL: 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; YYERROR;
break; break;
case unoidl::detail::SourceProviderExpr::TYPE_INT: case unoidl::detail::SourceProviderExpr::TYPE_INT:
if ($3.ival == 0) { if ($3.ival == 0) {
error(@3, yyscanner, "cannot divide by zero"); error(@3, yyscanner, u"cannot divide by zero"_ustr);
YYERROR; YYERROR;
} }
$$ = unoidl::detail::SourceProviderExpr::Int($1.ival / $3.ival); $$ = unoidl::detail::SourceProviderExpr::Int($1.ival / $3.ival);
break; break;
case unoidl::detail::SourceProviderExpr::TYPE_UINT: case unoidl::detail::SourceProviderExpr::TYPE_UINT:
if ($3.uval == 0) { if ($3.uval == 0) {
error(@3, yyscanner, "cannot divide by zero"); error(@3, yyscanner, u"cannot divide by zero"_ustr);
YYERROR; YYERROR;
} }
$$ = unoidl::detail::SourceProviderExpr::Uint($1.uval / $3.uval); $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval / $3.uval);
break; break;
case unoidl::detail::SourceProviderExpr::TYPE_FLOAT: case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
if ($3.fval == 0) { if ($3.fval == 0) {
error(@3, yyscanner, "cannot divide by zero"); error(@3, yyscanner, u"cannot divide by zero"_ustr);
YYERROR; YYERROR;
} }
$$ = unoidl::detail::SourceProviderExpr::Float($1.fval - $3.fval); $$ = unoidl::detail::SourceProviderExpr::Float($1.fval - $3.fval);
@@ -3375,20 +3375,20 @@ multExpr:
switch ($1.type) { switch ($1.type) {
case unoidl::detail::SourceProviderExpr::TYPE_INT: case unoidl::detail::SourceProviderExpr::TYPE_INT:
if ($3.ival == 0) { if ($3.ival == 0) {
error(@3, yyscanner, "cannot divide by zero"); error(@3, yyscanner, u"cannot divide by zero"_ustr);
YYERROR; YYERROR;
} }
$$ = unoidl::detail::SourceProviderExpr::Int($1.ival % $3.ival); $$ = unoidl::detail::SourceProviderExpr::Int($1.ival % $3.ival);
break; break;
case unoidl::detail::SourceProviderExpr::TYPE_UINT: case unoidl::detail::SourceProviderExpr::TYPE_UINT:
if ($3.uval == 0) { if ($3.uval == 0) {
error(@3, yyscanner, "cannot divide by zero"); error(@3, yyscanner, u"cannot divide by zero"_ustr);
YYERROR; YYERROR;
} }
$$ = unoidl::detail::SourceProviderExpr::Uint($1.uval % $3.uval); $$ = unoidl::detail::SourceProviderExpr::Uint($1.uval % $3.uval);
break; break;
default: default:
error(@1, yyscanner, "arguments of non-integer type to \"%\""); error(@1, yyscanner, u"arguments of non-integer type to \"%\""_ustr);
YYERROR; YYERROR;
break; break;
} }
@@ -3400,7 +3400,7 @@ unaryExpr:
'+' primaryExpr '+' primaryExpr
{ {
if ($2.type == unoidl::detail::SourceProviderExpr::TYPE_BOOL) { 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; YYERROR;
} }
$$ = $2; $$ = $2;
@@ -3409,12 +3409,12 @@ unaryExpr:
{ {
switch ($2.type) { switch ($2.type) {
case unoidl::detail::SourceProviderExpr::TYPE_BOOL: 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; YYERROR;
break; break;
case unoidl::detail::SourceProviderExpr::TYPE_INT: case unoidl::detail::SourceProviderExpr::TYPE_INT:
if ($2.ival == SAL_MIN_INT64) { if ($2.ival == SAL_MIN_INT64) {
error(@2, yyscanner, "cannot negate -2^63"); error(@2, yyscanner, u"cannot negate -2^63"_ustr);
YYERROR; YYERROR;
} }
$$ = unoidl::detail::SourceProviderExpr::Int(-$2.ival); $$ = unoidl::detail::SourceProviderExpr::Int(-$2.ival);
@@ -3449,7 +3449,7 @@ unaryExpr:
$$ = unoidl::detail::SourceProviderExpr::Uint(~$2.uval); $$ = unoidl::detail::SourceProviderExpr::Uint(~$2.uval);
break; break;
default: default:
error(@2, yyscanner, "argument of non-integer type to \"~\""); error(@2, yyscanner, u"argument of non-integer type to \"~\""_ustr);
YYERROR; YYERROR;
break; break;
} }
@@ -3705,7 +3705,7 @@ type:
case unoidl::detail::SourceProviderType::TYPE_VOID: case unoidl::detail::SourceProviderType::TYPE_VOID:
case unoidl::detail::SourceProviderType::TYPE_EXCEPTION: case unoidl::detail::SourceProviderType::TYPE_EXCEPTION:
case unoidl::detail::SourceProviderType::TYPE_PARAMETER: //TODO? 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; YYERROR;
break; break;
default: default:
@@ -3987,35 +3987,35 @@ OUString SourceProviderType::getName() const {
} }
switch (type) { switch (type) {
case unoidl::detail::SourceProviderType::TYPE_VOID: case unoidl::detail::SourceProviderType::TYPE_VOID:
return "void"; return u"void"_ustr;
case unoidl::detail::SourceProviderType::TYPE_BOOLEAN: case unoidl::detail::SourceProviderType::TYPE_BOOLEAN:
return "boolean"; return u"boolean"_ustr;
case unoidl::detail::SourceProviderType::TYPE_BYTE: case unoidl::detail::SourceProviderType::TYPE_BYTE:
return "byte"; return u"byte"_ustr;
case unoidl::detail::SourceProviderType::TYPE_SHORT: case unoidl::detail::SourceProviderType::TYPE_SHORT:
return "short"; return u"short"_ustr;
case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_SHORT: case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_SHORT:
return "unsigned short"; return u"unsigned short"_ustr;
case unoidl::detail::SourceProviderType::TYPE_LONG: case unoidl::detail::SourceProviderType::TYPE_LONG:
return "long"; return u"long"_ustr;
case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_LONG: case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_LONG:
return "unsigned long"; return u"unsigned long"_ustr;
case unoidl::detail::SourceProviderType::TYPE_HYPER: case unoidl::detail::SourceProviderType::TYPE_HYPER:
return "hyper"; return u"hyper"_ustr;
case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_HYPER: case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_HYPER:
return "unsigned hyper"; return u"unsigned hyper"_ustr;
case unoidl::detail::SourceProviderType::TYPE_FLOAT: case unoidl::detail::SourceProviderType::TYPE_FLOAT:
return "float"; return u"float"_ustr;
case unoidl::detail::SourceProviderType::TYPE_DOUBLE: case unoidl::detail::SourceProviderType::TYPE_DOUBLE:
return "double"; return u"double"_ustr;
case unoidl::detail::SourceProviderType::TYPE_CHAR: case unoidl::detail::SourceProviderType::TYPE_CHAR:
return "char"; return u"char"_ustr;
case unoidl::detail::SourceProviderType::TYPE_STRING: case unoidl::detail::SourceProviderType::TYPE_STRING:
return "string"; return u"string"_ustr;
case unoidl::detail::SourceProviderType::TYPE_TYPE: case unoidl::detail::SourceProviderType::TYPE_TYPE:
return "type"; return u"type"_ustr;
case unoidl::detail::SourceProviderType::TYPE_ANY: case unoidl::detail::SourceProviderType::TYPE_ANY:
return "any"; return u"any"_ustr;
case unoidl::detail::SourceProviderType::TYPE_SEQUENCE: case unoidl::detail::SourceProviderType::TYPE_SEQUENCE:
assert(subtypes.size() == 1); assert(subtypes.size() == 1);
return "[]" + subtypes.front().getName(); return "[]" + subtypes.front().getName();
@@ -4374,7 +4374,7 @@ bool SourceProviderInterfaceTypeEntityPad::addOptionalBaseMembers(
} }
for (auto & i: entity->getDirectAttributes()) { for (auto & i: entity->getDirectAttributes()) {
Member & m( Member & m(
allMembers.emplace(i.name, Member("")) allMembers.emplace(i.name, Member(u""_ustr))
.first->second); .first->second);
if (m.mandatory.isEmpty()) { if (m.mandatory.isEmpty()) {
m.optional.insert(name); m.optional.insert(name);
@@ -4382,7 +4382,7 @@ bool SourceProviderInterfaceTypeEntityPad::addOptionalBaseMembers(
} }
for (auto & i: entity->getDirectMethods()) { for (auto & i: entity->getDirectMethods()) {
Member & m( Member & m(
allMembers.emplace(i.name, Member("")) allMembers.emplace(i.name, Member(u""_ustr))
.first->second); .first->second);
if (m.mandatory.isEmpty()) { if (m.mandatory.isEmpty()) {
m.optional.insert(name); m.optional.insert(name);

View File

@@ -201,7 +201,7 @@ rtl::Reference<Entity> Cursor::getNext(OUString * name) {
} }
if (ent != data.entities.end()) { if (ent != data.entities.end()) {
throw FileFormatException( throw FileFormatException(
stat.getFileURL(), "source file defines more than one entity"); stat.getFileURL(), u"source file defines more than one entity"_ustr);
} }
ent = j; ent = j;
} }
@@ -259,7 +259,7 @@ rtl::Reference<Entity> SourceTreeProvider::findEntity(OUString const & name)
assert(i == start || i != 0); assert(i == start || i != 0);
if (i == start || name[i - 1] == '_') { if (i == start || name[i - 1] == '_') {
throw FileFormatException( //TODO throw FileFormatException( //TODO
"", "Illegal UNOIDL identifier \"" + name + "\""); u""_ustr, "Illegal UNOIDL identifier \"" + name + "\"");
} }
buf[i] = '/'; buf[i] = '/';
start = i + 1; start = i + 1;
@@ -269,21 +269,21 @@ rtl::Reference<Entity> SourceTreeProvider::findEntity(OUString const & name)
|| !rtl::isAsciiUpperCase(name[start])) || !rtl::isAsciiUpperCase(name[start]))
{ {
throw FileFormatException( //TODO throw FileFormatException( //TODO
"", "Illegal UNOIDL identifier \"" + name + "\""); u""_ustr, "Illegal UNOIDL identifier \"" + name + "\"");
} }
} else if (rtl::isAsciiDigit(c)) { } else if (rtl::isAsciiDigit(c)) {
if (i == start) { if (i == start) {
throw FileFormatException( //TODO throw FileFormatException( //TODO
"", "Illegal UNOIDL identifier \"" + name + "\""); u""_ustr, "Illegal UNOIDL identifier \"" + name + "\"");
} }
} else if (!rtl::isAsciiAlpha(c)) { } else if (!rtl::isAsciiAlpha(c)) {
throw FileFormatException( //TODO throw FileFormatException( //TODO
"", "Illegal UNOIDL identifier \"" + name + "\""); u""_ustr, "Illegal UNOIDL identifier \"" + name + "\"");
} }
} }
if (i == start) { if (i == start) {
throw FileFormatException( //TODO throw FileFormatException( //TODO
"", "Illegal UNOIDL identifier \"" + name + "\""); u""_ustr, "Illegal UNOIDL identifier \"" + name + "\"");
} }
OUString uri(uri_ + buf); OUString uri(uri_ + buf);
rtl::Reference<Entity> ent; rtl::Reference<Entity> ent;

View File

@@ -140,11 +140,11 @@ OUString showDirection(
{ {
switch (direction) { switch (direction) {
case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN: case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN:
return "[in]"; return u"[in]"_ustr;
case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_OUT: case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_OUT:
return "[out]"; return u"[out]"_ustr;
case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN_OUT: case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN_OUT:
return "[inout]"; return u"[inout]"_ustr;
default: default:
assert(false && "this cannot happen"); for (;;) { std::abort(); } assert(false && "this cannot happen"); for (;;) { std::abort(); }
} }
@@ -251,10 +251,10 @@ void checkMap(
<< "plain struct type " << name << "plain struct type " << name
<< " direct base changed from " << " direct base changed from "
<< (ent2A->getDirectBase().isEmpty() << (ent2A->getDirectBase().isEmpty()
? OUString("none") : ent2A->getDirectBase()) ? u"none"_ustr : ent2A->getDirectBase())
<< " to " << " to "
<< (ent2B->getDirectBase().isEmpty() << (ent2B->getDirectBase().isEmpty()
? OUString("none") : ent2B->getDirectBase()) ? u"none"_ustr : ent2B->getDirectBase())
<< std::endl; << std::endl;
std::exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }
@@ -345,11 +345,11 @@ void checkMap(
<< i - ent2A->getMembers().begin() + 1 << i - ent2A->getMembers().begin() + 1
<< " changed from " << " changed from "
<< (i->parameterized << (i->parameterized
? OUString("parameterized ") : OUString()) ? u"parameterized "_ustr : OUString())
<< i->type << " " << i->name << i->type << " " << i->name
<< " to " << " to "
<< (j->parameterized << (j->parameterized
? OUString("parameterized ") : OUString()) ? u"parameterized "_ustr : OUString())
<< j->type << " " << j->name << j->type << " " << j->name
<< std::endl; << std::endl;
std::exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
@@ -368,10 +368,10 @@ void checkMap(
<< "exception type " << name << "exception type " << name
<< " direct base changed from " << " direct base changed from "
<< (ent2A->getDirectBase().isEmpty() << (ent2A->getDirectBase().isEmpty()
? OUString("none") : ent2A->getDirectBase()) ? u"none"_ustr : ent2A->getDirectBase())
<< " to " << " to "
<< (ent2B->getDirectBase().isEmpty() << (ent2B->getDirectBase().isEmpty()
? OUString("none") : ent2B->getDirectBase()) ? u"none"_ustr : ent2B->getDirectBase())
<< std::endl; << std::endl;
std::exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }
@@ -489,14 +489,14 @@ void checkMap(
<< " direct attribute #" << " direct attribute #"
<< i - ent2A->getDirectAttributes().begin() + 1 << i - ent2A->getDirectAttributes().begin() + 1
<< " changed from " << " changed from "
<< (i->bound ? OUString("bound ") : OUString()) << (i->bound ? u"bound "_ustr : OUString())
<< (i->readOnly << (i->readOnly
? OUString("read-only ") : OUString()) ? u"read-only "_ustr : OUString())
<< i->type << " " << i->name //TODO: exceptions << i->type << " " << i->name //TODO: exceptions
<< " to " << " to "
<< (j->bound ? OUString("bound ") : OUString()) << (j->bound ? u"bound "_ustr : OUString())
<< (j->readOnly << (j->readOnly
? OUString("read-only ") : OUString()) ? u"read-only "_ustr : OUString())
<< j->type << " " << j->name //TODO: exceptions << j->type << " " << j->name //TODO: exceptions
<< std::endl; << std::endl;
std::exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
@@ -661,10 +661,10 @@ void checkMap(
<< i - ent2A->getConstructors().begin() + 1 << i - ent2A->getConstructors().begin() + 1
<< " changed from " << " changed from "
<< (i->defaultConstructor << (i->defaultConstructor
? OUString("default ") : i->name) //TODO: parameters, exceptions ? u"default "_ustr : i->name) //TODO: parameters, exceptions
<< " to " << " to "
<< (j->defaultConstructor << (j->defaultConstructor
? OUString("default ") : j->name) //TODO: parameters, exceptions ? u"default "_ustr : j->name) //TODO: parameters, exceptions
<< std::endl; << std::endl;
std::exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }

View File

@@ -287,7 +287,7 @@ sal_uInt8 MappedFile::read8(sal_uInt32 offset) const {
assert(size >= 8); assert(size >= 8);
if (offset > size - 1) { if (offset > size - 1) {
throw FileFormatException( 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); return get8(offset);
} }
@@ -296,7 +296,7 @@ sal_uInt16 MappedFile::read16(sal_uInt32 offset) const {
assert(size >= 8); assert(size >= 8);
if (offset > size - 2) { if (offset > size - 2) {
throw FileFormatException( 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); return get16(offset);
} }
@@ -305,7 +305,7 @@ sal_uInt32 MappedFile::read32(sal_uInt32 offset) const {
assert(size >= 8); assert(size >= 8);
if (offset > size - 4) { if (offset > size - 4) {
throw FileFormatException( 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); return get32(offset);
} }
@@ -314,7 +314,7 @@ sal_uInt64 MappedFile::read64(sal_uInt32 offset) const {
assert(size >= 8); assert(size >= 8);
if (offset > size - 8) { if (offset > size - 8) {
throw FileFormatException( 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); return get64(offset);
} }
@@ -323,7 +323,7 @@ float MappedFile::readIso60599Binary32(sal_uInt32 offset) const {
assert(size >= 8); assert(size >= 8);
if (offset > size - 4) { if (offset > size - 4) {
throw FileFormatException( 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); return getIso60599Binary32(offset);
} }
@@ -332,7 +332,7 @@ double MappedFile::readIso60599Binary64(sal_uInt32 offset) const {
assert(size >= 8); assert(size >= 8);
if (offset > size - 8) { if (offset > size - 8) {
throw FileFormatException( 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); return getIso60599Binary64(offset);
} }
@@ -340,20 +340,20 @@ double MappedFile::readIso60599Binary64(sal_uInt32 offset) const {
OUString MappedFile::readNulName(sal_uInt32 offset) { OUString MappedFile::readNulName(sal_uInt32 offset) {
if (offset > size) { if (offset > size) {
throw FileFormatException( throw FileFormatException(
uri, "UNOIDL format: offset for string too large"); uri, u"UNOIDL format: offset for string too large"_ustr);
} }
sal_uInt64 end = offset; sal_uInt64 end = offset;
for (;; ++end) { for (;; ++end) {
if (end == size) { if (end == size) {
throw FileFormatException( 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) { if (static_cast< char const * >(address)[end] == 0) {
break; break;
} }
} }
if (end - offset > SAL_MAX_INT32) { 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; OUString name;
if (!rtl_convertStringToUString( if (!rtl_convertStringToUString(
@@ -363,7 +363,7 @@ OUString MappedFile::readNulName(sal_uInt32 offset) {
| RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
| RTL_TEXTTOUNICODE_FLAGS_INVALID_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); checkEntityName(this, name);
return name; return name;
@@ -432,12 +432,12 @@ OUString MappedFile::readIdxString(
len = read32(off); len = read32(off);
if ((len & 0x80000000) != 0) { if ((len & 0x80000000) != 0) {
throw FileFormatException( 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) { if (len > SAL_MAX_INT32 || len > size - off - 4) {
throw FileFormatException( throw FileFormatException(
uri, "UNOIDL format: size of string is too large"); uri, u"UNOIDL format: size of string is too large"_ustr);
} }
OUString name; OUString name;
if (!rtl_convertStringToUString( if (!rtl_convertStringToUString(
@@ -448,7 +448,7 @@ OUString MappedFile::readIdxString(
| RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
{ {
throw FileFormatException( throw FileFormatException(
uri, "UNOIDL format: string bytes do not match encoding"); uri, u"UNOIDL format: string bytes do not match encoding"_ustr);
} }
return name; return name;
} }
@@ -477,7 +477,7 @@ Compare compare(
sal_uInt32 off = entry->name.getUnsigned32(); sal_uInt32 off = entry->name.getUnsigned32();
if (off > file->size - 1) { // at least a trailing NUL if (off > file->size - 1) { // at least a trailing NUL
throw FileFormatException( throw FileFormatException(
file->uri, "UNOIDL format: string offset too large"); file->uri, u"UNOIDL format: string offset too large"_ustr);
} }
assert(nameLength >= 0); assert(nameLength >= 0);
sal_uInt64 min = std::min( sal_uInt64 min = std::min(
@@ -497,7 +497,7 @@ Compare compare(
if (static_cast< sal_uInt64 >(nameLength) == min) { if (static_cast< sal_uInt64 >(nameLength) == min) {
if (file->size - off == min) { if (file->size - off == min) {
throw FileFormatException( throw FileFormatException(
file->uri, "UNOIDL format: string misses trailing NUL"); file->uri, u"UNOIDL format: string misses trailing NUL"_ustr);
} }
return return
static_cast< unsigned char const * >(file->address)[off + min] == 0 static_cast< unsigned char const * >(file->address)[off + min] == 0
@@ -529,7 +529,7 @@ sal_uInt32 findInMap(
sal_uInt32 off = mapBegin[n].data.getUnsigned32(); sal_uInt32 off = mapBegin[n].data.getUnsigned32();
if (off == 0) { if (off == 0) {
throw FileFormatException( 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; return off;
} }
@@ -704,7 +704,7 @@ public:
map_.trace = std::move(trace); map_.trace = std::move(trace);
if (!map_.trace.insert(map_.map).second) { if (!map_.trace.insert(map_.map).second) {
throw FileFormatException( 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); sal_uInt32 n = file->read32(offset + 1);
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( 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) if (sal_uInt64(offset) + 5 + 8 * sal_uInt64(n) > file->size)
// cannot overflow // cannot overflow
{ {
throw FileFormatException( throw FileFormatException(
file->uri, 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)); 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); sal_uInt32 n = file->read32(offset + 1);
if (n == 0) { if (n == 0) {
throw FileFormatException( 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) { if (n > SAL_MAX_INT32) {
throw FileFormatException( 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; offset += 5;
std::vector< EnumTypeEntity::Member > mems; std::vector< EnumTypeEntity::Member > mems;
@@ -805,8 +805,8 @@ rtl::Reference< Entity > readEntity(
if (base.isEmpty()) { if (base.isEmpty()) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: empty base type name of plain struct" (u"UNOIDL format: empty base type name of plain struct"
" type")); " type"_ustr));
} }
checkTypeName(file, base); checkTypeName(file, base);
} }
@@ -814,8 +814,8 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many direct members of plain struct" (u"UNOIDL format: too many direct members of plain struct"
" type")); " type"_ustr));
} }
offset += 4; offset += 4;
std::vector< PlainStructTypeEntity::Member > mems; std::vector< PlainStructTypeEntity::Member > mems;
@@ -839,8 +839,8 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many type parameters of polymorphic" (u"UNOIDL format: too many type parameters of polymorphic"
" struct type template")); " struct type template"_ustr));
} }
offset += 5; offset += 5;
std::vector< OUString > params; std::vector< OUString > params;
@@ -854,8 +854,8 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many members of polymorphic struct" (u"UNOIDL format: too many members of polymorphic struct"
" type template")); " type template"_ustr));
} }
offset += 4; offset += 4;
std::vector< PolymorphicStructTypeTemplateEntity::Member > mems; std::vector< PolymorphicStructTypeTemplateEntity::Member > mems;
@@ -892,8 +892,8 @@ rtl::Reference< Entity > readEntity(
if (base.isEmpty()) { if (base.isEmpty()) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: empty base type name of exception" (u"UNOIDL format: empty base type name of exception"
" type")); " type"_ustr));
} }
checkTypeName(file, base); checkTypeName(file, base);
} }
@@ -901,7 +901,7 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
"UNOIDL format: too many direct members of exception type"); u"UNOIDL format: too many direct members of exception type"_ustr);
} }
offset += 4; offset += 4;
std::vector< ExceptionTypeEntity::Member > mems; std::vector< ExceptionTypeEntity::Member > mems;
@@ -925,8 +925,8 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many direct mandatory bases of" (u"UNOIDL format: too many direct mandatory bases of"
" interface type")); " interface type"_ustr));
} }
offset += 5; offset += 5;
std::vector< AnnotatedReference > mandBases; std::vector< AnnotatedReference > mandBases;
@@ -941,8 +941,8 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many direct optional bases of" (u"UNOIDL format: too many direct optional bases of"
" interface type")); " interface type"_ustr));
} }
offset += 4; offset += 4;
std::vector< AnnotatedReference > optBases; std::vector< AnnotatedReference > optBases;
@@ -957,8 +957,8 @@ rtl::Reference< Entity > readEntity(
if (nAttrs > SAL_MAX_INT32) { if (nAttrs > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many direct attributes of interface" (u"UNOIDL format: too many direct attributes of interface"
" type")); " type"_ustr));
} }
offset += 4; offset += 4;
std::vector< InterfaceTypeEntity::Attribute > attrs; std::vector< InterfaceTypeEntity::Attribute > attrs;
@@ -1018,8 +1018,8 @@ rtl::Reference< Entity > readEntity(
if (nMeths > SAL_MAX_INT32 - nAttrs) { if (nMeths > SAL_MAX_INT32 - nAttrs) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many direct attributes and methods of" (u"UNOIDL format: too many direct attributes and methods of"
" interface type")); " interface type"_ustr));
} }
offset += 4; offset += 4;
std::vector< InterfaceTypeEntity::Method > meths; std::vector< InterfaceTypeEntity::Method > meths;
@@ -1107,15 +1107,15 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, 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) if (sal_uInt64(offset) + 5 + 8 * sal_uInt64(n) > file->size)
// cannot overflow // cannot overflow
{ {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: constant group map offset + size too" (u"UNOIDL format: constant group map offset + size too"
" large")); " large"_ustr));
} }
MapEntry const * p = reinterpret_cast< MapEntry const * >( MapEntry const * p = reinterpret_cast< MapEntry const * >(
static_cast< char const * >(file->address) + offset + 5); static_cast< char const * >(file->address) + offset + 5);
@@ -1148,8 +1148,8 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many constructors of" (u"UNOIDL format: too many constructors of"
" single-interface--based service")); " single-interface--based service"_ustr));
} }
offset += 4; offset += 4;
ctors.reserve(n); ctors.reserve(n);
@@ -1226,8 +1226,8 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many direct mandatory service bases of" (u"UNOIDL format: too many direct mandatory service bases of"
" accumulation-based service")); " accumulation-based service"_ustr));
} }
offset += 5; offset += 5;
std::vector< AnnotatedReference > mandServs; std::vector< AnnotatedReference > mandServs;
@@ -1242,8 +1242,8 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many direct optional service bases of" (u"UNOIDL format: too many direct optional service bases of"
" accumulation-based service")); " accumulation-based service"_ustr));
} }
offset += 4; offset += 4;
std::vector< AnnotatedReference > optServs; std::vector< AnnotatedReference > optServs;
@@ -1258,8 +1258,8 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many direct mandatory interface bases" (u"UNOIDL format: too many direct mandatory interface bases"
" of accumulation-based service")); " of accumulation-based service"_ustr));
} }
offset += 4; offset += 4;
std::vector< AnnotatedReference > mandIfcs; std::vector< AnnotatedReference > mandIfcs;
@@ -1274,8 +1274,8 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many direct optional interface bases" (u"UNOIDL format: too many direct optional interface bases"
" of accumulation-based service")); " of accumulation-based service"_ustr));
} }
offset += 4; offset += 4;
std::vector< AnnotatedReference > optIfcs; std::vector< AnnotatedReference > optIfcs;
@@ -1290,8 +1290,8 @@ rtl::Reference< Entity > readEntity(
if (n > SAL_MAX_INT32) { if (n > SAL_MAX_INT32) {
throw FileFormatException( throw FileFormatException(
file->uri, file->uri,
("UNOIDL format: too many direct properties of" (u"UNOIDL format: too many direct properties of"
" accumulation-based service")); " accumulation-based service"_ustr));
} }
offset += 4; offset += 4;
std::vector< AccumulationBasedServiceEntity::Property > props; std::vector< AccumulationBasedServiceEntity::Property > props;
@@ -1351,14 +1351,14 @@ UnoidlProvider::UnoidlProvider(OUString const & uri): file_(new MappedFile(uri))
{ {
throw FileFormatException( throw FileFormatException(
file_->uri, file_->uri,
"UNOIDL format: does not begin with magic UNOIDL\\xFF and version" u"UNOIDL format: does not begin with magic UNOIDL\\xFF and version"
" 0"); " 0"_ustr);
} }
sal_uInt32 off = file_->read32(8); sal_uInt32 off = file_->read32(8);
map_.map.size = file_->read32(12); map_.map.size = file_->read32(12);
if (off + 8 * sal_uInt64(map_.map.size) > file_->size) { // cannot overflow if (off + 8 * sal_uInt64(map_.map.size) > file_->size) { // cannot overflow
throw FileFormatException( 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 * >( map_.map.begin = reinterpret_cast< MapEntry const * >(
static_cast< char const * >(file_->address) + off); static_cast< char const * >(file_->address) + off);
@@ -1412,13 +1412,13 @@ rtl::Reference< Entity > UnoidlProvider::findEntity(OUString const & name) const
// cannot overflow // cannot overflow
{ {
throw FileFormatException( 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 * >( map.map.begin = reinterpret_cast< MapEntry const * >(
static_cast< char const * >(file_->address) + off + 5); static_cast< char const * >(file_->address) + off + 5);
if (!map.trace.insert(map.map).second) { if (!map.trace.insert(map.map).second) {
throw FileFormatException( throw FileFormatException(
file_->uri, "UNOIDL format: recursive map"); file_->uri, u"UNOIDL format: recursive map"_ustr);
} }
i = j + 1; i = j + 1;
} }