diff options
| -rw-r--r-- | python/cache.cc | 6 | ||||
| -rw-r--r-- | python/indexfile.cc | 4 | ||||
| -rw-r--r-- | python/metaindex.cc | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/python/cache.cc b/python/cache.cc index 30c0e683..68ee7b9e 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -840,6 +840,7 @@ static PyObject *VersionGetIsTrusted(PyObject *Self, void*) { } #endif +#define NOTNULL(x) (x ? x : "") static PyObject *VersionRepr(PyObject *Self) { @@ -848,11 +849,12 @@ static PyObject *VersionRepr(PyObject *Self) " Arch:'%s' Size:%lu ISize:%lu Hash:%u ID:%u " "Priority:%u>", Self->ob_type->tp_name, Ver.ParentPkg().Name(), Ver.VerStr(), - Ver.Section(), Ver.Arch(), + NOTNULL(Ver.Section()), NOTNULL(Ver.Arch()), (unsigned long)Ver->Size, (unsigned long)Ver->InstalledSize, Ver->Hash, Ver->ID, Ver->Priority); } +#undef NOTNULL static PyGetSetDef VersionGetSet[] = { {"arch",VersionGetArch}, @@ -1096,7 +1098,7 @@ static PyObject *DependencyRepr(PyObject *Self) return PyString_FromFormat("<%s object: pkg:'%s' ver:'%s' comp:'%s'>", Self->ob_type->tp_name, Dep.TargetPkg().Name(), - (Dep.TargetVer() == 0?"":Dep.TargetVer()), + (Dep.TargetVer() == 0 ? "" : Dep.TargetVer()), Dep.CompType()); } diff --git a/python/indexfile.cc b/python/indexfile.cc index 74345ec9..a6f8904e 100644 --- a/python/indexfile.cc +++ b/python/indexfile.cc @@ -55,6 +55,7 @@ static PyObject *PackageIndexFileGetIsTrusted(PyObject *Self,void*) { } #undef File +#define S(x) (x ? x : "") static PyObject *PackageIndexFileRepr(PyObject *Self) { pkgIndexFile *File = GetCpp<pkgIndexFile*>(Self); @@ -62,10 +63,11 @@ static PyObject *PackageIndexFileRepr(PyObject *Self) "Label:'%s' Describe='%s' Exists='%i' " "HasPackages='%i' Size='%lu' " "IsTrusted='%i' ArchiveURI='%s'>", - File->GetType()->Label, File->Describe().c_str(), File->Exists(), + S(File->GetType()->Label), File->Describe().c_str(), File->Exists(), File->HasPackages(), File->Size(), File->IsTrusted(), File->ArchiveURI("").c_str()); } +#undef S static PyGetSetDef PackageIndexFileGetSet[] = { {"describe",PackageIndexFileGetDescribe}, diff --git a/python/metaindex.cc b/python/metaindex.cc index 62ff6b90..4e059f0c 100644 --- a/python/metaindex.cc +++ b/python/metaindex.cc @@ -61,14 +61,16 @@ static PyGetSetDef MetaIndexGetSet[] = { {} }; +#define S(x) (x ? x : "") static PyObject *MetaIndexRepr(PyObject *Self) { metaIndex *meta = GetCpp<metaIndex*>(Self); return PyString_FromFormat("<%s object: type='%s', uri:'%s' dist='%s' " "is_trusted='%i'>", Self->ob_type->tp_name, - meta->GetType(), meta->GetURI().c_str(), + S(meta->GetType()), meta->GetURI().c_str(), meta->GetDist().c_str(), meta->IsTrusted()); } +#undef S PyTypeObject PyMetaIndex_Type = { |
