D20945: KContacts - fix compile warnings

Pino Toscano noreply at phabricator.kde.org
Wed May 1 22:29:29 BST 2019


pino added inline comments.

INLINE COMMENTS

> ldifconverter.cpp:114-121
> +    bool result = true;
> +
>      ContactGroup::List::ConstIterator it;
>      const ContactGroup::List::ConstIterator end(contactGroupList.constEnd());
>      for (it = contactGroupList.constBegin(); it != end; ++it) {
> -        contactGroupToLDIF(*it, str);
> +        result = contactGroupToLDIF(*it, str);
>      }

this will now return the result of the last contactGroupToLDIF call -- so, if contactGroupToLDIF returns false for any element but last of the list, the result is still true (like the current code, though)

IMHO there are two options:
a) if the results of the various contactGroupToLDIF is not wanted/needed, cast them to (void)
b) if the results matter, either make sure that at least one failure generates a failure result of the whole function, or stop and fail at the first contactGroupToLDIF call that returns false

> ldifconverter.cpp:126-133
> +    bool result = true;
> +
>      AddresseeList::ConstIterator it;
>      const AddresseeList::ConstIterator end(addrList.constEnd());
>      for (it = addrList.constBegin(); it != end; ++it) {
> -        addresseeToLDIF(*it, str);
> +        result = addresseeToLDIF(*it, str);
>      }

ditto

REPOSITORY
  R174 PIM: KContacts

REVISION DETAIL
  https://phabricator.kde.org/D20945

To: winterz, vkrause, mlaurent
Cc: pino, kde-pim, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20190501/8fe01aa6/attachment.html>


More information about the kde-pim mailing list