Re: Keywords with id=0?
Robert Krawitz <rlk-FrUbXkNCsVf2fBVCVOL8/[email protected]> Sun, 15 Dec 2019 11:23:17 -0500 (EST)
| Newsgroups | gmane.comp.kde.kimdaba |
|---|---|
| Message-ID | <20191215162317.6660F424960@localhost> |
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-FrUbXkNCsVf2fBVCVOL8/[email protected]> *** 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