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 | |
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
-rw-r--r-- | codemaker/source/codemaker/codemaker.cxx | 2 | ||||
-rw-r--r-- | codemaker/source/codemaker/typemanager.cxx | 2 | ||||
-rw-r--r-- | codemaker/source/cppumaker/cppumaker.cxx | 8 | ||||
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 114 | ||||
-rw-r--r-- | codemaker/source/javamaker/classfile.cxx | 20 | ||||
-rw-r--r-- | codemaker/source/javamaker/javamaker.cxx | 2 | ||||
-rw-r--r-- | codemaker/source/javamaker/javatype.cxx | 48 | ||||
-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 |
12 files changed, 252 insertions, 252 deletions
diff --git a/codemaker/source/codemaker/codemaker.cxx b/codemaker/source/codemaker/codemaker.cxx index cb797533e2b9..df93ed2f5662 100644 --- a/codemaker/source/codemaker/codemaker.cxx +++ b/codemaker/source/codemaker/codemaker.cxx @@ -36,7 +36,7 @@ OString convertString(OUString const & string) { | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) { throw CannotDumpException( - "Failure converting string from UTF-16 to UTF-8"); + u"Failure converting string from UTF-16 to UTF-8"_ustr); } return s; } diff --git a/codemaker/source/codemaker/typemanager.cxx b/codemaker/source/codemaker/typemanager.cxx index 194840ca9d5b..48588e2c4200 100644 --- a/codemaker/source/codemaker/typemanager.cxx +++ b/codemaker/source/codemaker/typemanager.cxx @@ -62,7 +62,7 @@ codemaker::UnoType::Sort TypeManager::getSort( { if (name.isEmpty()) { if (cursor != nullptr) { - *cursor = manager_->createCursor(""); + *cursor = manager_->createCursor(u""_ustr); } return codemaker::UnoType::Sort::Module; } diff --git a/codemaker/source/cppumaker/cppumaker.cxx b/codemaker/source/cppumaker/cppumaker.cxx index 5e666456c301..3fe5c8855712 100644 --- a/codemaker/source/cppumaker/cppumaker.cxx +++ b/codemaker/source/cppumaker/cppumaker.cxx @@ -70,7 +70,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { } } } else { - produce("", typeMgr, generated, options); + produce(u""_ustr, typeMgr, generated, options); } if (!options.isValid("-nD"_ostr)) { // 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 // C++ header files: produce( - "com.sun.star.uno.RuntimeException", typeMgr, generated, + u"com.sun.star.uno.RuntimeException"_ustr, typeMgr, generated, options); produce( - "com.sun.star.uno.TypeClass", typeMgr, generated, options); + u"com.sun.star.uno.TypeClass"_ustr, typeMgr, generated, options); produce( - "com.sun.star.uno.XInterface", typeMgr, generated, options); + u"com.sun.star.uno.XInterface"_ustr, typeMgr, generated, options); } } catch (CannotDumpException & e) { std::cerr << "ERROR: " << e.getMessage() << '\n'; diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index b2ba3413402c..8d67cdc94e11 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -419,7 +419,7 @@ void CppuType::dump(CppuOptions const & options) m_cppuTypeDynamic = false; } 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( @@ -670,86 +670,86 @@ OUString CppuType::getTypeClass(OUString const & name, bool cStyle) switch (m_typeMgr->getSort(name, &ent)) { case codemaker::UnoType::Sort::Void: return cStyle - ? OUString("typelib_TypeClass_VOID") - : OUString("::css::uno::TypeClass_VOID"); + ? u"typelib_TypeClass_VOID"_ustr + : u"::css::uno::TypeClass_VOID"_ustr; case codemaker::UnoType::Sort::Boolean: return cStyle - ? OUString("typelib_TypeClass_BOOLEAN") - : OUString("::css::uno::TypeClass_BOOLEAN"); + ? u"typelib_TypeClass_BOOLEAN"_ustr + : u"::css::uno::TypeClass_BOOLEAN"_ustr; case codemaker::UnoType::Sort::Byte: return cStyle - ? OUString("typelib_TypeClass_BYTE") - : OUString("::css::uno::TypeClass_BYTE"); + ? u"typelib_TypeClass_BYTE"_ustr + : u"::css::uno::TypeClass_BYTE"_ustr; case codemaker::UnoType::Sort::Short: return cStyle - ? OUString("typelib_TypeClass_SHORT") - : OUString("::css::uno::TypeClass_SHORT"); + ? u"typelib_TypeClass_SHORT"_ustr + : u"::css::uno::TypeClass_SHORT"_ustr; case codemaker::UnoType::Sort::UnsignedShort: return cStyle - ? OUString("typelib_TypeClass_UNSIGNED_SHORT") - : OUString("::css::uno::TypeClass_UNSIGNED_SHORT"); + ? u"typelib_TypeClass_UNSIGNED_SHORT"_ustr + : u"::css::uno::TypeClass_UNSIGNED_SHORT"_ustr; case codemaker::UnoType::Sort::Long: return cStyle - ? OUString("typelib_TypeClass_LONG") - : OUString("::css::uno::TypeClass_LONG"); + ? u"typelib_TypeClass_LONG"_ustr + : u"::css::uno::TypeClass_LONG"_ustr; case codemaker::UnoType::Sort::UnsignedLong: return cStyle - ? OUString("typelib_TypeClass_UNSIGNED_LONG") - : OUString("::css::uno::TypeClass_UNSIGNED_LONG"); + ? u"typelib_TypeClass_UNSIGNED_LONG"_ustr + : u"::css::uno::TypeClass_UNSIGNED_LONG"_ustr; case codemaker::UnoType::Sort::Hyper: return cStyle - ? OUString("typelib_TypeClass_HYPER") - : OUString("::css::uno::TypeClass_HYPER"); + ? u"typelib_TypeClass_HYPER"_ustr + : u"::css::uno::TypeClass_HYPER"_ustr; case codemaker::UnoType::Sort::UnsignedHyper: return cStyle - ? OUString("typelib_TypeClass_UNSIGNED_HYPER") - : OUString("::css::uno::TypeClass_UNSIGNED_HYPER"); + ? u"typelib_TypeClass_UNSIGNED_HYPER"_ustr + : u"::css::uno::TypeClass_UNSIGNED_HYPER"_ustr; case codemaker::UnoType::Sort::Float: return cStyle - ? OUString("typelib_TypeClass_FLOAT") - : OUString("::css::uno::TypeClass_FLOAT"); + ? u"typelib_TypeClass_FLOAT"_ustr + : u"::css::uno::TypeClass_FLOAT"_ustr; case codemaker::UnoType::Sort::Double: return cStyle - ? OUString("typelib_TypeClass_DOUBLE") - : OUString("::css::uno::TypeClass_DOUBLE"); + ? u"typelib_TypeClass_DOUBLE"_ustr + : u"::css::uno::TypeClass_DOUBLE"_ustr; case codemaker::UnoType::Sort::Char: return cStyle - ? OUString("typelib_TypeClass_CHAR") - : OUString("::css::uno::TypeClass_CHAR"); + ? u"typelib_TypeClass_CHAR"_ustr + : u"::css::uno::TypeClass_CHAR"_ustr; case codemaker::UnoType::Sort::String: return cStyle - ? OUString("typelib_TypeClass_STRING") - : OUString("::css::uno::TypeClass_STRING"); + ? u"typelib_TypeClass_STRING"_ustr + : u"::css::uno::TypeClass_STRING"_ustr; case codemaker::UnoType::Sort::Type: return cStyle - ? OUString("typelib_TypeClass_TYPE") - : OUString("::css::uno::TypeClass_TYPE"); + ? u"typelib_TypeClass_TYPE"_ustr + : u"::css::uno::TypeClass_TYPE"_ustr; case codemaker::UnoType::Sort::Any: return cStyle - ? OUString("typelib_TypeClass_ANY") - : OUString("::css::uno::TypeClass_ANY"); + ? u"typelib_TypeClass_ANY"_ustr + : u"::css::uno::TypeClass_ANY"_ustr; case codemaker::UnoType::Sort::Sequence: return cStyle - ? OUString("typelib_TypeClass_SEQUENCE") - : OUString("::css::uno::TypeClass_SEQUENCE"); + ? u"typelib_TypeClass_SEQUENCE"_ustr + : u"::css::uno::TypeClass_SEQUENCE"_ustr; case codemaker::UnoType::Sort::Enum: return cStyle - ? OUString("typelib_TypeClass_ENUM") - : OUString("::css::uno::TypeClass_ENUM"); + ? u"typelib_TypeClass_ENUM"_ustr + : u"::css::uno::TypeClass_ENUM"_ustr; case codemaker::UnoType::Sort::PlainStruct: case codemaker::UnoType::Sort::PolymorphicStructTemplate: case codemaker::UnoType::Sort::InstantiatedPolymorphicStruct: return cStyle - ? OUString("typelib_TypeClass_STRUCT") - : OUString("::css::uno::TypeClass_STRUCT"); + ? u"typelib_TypeClass_STRUCT"_ustr + : u"::css::uno::TypeClass_STRUCT"_ustr; case codemaker::UnoType::Sort::Exception: return cStyle - ? OUString("typelib_TypeClass_EXCEPTION") - : OUString("::css::uno::TypeClass_EXCEPTION"); + ? u"typelib_TypeClass_EXCEPTION"_ustr + : u"::css::uno::TypeClass_EXCEPTION"_ustr; case codemaker::UnoType::Sort::Interface: return cStyle - ? OUString("typelib_TypeClass_INTERFACE") - : OUString("::css::uno::TypeClass_INTERFACE"); + ? u"typelib_TypeClass_INTERFACE"_ustr + : u"::css::uno::TypeClass_INTERFACE"_ustr; case codemaker::UnoType::Sort::Typedef: return getTypeClass(dynamic_cast<unoidl::TypedefEntity&>(*ent).getType(), cStyle); default: @@ -1397,7 +1397,7 @@ void InterfaceType::dumpComprehensiveGetCppuType(FileStream & out) << indent() << "bInitStarted = true;\n"; std::set< OUString > seen; // 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"); dumpAttributesCppuDecl(out, &seen); dumpMethodsCppuDecl(out, &seen); @@ -2818,21 +2818,21 @@ void ExceptionType::dumpHdlFile( { if (name_ == "com.sun.star.uno.Exception") { - includes.addCustom("#if defined(LIBO_INTERNAL_ONLY)"); - includes.addCustom("#if __has_include(<version>)"); - includes.addCustom("#include <version>"); - includes.addCustom("#endif"); - includes.addCustom("#if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907"); - includes.addCustom("#include <source_location>"); - includes.addCustom("#define LIBO_USE_SOURCE_LOCATION std"); - includes.addCustom("#elif __has_include(<experimental/source_location>)"); - includes.addCustom("#include <experimental/source_location>"); - includes.addCustom("#define LIBO_USE_SOURCE_LOCATION std::experimental"); - includes.addCustom("#endif"); - includes.addCustom("#endif"); - includes.addCustom("#if defined LIBO_USE_SOURCE_LOCATION"); - includes.addCustom("#include <o3tl/runtimetooustring.hxx>"); - includes.addCustom("#endif"); + includes.addCustom(u"#if defined(LIBO_INTERNAL_ONLY)"_ustr); + includes.addCustom(u"#if __has_include(<version>)"_ustr); + includes.addCustom(u"#include <version>"_ustr); + includes.addCustom(u"#endif"_ustr); + includes.addCustom(u"#if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907"_ustr); + includes.addCustom(u"#include <source_location>"_ustr); + includes.addCustom(u"#define LIBO_USE_SOURCE_LOCATION std"_ustr); + includes.addCustom(u"#elif __has_include(<experimental/source_location>)"_ustr); + includes.addCustom(u"#include <experimental/source_location>"_ustr); + includes.addCustom(u"#define LIBO_USE_SOURCE_LOCATION std::experimental"_ustr); + includes.addCustom(u"#endif"_ustr); + includes.addCustom(u"#endif"_ustr); + includes.addCustom(u"#if defined LIBO_USE_SOURCE_LOCATION"_ustr); + includes.addCustom(u"#include <o3tl/runtimetooustring.hxx>"_ustr); + includes.addCustom(u"#endif"_ustr); } dumpHFileContent(out, includes); } diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx index 880191045d89..fd32497508c6 100644 --- a/codemaker/source/javamaker/classfile.cxx +++ b/codemaker/source/javamaker/classfile.cxx @@ -73,7 +73,7 @@ void appendStream( void write(FileStream & file, void const * buffer, sal_uInt64 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) { @@ -234,7 +234,7 @@ void ClassFile::Code::instrLookupswitch( // <match--offset pairs...>: std::vector< std::pair< sal_Int32, Code * > >::size_type size = blocks.size(); 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(); appendU1(m_code, 0xAB); @@ -408,7 +408,7 @@ void ClassFile::Code::addException( { OSL_ASSERT(start < end && end <= m_code.size() && handler <= m_code.size()); 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; appendU2(m_exceptionTable, static_cast< sal_uInt16 >(start)); @@ -549,7 +549,7 @@ sal_uInt16 ClassFile::addDoubleInfo(double value) { void ClassFile::addInterface(OString const & interface) { 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; appendU2(m_interfaces, addClassInfo(interface)); @@ -561,7 +561,7 @@ void ClassFile::addField( OString const & signature) { 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; appendU2(m_fields, static_cast< sal_uInt16 >(accessFlags)); @@ -586,7 +586,7 @@ void ClassFile::addMethod( OString const & signature) { 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; appendU2(m_methods, static_cast< sal_uInt16 >(accessFlags)); @@ -594,7 +594,7 @@ void ClassFile::addMethod( appendU2(m_methods, addUtf8Info(descriptor)); std::vector< OString >::size_type excs = exceptions.size(); 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( m_methods, @@ -609,7 +609,7 @@ void ClassFile::addMethod( > (SAL_MAX_UINT32 - (2 + 2 + 4 + 2 + 2) - 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)); appendU4( @@ -660,7 +660,7 @@ void ClassFile::write(FileStream & file) const { sal_uInt16 ClassFile::nextConstantPoolIndex(sal_uInt16 width) { OSL_ASSERT(width == 1 || width == 2); 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; m_constantPoolCount = m_constantPoolCount + width; @@ -673,7 +673,7 @@ sal_uInt16 ClassFile::addUtf8Info(OString const & value) { return i->second; } 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); appendU1(m_constantPool, 1); diff --git a/codemaker/source/javamaker/javamaker.cxx b/codemaker/source/javamaker/javamaker.cxx index 177069d5b1ea..4c15f4c1e78b 100644 --- a/codemaker/source/javamaker/javamaker.cxx +++ b/codemaker/source/javamaker/javamaker.cxx @@ -70,7 +70,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { } } } else { - produce("", typeMgr, generated, options); + produce(u""_ustr, typeMgr, generated, options); } } catch (CannotDumpException & e) { diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx index 6ac84ff75e02..974a8f31be6b 100644 --- a/codemaker/source/javamaker/javatype.cxx +++ b/codemaker/source/javamaker/javatype.cxx @@ -153,7 +153,7 @@ SpecialType translateUnoTypeToDescriptor( != codemaker::UnoType::Sort::InstantiatedPolymorphicStruct)); if (rank > 0xFF - (array ? 1 : 0)) { throw CannotDumpException( - "Too many array dimensions for Java class file format"); + u"Too many array dimensions for Java class file format"_ustr); } if (array) { ++rank; @@ -592,7 +592,7 @@ void TypeInfo::generatePolymorphicUnoTypeCode( "com/sun/star/uno/TypeClass"_ostr, "SEQUENCE"_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( "com/sun/star/uno/Type"_ostr, "<init>"_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(); if (typeInfos > SAL_MAX_INT32) { 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) return; @@ -677,7 +677,7 @@ void addTypeInfo( code->instrReturn(); if (stack > SAL_MAX_UINT16 - 4) { 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); classFile->addMethod( @@ -1194,7 +1194,7 @@ sal_uInt16 addLoadLocal( code->instrGetstatic( "com/sun/star/uno/TypeClass"_ostr, "STRUCT"_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( "com/sun/star/uno/Type"_ostr, "<init>"_ostr, "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"_ostr); @@ -1219,7 +1219,7 @@ sal_uInt16 addLoadLocal( code->instrGetstatic( "com/sun/star/uno/TypeClass"_ostr, "INTERFACE"_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( "com/sun/star/uno/Type"_ostr, "<init>"_ostr, "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"_ostr); @@ -1305,7 +1305,7 @@ sal_uInt16 addLoadLocal( } if (*index > SAL_MAX_UINT16 - size) { 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; return stack; @@ -1455,7 +1455,7 @@ void handlePolyStructType( sig.append(codemaker::convertString(param) + ":Ljava/lang/Object;"); 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;"); @@ -1473,7 +1473,7 @@ void handlePolyStructType( std::map< OUString, sal_Int32 >::iterator it( typeParameters.find(member.type)); if (it == typeParameters.end()) { - throw CannotDumpException("Bad type information"); //TODO + throw CannotDumpException(u"Bad type information"_ustr); //TODO } typeParameterIndex = it->second; } else { @@ -1593,7 +1593,7 @@ void handleExceptionType( if (baseRuntimeException) { addField( 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( entity->getDirectMembers().begin()); @@ -1615,7 +1615,7 @@ void handleExceptionType( stack = std::max( stack, addFieldInit( - manager, className, "Context", false, + manager, className, u"Context"_ustr, false, u"com.sun.star.uno.XInterface", dependencies, code.get())); } for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( @@ -1647,7 +1647,7 @@ void handleExceptionType( stack = std::max( stack, addFieldInit( - manager, className, "Context", false, + manager, className, u"Context"_ustr, false, u"com.sun.star.uno.XInterface", dependencies, code.get())); } for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( @@ -1685,7 +1685,7 @@ void handleExceptionType( stack = std::max( stack, addFieldInit( - manager, className, "Context", false, + manager, className, u"Context"_ustr, false, u"com.sun.star.uno.XInterface", dependencies, code.get())); } for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( @@ -1716,7 +1716,7 @@ void handleExceptionType( stack = std::max( stack, addFieldInit( - manager, className, "Context", false, + manager, className, u"Context"_ustr, false, u"com.sun.star.uno.XInterface", dependencies, code.get())); } for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( @@ -1757,7 +1757,7 @@ void handleExceptionType( maxSize, addDirectArgument( 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( entity->getDirectMembers().begin()); @@ -1804,7 +1804,7 @@ void handleExceptionType( maxSize2, addDirectArgument( 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( entity->getDirectMembers().begin()); @@ -2220,7 +2220,7 @@ void addConstructor( &tree.getRoot(), tryStart, tryEnd, pos2, code.get()); code->addException( 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); } code->setMaxStackAndLocals(stack, localIndex); @@ -2254,10 +2254,10 @@ void handleService( OString realJavaBaseName( codemaker::convertString(entity->getBase())); dependencies->insert(entity->getBase()); - dependencies->insert("com.sun.star.lang.XMultiComponentFactory"); - dependencies->insert("com.sun.star.uno.DeploymentException"); - dependencies->insert("com.sun.star.uno.TypeClass"); - dependencies->insert("com.sun.star.uno.XComponentContext"); + dependencies->insert(u"com.sun.star.lang.XMultiComponentFactory"_ustr); + dependencies->insert(u"com.sun.star.uno.DeploymentException"_ustr); + dependencies->insert(u"com.sun.star.uno.TypeClass"_ustr); + dependencies->insert(u"com.sun.star.uno.XComponentContext"_ustr); for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor& cons : entity->getConstructors()) { @@ -2340,9 +2340,9 @@ void handleSingleton( OString unoName(codemaker::convertString(name)); OString className( translateUnoidlEntityNameToJavaFullyQualifiedName(name, "singleton")); - dependencies->insert("com.sun.star.uno.DeploymentException"); - dependencies->insert("com.sun.star.uno.TypeClass"); - dependencies->insert("com.sun.star.uno.XComponentContext"); + dependencies->insert(u"com.sun.star.uno.DeploymentException"_ustr); + dependencies->insert(u"com.sun.star.uno.TypeClass"_ustr); + dependencies->insert(u"com.sun.star.uno.XComponentContext"_ustr); std::unique_ptr< ClassFile > cf( new ClassFile( static_cast< ClassFile::AccessFlags >( 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; } |