openbmc / phosphor-certificate-manager

Apache License 2.0
4 stars 4 forks source link

Fix CI compiler warnings #9

Open devenrao opened 4 years ago

devenrao commented 4 years ago

There are some warning in CI build probably need to check and fix

home/jenkins-op/workspace/openbmc-repository-ci/openbmc/phosphor-certificate-manager/certificate.cpp:91: warning: the use of tempnam' is dangerous, better usemkstemp'

16:11:34 [certificate.hpp:88]: (performance) Function parameter 'filePath' should be passed by const reference. 16:11:34 [certs_manager.hpp:70]: (performance) Function parameter 'filePath' should be passed by const reference. 16:11:34 [certificate.cpp:212]: (performance) Function parameter 'filePath' should be passed by const reference. 16:11:34 [certs_manager.cpp:457]: (error) Memory pointed to by 'rsa' is freed twice. 16:11:34 [certificate.cpp:498]: (style) Consider using std::find_if algorithm instead of a raw loop. 16:11:34 [certs_manager.cpp:249]: (style) Statements following return, break, continue, goto or throw will never be executed. 16:11:34 [certs_manager.cpp:129]: (performance) Function parameter 'filePath' should be passed by const reference. 16:11:34 [certs_manager.cpp:216]: (performance) Function parameter 'alternativeNames' should be passed by const reference. 16:11:34 [certs_manager.cpp:216]: (performance) Function parameter 'challengePassword' should be passed by const reference. 16:11:34 [certs_manager.cpp:217]: (performance) Function parameter 'city' should be passed by const reference. 16:11:34 [certs_manager.cpp:217]: (performance) Function parameter 'commonName' should be passed by const reference. 16:11:34 [certs_manager.cpp:217]: (performance) Function parameter 'contactPerson' should be passed by const reference. 16:11:34 [certs_manager.cpp:218]: (performance) Function parameter 'country' should be passed by const reference. 16:11:34 [certs_manager.cpp:218]: (performance) Function parameter 'email' should be passed by const reference. 16:11:34 [certs_manager.cpp:218]: (performance) Function parameter 'givenName' should be passed by const reference. 16:11:34 [certs_manager.cpp:219]: (performance) Function parameter 'initials' should be passed by const reference. 16:11:34 [certs_manager.cpp:219]: (performance) Function parameter 'keyCurveId' should be passed by const reference. 16:11:34 [certs_manager.cpp:220]: (performance) Function parameter 'keyPairAlgorithm' should be passed by const reference. 16:11:34 [certs_manager.cpp:220]: (performance) Function parameter 'keyUsage' should be passed by const reference. 16:11:34 [certs_manager.cpp:221]: (performance) Function parameter 'organization' should be passed by const reference. 16:11:34 [certs_manager.cpp:221]: (performance) Function parameter 'organizationalUnit' should be passed by const reference. 16:11:34 [certs_manager.cpp:221]: (performance) Function parameter 'state' should be passed by const reference. 16:11:34 [certs_manager.cpp:222]: (performance) Function parameter 'surname' should be passed by const reference. 16:11:34 [certs_manager.cpp:222]: (performance) Function parameter 'unstructuredName' should be passed by const reference. 16:11:34 [certs_manager.cpp:309]: (performance) Function parameter 'challengePassword' should be passed by const reference. 16:11:34 [certs_manager.cpp:310]: (performance) Function parameter 'city' should be passed by const reference. 16:11:34 [certs_manager.cpp:310]: (performance) Function parameter 'commonName' should be passed by const reference. 16:11:34 [certs_manager.cpp:310]: (performance) Function parameter 'contactPerson' should be passed by const reference. 16:11:34 [certs_manager.cpp:311]: (performance) Function parameter 'country' should be passed by const reference. 16:11:34 [certs_manager.cpp:311]: (performance) Function parameter 'email' should be passed by const reference. 16:11:34 [certs_manager.cpp:311]: (performance) Function parameter 'givenName' should be passed by const reference. 16:11:34 [certs_manager.cpp:312]: (performance) Function parameter 'initials' should be passed by const reference. 16:11:34 [certs_manager.cpp:312]: (performance) Function parameter 'keyCurveId' should be passed by const reference. 16:11:34 [certs_manager.cpp:314]: (performance) Function parameter 'organization' should be passed by const reference. 16:11:34 [certs_manager.cpp:314]: (performance) Function parameter 'organizationalUnit' should be passed by const reference. 16:11:34 [certs_manager.cpp:314]: (performance) Function parameter 'state' should be passed by const reference. 16:11:34 [certs_manager.cpp:315]: (performance) Function parameter 'surname' should be passed by const reference. 16:11:34 [certs_manager.cpp:315]: (performance) Function parameter 'unstructuredName' should be passed by const reference. 16:11:34 [test/certs_manager_test.cpp:36]: (warning) Member variable 'TestCertificates::certId' is not initialized in the constructor. 16:11:34 [test/certs_manager_test.cpp:146]: (style) Class 'MainApp' has a constructor with 1 argument that is not explicit. 16:11:34

matthewfischer commented 8 months ago

These are all fixed with the exception of the first one:

home/jenkins-op/workspace/openbmc-repository-ci/openbmc/phosphor-certificate-manager/certificate.cpp:91: warning: the use of tempnam' is dangerous, better use mkstemp'