Make the OUString ctors taking raw sal_Unicode pointer/non-const array explicit

...and in turn add OUString::operator = and OUString::operator +=
overloads that take a std::u16string_view.  Without making the ctors explicit,
the operator overloads would have caused ambiguities when called with raw
sal_Unicode pointers/non-const arrays, as those can convert to both OUString and
to std::u16string_view.

But the std::u16string_view operator overloads will generally be useful when
changing OUStringLiteral similarly to 4b9e440c51be3e40326bc90c33ae69885bfb51e4
"Turn OStringLiteral into a consteval'ed, static-refcound rtl_String", at which
point many existing uses of OUStringLiteral will be replaced with uses of
std::u16string_view.

Implementing this change turned up a need for an operator = overload for
OUStringNumber, which has thus been added.  No such need turned up for a
corresponding operator += overload, but which can easily be added when the need
arises.

It also revealed that the operator == overloads between an OUString and a raw
sal_Unicode pointer/non-const array were implemented rather inefficiently,
creating a temporary OUString from the raw argument.  Those have been improved.

Preceding commits have already taken care of many dubious or simply unnecessary
implicit uses of the now-explicit OUString ctors.  This commit makes explicit
the few remaining reasonable uses.  (And in some cases needed to change variable
initialization syntax from using parentheses to using curly braces, to avoid the
most vexing parse issue.  And needed to explicitly add OUString ctors from
char16 const[2] string literal lvalues in a conditional expression in
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx that are only necessary
because MSVC apparently still insists on doing array-to-pointer decay there.)

All of this only affects LIBO_INTERNAL_ONLY.

Change-Id: I7ce31162e9be1c3ff3c0bd184a34b535ec56be9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102098
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2020-09-05 21:45:38 +02:00
parent fbcdbfef86
commit c927aab29e
23 changed files with 139 additions and 98 deletions

View File

@ -414,7 +414,7 @@ void SbRtl_CurDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
_set_thread_local_invalid_parameter_handler(handler);
if ( ok )
{
rPar.Get32(0)->PutString( o3tl::toU(pBuffer) );
rPar.Get32(0)->PutString( OUString(o3tl::toU(pBuffer)) );
}
else
{

View File

@ -45,8 +45,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP EmbedDocument_Impl::SetHostNames( LPCOLESTR sz
// the code should be ignored for links
if ( !m_aFileName.getLength() )
{
m_pDocHolder->setTitle(o3tl::toU(szContainerObj));
m_pDocHolder->setContainerName(o3tl::toU(szContainerApp));
m_pDocHolder->setTitle(OUString(o3tl::toU(szContainerObj)));
m_pDocHolder->setContainerName(OUString(o3tl::toU(szContainerApp)));
}
return S_OK;

View File

@ -2866,7 +2866,7 @@ HRESULT InterfaceOleWrapper::InvokeGeneral( DISPID dispidMember, unsigned short
CComVariant arg;
if( pdispparams->cArgs == 1 && SUCCEEDED( arg.ChangeType( VT_BSTR, &pdispparams->rgvarg[0])) )
{
Reference<XIdlClass> classStruct= xRefl->forName(o3tl::toU(arg.bstrVal));
Reference<XIdlClass> classStruct= xRefl->forName(OUString(o3tl::toU(arg.bstrVal)));
if( classStruct.is())
{
Any anyStruct;

View File

@ -102,7 +102,7 @@ static OUString lcl_getURLFromShellItem (IShellItem* pItem)
hr = pItem->GetDisplayName ( SIGDN_FILESYSPATH, &pStr );
if (SUCCEEDED(hr))
{
::osl::FileBase::getFileURLFromSystemPath( o3tl::toU(pStr), sURL );
::osl::FileBase::getFileURLFromSystemPath( OUString(o3tl::toU(pStr)), sURL );
goto cleanup;
}
@ -128,7 +128,7 @@ static OUString lcl_getURLFromShellItem (IShellItem* pItem)
hr = SHGetKnownFolderPath(known_folder_id, 0, nullptr, &pStr);
if (SUCCEEDED(hr))
{
::osl::FileBase::getFileURLFromSystemPath(o3tl::toU(pStr), sURL);
::osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(pStr)), sURL);
goto cleanup;
}
}
@ -137,7 +137,7 @@ static OUString lcl_getURLFromShellItem (IShellItem* pItem)
// Default fallback
hr = SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &pStr);
if (SUCCEEDED(hr))
::osl::FileBase::getFileURLFromSystemPath(o3tl::toU(pStr), sURL);
::osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(pStr)), sURL);
else // shouldn't happen...
goto bailout;

