[LyX/master] Amend d3c335a5d5

Yuriy Skalko yuriy.skalko at gmail.com
Tue Oct 5 13:48:50 UTC 2021


commit 6a7c9d12f9f45b207ed19b03cb494ec5fb660617
Author: Yuriy Skalko <yuriy.skalko at gmail.com>
Date:   Fri Oct 1 00:37:58 2021 +0300

    Amend d3c335a5d5
---
 src/Text.cpp                     |    4 ++--
 src/Text2.cpp                    |    2 +-
 src/TextMetrics.cpp              |   12 ++++++------
 src/VSpace.cpp                   |    6 +++---
 src/frontends/qt/GuiWorkArea.cpp |    4 ++--
 src/lyxfind.cpp                  |    6 +++---
 6 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index 8f30f4e..aa70b18 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -209,7 +209,7 @@ pit_type Text::outerHook(pit_type par_offset) const
 
 	if (par.getDepth() == 0)
 		return pars_.size();
-	return depthHook(par_offset, depth_type(par.getDepth() - 1));
+	return depthHook(par_offset, par.getDepth() - 1);
 }
 
 
@@ -369,7 +369,7 @@ InsetText const & Text::inset() const
 void Text::readParToken(Paragraph & par, Lexer & lex,
 	string const & token, Font & font, Change & change, ErrorList & errorList)
 {
-	Buffer * buf = const_cast<Buffer *>(&owner_->buffer());
+	Buffer * buf = &owner_->buffer();
 	BufferParams & bp = buf->params();
 
 	if (token[0] != '\\') {
diff --git a/src/Text2.cpp b/src/Text2.cpp
index cc53403..66dd083 100644
--- a/src/Text2.cpp
+++ b/src/Text2.cpp
@@ -934,7 +934,7 @@ bool Text::deleteEmptyParagraphMechanism(Cursor & cur,
 
 void Text::deleteEmptyParagraphMechanism(pit_type first, pit_type last, bool trackChanges)
 {
-	pos_type last_pos = static_cast<pos_type>(pars_[last].size() - 1);
+	pos_type last_pos = pars_[last].size() - 1;
 	deleteEmptyParagraphMechanism(first, last, 0, last_pos, trackChanges);
 }
 
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 57c7715..a2a3e4b 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -434,7 +434,7 @@ bool TextMetrics::redoParagraph(pit_type const pit, bool const align_rows)
 	// environment? I think the answer is: when paragraphs are merged;
 	// when layout is set; when material is pasted.
 	if (par.brokenBiblio()) {
-		Cursor & cur = const_cast<Cursor &>(bv_->cursor());
+		Cursor & cur = bv_->cursor();
 		// In some cases, we do not know how to record undo
 		if (&cur.inset() == &text_->inset())
 			cur.recordUndo(pit, pit);
@@ -700,7 +700,7 @@ void TextMetrics::setRowAlignment(Row & row, int width) const
 	// We don't have to look at the alignment if the row is already
 	// larger then the permitted width as then we force the
 	// LEFT_ALIGN'edness!
-	if (int(row.width()) >= max_width_)
+	if (row.width() >= max_width_)
 		return;
 
 	if (nh == 0) {
@@ -1300,7 +1300,7 @@ pit_type TextMetrics::getPitNearY(int y)
 
 	ParagraphMetrics const & pm = it->second;
 
-	if (y < it->second.position() - int(pm.ascent())) {
+	if (y < it->second.position() - pm.ascent()) {
 		// We are looking for a position that is before the first paragraph in
 		// the cache (which is in priciple off-screen, that is before the
 		// visible part.
@@ -1315,7 +1315,7 @@ pit_type TextMetrics::getPitNearY(int y)
 
 	ParagraphMetrics const & pm_last = par_metrics_[last->first];
 
-	if (y >= last->second.position() + int(pm_last.descent())) {
+	if (y >= last->second.position() + pm_last.descent()) {
 		// We are looking for a position that is after the last paragraph in
 		// the cache (which is in priciple off-screen), that is before the
 		// visible part.
@@ -1334,7 +1334,7 @@ pit_type TextMetrics::getPitNearY(int y)
 
 		ParagraphMetrics const & pm2 = par_metrics_[it->first];
 
-		if (it->first >= pit && int(it->second.position()) - int(pm2.ascent()) <= y) {
+		if (it->first >= pit && it->second.position() - pm2.ascent() <= y) {
 			pit = it->first;
 			yy = it->second.position();
 		}
@@ -1461,7 +1461,7 @@ void TextMetrics::setCursorFromCoordinates(Cursor & cur, int const x, int const
 	LBUFERR(pm.rows().size());
 	for (; r < int(pm.rows().size()) - 1; ++r) {
 		Row const & row = pm.rows()[r];
-		if (int(yy + row.height()) > y)
+		if (yy + row.height() > y)
 			break;
 		yy += row.height();
 	}
diff --git a/src/VSpace.cpp b/src/VSpace.cpp
index abec3ef..66e3a6c 100644
--- a/src/VSpace.cpp
+++ b/src/VSpace.cpp
@@ -263,10 +263,10 @@ int VSpace::inPixels(BufferView const & bv) const
 	// This is how the skips are normally defined by LaTeX.
 	// But there should be some way to change this per document.
 	case SMALLSKIP:
-		return int(default_height / 4);
+		return default_height / 4;
 
 	case MEDSKIP:
-		return int(default_height / 2);
+		return default_height / 2;
 
 	case BIGSKIP:
 		return default_height;
@@ -276,7 +276,7 @@ int VSpace::inPixels(BufferView const & bv) const
 		return 3 * default_height;
 
 	case HALFLINE:
-		return int(default_height / 2);
+		return default_height / 2;
 
 	case FULLLINE:
 		return default_height;
diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp
index e08779a..1d6cd07 100644
--- a/src/frontends/qt/GuiWorkArea.cpp
+++ b/src/frontends/qt/GuiWorkArea.cpp
@@ -1231,8 +1231,8 @@ void GuiWorkArea::Private::resetScreen()
 {
 	if (use_backingstore_) {
 		int const pr = p->pixelRatio();
-		screen_ = QImage(static_cast<int>(pr * p->viewport()->width()),
-		                 static_cast<int>(pr * p->viewport()->height()),
+		screen_ = QImage(pr * p->viewport()->width(),
+		                 pr * p->viewport()->height(),
 		                 QImage::Format_ARGB32_Premultiplied);
 #  if QT_VERSION >= 0x050000
 		screen_.setDevicePixelRatio(pr);
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index 4a8c037..86cf64d 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -3990,14 +3990,14 @@ MatchResult findAdvFinalize(DocIterator & cur, MatchStringAdv const & match, Mat
 	      max_match.match_len = actual_match_len;
               maxl = len;
               if (maxl - minl < 4)
-                len = (int)((maxl + minl)/2);
+                len = (maxl + minl)/2;
               else
-                len = (int)(minl + (maxl - minl + 3)/4);
+                len = minl + (maxl - minl + 3)/4;
             }
             else {
               // (actual_match_len < max_match.match_len)
               minl = len + 1;
-              len = (int)((maxl + minl)/2);
+              len = (maxl + minl)/2;
             }
           }
 	  len = minl;


More information about the lyx-cvs mailing list