commit b005aa1992034ed7a74471819d933d9dff1798e1
Author: Thibaut Cuvelier <[email protected]>
Date: Wed Oct 22 16:59:42 2025 +0200
Fix type-conversion warnings in MathData.cpp and InsetMathGrid.cpp.
`lyx::pos_type` and `MathData::pos_type` are different, which could lead to
subtle bugs.
---
src/mathed/InsetMathGrid.cpp | 8 ++++----
src/mathed/MathData.cpp | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index 4a712a9d3f..55c5355b9e 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -212,9 +212,9 @@ void InsetMathGrid::setHorizontalAlignments(docstring const
& hh)
}
--it;
if (newcolumn) {
- colinfo_[col].lines = count(
+ colinfo_[col].lines = static_cast<int>(count(
colinfo_[col].special.begin(),
- colinfo_[col].special.end(), '|');
+ colinfo_[col].special.end(), '|'));
LYXERR(Debug::MATHED, "special column
separator: `"
<< to_utf8(colinfo_[col].special) <<
'\'');
++col;
@@ -229,9 +229,9 @@ void InsetMathGrid::setHorizontalAlignments(docstring const
& hh)
colinfo_[col].align = static_cast<char>(c);
if (!colinfo_[col].special.empty()) {
colinfo_[col].special += c;
- colinfo_[col].lines = count(
+ colinfo_[col].lines = static_cast<int>(count(
colinfo_[col].special.begin(),
- colinfo_[col].special.end(),
'|');
+ colinfo_[col].special.end(),
'|'));
LYXERR(Debug::MATHED, "special column
separator: `"
<< to_utf8(colinfo_[col].special) <<
'\'');
}
diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp
index 0425f672bf..f655006c3b 100644
--- a/src/mathed/MathData.cpp
+++ b/src/mathed/MathData.cpp
@@ -845,7 +845,7 @@ void MathData::collectOptionalParameters(Cursor * cur,
// (see caller), but making this explicit pleases coverity.
if (cur && thisSlice != lyx::npos
&& thisPos >= pos && thisPos <= right) {
- int paramPos = max(0, int(thisPos - pos - 1));
+ lyx::pos_type paramPos = max(0, int(thisPos - pos - 1));
vector<CursorSlice> x;
cur->resize(thisSlice + 1, x);
(*cur)[thisSlice].pos() = macroPos;
@@ -882,7 +882,7 @@ void MathData::collectParameters(Cursor * cur,
// fix cursor
vector<CursorSlice> argSlices;
- int argPos = 0;
+ lyx::pos_type argPos = 0;
// Note: The two expressions on the first line are equivalent
// (see caller), but making this explicit pleases coverity.
if (cur && thisSlice != lyx::npos && thisPos == pos)
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs