2018-08-15 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in rddbmgr(8) that caused unreliable calculation of
	the correct schema version from a package version string.
This commit is contained in:
Fred Gleason 2018-08-15 23:03:28 +00:00
parent e6ea8a59d0
commit f0f5730e76
3 changed files with 13 additions and 5 deletions

View File

@ -17432,3 +17432,6 @@
* Remved 'rdcheckcuts.pro'.
2018-08-15 Fred Gleason <fredg@paravelsystems.com>
* Fixed style inconsistencies in dialogs within rddgimport(1).
2018-08-15 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rddbmgr(8) that caused unreliable calculation of
the correct schema version from a package version string.

View File

@ -320,7 +320,8 @@ MainObject::MainObject(QObject *parent)
}
}
else {
if((set_schema=GetVersionSchema(set_version))==0) {
set_schema=GetVersionSchema(set_version);
if(set_schema==0) {
fprintf(stderr,"invalid/unsupported Rivendell version\n");
exit(1);
}

View File

@ -32,6 +32,7 @@ class VersionString : public QString
int minor() const;
int point() const;
bool operator<(const VersionString &rhs) const;
bool operator==(const VersionString &rhs) const;
private:
int ver_major;
@ -95,13 +96,16 @@ bool VersionString::operator<(const VersionString &rhs) const
if(minor()>rhs.minor()) {
return false;
}
if(point()<rhs.point()) {
return true;
}
return false;
}
bool VersionString::operator==(const VersionString &rhs) const
{
return (major()==rhs.major())&&(minor()==rhs.minor());
}
//
// Version -> Schema Map
//
@ -169,7 +173,7 @@ int MainObject::GetVersionSchema(const QString &ver) const
return 0;
}
return global_version_map[VersionString(f0[0]+"."+f0[1])];
return global_version_map.value(VersionString(f0[0]+"."+f0[1]));
}