diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-14 17:14:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-11 11:38:15 +0200 |
commit | 1f08bff31238d5818c54a0b86570689644dff087 (patch) | |
tree | d4d6f4b62a3c48ddeb85ba89818247c17f2578c8 /hwpfilter | |
parent | ff130af9661a57d290dbf89b54a4c0ce8d0f71ea (diff) |
new loplugin:shouldreturnbool
look for methods returning only 1 and/or 0, which (most of the time)
should be returning bool.
Off by default, because some of this is a matter of taste
Change-Id: Ib17782e629888255196e89d4a178618a9612a0de
Reviewed-on: https://gerrit.libreoffice.org/54379
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'hwpfilter')
-rw-r--r-- | hwpfilter/source/solver.cxx | 14 | ||||
-rw-r--r-- | hwpfilter/source/solver.h | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/hwpfilter/source/solver.cxx b/hwpfilter/source/solver.cxx index f297160159f1..d1c76b8cd916 100644 --- a/hwpfilter/source/solver.cxx +++ b/hwpfilter/source/solver.cxx @@ -62,18 +62,18 @@ double* mgcLinearSystemD::NewVector (int N) return B; } -int mgcLinearSystemD::Solve (int n, double** a, double* b) +bool mgcLinearSystemD::Solve (int n, double** a, double* b) { std::unique_ptr<int[]> indxc( new int[n] ); if ( !indxc ) - return 0; + return false; std::unique_ptr<int[]> indxr( new int[n] ); if ( !indxr ) { - return 0; + return false; } std::unique_ptr<int[]> ipiv( new int[n] ); if ( !ipiv ) { - return 0; + return false; } int i, j, k; @@ -104,7 +104,7 @@ int mgcLinearSystemD::Solve (int n, double** a, double* b) } else if ( ipiv[k] > 1 ) { - return 0; + return false; } } } @@ -126,7 +126,7 @@ int mgcLinearSystemD::Solve (int n, double** a, double* b) indxc[i] = icol; if ( a[icol][icol] == 0 ) { - return 0; + return false; } double pivinv = 1/a[icol][icol]; @@ -161,7 +161,7 @@ int mgcLinearSystemD::Solve (int n, double** a, double* b) } } - return 1; + return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/hwpfilter/source/solver.h b/hwpfilter/source/solver.h index 54daf1542653..ea3295bad9d4 100644 --- a/hwpfilter/source/solver.h +++ b/hwpfilter/source/solver.h @@ -27,7 +27,7 @@ public: static void DeleteMatrix (int N, double** A); static double* NewVector (int N); - static int Solve (int N, double** A, double* b); + static bool Solve (int N, double** A, double* b); // Input: // A[N][N] coefficient matrix, entries are A[row][col] // b[N] vector, entries are b[row] |