Bug 392405 - Function 'getImageIdsFromArea' argument order different
Summary: Function 'getImageIdsFromArea' argument order different
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Engine (show other bugs)
Version: unspecified
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-27 11:37 UTC by Sebastian
Modified: 2018-03-27 14:01 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian 2018-03-27 11:37:25 UTC
Cppcheck found an issue with the order of the function arguments between declaration and definition in latest git sources:
Id: funcArgOrderDifferent
Summary: Function 'getImageIdsFromArea' argument order different: declaration 'lat1, lng1, lat2, lng2, sortMode, sortBy' definition 'lat1, lat2, lng1, lng2, , '

Declaration in coredb.h:
    QList<QVariant> getImageIdsFromArea(qreal lat1, qreal lng1, qreal lat2, qreal lng2, int sortMode, const QString& sortBy);

Definition in coredb.cpp:
QList<QVariant> CoreDB::getImageIdsFromArea(qreal lat1, qreal lat2, qreal lng1, qreal lng2, int /*sortMode*/,
                                             const QString& /*sortBy*/)

One of them must be wrong. I do not know if it results in an error currently, but i guess it is better to fix it.
Comment 1 caulier.gilles 2018-03-27 13:54:34 UTC
The place where this function is used is this one :

QList<QVariant> imagesInfoFromArea =
                CoreDbAccess().db()->getImageIdsFromArea(m_jobInfo.lat1(),
                                                         m_jobInfo.lat2(),
                                                         m_jobInfo.lng1(),
                                                         m_jobInfo.lng2(),
                                                         0,
                                                         QLatin1String("rating"));

... from GPSJob class. So the right order is lattitude x2 , longitude x2.

Into CoreDB::getImageIdsFromArea(), the argument are serialized into a QList<Qvariant> and passed to the DB interface to build the query.

So just the coredb.h file must be modified. Thank to ccpcheck to find the mess in arguments order.

Gilles Caulier
Comment 2 caulier.gilles 2018-03-27 13:56:03 UTC
Git commit e44632338a2ce8af7883d657a8a0201b79f7d6c4 by Gilles Caulier.
Committed on 27/03/2018 at 13:55.
Pushed by cgilles into branch 'master'.

fix arg order mess detected by ccpcheck
FIXED-IN: 6.0.0

M  +1    -1    core/libs/database/coredb/coredb.h

https://commits.kde.org/digikam/e44632338a2ce8af7883d657a8a0201b79f7d6c4
Comment 3 caulier.gilles 2018-03-27 14:01:15 UTC
Sebastian,

Just for info, we have a Jenkins CI running on KDE server to check code and more...

Look here :

https://build.kde.org/job/Extragear%20digikam%20kf5-qt5%20SUSEQt5.9/

ANother static analyzer source code script running over digiKam is Krazy. This give another reports, more focused on Qt like source code (ccpcheck is more generic) :

http://ebn.kde.org/krazy/reports/extragear/graphics/digikam/

All patches to fixes warnings from these tools are welcome...

BEst

Gilles Caulier