A Dissabte 17 Gener 2009, Brad Hards va escriure: > Coverity says that there is a path through doFilePrint that can result in > returning an uninitialised value (in this case, ret). > > (I agree: look at the path through line 83: > if ( res ) ret = 0; > If res is not true, then ret won't be initialised.) > > See run 183 for this one. > > We could just turn that into > if (res) { > ret = 0; > } else { > ret = -1; > } > but it seems cleaner to just initialise it in the first place. See below. > > I'm just not sure what the right initialisation value should be. Ideas?
That's John's code and i think initialisation is a bad idea since if you look at .h there's an explanation of what each value means, it seems we need a new -X for this error, or at least a "generic error" code and then we can use it as generic initialization value of ret. Albert > > Brad > > --- core/fileprinter.cpp (revision 912249) > +++ core/fileprinter.cpp (working copy) > @@ -66,7 +66,7 @@ > > QString exe; > QStringList argList; > - int ret; > + int ret = -1; > > // Print to File if a filename set, assumes there must be only 1 file > if ( !printer.outputFileName().isEmpty() ) { > _______________________________________________ > Okular-devel mailing list > Okular-devel@kde.org > https://mail.kde.org/mailman/listinfo/okular-devel _______________________________________________ Okular-devel mailing list Okular-devel@kde.org https://mail.kde.org/mailman/listinfo/okular-devel