[PATCH] Fix for fdo43460 Part VIII getLength() to isEmpty()
Olivier Hallot
olivier.hallot at alta.org.br
Wed Dec 14 04:59:15 PST 2011
Part VIII
Module
comfigmgr
---
configmgr/source/access.cxx | 16 ++++++++--------
configmgr/source/childaccess.cxx | 6 +++---
configmgr/source/components.cxx | 2 +-
configmgr/source/configurationprovider.cxx | 22 +++++++++++-----------
configmgr/source/data.cxx | 12 ++++++------
configmgr/source/propertynode.cxx | 2 +-
configmgr/source/valueparser.cxx | 6 +++---
configmgr/source/writemodfile.cxx | 6 +++---
configmgr/source/xcdparser.cxx | 4 ++--
configmgr/source/xcuparser.cxx | 6 +++---
10 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx
index dab5e21..51fb2db 100644
--- a/configmgr/source/access.cxx
+++ b/configmgr/source/access.cxx
@@ -650,7 +650,7 @@ void Access::initBroadcasterAndChanges(
case Node::KIND_GROUP:
case Node::KIND_SET:
if (i->second.children.empty()) {
- if (child->getNode()->getTemplateName().getLength() != 0) {
+ if (!child->getNode()->getTemplateName().isEmpty()) {
for (ContainerListeners::iterator j(
containerListeners_.begin());
j != containerListeners_.end(); ++j)
@@ -1243,7 +1243,7 @@ rtl::OUString Access::getHierarchicalName() throw (css::uno::RuntimeException) {
path.append(root->getAbsolutePathRepresentation());
}
rtl::OUString rel(getRelativePathRepresentation());
- if (path.getLength() != 0 && rel.getLength() != 0) {
+ if (path.getLength() != 0 && !rel.isEmpty()) {
path.append(sal_Unicode('/'));
}
path.append(rel);
@@ -1259,7 +1259,7 @@ rtl::OUString Access::composeHierarchicalName(
assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess();
- if (aRelativeName.getLength() == 0 || aRelativeName[0] == '/') {
+ if (aRelativeName.isEmpty() || aRelativeName[0] == '/') {
throw css::lang::IllegalArgumentException(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
@@ -1299,7 +1299,7 @@ void Access::setName(rtl::OUString const & aName)
rtl::Reference< Access > parent(getParentAccess());
if (parent.is()) {
rtl::Reference< Node > node(getNode());
- if (node->getTemplateName().getLength() != 0) {
+ if (! node->getTemplateName().isEmpty()) {
rtl::Reference< ChildAccess > other(
parent->getChild(aName));
if (other.get() == this) {
@@ -1995,7 +1995,7 @@ rtl::Reference< ChildAccess > Access::getUnmodifiedChild(
rtl::Reference< ChildAccess > Access::getSubChild(rtl::OUString const & path) {
sal_Int32 i = 0;
// For backwards compatibility, allow absolute paths where meaningful:
- if (path.getLength() != 0 && path[0] == '/') {
+ if (!path.isEmpty() && path[0] == '/') {
++i;
if (!getRootAccess().is()) {
return rtl::Reference< ChildAccess >();
@@ -2042,13 +2042,13 @@ rtl::Reference< ChildAccess > Access::getSubChild(rtl::OUString const & path) {
switch (p->kind()) {
case Node::KIND_LOCALIZED_PROPERTY:
if (!Components::allLocales(getRootAccess()->getLocale()) ||
- templateName.getLength() != 0)
+ !templateName.isEmpty())
{
return rtl::Reference< ChildAccess >();
}
break;
case Node::KIND_SET:
- if (templateName.getLength() != 0 &&
+ if (!templateName.isEmpty() &&
!dynamic_cast< SetNode * >(p.get())->isValidTemplate(
templateName))
{
@@ -2152,7 +2152,7 @@ void Access::checkFinalized() {
}
void Access::checkKnownProperty(rtl::OUString const & descriptor) {
- if (descriptor.getLength() == 0) {
+ if (descriptor.isEmpty()) {
return;
}
rtl::Reference< ChildAccess > child(getChild(descriptor));
diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx
index a9c41d2..180df7c 100644
--- a/configmgr/source/childaccess.cxx
+++ b/configmgr/source/childaccess.cxx
@@ -201,7 +201,7 @@ void ChildAccess::bind(
rtl::Reference< Access > const & parent, rtl::OUString const & name)
throw ()
{
- assert(!parent_.is() && root.is() && parent.is() && name.getLength() != 0);
+ assert(!parent_.is() && root.is() && parent.is() && !name.isEmpty());
root_ = root;
parent_ = parent;
name_ = name;
@@ -272,7 +272,7 @@ namespace
{
rtl::OUString lcl_StripSegment(const rtl::OUString &rLocale)
{
- sal_Int32 i = rLocale.getLength() ? rLocale.getLength() - 1 : 0;
+ sal_Int32 i = !rLocale.isEmpty() ? rLocale.getLength() - 1 : 0;
while (i > 0 && rLocale[i] != '-' && rLocale[i] != '_')
--i;
return rLocale.copy(0, i);
@@ -301,7 +301,7 @@ css::uno::Any ChildAccess::asValue() {
if (child.is())
break;
rtl::OUString sTmpLocale = lcl_StripSegment(sLocale);
- if (!sTmpLocale.getLength())
+ if (sTmpLocale.isEmpty())
break;
sLocale = sTmpLocale;
}
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index 48d555e..c539b6a 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -710,7 +710,7 @@ void Components::parseFileList(
{
for (sal_Int32 i = 0;;) {
rtl::OUString url(urls.getToken(0, ' ', i));
- if (url.getLength() != 0) {
+ if (!url.isEmpty()) {
ini.expandMacrosFrom(url); //TODO: detect failure
Additions * adds = 0;
if (recordAdditions) {
diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx
index 952db7a..5a7ed78 100644
--- a/configmgr/source/configurationprovider.cxx
+++ b/configmgr/source/configurationprovider.cxx
@@ -205,7 +205,7 @@ Service::createInstanceWithArguments(
} else if (Arguments.getLength() == 1 && (Arguments[i] >>= nodepath)) {
// For backwards compatibility, allow a single string argument that
// denotes nodepath.
- if (nodepath.getLength() == 0) {
+ if (nodepath.isEmpty()) {
badNodePath();
}
break;
@@ -222,16 +222,16 @@ Service::createInstanceWithArguments(
if (name.equalsIgnoreAsciiCaseAsciiL(
RTL_CONSTASCII_STRINGPARAM("nodepath")))
{
- if (nodepath.getLength() != 0 || !(value >>= nodepath) ||
- nodepath.getLength() == 0)
+ if (!nodepath.isEmpty() || !(value >>= nodepath) ||
+ nodepath.isEmpty())
{
badNodePath();
}
} else if (name.equalsIgnoreAsciiCaseAsciiL(
RTL_CONSTASCII_STRINGPARAM("locale")))
{
- if (locale.getLength() != 0 || !(value >>= locale) ||
- locale.getLength() == 0)
+ if (!locale.isEmpty() || !(value >>= locale) ||
+ locale.isEmpty())
{
throw css::uno::Exception(
rtl::OUString(
@@ -243,7 +243,7 @@ Service::createInstanceWithArguments(
}
}
}
- if (nodepath.getLength() == 0) {
+ if (nodepath.isEmpty()) {
badNodePath();
}
// For backwards compatibility, allow a nodepath that misses the leading
@@ -251,10 +251,10 @@ Service::createInstanceWithArguments(
if (nodepath[0] != '/') {
nodepath = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + nodepath;
}
- if (locale.getLength() == 0) {
+ if (locale.isEmpty()) {
//TODO: should the Access use the dynamically changing locale_ instead?
locale = locale_;
- if (locale.getLength() == 0) {
+ if (locale.isEmpty()) {
locale = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US"));
}
}
@@ -367,7 +367,7 @@ css::lang::Locale Service::getLocale() throw (css::uno::RuntimeException) {
css::lang::Locale loc;
if (locale_.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("*"))) {
loc.Language = locale_;
- } else if (locale_.getLength() != 0) {
+ } else if (! locale_.isEmpty()) {
try {
comphelper::Locale l(locale_);
loc.Language = l.getLanguage();
@@ -487,8 +487,8 @@ Factory::createInstanceWithArgumentsAndContext(
if (name.equalsIgnoreAsciiCaseAsciiL(
RTL_CONSTASCII_STRINGPARAM("locale")))
{
- if (locale.getLength() != 0 || !(value >>= locale) ||
- locale.getLength() == 0)
+ if (!locale.isEmpty() || !(value >>= locale) ||
+ locale.isEmpty())
{
throw css::uno::Exception(
rtl::OUString(
diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx
index 0fdc1e5..da3a0e2 100644
--- a/configmgr/source/data.cxx
+++ b/configmgr/source/data.cxx
@@ -98,7 +98,7 @@ bool decode(
rtl::OUString Data::createSegment(
rtl::OUString const & templateName, rtl::OUString const & name)
{
- if (templateName.getLength() == 0) {
+ if (templateName.isEmpty()) {
return name;
}
rtl::OUStringBuffer buf(templateName);
@@ -212,7 +212,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
rtl::OUString * canonicRepresentation, Path * path, int * finalizedLayer)
const
{
- if (pathRepresentation.getLength() == 0 || pathRepresentation[0] != '/') {
+ if (pathRepresentation.isEmpty() || pathRepresentation[0] != '/') {
throw css::uno::RuntimeException(
(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad path ")) +
pathRepresentation),
@@ -282,7 +282,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
if (setElement) {
switch (parent->kind()) {
case Node::KIND_LOCALIZED_PROPERTY:
- if (templateName.getLength() != 0) {
+ if (!templateName.isEmpty()) {
throw css::uno::RuntimeException(
(rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("bad path ")) +
@@ -291,7 +291,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
}
break;
case Node::KIND_SET:
- if (templateName.getLength() != 0 &&
+ if (!templateName.isEmpty() &&
!dynamic_cast< SetNode * >(parent.get())->isValidTemplate(
templateName))
{
@@ -308,8 +308,8 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
pathRepresentation),
css::uno::Reference< css::uno::XInterface >());
}
- if (templateName.getLength() != 0 && p != 0) {
- assert(p->getTemplateName().getLength() != 0);
+ if (!templateName.isEmpty() && p != 0) {
+ assert(!p->getTemplateName().isEmpty());
if (!equalTemplateNames(templateName, p->getTemplateName())) {
throw css::uno::RuntimeException(
(rtl::OUString(
diff --git a/configmgr/source/propertynode.cxx b/configmgr/source/propertynode.cxx
index 5aa86db..ea95274 100644
--- a/configmgr/source/propertynode.cxx
+++ b/configmgr/source/propertynode.cxx
@@ -69,7 +69,7 @@ bool PropertyNode::isNillable() const {
}
css::uno::Any PropertyNode::getValue(Components & components) {
- if (externalDescriptor_.getLength() != 0) {
+ if (!externalDescriptor_.isEmpty()) {
css::beans::Optional< css::uno::Any > val(
components.getExternalValue(externalDescriptor_));
if (val.IsPresent) {
diff --git a/configmgr/source/valueparser.cxx b/configmgr/source/valueparser.cxx
index a98aae6..3cc2993 100644
--- a/configmgr/source/valueparser.cxx
+++ b/configmgr/source/valueparser.cxx
@@ -194,7 +194,7 @@ template< typename T > css::uno::Any parseListValue(
{
comphelper::SequenceAsVector< T > seq;
xmlreader::Span sep;
- if (separator.getLength() == 0) {
+ if (separator.isEmpty()) {
sep = xmlreader::Span(RTL_CONSTASCII_STRINGPARAM(" "));
} else {
sep = xmlreader::Span(separator.getStr(), separator.getLength());
@@ -285,7 +285,7 @@ xmlreader::XmlReader::Text ValueParser::getTextMode() const {
case STATE_IT:
return
(type_ == TYPE_STRING || type_ == TYPE_STRING_LIST ||
- separator_.getLength() != 0)
+ !separator_.isEmpty())
? xmlreader::XmlReader::TEXT_RAW
: xmlreader::XmlReader::TEXT_NORMALIZED;
default:
@@ -305,7 +305,7 @@ bool ValueParser::startElement(
case STATE_TEXT:
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
name.equals(RTL_CONSTASCII_STRINGPARAM("it")) &&
- isListType(type_) && separator_.getLength() == 0)
+ isListType(type_) && separator_.isEmpty())
{
pad_.clear();
// before first <it>, characters are not ignored; assume they
diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx
index 1bae01a..3a97853 100644
--- a/configmgr/source/writemodfile.cxx
+++ b/configmgr/source/writemodfile.cxx
@@ -405,7 +405,7 @@ void writeNode(
case Node::KIND_LOCALIZED_VALUE:
{
writeData(handle, RTL_CONSTASCII_STRINGPARAM("<value"));
- if (name.getLength() != 0) {
+ if (!name.isEmpty()) {
writeData(handle, RTL_CONSTASCII_STRINGPARAM(" xml:lang=\""));
writeAttributeValue(handle, name);
writeData(handle, RTL_CONSTASCII_STRINGPARAM("\""));
@@ -438,7 +438,7 @@ void writeNode(
case Node::KIND_SET:
writeData(handle, RTL_CONSTASCII_STRINGPARAM("<node oor:name=\""));
writeAttributeValue(handle, name);
- if (node->getTemplateName().getLength() != 0) { // set member
+ if (!node->getTemplateName().isEmpty()) { // set member
writeData(
handle, RTL_CONSTASCII_STRINGPARAM("\" oor:op=\"replace"));
}
@@ -474,7 +474,7 @@ void writeModifications(
switch (parent->kind()) {
case Node::KIND_LOCALIZED_PROPERTY:
writeData(handle, RTL_CONSTASCII_STRINGPARAM("<value"));
- if (nodeName.getLength() != 0) {
+ if (!nodeName.isEmpty()) {
writeData(
handle, RTL_CONSTASCII_STRINGPARAM(" xml:lang=\""));
writeAttributeValue(handle, nodeName);
diff --git a/configmgr/source/xcdparser.cxx b/configmgr/source/xcdparser.cxx
index 7dfb36d..dee021b 100644
--- a/configmgr/source/xcdparser.cxx
+++ b/configmgr/source/xcdparser.cxx
@@ -86,7 +86,7 @@ bool XcdParser::startElement(
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
name.equals(RTL_CONSTASCII_STRINGPARAM("dependency")))
{
- if (dependency_.getLength() == 0) {
+ if (dependency_.isEmpty()) {
xmlreader::Span attrFile;
for (;;) {
int attrNsId;
@@ -110,7 +110,7 @@ bool XcdParser::startElement(
css::uno::Reference< css::uno::XInterface >());
}
dependency_ = attrFile.convertFromUtf8();
- if (dependency_.getLength() == 0) {
+ if (dependency_.isEmpty()) {
throw css::uno::RuntimeException(
(rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx
index 764cf8c..7ea5cb8 100644
--- a/configmgr/source/xcuparser.cxx
+++ b/configmgr/source/xcuparser.cxx
@@ -490,7 +490,7 @@ void XcuParser::handlePropValue(
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("external")))
{
external = reader.getAttributeValue(true).convertFromUtf8();
- if (external.getLength() == 0) {
+ if (external.isEmpty()) {
throw css::uno::RuntimeException(
(rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
@@ -509,7 +509,7 @@ void XcuParser::handlePropValue(
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >());
}
- if (external.getLength() != 0) {
+ if (!external.isEmpty()) {
throw css::uno::RuntimeException(
(rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
@@ -519,7 +519,7 @@ void XcuParser::handlePropValue(
}
prop->setValue(valueParser_.getLayer(), css::uno::Any());
state_.push(State(false));
- } else if (external.getLength() == 0) {
+ } else if (external.isEmpty()) {
valueParser_.separator_ = separator;
valueParser_.start(prop);
} else {
--
1.7.5.4
--------------030000070709020301020405--
More information about the LibreOffice
mailing list