View File

@ -3826,9 +3826,9 @@ void HwpReader::makePicture(Picture * hbox)
padd("xlink:type", sXML_CDATA, "simple");
#ifdef _WIN32
if( hbox->follow[4] != 0 )
padd("xlink:href", sXML_CDATA, reinterpret_cast<sal_Unicode const *>(hconv(kstr2hstr(hbox->follow.data() + 4).c_str())));
padd("xlink:href", sXML_CDATA, fromHcharStringToOUString(hstr2ucsstr(kstr2hstr(hbox->follow.data() + 4).c_str())));
else
padd("xlink:href", sXML_CDATA, reinterpret_cast<sal_Unicode const *>(hconv(kstr2hstr(hbox->follow.data() + 5).c_str())));
padd("xlink:href", sXML_CDATA, fromHcharStringToOUString(hstr2ucsstr(kstr2hstr(hbox->follow.data() + 5).c_str())));
#else
if( hbox->follow[4] != 0 )
padd("xlink:href", sXML_CDATA,
@ -3887,7 +3887,7 @@ void HwpReader::makePicture(Picture * hbox)
if ( hbox->pictype == PICTYPE_FILE ){
#ifdef _WIN32
sprintf(buf, "file:///%s", hbox->picinfo.picun.path );
padd("xlink:href", sXML_CDATA, reinterpret_cast<sal_Unicode const *>(hconv(kstr2hstr(reinterpret_cast<uchar *>(buf)).c_str())));
padd("xlink:href", sXML_CDATA, fromHcharStringToOUString(hstr2ucsstr(kstr2hstr(reinterpret_cast<uchar *>(buf)).c_str())));
#else
padd("xlink:href", sXML_CDATA,
fromHcharStringToOUString(hstr2ucsstr(kstr2hstr(reinterpret_cast<uchar const *>(urltounix(hbox->picinfo.picun.path).c_str())).c_str())));

View File

@ -403,26 +403,26 @@ LocaleDataImpl::getLocaleItem( const Locale& rLocale )
sal_Int16 dataItemCount = 0;
sal_Unicode **dataItem = func(dataItemCount);
LocaleDataItem item(
dataItem[0],
dataItem[1],
dataItem[2],
dataItem[3],
dataItem[4],
dataItem[5],
dataItem[6],
dataItem[7],
dataItem[8],
dataItem[9],
dataItem[10],
dataItem[11],
dataItem[12],
dataItem[13],
dataItem[14],
dataItem[15],
dataItem[16],
dataItem[17]
);
LocaleDataItem item{
OUString(dataItem[0]),
OUString(dataItem[1]),
OUString(dataItem[2]),
OUString(dataItem[3]),
OUString(dataItem[4]),
OUString(dataItem[5]),
OUString(dataItem[6]),
OUString(dataItem[7]),
OUString(dataItem[8]),
OUString(dataItem[9]),
OUString(dataItem[10]),
OUString(dataItem[11]),
OUString(dataItem[12]),
OUString(dataItem[13]),
OUString(dataItem[14]),
OUString(dataItem[15]),
OUString(dataItem[16]),
OUString(dataItem[17])
};
return item;
}
else {
@ -443,27 +443,27 @@ LocaleDataImpl::getLocaleItem2( const Locale& rLocale )
assert(dataItemCount >= 18);
LocaleDataItem2 item(
dataItem[0],
dataItem[1],
dataItem[2],
dataItem[3],
dataItem[4],
dataItem[5],
dataItem[6],
dataItem[7],
dataItem[8],
dataItem[9],
dataItem[10],
dataItem[11],
dataItem[12],
dataItem[13],
dataItem[14],
dataItem[15],
dataItem[16],
dataItem[17],
dataItemCount >= 19 ? dataItem[18] : OUString()
);
LocaleDataItem2 item{
OUString(dataItem[0]),
OUString(dataItem[1]),
OUString(dataItem[2]),
OUString(dataItem[3]),
OUString(dataItem[4]),
OUString(dataItem[5]),
OUString(dataItem[6]),
OUString(dataItem[7]),
OUString(dataItem[8]),
OUString(dataItem[9]),
OUString(dataItem[10]),
OUString(dataItem[11]),
OUString(dataItem[12]),
OUString(dataItem[13]),
OUString(dataItem[14]),
OUString(dataItem[15]),
OUString(dataItem[16]),
OUString(dataItem[17]),
dataItemCount >= 19 ? OUString(dataItem[18]) : OUString()
};
return item;
}
else {
@ -719,8 +719,9 @@ Sequence< CalendarItem2 > LocaleDataImpl::getCalendarItems(
case REF_PMONTHS:
for (CalendarItem2& rItem : aItems)
{
CalendarItem2 item( allCalendars[rnOffset], allCalendars[rnOffset+1],
allCalendars[rnOffset+2], allCalendars[rnOffset+3]);
CalendarItem2 item{ OUString(allCalendars[rnOffset]),
OUString(allCalendars[rnOffset+1]),
OUString(allCalendars[rnOffset+2]), OUString(allCalendars[rnOffset+3])};
rItem = item;
rnOffset += 4;
}
@ -729,8 +730,9 @@ Sequence< CalendarItem2 > LocaleDataImpl::getCalendarItems(
// Absent narrow name.
for (CalendarItem2& rItem : aItems)
{
CalendarItem2 item( allCalendars[rnOffset], allCalendars[rnOffset+1],
allCalendars[rnOffset+2], OUString());
CalendarItem2 item{ OUString(allCalendars[rnOffset]),
OUString(allCalendars[rnOffset+1]),
OUString(allCalendars[rnOffset+2]), OUString()};
rItem = item;
rnOffset += 3;
}
@ -812,10 +814,10 @@ LocaleDataImpl::getAllCurrencies2( const Locale& rLocale )
Sequence< Currency2 > seq(currencyCount);
for(int i = 0, nOff = 0; i < currencyCount; i++, nOff += 8 ) {
Currency2 cur(
allCurrencies[nOff], // string ID
allCurrencies[nOff+1], // string Symbol
allCurrencies[nOff+2], // string BankSymbol
allCurrencies[nOff+3], // string Name
OUString(allCurrencies[nOff]), // string ID
OUString(allCurrencies[nOff+1]), // string Symbol
OUString(allCurrencies[nOff+2]), // string BankSymbol
OUString(allCurrencies[nOff+3]), // string Name
allCurrencies[nOff+4][0] != 0, // boolean Default
allCurrencies[nOff+5][0] != 0, // boolean UsedInCompatibleFormatCodes
allCurrencies[nOff+6][0], // short DecimalPlaces
@ -876,10 +878,10 @@ LocaleDataImpl::getAllFormats( const Locale& rLocale )
{
FormatElement elem(
OUString(formatArray[nOff]).replaceAll(s.from, s.to),
formatArray[nOff + 1],
formatArray[nOff + 2],
formatArray[nOff + 3],
formatArray[nOff + 4],
OUString(formatArray[nOff + 1]),
OUString(formatArray[nOff + 2]),
OUString(formatArray[nOff + 3]),
OUString(formatArray[nOff + 4]),
formatArray[nOff + 5][0],
formatArray[nOff + 6][0] != 0);
seq[f] = elem;
@ -944,7 +946,8 @@ LocaleDataImpl::getCollatorImplementations( const Locale& rLocale )
sal_Unicode **collatorArray = func(collatorCount);
Sequence< Implementation > seq(collatorCount);
for(sal_Int16 i = 0; i < collatorCount; i++) {
Implementation impl(collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_ALGO],
Implementation impl(
OUString(collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_ALGO]),
collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_DEFAULT][0] != 0);
seq[i] = impl;
}
@ -1163,11 +1166,11 @@ LocaleDataImpl::getLanguageCountryInfo( const Locale& rLocale )
if ( func ) {
sal_Int16 LCInfoCount = 0;
sal_Unicode **LCInfoArray = func(LCInfoCount);
LanguageCountryInfo info(LCInfoArray[0],
LCInfoArray[1],
LCInfoArray[2],
LCInfoArray[3],
LCInfoArray[4]);
LanguageCountryInfo info{OUString(LCInfoArray[0]),
OUString(LCInfoArray[1]),
OUString(LCInfoArray[2]),
OUString(LCInfoArray[3]),
OUString(LCInfoArray[4])};
return info;
}
else {
@ -1186,7 +1189,8 @@ LocaleDataImpl::getForbiddenCharacters( const Locale& rLocale )
if ( func ) {
sal_Int16 LCForbiddenCharactersCount = 0;
sal_Unicode **LCForbiddenCharactersArray = func(LCForbiddenCharactersCount);
ForbiddenCharacters chars(LCForbiddenCharactersArray[0], LCForbiddenCharactersArray[1]);
ForbiddenCharacters chars{
OUString(LCForbiddenCharactersArray[0]), OUString(LCForbiddenCharactersArray[1])};
return chars;
}
else {

View File

@ -213,14 +213,14 @@ public:
#if defined LIBO_INTERNAL_ONLY
template<typename T> OUString(
template<typename T> explicit OUString(
T const & value,
typename libreoffice_internal::CharPtrDetector<T, libreoffice_internal::Dummy>::TypeUtf16
= libreoffice_internal::Dummy()):
pData(nullptr)
{ rtl_uString_newFromStr(&pData, value); }
template<typename T> OUString(
template<typename T> explicit OUString(
T & value,
typename
libreoffice_internal::NonConstCharArrayDetector<T, libreoffice_internal::Dummy>::TypeUtf16
@ -560,6 +560,22 @@ public:
}
return *this;
}
template<typename T>
OUString & operator =(OUStringNumber<T> && n) {
// n.length should never be zero, so no need to add an optimization for that case
rtl_uString_newFromStr_WithLength(&pData, n.buf, n.length);
return *this;
}
OUString & operator =(std::u16string_view sv) {
if (sv.empty()) {
rtl_uString_new(&pData);
} else {
rtl_uString_newFromStr_WithLength(&pData, sv.data(), sv.size());
}
return *this;
}
#endif
#if defined LIBO_INTERNAL_ONLY
@ -642,6 +658,15 @@ public:
return *this;
}
void operator +=(OUStringLiteral const &) && = delete;
OUString & operator +=(std::u16string_view sv) & {
if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
throw std::bad_alloc();
}
rtl_uString_newConcatUtf16L(&pData, pData, sv.data(), sv.size());
return *this;
}
void operator +=(std::u16string_view) && = delete;
#endif
#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
@ -1614,18 +1639,30 @@ public:
#if defined LIBO_INTERNAL_ONLY
template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
operator ==(OUString const & s1, T const & s2) { return s1.compareTo(s2) == 0; }
operator ==(OUString const & s1, T const & s2) {
return rtl_ustr_compare_WithLength(s1.getStr(), s1.getLength(), s2, rtl_ustr_getLength(s2))
== 0;
}
template<typename T>
friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
operator ==(OUString const & s1, T & s2) { return s1.compareTo(s2) == 0; }
operator ==(OUString const & s1, T & s2) {
return rtl_ustr_compare_WithLength(s1.getStr(), s1.getLength(), s2, rtl_ustr_getLength(s2))
== 0;
}
template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
operator ==(T const & s1, OUString const & s2) { return s2.compareTo(s1) == 0; }
operator ==(T const & s1, OUString const & s2) {
return rtl_ustr_compare_WithLength(s1, rtl_ustr_getLength(s1), s2.getStr(), s2.getLength())
== 0;
}
template<typename T>
friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
operator ==(T & s1, OUString const & s2) { return s2.compareTo(s1) == 0; }
operator ==(T & s1, OUString const & s2) {
return rtl_ustr_compare_WithLength(s1, rtl_ustr_getLength(s1), s2.getStr(), s2.getLength())
== 0;
}
template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
operator !=(OUString const & s1, T const & s2) { return !(s1 == s2); }

View File

@ -174,7 +174,7 @@ namespace
}
else
{
has_parent = !osl::systemPathIsLogicalDrivePattern(path);
has_parent = !osl::systemPathIsLogicalDrivePattern(OUString(path));
}
return has_parent;
}

View File

@ -102,7 +102,7 @@ namespace /* private */
while (size_t l = wcslen(p))
{
environment->push_back(o3tl::toU(p));
environment->push_back(OUString(o3tl::toU(p)));
p += l + 1;
}
FreeEnvironmentStringsW(env);

View File

@ -651,7 +651,7 @@ oslSocketResult SAL_CALL osl_getLocalHostname (rtl_uString **strLocalHostname)
if (rtl_ustr_getLength(LocalHostname) > 0)
{
return {osl_Socket_Ok, LocalHostname};
return {osl_Socket_Ok, OUString(LocalHostname)};
}
return {osl_Socket_Error, OUString()};

View File

@ -4975,14 +4975,14 @@ namespace osl_Directory
if (i == path.getLength())
buffer[i] = 0;
Directory::remove(buffer);
Directory::remove(OUString(buffer));
i = rtl_ustr_lastIndexOfChar(buffer, '/');
assert(i != -1);
if (i != -1)
{
buffer[i] = 0;
Directory::remove(buffer);
Directory::remove(OUString(buffer));
}
}

View File

@ -389,7 +389,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
if ( ( lRet == ERROR_SUCCESS ) && ( Type == REG_SZ ) && ( _waccess( o3tl::toW(PathW), 0 ) == 0 ) )
{
CPPUNIT_ASSERT_EQUAL_MESSAGE( "#Convert from system path to URL failed.",
::osl::File::E_None, ::osl::File::getFileURLFromSystemPath( PathW, strConfigDirectory ) );
::osl::File::E_None, ::osl::File::getFileURLFromSystemPath( OUString(PathW), strConfigDirectory ) );
}
lSize = sizeof(PathW);
@ -397,7 +397,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
if ( ( lRet == ERROR_SUCCESS ) && ( Type == REG_SZ ) && ( _waccess( o3tl::toW(PathW), 0 ) == 0 ) )
{
CPPUNIT_ASSERT_EQUAL_MESSAGE( "#Convert from system path to URL failed.",
::osl::File::E_None, ::osl::File::getFileURLFromSystemPath( PathW, strHomeDirectory ) );
::osl::File::E_None, ::osl::File::getFileURLFromSystemPath( OUString(PathW), strHomeDirectory ) );
}
RegCloseKey(hRegKey);

View File

@ -2938,7 +2938,7 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray )
else
{
// Old (deprecated) addins first for legacy.
if (ScGlobal::GetLegacyFuncCollection()->findByName(cSymbol))
if (ScGlobal::GetLegacyFuncCollection()->findByName(OUString(cSymbol)))
{
aIntName = cSymbol;
}

View File

@ -1189,7 +1189,7 @@ OUString ModelData_Impl::GetRecommendedDir( const OUString& aSuggestedDir )
if( SUCCEEDED(hRes) )
{
OUString sTempINetFiles;
if( osl::FileBase::getFileURLFromSystemPath(o3tl::toU(sPath), sTempINetFiles) == osl::FileBase::E_None )
if( osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(sPath)), sTempINetFiles) == osl::FileBase::E_None )
bIsInTempPath = !sTempINetFiles.isEmpty() && sLocationURL.startsWith( sTempINetFiles );
}
}

