Kaydet (Commit) 853c2fc7 authored tarafından Michael Stahl's avatar Michael Stahl

sal: try to avoid abuse of OUStringBuffer(int) ctor

... to avoid bugs like commit f0d6e0e1.

Change-Id: I1e41d421609e09bf62a7a04ba34f3a8e8d118fd3
üst ba68436e
...@@ -96,6 +96,23 @@ public: ...@@ -96,6 +96,23 @@ public:
{ {
rtl_string_new_WithLength( &pData, length ); rtl_string_new_WithLength( &pData, length );
} }
#if __cplusplus >= 201103L
explicit OStringBuffer(unsigned int length)
: OStringBuffer(static_cast<int>(length))
{
}
explicit OStringBuffer(long length)
: OStringBuffer(static_cast<int>(length))
{
}
explicit OStringBuffer(unsigned long length)
: OStringBuffer(static_cast<int>(length))
{
}
// avoid obvious bugs
explicit OStringBuffer(char) = delete;
explicit OStringBuffer(sal_Unicode) = delete;
#endif
/** /**
Constructs a string buffer so that it represents the same Constructs a string buffer so that it represents the same
......
...@@ -91,6 +91,23 @@ public: ...@@ -91,6 +91,23 @@ public:
{ {
rtl_uString_new_WithLength( &pData, length ); rtl_uString_new_WithLength( &pData, length );
} }
#if __cplusplus >= 201103L
explicit OUStringBuffer(unsigned int length)
: OUStringBuffer(static_cast<int>(length))
{
}
explicit OUStringBuffer(long length)
: OUStringBuffer(static_cast<int>(length))
{
}
explicit OUStringBuffer(unsigned long length)
: OUStringBuffer(static_cast<int>(length))
{
}
// avoid obvious bugs
explicit OUStringBuffer(char) = delete;
explicit OUStringBuffer(sal_Unicode) = delete;
#endif
/** /**
Constructs a string buffer so that it represents the same Constructs a string buffer so that it represents the same
......
...@@ -374,7 +374,8 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam, // multiple (repeate ...@@ -374,7 +374,8 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam, // multiple (repeate
} }
ScRefAddress aRef; ScRefAddress aRef;
OUStringBuffer aForString('='); OUStringBuffer aForString;
aForString.append('=');
aForString.append(ScCompiler::GetNativeSymbol(ocTableOp)); aForString.append(ScCompiler::GetNativeSymbol(ocTableOp));
aForString.append(ScCompiler::GetNativeSymbol( ocOpen)); aForString.append(ScCompiler::GetNativeSymbol( ocOpen));
......
...@@ -375,7 +375,8 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam ...@@ -375,7 +375,8 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam
ScDocument* pDoc = &mpImpl->mrDoc; ScDocument* pDoc = &mpImpl->mrDoc;
ScRefAddress aRef; ScRefAddress aRef;
OUStringBuffer aFormulaBuf('='); OUStringBuffer aFormulaBuf;
aFormulaBuf.append('=');
aFormulaBuf.append(ScCompiler::GetNativeSymbol(ocTableOp)); aFormulaBuf.append(ScCompiler::GetNativeSymbol(ocTableOp));
aFormulaBuf.append(ScCompiler::GetNativeSymbol(ocOpen)); aFormulaBuf.append(ScCompiler::GetNativeSymbol(ocOpen));
......
...@@ -133,7 +133,7 @@ void XMLCharContext::EndElement() ...@@ -133,7 +133,7 @@ void XMLCharContext::EndElement()
} }
else else
{ {
OUStringBuffer sBuff( m_nCount ); OUStringBuffer sBuff(static_cast<int>(m_nCount));
while( m_nCount-- ) while( m_nCount-- )
sBuff.append( &m_c, 1 ); sBuff.append( &m_c, 1 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment