basegfx/source/curve/b2dcubicbezier.cxx | 2 - basegfx/source/vector/b2dvector.cxx | 4 +-- basegfx/source/vector/b2ivector.cxx | 3 ++ drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx | 16 +++++++++++-- include/basegfx/matrix/hommatrixtemplate.hxx | 2 - include/basegfx/vector/b3dvector.hxx | 2 - 6 files changed, 22 insertions(+), 7 deletions(-)
New commits: commit d89d5dbaa339b143280630aa7130bf9124f00a2b Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sun Aug 3 21:42:02 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon Aug 4 12:37:10 2025 +0200 cid#1659722 Division or modulo by float zero Change-Id: Ibc49973a7d2b7660187f8801dd88a95bcd57e0f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188893 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/basegfx/source/vector/b2ivector.cxx b/basegfx/source/vector/b2ivector.cxx index 6d618facf48f..9a6036b81f40 100644 --- a/basegfx/source/vector/b2ivector.cxx +++ b/basegfx/source/vector/b2ivector.cxx @@ -20,6 +20,7 @@ #include <basegfx/vector/b2ivector.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <cassert> namespace basegfx { @@ -46,6 +47,8 @@ namespace basegfx if(!::basegfx::fTools::equalZero(fLenNow)) { + assert(fLenNow != 0 && "help coverity see it's not zero"); + const double fOne(1.0); if(!::basegfx::fTools::equal(fOne, fLenNow)) commit e102e77cdf0d0c85e691746111f7fbb30c360b8b Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sun Aug 3 21:37:58 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon Aug 4 12:36:56 2025 +0200 cid#1659622 silence Division or modulo by float zero and cid#1659712 Division or modulo by float zero Change-Id: Ib13a4f2c5cabad62db2099a83fb8fdeae38d6f99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188889 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index 34a3806e3b1e..8f71c3436a30 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -820,7 +820,7 @@ namespace basegfx if(!bStartIsZero) { - assert(fEnd != 0.0 && "help coverity see it's not zero"); + assert(fEnd != 0 && "help coverity see it's not zero"); fStart /= fEnd; } } diff --git a/basegfx/source/vector/b2dvector.cxx b/basegfx/source/vector/b2dvector.cxx index a98313be7bd8..98f2d31b6a79 100644 --- a/basegfx/source/vector/b2dvector.cxx +++ b/basegfx/source/vector/b2dvector.cxx @@ -30,7 +30,7 @@ namespace basegfx if(!fTools::equalZero(fLen)) { - assert(fLen != 0.0 && "help coverity see it's not zero"); + assert(fLen != 0 && "help coverity see it's not zero"); const double fOne(1.0); @@ -92,7 +92,7 @@ namespace basegfx if(!fTools::equalZero(fLenNow)) { - assert(fLenNow != 0.0 && "help coverity see it's not zero"); + assert(fLenNow != 0 && "help coverity see it's not zero"); const double fOne(1.0); diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx index 2afaa977c3c2..4375f77a4bc6 100644 --- a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx @@ -129,10 +129,22 @@ namespace if(bCreateTextureCoordinates) { const double fPolygonLengthA(basegfx::utils::getLength(aSubA)); - fTexHorMultiplicatorA = basegfx::fTools::equalZero(fPolygonLengthA) ? 1.0 : 1.0 / fPolygonLengthA; + if (basegfx::fTools::equalZero(fPolygonLengthA)) + fTexHorMultiplicatorA = 1.0; + else + { + assert(fPolygonLengthA != 0 && "help coverity see it's not zero"); + fTexHorMultiplicatorA = 1.0 / fPolygonLengthA; + } const double fPolygonLengthB(basegfx::utils::getLength(aSubB)); - fTexHorMultiplicatorB = basegfx::fTools::equalZero(fPolygonLengthB) ? 1.0 : 1.0 / fPolygonLengthB; + if (basegfx::fTools::equalZero(fPolygonLengthB)) + fTexHorMultiplicatorB = 1.0; + else + { + assert(fPolygonLengthB != 0 && "help coverity see it's not zero"); + fTexHorMultiplicatorB = 1.0 / fPolygonLengthB; + } } for(sal_uInt32 b(0); b < nEdgeCount; b++) diff --git a/include/basegfx/matrix/hommatrixtemplate.hxx b/include/basegfx/matrix/hommatrixtemplate.hxx index e99e84f05718..9794b2a9aecf 100644 --- a/include/basegfx/matrix/hommatrixtemplate.hxx +++ b/include/basegfx/matrix/hommatrixtemplate.hxx @@ -155,7 +155,7 @@ namespace basegfx::internal return false; } - assert(fBig != 0.0 && "help coverity see it's not zero"); + assert(fBig != 0 && "help coverity see it's not zero"); fStorage[a] = 1.0 / fBig; } diff --git a/include/basegfx/vector/b3dvector.hxx b/include/basegfx/vector/b3dvector.hxx index 29b5a0457978..5846eaf09f3c 100644 --- a/include/basegfx/vector/b3dvector.hxx +++ b/include/basegfx/vector/b3dvector.hxx @@ -139,7 +139,7 @@ namespace basegfx if(!::basegfx::fTools::equalZero(fLenNow)) { - assert(fLenNow != 0.0 && "help coverity see it's not zero"); + assert(fLenNow != 0 && "help coverity see it's not zero"); const double fOne(1.0);