View File

@ -73,7 +73,7 @@ namespace /* private */
lret = RegQueryValueW(hkey, nullptr, buff, &sz);
if (lret == ERROR_SUCCESS)
{
osl::FileBase::getFileURLFromSystemPath(o3tl::toU(buff), altSenddocUrl);
osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(buff)), altSenddocUrl);
}
RegCloseKey(hkey);
}

View File

@ -160,7 +160,7 @@ SotClipboardFormatId DdeData::GetInternalFormat(sal_uLong nFmt)
WCHAR szName[ 256 ];
if(GetClipboardFormatNameW( nFmt, szName, SAL_N_ELEMENTS(szName) ))
return SotExchange::RegisterFormatName( o3tl::toU(szName) );
return SotExchange::RegisterFormatName( OUString(o3tl::toU(szName)) );
}
#endif
break;

View File

@ -379,7 +379,7 @@ DdeItem* DdeInternal::FindItem( DdeTopic& rTopic, HSZ hItem )
// Let's query our subclass
WCHAR chBuf[250];
DdeQueryStringW(pInst->hDdeInstSvr,hItem,chBuf,SAL_N_ELEMENTS(chBuf),CP_WINUNICODE );
bContinue = rTopic.MakeItem( o3tl::toU(chBuf) );
bContinue = rTopic.MakeItem( OUString(o3tl::toU(chBuf)) );
// We need to search again
}
while( bContinue );
@ -625,7 +625,7 @@ DdeItem::DdeItem( const sal_Unicode* p )
{
DdeInstData* pInst = ImpGetInstData();
assert(pInst);
pName = new DdeString( pInst->hDdeInstSvr, p );
pName = new DdeString( pInst->hDdeInstSvr, OUString(p) );
nType = DDEITEM;
pMyTopic = nullptr;
pImpData = nullptr;

View File

@ -1967,8 +1967,8 @@ void SwWW8ImplReader::ImportDopTypography(const WW8DopTypography &rTypo)
{
case 2: // custom
{
i18n::ForbiddenCharacters aForbidden(+rTypo.m_rgxchFPunct,
+rTypo.m_rgxchLPunct);
i18n::ForbiddenCharacters aForbidden(OUString(+rTypo.m_rgxchFPunct),
OUString(+rTypo.m_rgxchLPunct));
// unary + makes sure not to accidentally call the
// OUString(ConstCharArrayDetector<...>::TypeUtf16) ctor that takes the full
// m_rgxchFPunct, m_rgxchLPunct arrays with embedded NULs, instead of just the

View File

@ -2736,7 +2736,7 @@ bool SwTransferable::PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
DWORD nCopied = GetLongPathNameW(o3tl::toW(sSysPath.getStr()),
o3tl::toW(aBuf.get()), 32767);
if (nCopied && nCopied < 32767)
sText = URIHelper::SmartRel2Abs(INetURLObject(), aBuf.get(),
sText = URIHelper::SmartRel2Abs(INetURLObject(), OUString(aBuf.get()),
Link<OUString*, bool>(), false);
}
#endif

View File

@ -29,7 +29,7 @@ OUString UNCToDavURL(LPCWSTR sUNC)
bufURL = std::make_unique<wchar_t[]>(nSize);
nResult = DavGetHTTPFromUNCPath(sUNC, bufURL.get(), &nSize);
}
return nResult == ERROR_SUCCESS ? o3tl::toU(bufURL.get()) : OUString();
return nResult == ERROR_SUCCESS ? OUString(o3tl::toU(bufURL.get())) : OUString();
}
#endif
}

