[Qgis-developer] Small patch to cleanup enum conversion in class QgsGdalProviderBase
David Weiß
David.Weiss at ptvgroup.com
Fri Feb 20 07:28:19 PST 2015
> Hi David,
Hi Jürgen,
> On Fri, 20. Feb 2015 at 12:39:06 +0100, David Weiß wrote:
> > Goal is to improve const and type correctness and shorten the files by
> > removing duplicate statements, thus improving code quality.
>
> > Please review.
>
> Making this a pull request would also have feeded the patch into travis-ci and
> revealed that this doesn't build as there are now ints passed to the methods
> where enums are now expected.
Luigi already pointed that out, makes sense.
Will do next time.
> For code quality I'd also keep the last return and remove the default case
> instead. That way the compiler can warn about missing cases (eg. if we
> missed one or when new enum values are added to GDAL). Commited that
> way as de8a002.
Thanks for the review.
I see your point, but I suggest this should rather be handled by a unit test, a linter or -Wswitch-enum for recent compilers.
I consider switch w/o default bad practice, especially if the enum provides kind of a default value.
> Now back into release packaging mode...
Good luck and have nice weekend!
David
More information about the Qgis-developer
mailing list