github-af / SmartPGP

SmartPGP is a JavaCard implementation of the OpenPGP card specifications
GNU General Public License v2.0
227 stars 47 forks source link

Improve code quality #27

Closed bitlogik closed 3 years ago

bitlogik commented 3 years ago

We performed a compilation with a zealous compiler, that provides an advanced static analysis of the code.

That doesn't change the behavior of the applet, but this improve code quality, which is helpful for a security application. This mostly remove unnecessary code.

The changes are the following :

martinpaljak commented 3 years ago

I'd split it into removing useless code (nooone should have objections) and the this. change, which is a questionable matter of taste, especially with modern IDE-s

bitlogik commented 3 years ago

OK will do that. Will remove the "this" commit from this PR, and then open an other dedicated PR, where the developers can bicker on whether they appreciate or not this compiler warning. 😄

af-anssi commented 3 years ago

There are three main branches in the project: javacard-3.0.1, javacard-3.0.4-without-secure-messaging and javacard-3.0.4. The branch javacard-3.0.4-without-secure-messaging is based on javacard-3.0.1, and the branch `javacard-3.0.4 is based on javacard-3.0.4-without-secure-messaging.

Could you please split this pull request into several pull requests on the branch where the code to patch first appears ?

bitlogik commented 3 years ago

OK. This PR is now for the javacard-304. I'll do 2 others PR for the others branches (jc301 and jc304w/oSM).

af-anssi commented 3 years ago

I integrated your commit "Avoid same name as an attribute" 4cc58d2. Thank you for your contribution.

af-anssi commented 3 years ago

I also integrated your commit "Not required casting" 9bb7c71. Thanks again.

af-anssi commented 3 years ago

I did not integrated your commit "Remove useless else". I think the code is more human readable with those two else, even if there concretely not useful.