From 660d19b4f018bdefc18a96f1bcbafcdca040279b Mon Sep 17 00:00:00 2001 From: ip_gpu Date: Mon, 30 Oct 2017 09:33:19 +0500 Subject: [PATCH] fixed from PVS-Studio: V618 It's dangerous to call the 'fprintf' function in such a manner, as the line being passed could contain format specification. The example of the safe code: printf("%s", str); parameters.cpp 174 V728 An excessive check 'Recurse == 0' can be simplified. The '||' operator is surrounded by opposite expressions. klustakwik.cpp 1519 --- klustakwik.cpp | 2 +- parameters.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/klustakwik.cpp b/klustakwik.cpp index a9c66a5..f5f9f67 100644 --- a/klustakwik.cpp +++ b/klustakwik.cpp @@ -1516,7 +1516,7 @@ scalar KK::CEM(char *CluFile, integer Recurse, integer InitRand, if(Verbose>=1) { if(Recurse==0) Output("\t\tSP:"); - if ((Recurse!=0)||(SplitInfo==1&&Recurse==0)) + if ((Recurse!=0)||(SplitInfo==1)) Output("Iteration %d%c (" SCALARFMT " sec): %d clusters\n", (int)Iter, FullStep ? 'F' : 'Q', timesofar, (int)nClustersAlive); } diff --git a/parameters.cpp b/parameters.cpp index 7906c65..4a301bc 100644 --- a/parameters.cpp +++ b/parameters.cpp @@ -171,7 +171,7 @@ void print_params(FILE *fp) add_param(BOOLEAN, "help", &help); if (help) { - fprintf(fp, HelpString); + fprintf(fp, "%s\n", HelpString); PARAMETERS_TABLE(PRINT_PARAMETERS); exit(0); }