View File

@ -464,7 +464,7 @@ namespace
GetTTGlobalFontInfo( pTTF, &aInfo );
// most importantly: the family name
if( aInfo.ufamily )
o_rResult.SetFamilyName( aInfo.ufamily );
o_rResult.SetFamilyName( OUString(aInfo.ufamily) );
else if( aInfo.family )
o_rResult.SetFamilyName( OStringToOUString( aInfo.family, RTL_TEXTENCODING_ASCII_US ) );
// set weight

View File

@ -548,7 +548,7 @@ static FontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXW& rEnumFont
aDFA.SetSymbolFlag(rLogFont.lfCharSet == SYMBOL_CHARSET);
// get the font face name
aDFA.SetFamilyName(o3tl::toU(rLogFont.lfFaceName));
aDFA.SetFamilyName(OUString(o3tl::toU(rLogFont.lfFaceName)));
// use the face's style name only if it looks reasonable
const wchar_t* pStyleName = rEnumFont.elfStyle;
@ -558,7 +558,7 @@ static FontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXW& rEnumFont
if( *p < 0x0020 )
break;
if( p < pEnd )
aDFA.SetStyleName(o3tl::toU(pStyleName));
aDFA.SetStyleName(OUString(o3tl::toU(pStyleName)));
// heuristics for font quality
// - opentypeTT > truetype
@ -962,7 +962,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFa
wchar_t aFaceName[LF_FACESIZE+60];
if( GetTextFaceW( getHDC(), SAL_N_ELEMENTS(aFaceName), aFaceName ) )
rxFontMetric->SetFamilyName(o3tl::toU(aFaceName));
rxFontMetric->SetFamilyName(OUString(o3tl::toU(aFaceName)));
rxFontMetric->SetMinKashida(pFontInstance->GetKashidaWidth());
rxFontMetric->ImplCalcLineSpacing(pFontInstance.get());

View File

@ -1236,7 +1236,7 @@ void OOXMLFastContextHandlerValue::pushBiDiEmbedLevel()
{
const bool bRtl
= mpValue && mpValue->getInt() == NS_ooxml::LN_Value_ST_Direction_rtl;
OOXMLFactory::characters(this, bRtl ? u"\u202B" : u"\u202A"); // RLE / LRE
OOXMLFactory::characters(this, bRtl ? OUString(u"\u202B") : OUString(u"\u202A")); // RLE / LRE
}
void OOXMLFastContextHandlerValue::popBiDiEmbedLevel()