include/svx/svdoedge.hxx | 4 ++-- svx/source/svdraw/svdoedge.cxx | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-)
New commits: commit 9e7ec018ce46b0edf9dc32301e294620a9470245 Author: shlok3640 <[email protected]> AuthorDate: Wed Dec 10 14:22:44 2025 +0000 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Dec 11 08:36:04 2025 +0100 tdf#75280 Convert sal_uIntPtr to sal_uInt64 in SdrEdgeObj Replaces sal_uIntPtr with sal_uInt64 in ImpCalcEdgeTrack and related variables. This ensures safety on 64-bit systems and avoids usage of pointer-sized integers for arithmetic logic, consistent with modern codebase standards. Change-Id: I9120d4e15fc63ea75dc04ae67969b6108e0499f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194938 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx index 3b0cf917a100..f5c6361b6a48 100644 --- a/include/svx/svdoedge.hxx +++ b/include/svx/svdoedge.hxx @@ -182,7 +182,7 @@ private: SAL_DLLPRIVATE XPolygon ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection& rCon1, SdrObjConnection& rCon2, SdrEdgeInfoRec* pInfo) const; SAL_DLLPRIVATE XPolygon ImpCalcEdgeTrack(const Point& rPt1, tools::Long nAngle1, const tools::Rectangle& rBoundRect1, const tools::Rectangle& rBewareRect1, const Point& rPt2, tools::Long nAngle2, const tools::Rectangle& rBoundRect2, const tools::Rectangle& rBewareRect2, - sal_uIntPtr* pnQuality, SdrEdgeInfoRec* pInfo) const; + sal_uInt64* pnQuality, SdrEdgeInfoRec* pInfo) const; SAL_DLLPRIVATE static bool ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrObjConnection& rCon, const SdrEdgeObj* pThis, OutputDevice* pOut=nullptr, SdrDragStat* pDragStat = nullptr); SAL_DLLPRIVATE static SdrEscapeDirection ImpCalcEscAngle(SdrObject const * pObj, const Point& aPt2); SAL_DLLPRIVATE void ImpSetTailPoint(bool bTail1, const Point& rPt); @@ -319,7 +319,7 @@ public: // true -> when determining the connector exit angle, angle for // object rotation is taken as an offset. // - // sal_uIntPtr EdgeFlowDefDist default 0, min 0, max ? + // sal_uInt64 EdgeFlowDefDist default 0, min 0, max ? // This is the default minimum distance on calculation of the // connection Line to the docked objects is in logical units. // This distance is overridden within the object, as soon as the diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index dc253e837952..84ca803ad8e3 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -815,7 +815,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection& } XPolygon aBestXP; - sal_uIntPtr nBestQual=0xFFFFFFFF; + sal_uInt64 nBestQual=0xFFFFFFFF; SdrEdgeInfoRec aBestInfo; bool bAuto1=bCon1 && rCon1.m_bBestVertex; bool bAuto2=bCon2 && rCon2.m_bBestVertex; @@ -852,7 +852,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection& SdrEscapeDirection nE2 = nA2==0 ? SdrEscapeDirection::RIGHT : nA2==9000 ? SdrEscapeDirection::TOP : nA2==18000 ? SdrEscapeDirection::LEFT : nA2==27000 ? SdrEscapeDirection::BOTTOM : SdrEscapeDirection::SMART; if ((nEsc1&nE1) && (nEsc2&nE2)) { - sal_uIntPtr nQual=0; + sal_uInt64 nQual=0; SdrEdgeInfoRec aInfo; if (pInfo!=nullptr) aInfo=*pInfo; XPolygon aXP(ImpCalcEdgeTrack(aPt1,nA1,aBoundRect1,aBewareRect1,aPt2,nA2,aBoundRect2,aBewareRect2,&nQual,&aInfo)); @@ -877,7 +877,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection& XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, tools::Long nAngle1, const tools::Rectangle& rBoundRect1, const tools::Rectangle& rBewareRect1, const Point& rPt2, tools::Long nAngle2, const tools::Rectangle& rBoundRect2, const tools::Rectangle& rBewareRect2, - sal_uIntPtr* pnQuality, SdrEdgeInfoRec* pInfo) const + sal_uInt64* pnQuality, SdrEdgeInfoRec* pInfo) const { SdrEdgeKind eKind=GetObjectItem(SDRATTR_EDGEKIND).GetValue(); bool bRts1=nAngle1==0; @@ -1363,8 +1363,8 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, tools::Long nAngle1, co cForm = 0; } if (pnQuality!=nullptr) { - sal_uIntPtr nQual=0; - sal_uIntPtr nQual0=nQual; // prevent overruns + sal_uInt64 nQual=0; + sal_uInt64 nQual0=nQual; // prevent overruns bool bOverflow = false; Point aPt0(aXP1[0]); for (sal_uInt16 nPntNum=1; nPntNum<nPointCount; nPntNum++) { @@ -1378,11 +1378,11 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, tools::Long nAngle1, co sal_uInt16 nTmp=nPointCount; if (cForm=='Z') { nTmp=2; // Z shape with good quality (nTmp=2 instead of 4) - sal_uIntPtr n1=std::abs(aXP1[1].X()-aXP1[0].X())+std::abs(aXP1[1].Y()-aXP1[0].Y()); - sal_uIntPtr n2=std::abs(aXP1[2].X()-aXP1[1].X())+std::abs(aXP1[2].Y()-aXP1[1].Y()); - sal_uIntPtr n3=std::abs(aXP1[3].X()-aXP1[2].X())+std::abs(aXP1[3].Y()-aXP1[2].Y()); + sal_uInt64 n1=std::abs(aXP1[1].X()-aXP1[0].X())+std::abs(aXP1[1].Y()-aXP1[0].Y()); + sal_uInt64 n2=std::abs(aXP1[2].X()-aXP1[1].X())+std::abs(aXP1[2].Y()-aXP1[1].Y()); + sal_uInt64 n3=std::abs(aXP1[3].X()-aXP1[2].X())+std::abs(aXP1[3].Y()-aXP1[2].Y()); // try to make lines lengths similar - sal_uIntPtr nBesser=0; + sal_uInt64 nBesser=0; n1+=n3; n3=n2/4; if (n1>=n2) nBesser=6; @@ -1393,7 +1393,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, tools::Long nAngle1, co } if (nTmp>=3) { nQual0=nQual; - nQual+=static_cast<sal_uIntPtr>(nTmp)*0x01000000; + nQual+=static_cast<sal_uInt64>(nTmp)*0x01000000; if (nQual<nQual0 || nTmp>15) bOverflow = true; } if (nPointCount>=2) { // check exit angle again @@ -1450,7 +1450,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, tools::Long nAngle1, co } if (nPointCount<=1) nIntersections++; nQual0=nQual; - nQual+=static_cast<sal_uIntPtr>(nIntersections)*0x10000000; + nQual+=static_cast<sal_uInt64>(nIntersections)*0x10000000; if (nQual<nQual0 || nIntersections>15) bOverflow = true; if (bOverflow || nQual==0xFFFFFFFF) nQual=0xFFFFFFFE;
