summaryrefslogtreecommitdiff
path: root/unoidl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-10 10:27:43 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-10 10:31:56 +0100
commit7cb9fce062c1c753708282098c2021ce342c675f (patch)
tree8e2ffc08f73972a9d97c86958e92197e6d98d169 /unoidl
parent9690dcc42e996dd993fe8cacca5694ddc0d84feb (diff)
loplugin:nullptr (automatic rewrite)
Change-Id: I7c8f90ae3cb496def3bee9a8a84974dd63478af3
Diffstat (limited to 'unoidl')
-rw-r--r--unoidl/source/legacyprovider.cxx4
-rw-r--r--unoidl/source/sourcefileprovider.cxx4
-rw-r--r--unoidl/source/sourceprovider-parser-requires.hxx6
-rw-r--r--unoidl/source/unoidl-check.cxx4
-rw-r--r--unoidl/source/unoidl-read.cxx6
-rw-r--r--unoidl/source/unoidl-write.cxx12
-rw-r--r--unoidl/source/unoidl.cxx2
-rw-r--r--unoidl/source/unoidlprovider.cxx36
8 files changed, 37 insertions, 37 deletions
diff --git a/unoidl/source/legacyprovider.cxx b/unoidl/source/legacyprovider.cxx
index eb3dde4cfef5..46058c7be032 100644
--- a/unoidl/source/legacyprovider.cxx
+++ b/unoidl/source/legacyprovider.cxx
@@ -113,7 +113,7 @@ Cursor::Cursor(
}
rtl::Reference< Entity > Cursor::getNext(OUString * name) {
- assert(name != 0);
+ assert(name != nullptr);
rtl::Reference< Entity > ent;
if (index_ != names_.getLength()) {
OUString path(names_.getElement(index_));
@@ -164,7 +164,7 @@ std::vector< OUString > Module::getMemberNames() const {
}
typereg::Reader getReader(RegistryKey & key, std::vector< char > * buffer) {
- assert(buffer != 0);
+ assert(buffer != nullptr);
RegValueType type;
sal_uInt32 size;
RegError e = key.getValueInfo("", &type, &size);
diff --git a/unoidl/source/sourcefileprovider.cxx b/unoidl/source/sourcefileprovider.cxx
index 7e687b7231a8..18a6d666cf02 100644
--- a/unoidl/source/sourcefileprovider.cxx
+++ b/unoidl/source/sourcefileprovider.cxx
@@ -36,7 +36,7 @@ private:
};
rtl::Reference< Entity > Cursor::getNext(OUString * name) {
- assert(name != 0);
+ assert(name != nullptr);
rtl::Reference< Entity > ent;
if (iterator_ != map_.end()) {
*name = iterator_->first;
@@ -129,7 +129,7 @@ rtl::Reference<Entity> SourceFileProvider::findEntity(OUString const & name)
return rtl::Reference<Entity>();
}
Module * mod = dynamic_cast< Module * >(j->second.get());
- assert(mod != 0);
+ assert(mod != nullptr);
map = &mod->map;
}
}
diff --git a/unoidl/source/sourceprovider-parser-requires.hxx b/unoidl/source/sourceprovider-parser-requires.hxx
index f9cd27ef83b1..18a5cf02ba81 100644
--- a/unoidl/source/sourceprovider-parser-requires.hxx
+++ b/unoidl/source/sourceprovider-parser-requires.hxx
@@ -97,7 +97,7 @@ struct SourceProviderType {
explicit SourceProviderType(SourceProviderType const * componentType):
type(TYPE_SEQUENCE),
entity() // avoid false warnings about uninitialized member
- { assert(componentType != 0); subtypes.push_back(*componentType); }
+ { assert(componentType != nullptr); subtypes.push_back(*componentType); }
SourceProviderType(
Type theType, OUString const & theName,
@@ -105,7 +105,7 @@ struct SourceProviderType {
type(theType), name(theName), entity(theEntity)
{
assert(theType >= TYPE_ENUM && theType <= TYPE_INTERFACE);
- assert(theEntity != 0);
+ assert(theEntity != nullptr);
}
SourceProviderType(
@@ -115,7 +115,7 @@ struct SourceProviderType {
type(TYPE_INSTANTIATED_POLYMORPHIC_STRUCT),
name(polymorphicStructTypeTemplateName), entity(theEntity),
subtypes(typeArguments)
- { assert(theEntity != 0); }
+ { assert(theEntity != nullptr); }
explicit SourceProviderType(OUString const & identifier):
type(TYPE_PARAMETER), name(identifier),
diff --git a/unoidl/source/unoidl-check.cxx b/unoidl/source/unoidl-check.cxx
index e52d3f8828d0..e0993bae60fd 100644
--- a/unoidl/source/unoidl-check.cxx
+++ b/unoidl/source/unoidl-check.cxx
@@ -91,7 +91,7 @@ OUString getArgumentUri(sal_uInt32 argument, bool * delimiter) {
OUString arg;
rtl_getAppCommandArg(argument, &arg.pData);
if (arg == "--") {
- if (delimiter == 0) {
+ if (delimiter == nullptr) {
badUsage();
}
*delimiter = true;
@@ -1172,7 +1172,7 @@ SAL_IMPLEMENT_MAIN() {
int side = 0;
for (sal_uInt32 i = 0; i != args; ++i) {
bool delimiter = false;
- OUString uri(getArgumentUri(i, side == 0 ? &delimiter : 0));
+ OUString uri(getArgumentUri(i, side == 0 ? &delimiter : nullptr));
if (delimiter) {
side = 1;
} else {
diff --git a/unoidl/source/unoidl-read.cxx b/unoidl/source/unoidl-read.cxx
index 67c870c6fb7e..e0ea73f4e13a 100644
--- a/unoidl/source/unoidl-read.cxx
+++ b/unoidl/source/unoidl-read.cxx
@@ -85,9 +85,9 @@ OUString decomposeType(
OUString const & type, std::size_t * rank,
std::vector<OUString> * typeArguments, bool * entity)
{
- assert(rank != 0);
- assert(typeArguments != 0);
- assert(entity != 0);
+ assert(rank != nullptr);
+ assert(typeArguments != nullptr);
+ assert(entity != nullptr);
OUString nucl(type);
*rank = 0;
typeArguments->clear();
diff --git a/unoidl/source/unoidl-write.cxx b/unoidl/source/unoidl-write.cxx
index f400c6afa948..01d22baffd52 100644
--- a/unoidl/source/unoidl-write.cxx
+++ b/unoidl/source/unoidl-write.cxx
@@ -58,11 +58,11 @@ OUString getArgumentUri(sal_uInt32 argument, bool * entities) {
OUString arg;
rtl_getAppCommandArg(argument, &arg.pData);
if (arg.startsWith("@", &arg)) {
- if (entities == 0) {
+ if (entities == nullptr) {
badUsage();
}
*entities = true;
- } else if (entities != 0) {
+ } else if (entities != nullptr) {
*entities = false;
}
OUString url;
@@ -454,7 +454,7 @@ sal_uInt64 writeMap(
{
switch (i->second.entity->getSort()) {
case unoidl::Entity::SORT_MODULE:
- i->second.dataOffset = writeMap(file, i->second.module, 0);
+ i->second.dataOffset = writeMap(file, i->second.module, nullptr);
break;
case unoidl::Entity::SORT_ENUM_TYPE:
{
@@ -1002,7 +1002,7 @@ sal_uInt64 writeMap(
i->second.nameOffset = writeNulName(file, i->first);
}
sal_uInt64 off = getOffset(file);
- if (rootSize == 0) {
+ if (rootSize == nullptr) {
write8(file, 0); // SORT_MODULE
write32(file, map.size());
// overflow from std::map::size_type -> sal_uInt64 is unrealistic
@@ -1033,7 +1033,7 @@ SAL_IMPLEMENT_MAIN() {
std::map< OUString, Item > map;
for (sal_uInt32 i = 0; i != args - 1; ++i) {
assert(args > 1);
- OUString uri(getArgumentUri(i, i == args - 2 ? &entities : 0));
+ OUString uri(getArgumentUri(i, i == args - 2 ? &entities : nullptr));
if (entities) {
mapEntities(mgr, uri, map);
} else {
@@ -1053,7 +1053,7 @@ SAL_IMPLEMENT_MAIN() {
: rtl::Reference< unoidl::MapCursor >()),
map);
}
- osl::File f(getArgumentUri(args - 1, 0));
+ osl::File f(getArgumentUri(args - 1, nullptr));
osl::FileBase::RC e = f.open(osl_File_OpenFlag_Write);
if (e == osl::FileBase::E_NOENT) {
e = f.open(osl_File_OpenFlag_Write | osl_File_OpenFlag_Create);
diff --git a/unoidl/source/unoidl.cxx b/unoidl/source/unoidl.cxx
index d6569e689a71..56761e1e315b 100644
--- a/unoidl/source/unoidl.cxx
+++ b/unoidl/source/unoidl.cxx
@@ -91,7 +91,7 @@ rtl::Reference< Entity > AggregatingCursor::getNext(OUString * name) {
rtl::Reference< Entity > ent(cursor_->getNext(&n));
if (ent.is()) {
if (seen_.insert(n).second) {
- if (name != 0) {
+ if (name != nullptr) {
*name = n;
}
return ent->getSort() == Entity::SORT_MODULE
diff --git a/unoidl/source/unoidlprovider.cxx b/unoidl/source/unoidlprovider.cxx
index 94204e809dc7..d2e664527a24 100644
--- a/unoidl/source/unoidlprovider.cxx
+++ b/unoidl/source/unoidlprovider.cxx
@@ -256,7 +256,7 @@ void checkEntityName(
}
-MappedFile::MappedFile(OUString const & fileUrl): uri(fileUrl), handle(0) {
+MappedFile::MappedFile(OUString const & fileUrl): uri(fileUrl), handle(nullptr) {
oslFileError e = osl_openFile(uri.pData, &handle, osl_File_OpenFlag_Read);
switch (e) {
case osl_File_E_None:
@@ -417,7 +417,7 @@ double MappedFile::getIso60599Binary64(sal_uInt32 offset) const {
OUString MappedFile::readIdxString(
sal_uInt32 * offset, rtl_TextEncoding encoding) const
{
- assert(offset != 0);
+ assert(offset != nullptr);
sal_uInt32 len = read32(*offset);
sal_uInt32 off;
if ((len & 0x80000000) == 0) {
@@ -470,7 +470,7 @@ Compare compare(
sal_Int32 nameOffset, sal_Int32 nameLength, MapEntry const * entry)
{
assert(file.is());
- assert(entry != 0);
+ assert(entry != nullptr);
sal_uInt32 off = entry->name.getUnsigned32();
if (off > file->size - 1) { // at least a trailing NUL
throw FileFormatException(
@@ -533,7 +533,7 @@ sal_uInt32 findInMap(
std::vector< OUString > readAnnotations(
bool annotated, rtl::Reference< MappedFile > const & file,
- sal_uInt32 offset, sal_uInt32 * newOffset = 0)
+ sal_uInt32 offset, sal_uInt32 * newOffset = nullptr)
{
std::vector< OUString > ans;
if (annotated) {
@@ -543,7 +543,7 @@ std::vector< OUString > readAnnotations(
ans.push_back(file->readIdxString(&offset));
}
}
- if (newOffset != 0) {
+ if (newOffset != nullptr) {
*newOffset = offset;
}
return ans;
@@ -551,18 +551,18 @@ std::vector< OUString > readAnnotations(
ConstantValue readConstant(
rtl::Reference< MappedFile > const & file, sal_uInt32 offset,
- sal_uInt32 * newOffset = 0, bool * annotated = 0)
+ sal_uInt32 * newOffset = nullptr, bool * annotated = nullptr)
{
assert(file.is());
int v = file->read8(offset);
int type = v & 0x7F;
- if (annotated != 0) {
+ if (annotated != nullptr) {
*annotated = (v & 0x80) != 0;
}
switch (type) {
case 0: // BOOLEAN
v = file->read8(offset + 1);
- if (newOffset != 0) {
+ if (newOffset != nullptr) {
*newOffset = offset + 2;
}
switch (v) {
@@ -577,14 +577,14 @@ ConstantValue readConstant(
+ OUString::number(v)));
}
case 1: // BYTE
- if (newOffset != 0) {
+ if (newOffset != nullptr) {
*newOffset = offset + 2;
}
return ConstantValue(static_cast< sal_Int8 >(file->read8(offset + 1)));
//TODO: implementation-defined behavior of conversion from sal_uInt8
// to sal_Int8 relies on two's complement representation
case 2: // SHORT
- if (newOffset != 0) {
+ if (newOffset != nullptr) {
*newOffset = offset + 3;
}
return ConstantValue(
@@ -592,12 +592,12 @@ ConstantValue readConstant(
//TODO: implementation-defined behavior of conversion from
// sal_uInt16 to sal_Int16 relies on two's complement representation
case 3: // UNSIGNED SHORT
- if (newOffset != 0) {
+ if (newOffset != nullptr) {
*newOffset = offset + 3;
}
return ConstantValue(file->read16(offset + 1));
case 4: // LONG
- if (newOffset != 0) {
+ if (newOffset != nullptr) {
*newOffset = offset + 5;
}
return ConstantValue(
@@ -605,12 +605,12 @@ ConstantValue readConstant(
//TODO: implementation-defined behavior of conversion from
// sal_uInt32 to sal_Int32 relies on two's complement representation
case 5: // UNSIGNED LONG
- if (newOffset != 0) {
+ if (newOffset != nullptr) {
*newOffset = offset + 5;
}
return ConstantValue(file->read32(offset + 1));
case 6: // HYPER
- if (newOffset != 0) {
+ if (newOffset != nullptr) {
*newOffset = offset + 9;
}
return ConstantValue(
@@ -618,17 +618,17 @@ ConstantValue readConstant(
//TODO: implementation-defined behavior of conversion from
// sal_uInt64 to sal_Int64 relies on two's complement representation
case 7: // UNSIGNED HYPER
- if (newOffset != 0) {
+ if (newOffset != nullptr) {
*newOffset = offset + 9;
}
return ConstantValue(file->read64(offset + 1));
case 8: // FLOAT
- if (newOffset != 0) {
+ if (newOffset != nullptr) {
*newOffset = offset + 5;
}
return ConstantValue(file->readIso60599Binary32(offset + 1));
case 9: // DOUBLE
- if (newOffset != 0) {
+ if (newOffset != nullptr) {
*newOffset = offset + 9;
}
return ConstantValue(file->readIso60599Binary64(offset + 1));
@@ -669,7 +669,7 @@ private:
};
rtl::Reference< Entity > UnoidlCursor::getNext(OUString * name) {
- assert(name != 0);
+ assert(name != nullptr);
rtl::Reference< Entity > ent;
if (index_ != map_.map.size) {
*name = file_->readNulName(map_.map.begin[index_].name.getUnsigned32());