Kaydet (Commit) 584262fe authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:stringconstant: handle OStringBuffer::append

Change-Id: I283da52c0ee2b63c19e31e9a61ab24997c037a6a
üst e316c4f2
......@@ -99,7 +99,7 @@ OString createFileNameFromType( const OString& destination,
fileNameBuf.append(destination.getStr(), destination.getLength());
if (bWithSeparator)
fileNameBuf.append("/", 1);
fileNameBuf.append("/");
fileNameBuf.append(type.getStr(), type.getLength());
fileNameBuf.append(postfix.getStr(), postfix.getLength());
......
......@@ -49,7 +49,7 @@ namespace {
void appendString(rtl::OStringBuffer & buffer, rtl::OUString const & string) {
buffer.append('"');
for (int i = 0; i < string.getLength(); ++i) {
buffer.append(RTL_CONSTASCII_STRINGPARAM("\\u"));
buffer.append("\\u");
sal_Unicode c = string[i];
if (c < 0x1000) {
buffer.append('0');
......@@ -72,7 +72,7 @@ void createMessage(
{
message.setLength(0);
appendString(message, string1);
message.append(RTL_CONSTASCII_STRINGPARAM(" vs. "));
message.append(" vs. ");
appendString(message, string2);
}
......
......@@ -63,28 +63,28 @@ void testConvertToString(TestConvertToString const & rTest)
rTest.nFlags));
rtl::OStringBuffer aPrefix;
aPrefix.append(RTL_CONSTASCII_STRINGPARAM("{"));
aPrefix.append("{");
for (sal_Int32 i = 0; i < rTest.nLength; ++i)
{
aPrefix.append(RTL_CONSTASCII_STRINGPARAM("U+"));
aPrefix.append("U+");
aPrefix.append(static_cast< sal_Int32 >(rTest.aSource[i]), 16);
if (i + 1 < rTest.nLength)
aPrefix.append(RTL_CONSTASCII_STRINGPARAM(","));
aPrefix.append(",");
}
aPrefix.append(RTL_CONSTASCII_STRINGPARAM("}, "));
aPrefix.append("}, ");
aPrefix.append(static_cast< sal_Int32 >(rTest.nEncoding));
aPrefix.append(RTL_CONSTASCII_STRINGPARAM(", 0x"));
aPrefix.append(", 0x");
aPrefix.append(static_cast< sal_Int32 >(rTest.nFlags), 16);
aPrefix.append(RTL_CONSTASCII_STRINGPARAM(" -> "));
aPrefix.append(" -> ");
if (bSuccess)
{
if (rTest.pStrict == nullptr || !aStrict.equals(rTest.pStrict))
{
rtl::OStringBuffer aMessage(aPrefix);
aMessage.append(RTL_CONSTASCII_STRINGPARAM("strict = \""));
aMessage.append("strict = \"");
aMessage.append(aStrict);
aMessage.append(RTL_CONSTASCII_STRINGPARAM("\""));
aMessage.append("\"");
CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false);
}
}
......@@ -93,22 +93,22 @@ void testConvertToString(TestConvertToString const & rTest)
if (!aStrict.equals(rtl::OString(RTL_CONSTASCII_STRINGPARAM("12345"))))
{
rtl::OStringBuffer aMessage(aPrefix);
aMessage.append(RTL_CONSTASCII_STRINGPARAM("modified output"));
aMessage.append("modified output");
CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false);
}
if (rTest.pStrict != nullptr)
{
rtl::OStringBuffer aMessage(aPrefix);
aMessage.append(RTL_CONSTASCII_STRINGPARAM("failed"));
aMessage.append("failed");
CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false);
}
}
if (!aRelaxed.equals(rTest.pRelaxed))
{
rtl::OStringBuffer aMessage(aPrefix);
aMessage.append(RTL_CONSTASCII_STRINGPARAM("relaxed = \""));
aMessage.append("relaxed = \"");
aMessage.append(aRelaxed);
aMessage.append(RTL_CONSTASCII_STRINGPARAM("\""));
aMessage.append("\"");
CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false);
}
}
......
......@@ -96,10 +96,9 @@ void test::oustring::EndsWith::endsWith()
for (size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) {
rtl::OStringBuffer msg;
appendString(msg, rtl::OString(data[i].str1, data[i].str1Len));
msg.append(
RTL_CONSTASCII_STRINGPARAM(".endsWithIgnoreAsciiCaseAsciiL("));
msg.append(".endsWithIgnoreAsciiCaseAsciiL(");
appendString(msg, rtl::OString(data[i].str2, data[i].str2Len));
msg.append(RTL_CONSTASCII_STRINGPARAM(") == "));
msg.append(") == ");
msg.append(data[i].endsWith);
CPPUNIT_ASSERT_EQUAL_MESSAGE(
msg.getStr(),
......
......@@ -433,7 +433,7 @@ bool PDFObjectRef::emit( EmitContext& rWriteContext ) const
aBuf.append( sal_Int32( m_nNumber ) );
aBuf.append( ' ' );
aBuf.append( sal_Int32( m_nGeneration ) );
aBuf.append( " R", 2 );
aBuf.append( " R" );
return rWriteContext.write( aBuf.getStr(), aBuf.getLength() );
}
......
......@@ -163,8 +163,8 @@ static Writer& OutCSS1_SwFormatLayoutSplit( Writer& rWrt, const SfxPoolItem& rHt
namespace
{
const sal_Char* const sCSS1_rule_end = " }";
const sal_Char* const sCSS1_span_tag_end = "\">";
const sal_Char sCSS1_rule_end[] = " }";
const sal_Char sCSS1_span_tag_end[] = "\">";
const sal_Char cCSS1_style_opt_end = '\"';
const sal_Char* const sHTML_FTN_fontheight = "57%";
......
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