dive.h: add a variant of FOR_EACH_PICTURE

This prevents a warning caused by -Waddress, that the address
of 'displayed_dive' will always be defined.

Exact macro variant suggested by Dirk.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2014-10-28 12:13:07 +02:00 committed by Dirk Hohndel
parent 70a2e91f1c
commit 874754e22b
2 changed files with 3 additions and 1 deletions

2
dive.h
View file

@ -349,6 +349,8 @@ struct picture {
if (_dive) \ if (_dive) \
for (struct picture *picture = (_dive)->picture_list; picture; picture = picture->next) for (struct picture *picture = (_dive)->picture_list; picture; picture = picture->next)
#define FOR_EACH_PICTURE_NON_PTR(_divestruct) \
for (struct picture *picture = (_divestruct).picture_list; picture; picture = picture->next)
extern struct picture *alloc_picture(); extern struct picture *alloc_picture();
extern void dive_create_picture(struct dive *d, char *filename, int shift_time); extern void dive_create_picture(struct dive *d, char *filename, int shift_time);

View file

@ -51,7 +51,7 @@ void DivePictureModel::updateDivePictures()
stringPixmapCache.clear(); stringPixmapCache.clear();
QStringList pictures; QStringList pictures;
FOR_EACH_PICTURE (&displayed_dive) { FOR_EACH_PICTURE_NON_PTR(displayed_dive) {
stringPixmapCache[QString(picture->filename)].offsetSeconds = picture->offset.seconds; stringPixmapCache[QString(picture->filename)].offsetSeconds = picture->offset.seconds;
pictures.push_back(QString(picture->filename)); pictures.push_back(QString(picture->filename));
} }