[KPhotoAlbum] Keywords with id=0?

Robert Krawitz rlk at alum.mit.edu
Sun Dec 15 16:23:17 GMT 2019


On Sun, 15 Dec 2019 17:05:53 +0100 (CET), Harald Barth wrote:
>>                     if (category->idForName(member) == 0)
>>                         qCWarning(XMLDBLog) << "Member" << member << "in group" << categoryName << "->" << groupMapIt.key() << "has no id!";
>
> If my check in the source is right: idForName returns an int and not an unsigned int.
>
> So unless -1 is a valid id I'd recommend to write the test as <= 0.

Agreed.  That's what I was originally going to do, actually.  I also
changed the validity test in rename to > 0 while I was at it.

> Alternatively one can exchnage all variables holding id and the
> return type of involved functions to unsigned int instead.

I think I'll do it this way; if we change it to unsigned, and someone
decrements something from 0, it will look like a large positive
integer.

OK, someone give me an lgtm and I'll push it.
-- 
Robert Krawitz                                     <rlk at alum.mit.edu>

***  MIT Engineers   A Proud Tradition   http://mitathletics.com  ***
Member of the League for Programming Freedom  --  http://ProgFree.org
Project lead for Gutenprint   --    http://gimp-print.sourceforge.net

"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton



More information about the Kphotoalbum mailing list