loplugin:stringconstant look for unnecessary OString constructor use
and tweak the methods in check.hxx to make them more flexible when called with dc.Class(xxx ? "foo" : "bar") Change-Id: I881fe628f22121ced4d8849715d6b1c92b092da1 Reviewed-on: https://gerrit.libreoffice.org/64207 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
b9c9c70157
commit
933660e591
@ -24,8 +24,8 @@ class TerminalCheck;
|
|||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck checkRecordDecl(
|
inline ContextCheck checkRecordDecl(
|
||||||
clang::Decl const * decl, clang::TagTypeKind tag, char const (& id)[N]);
|
clang::Decl const * decl, clang::TagTypeKind tag, llvm::StringRef id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,16 +59,13 @@ public:
|
|||||||
|
|
||||||
TypeCheck LvalueReference() const;
|
TypeCheck LvalueReference() const;
|
||||||
|
|
||||||
template<std::size_t N> inline ContextCheck Class(char const (& id)[N])
|
inline ContextCheck Class(llvm::StringRef id) const;
|
||||||
const;
|
|
||||||
|
|
||||||
template<std::size_t N> inline ContextCheck Struct(char const (& id)[N])
|
inline ContextCheck Struct(llvm::StringRef id) const;
|
||||||
const;
|
|
||||||
|
|
||||||
TypeCheck Typedef() const;
|
TypeCheck Typedef() const;
|
||||||
|
|
||||||
template<std::size_t N> inline ContextCheck Typedef(char const (& id)[N])
|
inline ContextCheck Typedef(llvm::StringRef id) const;
|
||||||
const;
|
|
||||||
|
|
||||||
TypeCheck NotSubstTemplateTypeParmType() const;
|
TypeCheck NotSubstTemplateTypeParmType() const;
|
||||||
|
|
||||||
@ -84,22 +81,17 @@ public:
|
|||||||
|
|
||||||
explicit operator bool() const { return decl_ != nullptr; }
|
explicit operator bool() const { return decl_ != nullptr; }
|
||||||
|
|
||||||
template<std::size_t N> inline ContextCheck Class(char const (& id)[N])
|
inline ContextCheck Class(llvm::StringRef id) const;
|
||||||
const;
|
|
||||||
|
|
||||||
template<std::size_t N> inline ContextCheck Struct(char const (& id)[N])
|
inline ContextCheck Struct(llvm::StringRef id) const;
|
||||||
const;
|
|
||||||
|
|
||||||
template<std::size_t N> inline ContextCheck Union(char const (& id)[N])
|
inline ContextCheck Union(llvm::StringRef id) const;
|
||||||
const;
|
|
||||||
|
|
||||||
template<std::size_t N> inline ContextCheck Function(char const (& id)[N])
|
inline ContextCheck Function(llvm::StringRef id) const;
|
||||||
const;
|
|
||||||
|
|
||||||
ContextCheck Operator(clang::OverloadedOperatorKind op) const;
|
ContextCheck Operator(clang::OverloadedOperatorKind op) const;
|
||||||
|
|
||||||
template<std::size_t N> inline ContextCheck Var(char const (& id)[N])
|
inline ContextCheck Var(llvm::StringRef id) const;
|
||||||
const;
|
|
||||||
|
|
||||||
ContextCheck MemberFunction() const;
|
ContextCheck MemberFunction() const;
|
||||||
|
|
||||||
@ -113,24 +105,21 @@ public:
|
|||||||
|
|
||||||
TerminalCheck GlobalNamespace() const;
|
TerminalCheck GlobalNamespace() const;
|
||||||
|
|
||||||
template<std::size_t N> inline ContextCheck Namespace(
|
inline ContextCheck Namespace(llvm::StringRef id) const;
|
||||||
char const (& id)[N]) const;
|
|
||||||
|
|
||||||
TerminalCheck StdNamespace() const;
|
TerminalCheck StdNamespace() const;
|
||||||
|
|
||||||
ContextCheck AnonymousNamespace() const;
|
ContextCheck AnonymousNamespace() const;
|
||||||
|
|
||||||
template<std::size_t N> inline ContextCheck Class(char const (& id)[N])
|
inline ContextCheck Class(llvm::StringRef id) const;
|
||||||
const;
|
|
||||||
|
|
||||||
template<std::size_t N> inline ContextCheck Struct(char const (& id)[N])
|
inline ContextCheck Struct(llvm::StringRef id) const;
|
||||||
const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend DeclCheck;
|
friend DeclCheck;
|
||||||
friend TypeCheck;
|
friend TypeCheck;
|
||||||
template<std::size_t N> friend ContextCheck detail::checkRecordDecl(
|
friend ContextCheck detail::checkRecordDecl(
|
||||||
clang::Decl const * decl, clang::TagTypeKind tag, char const (& id)[N]);
|
clang::Decl const * decl, clang::TagTypeKind tag, llvm::StringRef id);
|
||||||
|
|
||||||
explicit ContextCheck(clang::DeclContext const * context = nullptr):
|
explicit ContextCheck(clang::DeclContext const * context = nullptr):
|
||||||
context_(context) {}
|
context_(context) {}
|
||||||
@ -153,13 +142,13 @@ private:
|
|||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck checkRecordDecl(
|
ContextCheck checkRecordDecl(
|
||||||
clang::Decl const * decl, clang::TagTypeKind tag, char const (& id)[N])
|
clang::Decl const * decl, clang::TagTypeKind tag, llvm::StringRef id)
|
||||||
{
|
{
|
||||||
auto r = llvm::dyn_cast_or_null<clang::RecordDecl>(decl);
|
auto r = llvm::dyn_cast_or_null<clang::RecordDecl>(decl);
|
||||||
if (r != nullptr && r->getTagKind() == tag) {
|
if (r != nullptr && r->getTagKind() == tag) {
|
||||||
auto const i = r->getIdentifier();
|
auto const i = r->getIdentifier();
|
||||||
if (i != nullptr && i->isStr(id)) {
|
if (i != nullptr && i->getName() == id) {
|
||||||
return ContextCheck(r->getDeclContext());
|
return ContextCheck(r->getDeclContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,7 +157,7 @@ template<std::size_t N> ContextCheck checkRecordDecl(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck TypeCheck::Class(char const (& id)[N])
|
ContextCheck TypeCheck::Class(llvm::StringRef id)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
if (!type_.isNull()) {
|
if (!type_.isNull()) {
|
||||||
@ -180,8 +169,7 @@ template<std::size_t N> ContextCheck TypeCheck::Class(char const (& id)[N])
|
|||||||
return ContextCheck();
|
return ContextCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck TypeCheck::Struct(char const (& id)[N])
|
ContextCheck TypeCheck::Struct(llvm::StringRef id) const
|
||||||
const
|
|
||||||
{
|
{
|
||||||
if (!type_.isNull()) {
|
if (!type_.isNull()) {
|
||||||
auto const t = type_->getAs<clang::RecordType>();
|
auto const t = type_->getAs<clang::RecordType>();
|
||||||
@ -192,15 +180,14 @@ template<std::size_t N> ContextCheck TypeCheck::Struct(char const (& id)[N])
|
|||||||
return ContextCheck();
|
return ContextCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck TypeCheck::Typedef(char const (& id)[N])
|
ContextCheck TypeCheck::Typedef(llvm::StringRef id) const
|
||||||
const
|
|
||||||
{
|
{
|
||||||
if (!type_.isNull()) {
|
if (!type_.isNull()) {
|
||||||
if (auto const t = type_->getAs<clang::TypedefType>()) {
|
if (auto const t = type_->getAs<clang::TypedefType>()) {
|
||||||
auto const d = t->getDecl();
|
auto const d = t->getDecl();
|
||||||
auto const i = d->getIdentifier();
|
auto const i = d->getIdentifier();
|
||||||
assert(i != nullptr);
|
assert(i != nullptr);
|
||||||
if (i->isStr(id)) {
|
if (i->getName() == id) {
|
||||||
return ContextCheck(d->getDeclContext());
|
return ContextCheck(d->getDeclContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,58 +195,52 @@ template<std::size_t N> ContextCheck TypeCheck::Typedef(char const (& id)[N])
|
|||||||
return ContextCheck();
|
return ContextCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck DeclCheck::Class(char const (& id)[N])
|
ContextCheck DeclCheck::Class(llvm::StringRef id) const
|
||||||
const
|
|
||||||
{
|
{
|
||||||
return detail::checkRecordDecl(decl_, clang::TTK_Class, id);
|
return detail::checkRecordDecl(decl_, clang::TTK_Class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck DeclCheck::Struct(char const (& id)[N])
|
ContextCheck DeclCheck::Struct(llvm::StringRef id) const
|
||||||
const
|
|
||||||
{
|
{
|
||||||
return detail::checkRecordDecl(decl_, clang::TTK_Struct, id);
|
return detail::checkRecordDecl(decl_, clang::TTK_Struct, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck DeclCheck::Union(char const (& id)[N])
|
ContextCheck DeclCheck::Union(llvm::StringRef id) const
|
||||||
const
|
|
||||||
{
|
{
|
||||||
return detail::checkRecordDecl(decl_, clang::TTK_Union, id);
|
return detail::checkRecordDecl(decl_, clang::TTK_Union, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck DeclCheck::Function(char const (& id)[N])
|
ContextCheck DeclCheck::Function(llvm::StringRef id) const
|
||||||
const
|
|
||||||
{
|
{
|
||||||
auto f = llvm::dyn_cast_or_null<clang::FunctionDecl>(decl_);
|
auto f = llvm::dyn_cast_or_null<clang::FunctionDecl>(decl_);
|
||||||
if (f != nullptr) {
|
if (f != nullptr) {
|
||||||
auto const i = f->getIdentifier();
|
auto const i = f->getIdentifier();
|
||||||
if (i != nullptr && i->isStr(id)) {
|
if (i != nullptr && i->getName() == id) {
|
||||||
return ContextCheck(f->getDeclContext());
|
return ContextCheck(f->getDeclContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ContextCheck();
|
return ContextCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck DeclCheck::Var(char const (& id)[N])
|
ContextCheck DeclCheck::Var(llvm::StringRef id) const
|
||||||
const
|
|
||||||
{
|
{
|
||||||
auto f = llvm::dyn_cast_or_null<clang::VarDecl>(decl_);
|
auto f = llvm::dyn_cast_or_null<clang::VarDecl>(decl_);
|
||||||
if (f != nullptr) {
|
if (f != nullptr) {
|
||||||
auto const i = f->getIdentifier();
|
auto const i = f->getIdentifier();
|
||||||
if (i != nullptr && i->isStr(id)) {
|
if (i != nullptr && i->getName() == id) {
|
||||||
return ContextCheck(f->getDeclContext());
|
return ContextCheck(f->getDeclContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ContextCheck();
|
return ContextCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck ContextCheck::Namespace(
|
ContextCheck ContextCheck::Namespace(llvm::StringRef id) const
|
||||||
char const (& id)[N]) const
|
|
||||||
{
|
{
|
||||||
if (context_) {
|
if (context_) {
|
||||||
auto n = llvm::dyn_cast<clang::NamespaceDecl>(context_);
|
auto n = llvm::dyn_cast<clang::NamespaceDecl>(context_);
|
||||||
if (n != nullptr) {
|
if (n != nullptr) {
|
||||||
auto const i = n->getIdentifier();
|
auto const i = n->getIdentifier();
|
||||||
if (i != nullptr && i->isStr(id)) {
|
if (i != nullptr && i->getName() == id) {
|
||||||
return ContextCheck(n->getParent());
|
return ContextCheck(n->getParent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -267,15 +248,13 @@ template<std::size_t N> ContextCheck ContextCheck::Namespace(
|
|||||||
return ContextCheck();
|
return ContextCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck ContextCheck::Class(char const (& id)[N])
|
ContextCheck ContextCheck::Class(llvm::StringRef id) const
|
||||||
const
|
|
||||||
{
|
{
|
||||||
return detail::checkRecordDecl(
|
return detail::checkRecordDecl(
|
||||||
llvm::dyn_cast_or_null<clang::Decl>(context_), clang::TTK_Class, id);
|
llvm::dyn_cast_or_null<clang::Decl>(context_), clang::TTK_Class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N> ContextCheck ContextCheck::Struct(char const (& id)[N])
|
ContextCheck ContextCheck::Struct(llvm::StringRef id) const
|
||||||
const
|
|
||||||
{
|
{
|
||||||
return detail::checkRecordDecl(
|
return detail::checkRecordDecl(
|
||||||
llvm::dyn_cast_or_null<clang::Decl>(context_), clang::TTK_Struct, id);
|
llvm::dyn_cast_or_null<clang::Decl>(context_), clang::TTK_Struct, id);
|
||||||
|
@ -163,10 +163,23 @@ private:
|
|||||||
CallExpr const * expr, unsigned arg, FunctionDecl const * callee,
|
CallExpr const * expr, unsigned arg, FunctionDecl const * callee,
|
||||||
bool explicitFunctionalCastNotation);
|
bool explicitFunctionalCastNotation);
|
||||||
|
|
||||||
|
void handleOStringCtor(
|
||||||
|
CallExpr const * expr, unsigned arg, FunctionDecl const * callee,
|
||||||
|
bool explicitFunctionalCastNotation);
|
||||||
|
|
||||||
void handleOUStringCtor(
|
void handleOUStringCtor(
|
||||||
Expr const * expr, Expr const * argExpr, FunctionDecl const * callee,
|
Expr const * expr, Expr const * argExpr, FunctionDecl const * callee,
|
||||||
bool explicitFunctionalCastNotation);
|
bool explicitFunctionalCastNotation);
|
||||||
|
|
||||||
|
void handleOStringCtor(
|
||||||
|
Expr const * expr, Expr const * argExpr, FunctionDecl const * callee,
|
||||||
|
bool explicitFunctionalCastNotation);
|
||||||
|
|
||||||
|
enum class StringKind { Unicode, Char };
|
||||||
|
void handleStringCtor(
|
||||||
|
Expr const * expr, Expr const * argExpr, FunctionDecl const * callee,
|
||||||
|
bool explicitFunctionalCastNotation, StringKind stringKind);
|
||||||
|
|
||||||
void handleFunArgOstring(
|
void handleFunArgOstring(
|
||||||
CallExpr const * expr, unsigned arg, FunctionDecl const * callee);
|
CallExpr const * expr, unsigned arg, FunctionDecl const * callee);
|
||||||
|
|
||||||
@ -268,6 +281,16 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) {
|
|||||||
handleOUStringCtor(expr, i, fdecl, true);
|
handleOUStringCtor(expr, i, fdecl, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (loplugin::TypeCheck(t).NotSubstTemplateTypeParmType()
|
||||||
|
.LvalueReference().Const().NotSubstTemplateTypeParmType()
|
||||||
|
.Class("OString").Namespace("rtl").GlobalNamespace())
|
||||||
|
{
|
||||||
|
if (!(isLhsOfAssignment(fdecl, i)
|
||||||
|
|| hasOverloads(fdecl, expr->getNumArgs())))
|
||||||
|
{
|
||||||
|
handleOStringCtor(expr, i, fdecl, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
loplugin::DeclCheck dc(fdecl);
|
loplugin::DeclCheck dc(fdecl);
|
||||||
//TODO: u.compareToAscii("foo") -> u.???("foo")
|
//TODO: u.compareToAscii("foo") -> u.???("foo")
|
||||||
@ -1166,6 +1189,19 @@ bool StringConstant::VisitCXXConstructExpr(CXXConstructExpr const * expr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (loplugin::TypeCheck(t).NotSubstTemplateTypeParmType()
|
||||||
|
.LvalueReference().Const().NotSubstTemplateTypeParmType()
|
||||||
|
.Class("OString").Namespace("rtl").GlobalNamespace())
|
||||||
|
{
|
||||||
|
auto argExpr = expr->getArg(i);
|
||||||
|
if (argExpr && i <= consDecl->getNumParams())
|
||||||
|
{
|
||||||
|
if (!hasOverloads(consDecl, expr->getNumArgs()))
|
||||||
|
{
|
||||||
|
handleOStringCtor(expr, argExpr, consDecl, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1785,9 +1821,30 @@ void StringConstant::handleOUStringCtor(
|
|||||||
handleOUStringCtor(expr, expr->getArg(arg), callee, explicitFunctionalCastNotation);
|
handleOUStringCtor(expr, expr->getArg(arg), callee, explicitFunctionalCastNotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StringConstant::handleOStringCtor(
|
||||||
|
CallExpr const * expr, unsigned arg, FunctionDecl const * callee,
|
||||||
|
bool explicitFunctionalCastNotation)
|
||||||
|
{
|
||||||
|
handleOStringCtor(expr, expr->getArg(arg), callee, explicitFunctionalCastNotation);
|
||||||
|
}
|
||||||
|
|
||||||
void StringConstant::handleOUStringCtor(
|
void StringConstant::handleOUStringCtor(
|
||||||
Expr const * expr, Expr const * argExpr, FunctionDecl const * callee,
|
Expr const * expr, Expr const * argExpr, FunctionDecl const * callee,
|
||||||
bool explicitFunctionalCastNotation)
|
bool explicitFunctionalCastNotation)
|
||||||
|
{
|
||||||
|
handleStringCtor(expr, argExpr, callee, explicitFunctionalCastNotation, StringKind::Unicode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StringConstant::handleOStringCtor(
|
||||||
|
Expr const * expr, Expr const * argExpr, FunctionDecl const * callee,
|
||||||
|
bool explicitFunctionalCastNotation)
|
||||||
|
{
|
||||||
|
handleStringCtor(expr, argExpr, callee, explicitFunctionalCastNotation, StringKind::Char);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StringConstant::handleStringCtor(
|
||||||
|
Expr const * expr, Expr const * argExpr, FunctionDecl const * callee,
|
||||||
|
bool explicitFunctionalCastNotation, StringKind stringKind)
|
||||||
{
|
{
|
||||||
auto e0 = argExpr->IgnoreParenImpCasts();
|
auto e0 = argExpr->IgnoreParenImpCasts();
|
||||||
auto e1 = dyn_cast<CXXFunctionalCastExpr>(e0);
|
auto e1 = dyn_cast<CXXFunctionalCastExpr>(e0);
|
||||||
@ -1808,7 +1865,7 @@ void StringConstant::handleOUStringCtor(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!loplugin::DeclCheck(e3->getConstructor()).MemberFunction()
|
if (!loplugin::DeclCheck(e3->getConstructor()).MemberFunction()
|
||||||
.Class("OUString").Namespace("rtl").GlobalNamespace())
|
.Class(stringKind == StringKind::Unicode ? "OUString" : "OString").Namespace("rtl").GlobalNamespace())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1825,7 +1882,7 @@ void StringConstant::handleOUStringCtor(
|
|||||||
&& e3->getConstructor()->getNumParams() == 1
|
&& e3->getConstructor()->getNumParams() == 1
|
||||||
&& (loplugin::TypeCheck(
|
&& (loplugin::TypeCheck(
|
||||||
e3->getConstructor()->getParamDecl(0)->getType())
|
e3->getConstructor()->getParamDecl(0)->getType())
|
||||||
.Typedef("sal_Unicode").GlobalNamespace()))
|
.Typedef(stringKind == StringKind::Unicode ? "sal_Unicode" : "char").GlobalNamespace()))
|
||||||
{
|
{
|
||||||
// It may not be easy to rewrite OUString(c), esp. given there is no
|
// It may not be easy to rewrite OUString(c), esp. given there is no
|
||||||
// OUString ctor taking an OUStringLiteral1 arg, so don't warn there:
|
// OUString ctor taking an OUStringLiteral1 arg, so don't warn there:
|
||||||
|
@ -19,6 +19,13 @@ extern void foo(OUString const &);
|
|||||||
struct Foo {
|
struct Foo {
|
||||||
Foo(OUString const &, int) {}
|
Foo(OUString const &, int) {}
|
||||||
Foo(OUString const &) {}
|
Foo(OUString const &) {}
|
||||||
|
void foo(OUString const &) const {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Foo2 {
|
||||||
|
Foo2(OString const &, int) {}
|
||||||
|
Foo2(OString const &) {}
|
||||||
|
void foo(OString const &) const {}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
@ -59,7 +66,10 @@ int main() {
|
|||||||
Foo aFoo(OUString("xxx"), 1); // expected-error {{in call of 'Foo::Foo', replace 'OUString' constructed from a string literal directly with the string literal}}
|
Foo aFoo(OUString("xxx"), 1); // expected-error {{in call of 'Foo::Foo', replace 'OUString' constructed from a string literal directly with the string literal}}
|
||||||
(void)aFoo;
|
(void)aFoo;
|
||||||
Foo aFoo2(OUString("xxx")); // expected-error {{in call of 'Foo::Foo', replace 'OUString' constructed from a string literal directly with the string literal}}
|
Foo aFoo2(OUString("xxx")); // expected-error {{in call of 'Foo::Foo', replace 'OUString' constructed from a string literal directly with the string literal}}
|
||||||
(void)aFoo2;
|
aFoo2.foo(OUString("xxx")); // expected-error {{in call of 'Foo::foo', replace 'OUString' constructed from a string literal directly with the string literal}}
|
||||||
|
|
||||||
|
Foo2 aFoo3(OString("xxx")); // expected-error {{in call of 'Foo2::Foo2', replace 'OUString' constructed from a string literal directly with the string literal}}
|
||||||
|
aFoo3.foo(OString("xxx")); // expected-error {{in call of 'Foo2::foo', replace 'OUString' constructed from a string literal directly with the string literal}}
|
||||||
|
|
||||||
(void) OUString("xxx", 3, RTL_TEXTENCODING_ASCII_US); // expected-error {{simplify construction of 'OUString' with string constant argument [loplugin:stringconstant]}}
|
(void) OUString("xxx", 3, RTL_TEXTENCODING_ASCII_US); // expected-error {{simplify construction of 'OUString' with string constant argument [loplugin:stringconstant]}}
|
||||||
(void) OUString("xxx", 3, RTL_TEXTENCODING_ISO_8859_1); // expected-error {{suspicious 'rtl::OUString' constructor with text encoding 12 but plain ASCII content; use 'RTL_TEXTENCODING_ASCII_US' instead [loplugin:stringconstant]}}
|
(void) OUString("xxx", 3, RTL_TEXTENCODING_ISO_8859_1); // expected-error {{suspicious 'rtl::OUString' constructor with text encoding 12 but plain ASCII content; use 'RTL_TEXTENCODING_ASCII_US' instead [loplugin:stringconstant]}}
|
||||||
|
@ -165,12 +165,12 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Let's try to retrieve the list in Collected Addresses book
|
// Let's try to retrieve the list in Collected Addresses book
|
||||||
pMork = xConnection->getMorkParser(OString("CollectedAddressBook"));
|
pMork = xConnection->getMorkParser("CollectedAddressBook");
|
||||||
if (std::find(pMork->lists_.begin(), pMork->lists_.end(), m_aAddressbook) == pMork->lists_.end())
|
if (std::find(pMork->lists_.begin(), pMork->lists_.end(), m_aAddressbook) == pMork->lists_.end())
|
||||||
{
|
{
|
||||||
// so the list is in Address book
|
// so the list is in Address book
|
||||||
// TODO : manage case where an address book has been created
|
// TODO : manage case where an address book has been created
|
||||||
pMork = xConnection->getMorkParser(OString("AddressBook"));
|
pMork = xConnection->getMorkParser("AddressBook");
|
||||||
}
|
}
|
||||||
handleListTable = true;
|
handleListTable = true;
|
||||||
// retrieve row ids for that list table
|
// retrieve row ids for that list table
|
||||||
|
@ -41,12 +41,12 @@
|
|||||||
|
|
||||||
#include "dp_misc_api.hxx"
|
#include "dp_misc_api.hxx"
|
||||||
|
|
||||||
#define LOCKFILE_GROUP OString( "Lockdata" )
|
#define LOCKFILE_GROUP "Lockdata"
|
||||||
#define LOCKFILE_USERKEY OString( "User" )
|
#define LOCKFILE_USERKEY "User"
|
||||||
#define LOCKFILE_HOSTKEY OString( "Host" )
|
#define LOCKFILE_HOSTKEY "Host"
|
||||||
#define LOCKFILE_STAMPKEY OString( "Stamp" )
|
#define LOCKFILE_STAMPKEY "Stamp"
|
||||||
#define LOCKFILE_TIMEKEY OString( "Time" )
|
#define LOCKFILE_TIMEKEY "Time"
|
||||||
#define LOCKFILE_IPCKEY OString( "IPCServer" )
|
#define LOCKFILE_IPCKEY "IPCServer"
|
||||||
|
|
||||||
namespace desktop {
|
namespace desktop {
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ namespace desktop {
|
|||||||
Config aConfig(aLockname);
|
Config aConfig(aLockname);
|
||||||
aConfig.SetGroup(LOCKFILE_GROUP);
|
aConfig.SetGroup(LOCKFILE_GROUP);
|
||||||
OString aIPCserver = aConfig.ReadKey( LOCKFILE_IPCKEY );
|
OString aIPCserver = aConfig.ReadKey( LOCKFILE_IPCKEY );
|
||||||
if (!aIPCserver.equalsIgnoreAsciiCase(OString("true")))
|
if (!aIPCserver.equalsIgnoreAsciiCase("true"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
OString aHost = aConfig.ReadKey( LOCKFILE_HOSTKEY );
|
OString aHost = aConfig.ReadKey( LOCKFILE_HOSTKEY );
|
||||||
|
@ -102,25 +102,25 @@ static void predefineXInterface(AstModule* pRoot)
|
|||||||
{
|
{
|
||||||
// define the modules com::sun::star::uno
|
// define the modules com::sun::star::uno
|
||||||
AstModule* pParentScope = pRoot;
|
AstModule* pParentScope = pRoot;
|
||||||
AstModule* pModule = new AstModule(OString("com"), pParentScope);
|
AstModule* pModule = new AstModule("com", pParentScope);
|
||||||
pModule->setPredefined(true);
|
pModule->setPredefined(true);
|
||||||
pParentScope->addDeclaration(pModule);
|
pParentScope->addDeclaration(pModule);
|
||||||
pParentScope = pModule;
|
pParentScope = pModule;
|
||||||
pModule = new AstModule(OString("sun"), pParentScope);
|
pModule = new AstModule("sun", pParentScope);
|
||||||
pModule->setPredefined(true);
|
pModule->setPredefined(true);
|
||||||
pParentScope->addDeclaration(pModule);
|
pParentScope->addDeclaration(pModule);
|
||||||
pParentScope = pModule;
|
pParentScope = pModule;
|
||||||
pModule = new AstModule(OString("star"), pParentScope);
|
pModule = new AstModule("star", pParentScope);
|
||||||
pModule->setPredefined(true);
|
pModule->setPredefined(true);
|
||||||
pParentScope->addDeclaration(pModule);
|
pParentScope->addDeclaration(pModule);
|
||||||
pParentScope = pModule;
|
pParentScope = pModule;
|
||||||
pModule = new AstModule(OString("uno"), pParentScope);
|
pModule = new AstModule("uno", pParentScope);
|
||||||
pModule->setPredefined(true);
|
pModule->setPredefined(true);
|
||||||
pParentScope->addDeclaration(pModule);
|
pParentScope->addDeclaration(pModule);
|
||||||
pParentScope = pModule;
|
pParentScope = pModule;
|
||||||
|
|
||||||
// define XInterface
|
// define XInterface
|
||||||
AstInterface* pInterface = new AstInterface(OString("XInterface"), nullptr, pParentScope);
|
AstInterface* pInterface = new AstInterface("XInterface", nullptr, pParentScope);
|
||||||
pInterface->setDefined();
|
pInterface->setDefined();
|
||||||
pInterface->setPredefined(true);
|
pInterface->setPredefined(true);
|
||||||
pInterface->setPublished();
|
pInterface->setPublished();
|
||||||
@ -128,21 +128,21 @@ static void predefineXInterface(AstModule* pRoot)
|
|||||||
|
|
||||||
// define XInterface::queryInterface
|
// define XInterface::queryInterface
|
||||||
AstOperation* pOp = new AstOperation(static_cast<AstType*>(pRoot->lookupPrimitiveType(ET_any)),
|
AstOperation* pOp = new AstOperation(static_cast<AstType*>(pRoot->lookupPrimitiveType(ET_any)),
|
||||||
OString("queryInterface"), pInterface);
|
"queryInterface", pInterface);
|
||||||
AstParameter* pParam = new AstParameter(DIR_IN, false,
|
AstParameter* pParam = new AstParameter(DIR_IN, false,
|
||||||
static_cast<AstType*>(pRoot->lookupPrimitiveType(ET_type)),
|
static_cast<AstType*>(pRoot->lookupPrimitiveType(ET_type)),
|
||||||
OString("aType"), pOp);
|
"aType", pOp);
|
||||||
pOp->addDeclaration(pParam);
|
pOp->addDeclaration(pParam);
|
||||||
pInterface->addMember(pOp);
|
pInterface->addMember(pOp);
|
||||||
|
|
||||||
// define XInterface::acquire
|
// define XInterface::acquire
|
||||||
pOp = new AstOperation(static_cast<AstType*>(pRoot->lookupPrimitiveType(ET_void)),
|
pOp = new AstOperation(static_cast<AstType*>(pRoot->lookupPrimitiveType(ET_void)),
|
||||||
OString("acquire"), pInterface);
|
"acquire", pInterface);
|
||||||
pInterface->addMember(pOp);
|
pInterface->addMember(pOp);
|
||||||
|
|
||||||
// define XInterface::release
|
// define XInterface::release
|
||||||
pOp = new AstOperation(static_cast<AstType*>(pRoot->lookupPrimitiveType(ET_void)),
|
pOp = new AstOperation(static_cast<AstType*>(pRoot->lookupPrimitiveType(ET_void)),
|
||||||
OString("release"), pInterface);
|
"release", pInterface);
|
||||||
pInterface->addMember(pOp);
|
pInterface->addMember(pOp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,49 +150,49 @@ static void initializePredefinedTypes(AstModule* pRoot)
|
|||||||
{
|
{
|
||||||
if ( pRoot )
|
if ( pRoot )
|
||||||
{
|
{
|
||||||
AstBaseType* pPredefined = new AstBaseType(ET_long, OString("long"), pRoot);
|
AstBaseType* pPredefined = new AstBaseType(ET_long, "long", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_ulong, OString("unsigned long"), pRoot);
|
pPredefined = new AstBaseType(ET_ulong, "unsigned long", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_hyper, OString("hyper"), pRoot);
|
pPredefined = new AstBaseType(ET_hyper, "hyper", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_uhyper, OString("unsigned hyper"), pRoot);
|
pPredefined = new AstBaseType(ET_uhyper, "unsigned hyper", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_short, OString("short"), pRoot);
|
pPredefined = new AstBaseType(ET_short, "short", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_ushort, OString("unsigned short"), pRoot);
|
pPredefined = new AstBaseType(ET_ushort, "unsigned short", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_float, OString("float"), pRoot);
|
pPredefined = new AstBaseType(ET_float, "float", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_double, OString("double"), pRoot);
|
pPredefined = new AstBaseType(ET_double, "double", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_char, OString("char"), pRoot);
|
pPredefined = new AstBaseType(ET_char, "char", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_byte, OString("byte"), pRoot);
|
pPredefined = new AstBaseType(ET_byte, "byte", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_any, OString("any"), pRoot);
|
pPredefined = new AstBaseType(ET_any, "any", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_string, OString("string"), pRoot);
|
pPredefined = new AstBaseType(ET_string, "string", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_type, OString("type"), pRoot);
|
pPredefined = new AstBaseType(ET_type, "type", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_boolean, OString("boolean"), pRoot);
|
pPredefined = new AstBaseType(ET_boolean, "boolean", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
|
|
||||||
pPredefined = new AstBaseType(ET_void, OString("void"), pRoot);
|
pPredefined = new AstBaseType(ET_void, "void", pRoot);
|
||||||
pRoot->addDeclaration(pPredefined);
|
pRoot->addDeclaration(pPredefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,8 +210,8 @@ bool copyFile(const OString* source, const OString& target)
|
|||||||
sal_Int32 compileFile(const OString * pathname)
|
sal_Int32 compileFile(const OString * pathname)
|
||||||
{
|
{
|
||||||
// preprocess input file
|
// preprocess input file
|
||||||
OString tmpFile = makeTempName(OString("idli_"));
|
OString tmpFile = makeTempName("idli_");
|
||||||
OString preprocFile = makeTempName(OString("idlf_"));
|
OString preprocFile = makeTempName("idlf_");
|
||||||
|
|
||||||
OString fileName;
|
OString fileName;
|
||||||
if (pathname == nullptr) {
|
if (pathname == nullptr) {
|
||||||
|
@ -626,7 +626,7 @@ interface_dcl :
|
|||||||
&& ifc->getScopedName() != "com::sun::star::uno::XInterface")
|
&& ifc->getScopedName() != "com::sun::star::uno::XInterface")
|
||||||
{
|
{
|
||||||
addInheritedInterface(
|
addInheritedInterface(
|
||||||
ifc, OString("::com::sun::star::uno::XInterface"), false,
|
ifc, "::com::sun::star::uno::XInterface", false,
|
||||||
OUString());
|
OUString());
|
||||||
}
|
}
|
||||||
ifc->setDefined();
|
ifc->setDefined();
|
||||||
|
@ -209,10 +209,10 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const OString& sCur , ResDa
|
|||||||
OString sSourceText(
|
OString sSourceText(
|
||||||
pXMLElement->ToOString().
|
pXMLElement->ToOString().
|
||||||
replaceAll(
|
replaceAll(
|
||||||
OString("\n"),
|
"\n",
|
||||||
OString()).
|
OString()).
|
||||||
replaceAll(
|
replaceAll(
|
||||||
OString("\t"),
|
"\t",
|
||||||
OString()));
|
OString()));
|
||||||
// re-add spaces to the beginning of translated string,
|
// re-add spaces to the beginning of translated string,
|
||||||
// important for indentation of Basic code examples
|
// important for indentation of Basic code examples
|
||||||
|
@ -237,13 +237,13 @@ static void checkFunctionNames(const OString& aLanguage)
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
PoHeader hd(OString("formula/inc"));
|
PoHeader hd("formula/inc");
|
||||||
aPoOutput.writeHeader(hd);
|
aPoOutput.writeHeader(hd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
PoHeader hd(OString("scaddins/inc"));
|
PoHeader hd("scaddins/inc");
|
||||||
aPoOutput.writeHeader(hd);
|
aPoOutput.writeHeader(hd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ ErrCode DictionaryNeo::saveEntries(const OUString &rURL)
|
|||||||
// Always write as the latest version, i.e. DIC_VERSION_7
|
// Always write as the latest version, i.e. DIC_VERSION_7
|
||||||
|
|
||||||
rtl_TextEncoding eEnc = RTL_TEXTENCODING_UTF8;
|
rtl_TextEncoding eEnc = RTL_TEXTENCODING_UTF8;
|
||||||
pStream->WriteLine(OString(pVerOOo7));
|
pStream->WriteLine(pVerOOo7);
|
||||||
ErrCode nErr = pStream->GetError();
|
ErrCode nErr = pStream->GetError();
|
||||||
if (nErr != ERRCODE_NONE)
|
if (nErr != ERRCODE_NONE)
|
||||||
return nErr;
|
return nErr;
|
||||||
@ -439,7 +439,7 @@ ErrCode DictionaryNeo::saveEntries(const OUString &rURL)
|
|||||||
* undetermined or multiple? Earlier versions did not know about 'und' and
|
* undetermined or multiple? Earlier versions did not know about 'und' and
|
||||||
* 'mul' and 'zxx' codes. Sync with ReadDicVersion() */
|
* 'mul' and 'zxx' codes. Sync with ReadDicVersion() */
|
||||||
if (LinguIsUnspecified(nLanguage))
|
if (LinguIsUnspecified(nLanguage))
|
||||||
pStream->WriteLine(OString("lang: <none>"));
|
pStream->WriteLine("lang: <none>");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OStringBuffer aLine("lang: ");
|
OStringBuffer aLine("lang: ");
|
||||||
@ -449,9 +449,9 @@ ErrCode DictionaryNeo::saveEntries(const OUString &rURL)
|
|||||||
if (ERRCODE_NONE != (nErr = pStream->GetError()))
|
if (ERRCODE_NONE != (nErr = pStream->GetError()))
|
||||||
return nErr;
|
return nErr;
|
||||||
if (eDicType == DictionaryType_POSITIVE)
|
if (eDicType == DictionaryType_POSITIVE)
|
||||||
pStream->WriteLine(OString("type: positive"));
|
pStream->WriteLine("type: positive");
|
||||||
else
|
else
|
||||||
pStream->WriteLine(OString("type: negative"));
|
pStream->WriteLine("type: negative");
|
||||||
if (aDicName.endsWith(EXTENSION_FOR_TITLE_TEXT))
|
if (aDicName.endsWith(EXTENSION_FOR_TITLE_TEXT))
|
||||||
{
|
{
|
||||||
pStream->WriteLine(OUStringToOString("title: " +
|
pStream->WriteLine(OUStringToOString("title: " +
|
||||||
@ -460,7 +460,7 @@ ErrCode DictionaryNeo::saveEntries(const OUString &rURL)
|
|||||||
}
|
}
|
||||||
if (ERRCODE_NONE != (nErr = pStream->GetError()))
|
if (ERRCODE_NONE != (nErr = pStream->GetError()))
|
||||||
return nErr;
|
return nErr;
|
||||||
pStream->WriteLine(OString("---"));
|
pStream->WriteLine("---");
|
||||||
if (ERRCODE_NONE != (nErr = pStream->GetError()))
|
if (ERRCODE_NONE != (nErr = pStream->GetError()))
|
||||||
return nErr;
|
return nErr;
|
||||||
for (Reference<XDictionaryEntry> & aEntrie : aEntries)
|
for (Reference<XDictionaryEntry> & aEntrie : aEntries)
|
||||||
|
@ -43,19 +43,19 @@ void Test::testStartsWithIgnoreAsciiCase() {
|
|||||||
{
|
{
|
||||||
OString r;
|
OString r;
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(
|
||||||
OString("foo").startsWithIgnoreAsciiCase(OString("F"), &r));
|
OString("foo").startsWithIgnoreAsciiCase("F", &r));
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("oo"), r);
|
CPPUNIT_ASSERT_EQUAL(OString("oo"), r);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
OString r("other");
|
OString r("other");
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(
|
||||||
!OString("foo").startsWithIgnoreAsciiCase(OString("bar"), &r));
|
!OString("foo").startsWithIgnoreAsciiCase("bar", &r));
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("other"), r);
|
CPPUNIT_ASSERT_EQUAL(OString("other"), r);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
OString r("other");
|
OString r("other");
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(
|
||||||
!OString("foo").startsWithIgnoreAsciiCase(OString("foobar"), &r));
|
!OString("foo").startsWithIgnoreAsciiCase("foobar", &r));
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("other"), r);
|
CPPUNIT_ASSERT_EQUAL(OString("other"), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1109,7 +1109,7 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
|
|||||||
if( rEntity.maNamespaceCount.empty() )
|
if( rEntity.maNamespaceCount.empty() )
|
||||||
{
|
{
|
||||||
rEntity.maNamespaceCount.push(0);
|
rEntity.maNamespaceCount.push(0);
|
||||||
DefineNamespace( OString("xml"), "http://www.w3.org/XML/1998/namespace");
|
DefineNamespace( "xml", "http://www.w3.org/XML/1998/namespace");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1176,7 +1176,7 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
|
|||||||
sNamespace = OUString( XML_CAST( namespaces[ i + 1 ] ), strlen( XML_CAST( namespaces[ i + 1 ] )), RTL_TEXTENCODING_UTF8 );
|
sNamespace = OUString( XML_CAST( namespaces[ i + 1 ] ), strlen( XML_CAST( namespaces[ i + 1 ] )), RTL_TEXTENCODING_UTF8 );
|
||||||
nNamespaceToken = GetNamespaceToken( sNamespace );
|
nNamespaceToken = GetNamespaceToken( sNamespace );
|
||||||
if( rEntity.mxNamespaceHandler.is() )
|
if( rEntity.mxNamespaceHandler.is() )
|
||||||
rEvent.mxDeclAttributes->addUnknown( OString( "" ), OString( XML_CAST( namespaces[ i + 1 ] ) ) );
|
rEvent.mxDeclAttributes->addUnknown( "", OString( XML_CAST( namespaces[ i + 1 ] ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,8 +96,8 @@ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pAttrList->add( XML_paperWidth, OString::number( mrData.mnPaperWidth ).concat(OString("mm")).getStr() );
|
pAttrList->add( XML_paperWidth, OString::number( mrData.mnPaperWidth ).concat("mm").getStr() );
|
||||||
pAttrList->add( XML_paperHeight, OString::number( mrData.mnPaperHeight ).concat(OString("mm")).getStr() );
|
pAttrList->add( XML_paperHeight, OString::number( mrData.mnPaperHeight ).concat("mm").getStr() );
|
||||||
// pAttrList->add( XML_paperUnits, "mm" );
|
// pAttrList->add( XML_paperUnits, "mm" );
|
||||||
}
|
}
|
||||||
pAttrList->add( XML_scale, OString::number( mrData.mnScaling ).getStr() );
|
pAttrList->add( XML_scale, OString::number( mrData.mnScaling ).getStr() );
|
||||||
|
@ -647,7 +647,7 @@ void VmlCommentExporter::Commit( EscherPropertyContainer& rProps, const tools::R
|
|||||||
|
|
||||||
sal_Int32 VmlCommentExporter::StartShape()
|
sal_Int32 VmlCommentExporter::StartShape()
|
||||||
{
|
{
|
||||||
AddShapeAttribute( XML_type, OString( "#_x0000_t202") );
|
AddShapeAttribute( XML_type, "#_x0000_t202" );
|
||||||
|
|
||||||
sal_Int32 nId = VMLExport::StartShape();
|
sal_Int32 nId = VMLExport::StartShape();
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
|
|||||||
{
|
{
|
||||||
if( aFile.getLength() > 4 )
|
if( aFile.getLength() > 4 )
|
||||||
{
|
{
|
||||||
if( aFile.matchIgnoreAsciiCase( OString( ".pdf" ), aFile.getLength()-4 ) )
|
if( aFile.matchIgnoreAsciiCase( ".pdf", aFile.getLength()-4 ) )
|
||||||
aOutFile.append( pInFile, aFile.getLength() - 4 );
|
aOutFile.append( pInFile, aFile.getLength() - 4 );
|
||||||
else
|
else
|
||||||
aOutFile.append( aFile );
|
aOutFile.append( aFile );
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <rtl/math.hxx>
|
#include <rtl/math.hxx>
|
||||||
|
|
||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
|
#include <utility>
|
||||||
#include <vcl/metaact.hxx>
|
#include <vcl/metaact.hxx>
|
||||||
#include <vcl/gdimtf.hxx>
|
#include <vcl/gdimtf.hxx>
|
||||||
#include <basegfx/numeric/ftools.hxx>
|
#include <basegfx/numeric/ftools.hxx>
|
||||||
@ -73,7 +74,7 @@ namespace slideshow
|
|||||||
MetaCommentAction* pAct = static_cast<MetaCommentAction*>(pCurrAct);
|
MetaCommentAction* pAct = static_cast<MetaCommentAction*>(pCurrAct);
|
||||||
|
|
||||||
// skip comment if not a special XTEXT... comment
|
// skip comment if not a special XTEXT... comment
|
||||||
if( pAct->GetComment().matchIgnoreAsciiCase( OString("XTEXT") ) )
|
if( pAct->GetComment().matchIgnoreAsciiCase( "XTEXT" ) )
|
||||||
{
|
{
|
||||||
// fill classification vector with NOOPs,
|
// fill classification vector with NOOPs,
|
||||||
// then insert corresponding classes at
|
// then insert corresponding classes at
|
||||||
@ -261,9 +262,9 @@ namespace slideshow
|
|||||||
}
|
}
|
||||||
|
|
||||||
DrawShapeSubsetting::DrawShapeSubsetting( const DocTreeNode& rShapeSubset,
|
DrawShapeSubsetting::DrawShapeSubsetting( const DocTreeNode& rShapeSubset,
|
||||||
const GDIMetaFileSharedPtr& rMtf ) :
|
GDIMetaFileSharedPtr rMtf ) :
|
||||||
maActionClassVector(),
|
maActionClassVector(),
|
||||||
mpMtf( rMtf ),
|
mpMtf(std::move( rMtf )),
|
||||||
maSubset( rShapeSubset ),
|
maSubset( rShapeSubset ),
|
||||||
maSubsetShapes(),
|
maSubsetShapes(),
|
||||||
maCurrentSubsets(),
|
maCurrentSubsets(),
|
||||||
|
@ -59,7 +59,7 @@ namespace slideshow
|
|||||||
generated with verbose text comments switched on).
|
generated with verbose text comments switched on).
|
||||||
*/
|
*/
|
||||||
DrawShapeSubsetting( const DocTreeNode& rShapeSubset,
|
DrawShapeSubsetting( const DocTreeNode& rShapeSubset,
|
||||||
const ::std::shared_ptr< GDIMetaFile >& rMtf );
|
::std::shared_ptr< GDIMetaFile > rMtf );
|
||||||
|
|
||||||
/// Forbid copy construction
|
/// Forbid copy construction
|
||||||
DrawShapeSubsetting(const DrawShapeSubsetting&) = delete;
|
DrawShapeSubsetting(const DrawShapeSubsetting&) = delete;
|
||||||
|
@ -409,7 +409,7 @@ bool getRectanglesFromScrollMtf( ::basegfx::B2DRectangle& o_rScrollRect,
|
|||||||
MetaCommentAction * pAct =
|
MetaCommentAction * pAct =
|
||||||
static_cast<MetaCommentAction *>(pCurrAct);
|
static_cast<MetaCommentAction *>(pCurrAct);
|
||||||
// skip comment if not a special XTEXT... comment
|
// skip comment if not a special XTEXT... comment
|
||||||
if( pAct->GetComment().matchIgnoreAsciiCase( OString("XTEXT") ) )
|
if( pAct->GetComment().matchIgnoreAsciiCase( "XTEXT" ) )
|
||||||
{
|
{
|
||||||
if (pAct->GetComment().equalsIgnoreAsciiCase("XTEXT_SCROLLRECT"))
|
if (pAct->GetComment().equalsIgnoreAsciiCase("XTEXT_SCROLLRECT"))
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ DECLARE_TXTIMPORT_TEST(testTdf112191, "bullets.odt")
|
|||||||
bool bSuccess = sw::XTextRangeToSwPaM(aPaM, xPara);
|
bool bSuccess = sw::XTextRangeToSwPaM(aPaM, xPara);
|
||||||
CPPUNIT_ASSERT(bSuccess);
|
CPPUNIT_ASSERT(bSuccess);
|
||||||
|
|
||||||
assertExportedRange(OString("First bullet"), aPaM);
|
assertExportedRange("First bullet", aPaM);
|
||||||
|
|
||||||
// but when we extend to the next paragraph - now there are bullets
|
// but when we extend to the next paragraph - now there are bullets
|
||||||
xPara = getParagraph(6);
|
xPara = getParagraph(6);
|
||||||
|
@ -133,6 +133,7 @@
|
|||||||
#include <txtatr.hxx>
|
#include <txtatr.hxx>
|
||||||
|
|
||||||
#include <osl/file.hxx>
|
#include <osl/file.hxx>
|
||||||
|
#include <utility>
|
||||||
#include <vcl/embeddedfontshelper.hxx>
|
#include <vcl/embeddedfontshelper.hxx>
|
||||||
#include <svtools/miscopt.hxx>
|
#include <svtools/miscopt.hxx>
|
||||||
|
|
||||||
@ -207,14 +208,14 @@ class FFDataWriterHelper
|
|||||||
|
|
||||||
if ( !rHelp.isEmpty() )
|
if ( !rHelp.isEmpty() )
|
||||||
m_pSerializer->singleElementNS( XML_w, XML_helpText,
|
m_pSerializer->singleElementNS( XML_w, XML_helpText,
|
||||||
FSNS(XML_w, XML_type), OString("text"),
|
FSNS(XML_w, XML_type), "text",
|
||||||
FSNS(XML_w, XML_val),
|
FSNS(XML_w, XML_val),
|
||||||
OUStringToOString( rHelp, RTL_TEXTENCODING_UTF8 ).getStr(),
|
OUStringToOString( rHelp, RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||||
FSEND );
|
FSEND );
|
||||||
|
|
||||||
if ( !rHint.isEmpty() )
|
if ( !rHint.isEmpty() )
|
||||||
m_pSerializer->singleElementNS( XML_w, XML_statusText,
|
m_pSerializer->singleElementNS( XML_w, XML_statusText,
|
||||||
FSNS(XML_w, XML_type), OString("text"),
|
FSNS(XML_w, XML_type), "text",
|
||||||
FSNS(XML_w, XML_val),
|
FSNS(XML_w, XML_val),
|
||||||
OUStringToOString( rHint, RTL_TEXTENCODING_UTF8 ).getStr(),
|
OUStringToOString( rHint, RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||||
FSEND );
|
FSEND );
|
||||||
@ -225,7 +226,7 @@ class FFDataWriterHelper
|
|||||||
m_pSerializer->endElementNS( XML_w, XML_ffData );
|
m_pSerializer->endElementNS( XML_w, XML_ffData );
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
explicit FFDataWriterHelper( const ::sax_fastparser::FSHelperPtr& rSerializer ) : m_pSerializer( rSerializer ){}
|
explicit FFDataWriterHelper( ::sax_fastparser::FSHelperPtr rSerializer ) : m_pSerializer(std::move( rSerializer )){}
|
||||||
void WriteFormCheckbox( const OUString& rName,
|
void WriteFormCheckbox( const OUString& rName,
|
||||||
const OUString& rEntryMacro,
|
const OUString& rEntryMacro,
|
||||||
const OUString& rExitMacro,
|
const OUString& rExitMacro,
|
||||||
@ -6769,14 +6770,14 @@ void DocxAttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement )
|
|||||||
FSNS( XML_w, XML_val ), sIss.getStr(), FSEND );
|
FSNS( XML_w, XML_val ), sIss.getStr(), FSEND );
|
||||||
|
|
||||||
const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE);
|
const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE);
|
||||||
if (sIss.isEmpty() || sIss.match(OString("baseline")))
|
if (sIss.isEmpty() || sIss.match("baseline"))
|
||||||
{
|
{
|
||||||
long nHeight = rItem.GetHeight();
|
long nHeight = rItem.GetHeight();
|
||||||
OString sPos = OString::number( ( nHeight * nEsc + 500 ) / 1000 );
|
OString sPos = OString::number( ( nHeight * nEsc + 500 ) / 1000 );
|
||||||
m_pSerializer->singleElementNS( XML_w, XML_position,
|
m_pSerializer->singleElementNS( XML_w, XML_position,
|
||||||
FSNS( XML_w, XML_val ), sPos.getStr( ), FSEND );
|
FSNS( XML_w, XML_val ), sPos.getStr( ), FSEND );
|
||||||
|
|
||||||
if( ( 100 != nProp || sIss.match( OString( "baseline" ) ) ) && !m_rExport.m_bFontSizeWritten )
|
if( ( 100 != nProp || sIss.match( "baseline" ) ) && !m_rExport.m_bFontSizeWritten )
|
||||||
{
|
{
|
||||||
OString sSize = OString::number( ( nHeight * nProp + 500 ) / 1000 );
|
OString sSize = OString::number( ( nHeight * nProp + 500 ) / 1000 );
|
||||||
m_pSerializer->singleElementNS( XML_w, XML_sz,
|
m_pSerializer->singleElementNS( XML_w, XML_sz,
|
||||||
@ -7782,7 +7783,7 @@ void DocxAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop )
|
|||||||
if ( nCurrTab == nCount || pInheritedTabs->At(i) < rTabStop[nCurrTab] )
|
if ( nCurrTab == nCount || pInheritedTabs->At(i) < rTabStop[nCurrTab] )
|
||||||
{
|
{
|
||||||
m_pSerializer->singleElementNS( XML_w, XML_tab,
|
m_pSerializer->singleElementNS( XML_w, XML_tab,
|
||||||
FSNS( XML_w, XML_val ), OString("clear"),
|
FSNS( XML_w, XML_val ), "clear",
|
||||||
FSNS( XML_w, XML_pos ), OString::number(pInheritedTabs->At(i).GetTabPos()),
|
FSNS( XML_w, XML_pos ), OString::number(pInheritedTabs->At(i).GetTabPos()),
|
||||||
FSEND );
|
FSEND );
|
||||||
}
|
}
|
||||||
|
@ -56,13 +56,13 @@ public:
|
|||||||
{
|
{
|
||||||
Config aConfig(maConfigFile);
|
Config aConfig(maConfigFile);
|
||||||
|
|
||||||
aConfig.SetGroup(OString("TestGroup"));
|
aConfig.SetGroup("TestGroup");
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("TestGroup"), aConfig.GetGroup());
|
CPPUNIT_ASSERT_EQUAL(OString("TestGroup"), aConfig.GetGroup());
|
||||||
|
|
||||||
// so this is a quirk of Config - you can set the group name,
|
// so this is a quirk of Config - you can set the group name,
|
||||||
// but it might not exist so you really should first check if
|
// but it might not exist so you really should first check if
|
||||||
// it exists via HasGroup()
|
// it exists via HasGroup()
|
||||||
aConfig.SetGroup(OString("TestGroupA"));
|
aConfig.SetGroup("TestGroupA");
|
||||||
CPPUNIT_ASSERT(!aConfig.HasGroup("TestGroupA"));
|
CPPUNIT_ASSERT(!aConfig.HasGroup("TestGroupA"));
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("TestGroupA"), aConfig.GetGroup());
|
CPPUNIT_ASSERT_EQUAL(OString("TestGroupA"), aConfig.GetGroup());
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ public:
|
|||||||
{
|
{
|
||||||
Config aConfig(maConfigFile);
|
Config aConfig(maConfigFile);
|
||||||
|
|
||||||
aConfig.DeleteGroup(OString("TestGroup"));
|
aConfig.DeleteGroup("TestGroup");
|
||||||
CPPUNIT_ASSERT(!aConfig.HasGroup("TestGroup"));
|
CPPUNIT_ASSERT(!aConfig.HasGroup("TestGroup"));
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("TestGroup2"), aConfig.GetGroupName(0));
|
CPPUNIT_ASSERT_EQUAL(OString("TestGroup2"), aConfig.GetGroupName(0));
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ public:
|
|||||||
Config aConfig(maConfigFile);
|
Config aConfig(maConfigFile);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(!aConfig.HasGroup("NonExistentTestGroup"));
|
CPPUNIT_ASSERT(!aConfig.HasGroup("NonExistentTestGroup"));
|
||||||
aConfig.DeleteGroup(OString("NonExistentTestGroup"));
|
aConfig.DeleteGroup("NonExistentTestGroup");
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("TestGroup"), aConfig.GetGroupName(0));
|
CPPUNIT_ASSERT_EQUAL(OString("TestGroup"), aConfig.GetGroupName(0));
|
||||||
|
|
||||||
sal_uInt16 nActual = aConfig.GetGroupCount();
|
sal_uInt16 nActual = aConfig.GetGroupCount();
|
||||||
@ -106,64 +106,64 @@ public:
|
|||||||
void testReadKey()
|
void testReadKey()
|
||||||
{
|
{
|
||||||
Config aConfig(maConfigFile);
|
Config aConfig(maConfigFile);
|
||||||
aConfig.SetGroup(OString("TestGroup"));
|
aConfig.SetGroup("TestGroup");
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey(OString("testkey")));
|
CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey(OString("testkey")));
|
||||||
CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey(OString("nonexistenttestkey")));
|
CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey(OString("nonexistenttestkey")));
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("notexists"),
|
CPPUNIT_ASSERT_EQUAL(OString("notexists"),
|
||||||
aConfig.ReadKey(OString("nonexistenttestkey"), OString("notexists")));
|
aConfig.ReadKey("nonexistenttestkey", "notexists"));
|
||||||
|
|
||||||
aConfig.SetGroup(OString("TestGroup2"));
|
aConfig.SetGroup("TestGroup2");
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey(OString("testkey2")));
|
CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey(OString("testkey2")));
|
||||||
CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey(OString("nonexistenttestkey")));
|
CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey(OString("nonexistenttestkey")));
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("notexists"),
|
CPPUNIT_ASSERT_EQUAL(OString("notexists"),
|
||||||
aConfig.ReadKey(OString("nonexistenttestkey"), OString("notexists")));
|
aConfig.ReadKey("nonexistenttestkey", "notexists"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testGetKeyName()
|
void testGetKeyName()
|
||||||
{
|
{
|
||||||
Config aConfig(maConfigFile);
|
Config aConfig(maConfigFile);
|
||||||
aConfig.SetGroup(OString("TestGroup"));
|
aConfig.SetGroup("TestGroup");
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("testkey"), aConfig.GetKeyName(0));
|
CPPUNIT_ASSERT_EQUAL(OString("testkey"), aConfig.GetKeyName(0));
|
||||||
|
|
||||||
aConfig.SetGroup(OString("TestGroup2"));
|
aConfig.SetGroup("TestGroup2");
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("testkey2"), aConfig.GetKeyName(0));
|
CPPUNIT_ASSERT_EQUAL(OString("testkey2"), aConfig.GetKeyName(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testWriteDeleteKey()
|
void testWriteDeleteKey()
|
||||||
{
|
{
|
||||||
Config aConfig(maConfigFile);
|
Config aConfig(maConfigFile);
|
||||||
aConfig.SetGroup(OString("TestGroup"));
|
aConfig.SetGroup("TestGroup");
|
||||||
aConfig.WriteKey(OString("testkey_new"), OString("testvalue"));
|
aConfig.WriteKey("testkey_new", "testvalue");
|
||||||
|
|
||||||
sal_uInt16 nExpected = 2;
|
sal_uInt16 nExpected = 2;
|
||||||
sal_uInt16 nActual = aConfig.GetKeyCount();
|
sal_uInt16 nActual = aConfig.GetKeyCount();
|
||||||
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
|
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey(OString("testkey_new")));
|
CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey(OString("testkey_new")));
|
||||||
|
|
||||||
aConfig.DeleteKey(OString("testkey_new"));
|
aConfig.DeleteKey("testkey_new");
|
||||||
|
|
||||||
nExpected = 1;
|
nExpected = 1;
|
||||||
nActual = aConfig.GetKeyCount();
|
nActual = aConfig.GetKeyCount();
|
||||||
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
|
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
|
||||||
CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey(OString("testkey_new")));
|
CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey(OString("testkey_new")));
|
||||||
|
|
||||||
aConfig.SetGroup(OString("TestGroup2"));
|
aConfig.SetGroup("TestGroup2");
|
||||||
aConfig.WriteKey(OString("testkey_new"), OString("testvalue"));
|
aConfig.WriteKey("testkey_new", "testvalue");
|
||||||
|
|
||||||
nActual = aConfig.GetKeyCount();
|
nActual = aConfig.GetKeyCount();
|
||||||
nExpected = 2;
|
nExpected = 2;
|
||||||
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
|
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
|
||||||
CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey(OString("testkey_new")));
|
CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey(OString("testkey_new")));
|
||||||
|
|
||||||
aConfig.DeleteKey(OString("testkey_new"));
|
aConfig.DeleteKey("testkey_new");
|
||||||
|
|
||||||
nActual = aConfig.GetKeyCount();
|
nActual = aConfig.GetKeyCount();
|
||||||
nExpected = 1;
|
nExpected = 1;
|
||||||
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
|
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
|
||||||
CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey(OString("testkey_new")));
|
CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey(OString("testkey_new")));
|
||||||
|
|
||||||
aConfig.SetGroup(OString("TestGroup3"));
|
aConfig.SetGroup("TestGroup3");
|
||||||
aConfig.WriteKey(OString("testkey_new_group3"), OString("testvalue"));
|
aConfig.WriteKey("testkey_new_group3", "testvalue");
|
||||||
|
|
||||||
nActual = aConfig.GetKeyCount();
|
nActual = aConfig.GetKeyCount();
|
||||||
nExpected = 1;
|
nExpected = 1;
|
||||||
|
@ -1078,7 +1078,7 @@ PrinterGfx::DrawEPS( const tools::Rectangle& rBoundingBox, void* pPtr, sal_uInt3
|
|||||||
char cChar = aLine[1];
|
char cChar = aLine[1];
|
||||||
if( cChar == '%' )
|
if( cChar == '%' )
|
||||||
{
|
{
|
||||||
if( aLine.matchIgnoreAsciiCase( OString( "%%BoundingBox:") ) )
|
if( aLine.matchIgnoreAsciiCase( "%%BoundingBox:" ) )
|
||||||
{
|
{
|
||||||
aLine = WhitespaceToSpace( aLine.getToken(1, ':') );
|
aLine = WhitespaceToSpace( aLine.getToken(1, ':') );
|
||||||
if( !aLine.isEmpty() && aLine.indexOf( "atend" ) == -1 )
|
if( !aLine.isEmpty() && aLine.indexOf( "atend" ) == -1 )
|
||||||
|
@ -254,7 +254,7 @@ static bool passFileToCommandLine( const OUString& rFilename, const OUString& rC
|
|||||||
|
|
||||||
// setup command line for exec
|
// setup command line for exec
|
||||||
if( ! bPipe )
|
if( ! bPipe )
|
||||||
aCmdLine = aCmdLine.replaceAll(OString("(TMP)"), aFilename);
|
aCmdLine = aCmdLine.replaceAll("(TMP)", aFilename);
|
||||||
|
|
||||||
#if OSL_DEBUG_LEVEL > 1
|
#if OSL_DEBUG_LEVEL > 1
|
||||||
fprintf( stderr, "%s commandline: \"%s\"\n",
|
fprintf( stderr, "%s commandline: \"%s\"\n",
|
||||||
|
@ -625,19 +625,19 @@ void CPDManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner,
|
|||||||
if (!sPayLoad.isEmpty()) {
|
if (!sPayLoad.isEmpty()) {
|
||||||
OString aKey = OUStringToOString( pKey->getKey(), RTL_TEXTENCODING_ASCII_US );
|
OString aKey = OUStringToOString( pKey->getKey(), RTL_TEXTENCODING_ASCII_US );
|
||||||
OString aValue = OUStringToOString( sPayLoad, RTL_TEXTENCODING_ASCII_US );
|
OString aValue = OUStringToOString( sPayLoad, RTL_TEXTENCODING_ASCII_US );
|
||||||
if (aKey.equals(OString("Duplex"))) {
|
if (aKey.equals("Duplex")) {
|
||||||
aKey = OString("sides");
|
aKey = OString("sides");
|
||||||
} else if (aKey.equals(OString("Resolution"))) {
|
} else if (aKey.equals("Resolution")) {
|
||||||
aKey = OString("printer-resolution");
|
aKey = OString("printer-resolution");
|
||||||
} else if (aKey.equals(OString("PageSize"))) {
|
} else if (aKey.equals("PageSize")) {
|
||||||
aKey = OString("media");
|
aKey = OString("media");
|
||||||
}
|
}
|
||||||
if (aKey.equals(OString("sides"))) {
|
if (aKey.equals("sides")) {
|
||||||
if (aValue.equals(OString("None"))) {
|
if (aValue.equals("None")) {
|
||||||
aValue = OString("one-sided");
|
aValue = OString("one-sided");
|
||||||
} else if (aValue.equals(OString("DuplexNoTumble"))) {
|
} else if (aValue.equals("DuplexNoTumble")) {
|
||||||
aValue = OString("two-sided-long-edge");
|
aValue = OString("two-sided-long-edge");
|
||||||
} else if (aValue.equals(OString("DuplexTumble"))) {
|
} else if (aValue.equals("DuplexTumble")) {
|
||||||
aValue = OString("two-sided-short-edge");
|
aValue = OString("two-sided-short-edge");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ bool JobData::getStreamBuffer( void*& pData, sal_uInt32& bytes )
|
|||||||
SvMemoryStream aStream;
|
SvMemoryStream aStream;
|
||||||
|
|
||||||
// write header job data
|
// write header job data
|
||||||
aStream.WriteLine(OString("JobData 1"));
|
aStream.WriteLine("JobData 1");
|
||||||
|
|
||||||
OStringBuffer aLine;
|
OStringBuffer aLine;
|
||||||
|
|
||||||
|
@ -710,7 +710,7 @@ PPDParser::PPDParser( const OUString& rFile ) :
|
|||||||
OString aCurLine = aStream.ReadLine();
|
OString aCurLine = aStream.ReadLine();
|
||||||
if( aCurLine.startsWith("*") )
|
if( aCurLine.startsWith("*") )
|
||||||
{
|
{
|
||||||
if (aCurLine.matchIgnoreAsciiCase(OString("*include:")))
|
if (aCurLine.matchIgnoreAsciiCase("*include:"))
|
||||||
{
|
{
|
||||||
aCurLine = aCurLine.copy(9);
|
aCurLine = aCurLine.copy(9);
|
||||||
aCurLine = comphelper::string::stripStart(aCurLine, ' ');
|
aCurLine = comphelper::string::stripStart(aCurLine, ' ');
|
||||||
@ -726,7 +726,7 @@ PPDParser::PPDParser( const OUString& rFile ) :
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( ! bLanguageEncoding &&
|
else if( ! bLanguageEncoding &&
|
||||||
aCurLine.matchIgnoreAsciiCase(OString("*languageencoding")) )
|
aCurLine.matchIgnoreAsciiCase("*languageencoding") )
|
||||||
{
|
{
|
||||||
bLanguageEncoding = true; // generally only the first one counts
|
bLanguageEncoding = true; // generally only the first one counts
|
||||||
OString aLower = aCurLine.toAsciiLowerCase();
|
OString aLower = aCurLine.toAsciiLowerCase();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user