diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-11-06 17:24:13 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-11-06 17:24:13 +0100 |
commit | fc0d57b7aff84f4bdca0a1f201527c265d5f0cf5 (patch) | |
tree | 49a72b76d2d2a92af6371748c19277778159b86d /idlc | |
parent | e36dae401fc8963c9a92cb2c11d9b650b943c6d3 (diff) |
Revert "use the new OUString::fromUtf8 method"
This reverts commit 05050cdb23de586870bf479a9df5ced06828d498,
not all places that use e.g. OStringToOUString to convert potential UTF-8
are guaranteed to fulfil the prerequisites necessary to use fromUtf8 (and
some places like e.g. in codemaker are happy with the best-effort effect
of OStringToOUString's OSTRING_TO_OUSTRING_CVTFLAGS).
Diffstat (limited to 'idlc')
-rw-r--r-- | idlc/source/astconstant.cxx | 4 | ||||
-rw-r--r-- | idlc/source/astdump.cxx | 40 | ||||
-rw-r--r-- | idlc/source/astenum.cxx | 4 | ||||
-rw-r--r-- | idlc/source/astinterface.cxx | 12 | ||||
-rw-r--r-- | idlc/source/astoperation.cxx | 15 | ||||
-rw-r--r-- | idlc/source/aststruct.cxx | 15 | ||||
-rw-r--r-- | idlc/source/idlc.cxx | 2 | ||||
-rw-r--r-- | idlc/source/idlccompile.cxx | 13 | ||||
-rw-r--r-- | idlc/source/idlcproduce.cxx | 6 | ||||
-rw-r--r-- | idlc/source/options.cxx | 2 | ||||
-rw-r--r-- | idlc/source/parser.y | 10 |
11 files changed, 73 insertions, 50 deletions
diff --git a/idlc/source/astconstant.cxx b/idlc/source/astconstant.cxx index 7b9797981e61..b37ff90e6b73 100644 --- a/idlc/source/astconstant.cxx +++ b/idlc/source/astconstant.cxx @@ -109,13 +109,13 @@ bool AstConstant::dumpBlob( OUString type; if ( getNodeType() != NT_enum_val ) { - type = OUString::fromUtf8(exprTypeToString(getConstValueType())); + type = OStringToOUString(exprTypeToString(getConstValueType()), RTL_TEXTENCODING_UTF8); } rBlob.setFieldData( index, getDocumentation(), OUString(), RT_ACCESS_CONST | (published ? RT_ACCESS_PUBLISHED : 0), - OUString::fromUtf8(name), type, aConst); + OStringToOUString(name, RTL_TEXTENCODING_UTF8), type, aConst); return true; } diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx index 01ca504aaefd..c9a2c473f3fa 100644 --- a/idlc/source/astdump.cxx +++ b/idlc/source/astdump.cxx @@ -41,7 +41,7 @@ bool AstModule::dump(RegistryKey& rKey) localKey = rKey; }else { - if (rKey.createKey( OUString::fromUtf8(getFullName()), localKey)) + if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey)) { fprintf(stderr, "%s: warning, could not create key '%s' in '%s'\n", idlc()->getOptions()->getProgramName().getStr(), @@ -62,7 +62,7 @@ bool AstModule::dump(RegistryKey& rKey) m_bPublished ? TYPEREG_VERSION_1 : TYPEREG_VERSION_0, getDocumentation(), emptyStr, typeClass, m_bPublished, - OUString::fromUtf8(getRelativName()), 0, + OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8), 0, nConst, 0, 0); DeclList::const_iterator iter = getIteratorBegin(); @@ -102,7 +102,7 @@ bool AstModule::dump(RegistryKey& rKey) typereg::Writer aBlob( m_bPublished ? TYPEREG_VERSION_1 : TYPEREG_VERSION_0, getDocumentation(), emptyStr, typeClass, m_bPublished, - OUString::fromUtf8(getRelativName()), 0, 0, 0, + OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8), 0, 0, 0, 0); sal_uInt32 aBlobSize; @@ -131,7 +131,7 @@ bool AstTypeDef::dump(RegistryKey& rKey) { OUString emptyStr; RegistryKey localKey; - if (rKey.createKey( OUString::fromUtf8(getFullName()), localKey)) + if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey)) { fprintf(stderr, "%s: warning, could not create key '%s' in '%s'\n", idlc()->getOptions()->getProgramName().getStr(), @@ -142,10 +142,11 @@ bool AstTypeDef::dump(RegistryKey& rKey) typereg::Writer aBlob( m_bPublished ? TYPEREG_VERSION_1 : TYPEREG_VERSION_0, getDocumentation(), emptyStr, RT_TYPE_TYPEDEF, m_bPublished, - OUString::fromUtf8(getRelativName()), 1, 0, 0, 0); + OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8), 1, 0, 0, 0); aBlob.setSuperTypeName( 0, - OUString::fromUtf8(getBaseType()->getRelativName())); + OStringToOUString( + getBaseType()->getRelativName(), RTL_TEXTENCODING_UTF8)); sal_uInt32 aBlobSize; void const * pBlob = aBlob.getBlob(&aBlobSize); @@ -216,7 +217,7 @@ bool AstService::dump(RegistryKey& rKey) } RegistryKey localKey; if (rKey.createKey( - OUString::fromUtf8(getFullName()), + OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8), localKey)) { fprintf( stderr, "%s: warning, could not create key '%s' in '%s'\n", @@ -230,12 +231,12 @@ bool AstService::dump(RegistryKey& rKey) version, getDocumentation(), emptyStr, getNodeType() == NT_singleton ? RT_TYPE_SINGLETON : RT_TYPE_SERVICE, m_bPublished, - OUString::fromUtf8(getRelativName()), + OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8), superName.isEmpty() ? 0 : 1, properties, constructors, references); if (!superName.isEmpty()) { writer.setSuperTypeName( - 0, OUString::fromUtf8(superName)); + 0, OStringToOUString(superName, RTL_TEXTENCODING_UTF8)); } sal_uInt16 constructorIndex = 0; sal_uInt16 propertyIndex = 0; @@ -257,7 +258,8 @@ bool AstService::dump(RegistryKey& rKey) writer.setReferenceData( referenceIndex++, decl->getDocumentation(), RT_REF_SUPPORTS, (decl->isOptional() ? RT_ACCESS_OPTIONAL : RT_ACCESS_INVALID), - OUString::fromUtf8( decl->getRealInterface()->getRelativName() )); + OStringToOUString( decl->getRealInterface()->getRelativName(), + RTL_TEXTENCODING_UTF8)); break; } @@ -267,7 +269,8 @@ bool AstService::dump(RegistryKey& rKey) AstServiceMember * decl = static_cast<AstServiceMember *>(*i); writer.setReferenceData(referenceIndex++, decl->getDocumentation(), RT_REF_EXPORTS, (decl->isOptional() ? RT_ACCESS_OPTIONAL : RT_ACCESS_INVALID), - OUString::fromUtf8(decl->getRealService()->getRelativName())); + OStringToOUString(decl->getRealService()->getRelativName(), + RTL_TEXTENCODING_UTF8)); } break; @@ -276,7 +279,8 @@ bool AstService::dump(RegistryKey& rKey) AstObserves * decl = static_cast<AstObserves *>(*i); writer.setReferenceData(referenceIndex++, decl->getDocumentation(), RT_REF_OBSERVES, RT_ACCESS_INVALID, - OUString::fromUtf8( decl->getRealInterface()->getRelativName())); + OStringToOUString( decl->getRealInterface()->getRelativName(), + RTL_TEXTENCODING_UTF8)); break; } @@ -285,7 +289,8 @@ bool AstService::dump(RegistryKey& rKey) AstNeeds * decl = static_cast<AstNeeds *>(*i); writer.setReferenceData( referenceIndex++, decl->getDocumentation(), RT_REF_NEEDS, RT_ACCESS_INVALID, - OUString::fromUtf8( decl->getRealService()->getRelativName())); + OStringToOUString( decl->getRealService()->getRelativName(), + RTL_TEXTENCODING_UTF8)); break; } @@ -362,10 +367,10 @@ bool AstAttribute::dumpBlob( accessMode |= RT_ACCESS_REMOVABLE; } - OUString name(OUString::fromUtf8(getLocalName())); + OUString name(OStringToOUString(getLocalName(), RTL_TEXTENCODING_UTF8)); rBlob.setFieldData( index, getDocumentation(), OUString(), accessMode, name, - OUString::fromUtf8(getType()->getRelativName()), + OStringToOUString(getType()->getRelativName(), RTL_TEXTENCODING_UTF8), RTConstValue()); dumpExceptions( rBlob, m_getDocumentation, m_getExceptions, RT_MODE_ATTRIBUTE_GET, @@ -388,7 +393,7 @@ void AstAttribute::dumpExceptions( // AstInterface::dump: writer.setMethodData( idx, documentation, flags, - OUString::fromUtf8(getLocalName()), + OStringToOUString(getLocalName(), RTL_TEXTENCODING_UTF8), OUString("void"), 0, static_cast< sal_uInt16 >(exceptions.size())); sal_uInt16 exceptionIndex = 0; @@ -397,7 +402,8 @@ void AstAttribute::dumpExceptions( { writer.setMethodExceptionTypeName( idx, exceptionIndex++, - OUString::fromUtf8((*i)->getRelativName())); + OStringToOUString( + (*i)->getRelativName(), RTL_TEXTENCODING_UTF8)); } } } diff --git a/idlc/source/astenum.cxx b/idlc/source/astenum.cxx index 7332f1c76d32..1f330b18f780 100644 --- a/idlc/source/astenum.cxx +++ b/idlc/source/astenum.cxx @@ -60,7 +60,7 @@ AstConstant* AstEnum::checkValue(AstExpression* pExpr) bool AstEnum::dump(RegistryKey& rKey) { RegistryKey localKey; - if (rKey.createKey( OUString::fromUtf8(getFullName()), localKey)) + if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey)) { fprintf(stderr, "%s: warning, could not create key '%s' in '%s'\n", idlc()->getOptions()->getProgramName().getStr(), @@ -75,7 +75,7 @@ bool AstEnum::dump(RegistryKey& rKey) typereg::Writer aBlob( m_bPublished ? TYPEREG_VERSION_1 : TYPEREG_VERSION_0, getDocumentation(), emptyStr, RT_TYPE_ENUM, m_bPublished, - OUString::fromUtf8(getRelativName()), 0, + OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8), 0, nConst, 0, 0); DeclList::const_iterator iter = getIteratorBegin(); diff --git a/idlc/source/astinterface.cxx b/idlc/source/astinterface.cxx index 4f5affb721af..8bd8fb7cbfd9 100644 --- a/idlc/source/astinterface.cxx +++ b/idlc/source/astinterface.cxx @@ -103,7 +103,7 @@ bool AstInterface::dump(RegistryKey& rKey) return true; RegistryKey localKey; - if (rKey.createKey( OUString::fromUtf8(getFullName()), localKey)) + if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey)) { fprintf(stderr, "%s: warning, could not create key '%s' in '%s'\n", idlc()->getOptions()->getProgramName().getStr(), @@ -194,7 +194,7 @@ bool AstInterface::dump(RegistryKey& rKey) OUString emptyStr; typereg::Writer aBlob( version, getDocumentation(), emptyStr, RT_TYPE_INTERFACE, m_bPublished, - OUString::fromUtf8(getRelativName()), nBaseTypes, + OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8), nBaseTypes, nAttributes, nMethods, nReferences); sal_uInt16 superTypeIndex = 0; @@ -206,11 +206,15 @@ bool AstInterface::dump(RegistryKey& rKey) aBlob.setReferenceData( referenceIndex++, i->getDocumentation(), RT_REF_SUPPORTS, RT_ACCESS_OPTIONAL, - OUString::fromUtf8(i->getInterface()->getRelativName())); + OStringToOUString( + i->getInterface()->getRelativName(), + RTL_TEXTENCODING_UTF8)); } else { aBlob.setSuperTypeName( superTypeIndex++, - OUString::fromUtf8(i->getInterface()->getRelativName())); + OStringToOUString( + i->getInterface()->getRelativName(), + RTL_TEXTENCODING_UTF8)); } } diff --git a/idlc/source/astoperation.cxx b/idlc/source/astoperation.cxx index bcc23ec14907..5a38c8acbc20 100644 --- a/idlc/source/astoperation.cxx +++ b/idlc/source/astoperation.cxx @@ -48,11 +48,12 @@ bool AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index) if (m_pReturnType == 0) { returnTypeName = "void"; } else { - returnTypeName = OUString::fromUtf8(m_pReturnType->getRelativName()); + returnTypeName = OStringToOUString( + m_pReturnType->getRelativName(), RTL_TEXTENCODING_UTF8); } rBlob.setMethodData( index, getDocumentation(), methodMode, - OUString::fromUtf8(getLocalName()), + OStringToOUString(getLocalName(), RTL_TEXTENCODING_UTF8), returnTypeName, nParam, nExcep); if ( nParam ) @@ -90,8 +91,11 @@ bool AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index) rBlob.setMethodParameterData( index, paramIndex++, paramMode, - OUString::fromUtf8(pDecl->getLocalName()), - OUString::fromUtf8(pParam->getType()->getRelativName())); + OStringToOUString( + pDecl->getLocalName(), RTL_TEXTENCODING_UTF8), + OStringToOUString( + pParam->getType()->getRelativName(), + RTL_TEXTENCODING_UTF8)); } ++iter; } @@ -106,7 +110,8 @@ bool AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index) { rBlob.setMethodExceptionTypeName( index, exceptIndex++, - OUString::fromUtf8((*iter)->getRelativName())); + OStringToOUString( + (*iter)->getRelativName(), RTL_TEXTENCODING_UTF8)); ++iter; } } diff --git a/idlc/source/aststruct.cxx b/idlc/source/aststruct.cxx index b8f0a2e3a264..482ee73dadfa 100644 --- a/idlc/source/aststruct.cxx +++ b/idlc/source/aststruct.cxx @@ -78,7 +78,7 @@ bool AstStruct::isType() const { bool AstStruct::dump(RegistryKey& rKey) { RegistryKey localKey; - if (rKey.createKey( OUString::fromUtf8(getFullName()), localKey)) + if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey)) { fprintf(stderr, "%s: warning, could not create key '%s' in '%s'\n", idlc()->getOptions()->getProgramName().getStr(), @@ -107,13 +107,14 @@ bool AstStruct::dump(RegistryKey& rKey) (m_typeParameters.empty() && !m_bPublished ? TYPEREG_VERSION_0 : TYPEREG_VERSION_1), getDocumentation(), emptyStr, typeClass, m_bPublished, - OUString::fromUtf8(getRelativName()), + OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8), m_pBaseType == 0 ? 0 : 1, nMember, 0, static_cast< sal_uInt16 >(m_typeParameters.size())); if (m_pBaseType != 0) { aBlob.setSuperTypeName( 0, - OUString::fromUtf8(m_pBaseType->getRelativName())); + OStringToOUString( + m_pBaseType->getRelativName(), RTL_TEXTENCODING_UTF8)); } if ( nMember > 0 ) @@ -139,8 +140,9 @@ bool AstStruct::dump(RegistryKey& rKey) } aBlob.setFieldData( index++, pMember->getDocumentation(), emptyStr, flags, - OUString::fromUtf8(pMember->getLocalName()), - OUString::fromUtf8(typeName), + OStringToOUString( + pMember->getLocalName(), RTL_TEXTENCODING_UTF8), + OStringToOUString(typeName, RTL_TEXTENCODING_UTF8), RTConstValue()); } ++iter; @@ -153,7 +155,8 @@ bool AstStruct::dump(RegistryKey& rKey) { aBlob.setReferenceData( index++, emptyStr, RT_REF_TYPE_PARAMETER, RT_ACCESS_INVALID, - OUString::fromUtf8((*i)->getLocalName())); + OStringToOUString( + (*i)->getLocalName(), RTL_TEXTENCODING_UTF8)); } sal_uInt32 aBlobSize; diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx index b5ed727b9e5a..75a71dfa6a6b 100644 --- a/idlc/source/idlc.cxx +++ b/idlc/source/idlc.cxx @@ -272,7 +272,7 @@ OUString Idlc::processDocumentation() if (m_bIsDocValid) { OString raw(getDocumentation()); if (m_bGenerateDoc) { - doc = OUString::fromUtf8(raw); + doc = OStringToOUString(raw, RTL_TEXTENCODING_UTF8); } else if (raw.indexOf("@deprecated") != -1) { //TODO: this check is somewhat crude doc = "@deprecated"; diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index 53fd802fc5f6..695db41d2097 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -258,8 +258,9 @@ sal_Int32 compileFile(const OString * pathname) { cppArgs.append("-I"); cppArgs.append(filePath); - lCppArgs.push_back(OUString::fromUtf8( - cppArgs.makeStringAndClear().replace('\\', '/'))); + lCppArgs.push_back(OStringToOUString( + cppArgs.makeStringAndClear().replace('\\', '/'), + RTL_TEXTENCODING_UTF8)); } } @@ -271,7 +272,7 @@ sal_Int32 compileFile(const OString * pathname) { token = dOpt.getToken( 0, ' ', nIndex ); if (token.getLength()) - lCppArgs.push_back(OUString::fromUtf8("-D" + token)); + lCppArgs.push_back(OStringToOUString("-D" + token, RTL_TEXTENCODING_UTF8)); } while( nIndex != -1 ); } @@ -283,17 +284,17 @@ sal_Int32 compileFile(const OString * pathname) { token = incOpt.getToken( 0, ' ', nIndex ); if (token.getLength()) - lCppArgs.push_back(OUString::fromUtf8("-I" + token)); + lCppArgs.push_back(OStringToOUString("-I" + token, RTL_TEXTENCODING_UTF8)); } while( nIndex != -1 ); } lCppArgs.push_back(OUString("-o")); cppArgs.append(preprocFile); - lCppArgs.push_back(OUString::fromUtf8(cppArgs.makeStringAndClear())); + lCppArgs.push_back(OStringToOUString(cppArgs.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); cppArgs.append(tmpFile); - lCppArgs.push_back(OUString::fromUtf8(cppArgs.makeStringAndClear())); + lCppArgs.push_back(OStringToOUString(cppArgs.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); OUString cpp; OUString startDir; diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx index d7dd9f1c7946..35a3a20a5517 100644 --- a/idlc/source/idlcproduce.cxx +++ b/idlc/source/idlcproduce.cxx @@ -119,7 +119,7 @@ static bool cleanPath() void removeIfExists(const OString& pathname) { - osl::File::remove(OUString::fromUtf8(pathname)); + osl::File::remove(OStringToOUString(pathname, RTL_TEXTENCODING_UTF8)); } sal_Int32 SAL_CALL @@ -154,7 +154,7 @@ produceFile(const OString& regFileName, sPair_t const*const pDepFile) OString urlRegTmpName = convertToFileUrl(regTmpName); Registry regFile; - if ( regFile.create(OUString::fromUtf8(urlRegTmpName)) != REG_NO_ERROR ) + if ( regFile.create(OStringToOUString(urlRegTmpName, RTL_TEXTENCODING_UTF8)) != REG_NO_ERROR ) { fprintf(stderr, "%s: could not create registry file '%s'\n", pOptions->getProgramName().getStr(), regTmpName.getStr()); @@ -184,7 +184,7 @@ produceFile(const OString& regFileName, sPair_t const*const pDepFile) fprintf(stderr, "%s: could not close registry file '%s'\n", pOptions->getProgramName().getStr(), regFileName.getStr()); } - regFile.destroy(OUString::fromUtf8(regFileName)); + regFile.destroy(OStringToOUString(regFileName, RTL_TEXTENCODING_UTF8)); removeIfExists(regFileName); cleanPath(); return 1; diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx index cf6e46de9150..dfdb9bd291a9 100644 --- a/idlc/source/options.cxx +++ b/idlc/source/options.cxx @@ -197,7 +197,7 @@ bool Options::setOption(char const * option, std::string const & rArg) with error. */ OString convertIncPathtoShortWindowsPath(const OString& incPath) { - OUString path = OUString::fromUtf8(incPath); + OUString path = OStringToOUString(incPath, RTL_TEXTENCODING_UTF8); std::vector<sal_Unicode> vec(path.getLength() + 1); //GetShortPathNameW only works if the file can be found! diff --git a/idlc/source/parser.y b/idlc/source/parser.y index a9267ac17ad5..400778026c9c 100644 --- a/idlc/source/parser.y +++ b/idlc/source/parser.y @@ -61,6 +61,7 @@ using ::rtl::OUString; using ::rtl::OString; +using ::rtl::OStringToOUString; using ::rtl::OStringBuffer; extern int yylex(void); @@ -896,7 +897,8 @@ attribute_get_raises: IDL_GET raises ';' { $$.documentation = new rtl::OUString( - rtl::OUString::fromUtf8(idlc()->getDocumentation())); + rtl::OStringToOUString( + idlc()->getDocumentation(), RTL_TEXTENCODING_UTF8)); $$.exceptions = $2; } ; @@ -918,7 +920,8 @@ attribute_set_raises: raises ';' { $$.documentation = new rtl::OUString( - rtl::OUString::fromUtf8(idlc()->getDocumentation())); + rtl::OStringToOUString( + idlc()->getDocumentation(), RTL_TEXTENCODING_UTF8)); $$.exceptions = $3; } ; @@ -1200,7 +1203,8 @@ interface_inheritance_decl: } else { addInheritedInterface( ifc, *$4, $1, - rtl::OUString::fromUtf8(idlc()->getDocumentation())); + rtl::OStringToOUString( + idlc()->getDocumentation(), RTL_TEXTENCODING_UTF8)); } delete $4; } |