[LyX/master] Fix warnings

Richard Kimberly Heck rikiheck at lyx.org
Mon May 18 04:50:41 UTC 2020


commit ca417d2c87a92cbbe1d186b9c0dd9abb6373f35a
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Mon May 18 01:15:50 2020 -0400

    Fix warnings
---
 src/frontends/qt/GuiWorkArea.cpp |   16 ++++++++--------
 src/frontends/qt/GuiWorkArea.h   |    4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp
index 90b17ba..424d22c 100644
--- a/src/frontends/qt/GuiWorkArea.cpp
+++ b/src/frontends/qt/GuiWorkArea.cpp
@@ -239,7 +239,7 @@ SyntheticMouseEvent::SyntheticMouseEvent()
 
 
 GuiWorkArea::Private::Private(GuiWorkArea * parent)
-: p(parent), buffer_view_(0), lyx_view_(0), caret_(0),
+: p(parent), buffer_view_(nullptr), lyx_view_(nullptr), caret_(nullptr),
   caret_visible_(false), need_resize_(false), preedit_lines_(1),
   last_pixel_ratio_(1.0), completer_(new GuiCompleter(p, p)),
   dialog_mode_(false), shell_escape_(false), read_only_(false),
@@ -1206,7 +1206,7 @@ void GuiWorkArea::Private::paintPreeditText(GuiPainter & pain)
 	bool cursor_is_visible = false;
 	for (auto const & attr : preedit_attr_) {
 		if (attr.type == QInputMethodEvent::Cursor) {
-			cursor_pos = attr.start;
+			cursor_pos = size_t(attr.start);
 			cursor_is_visible = attr.length != 0;
 			break;
 		}
@@ -1225,8 +1225,8 @@ void GuiWorkArea::Private::paintPreeditText(GuiPainter & pain)
 			if (attr.type == QInputMethodEvent::TextFormat) {
 				if (attr.start <= int(cursor_pos)
 					&& int(cursor_pos) < attr.start + attr.length) {
-						rStart = attr.start;
-						rLength = attr.length;
+						rStart = size_t(attr.start);
+						rLength = size_t(attr.length);
 						if (!cursor_is_visible)
 							cursor_pos += rLength;
 						break;
@@ -1752,11 +1752,11 @@ GuiWorkArea * TabWorkArea::workArea(Buffer & buffer) const
 	// showing the same buffer.
 	for (int i = 0; i != count(); ++i) {
 		GuiWorkArea * wa = workArea(i);
-		LASSERT(wa, return 0);
+		LASSERT(wa, return nullptr);
 		if (&wa->bufferView().buffer() == &buffer)
 			return wa;
 	}
-	return 0;
+	return nullptr;
 }
 
 
@@ -2011,7 +2011,7 @@ bool operator==(DisplayPath const & a, DisplayPath const & b)
 
 void TabWorkArea::updateTabTexts()
 {
-	size_t n = count();
+	int const n = count();
 	if (n == 0)
 		return;
 	std::list<DisplayPath> paths;
@@ -2019,7 +2019,7 @@ void TabWorkArea::updateTabTexts()
 
 	// collect full names first: path into postfix, empty prefix and
 	// filename without extension
-	for (size_t i = 0; i < n; ++i) {
+	for (int i = 0; i < n; ++i) {
 		GuiWorkArea * i_wa = workArea(i);
 		FileName const fn = i_wa->bufferView().buffer().fileName();
 		paths.push_back(DisplayPath(i, fn));
diff --git a/src/frontends/qt/GuiWorkArea.h b/src/frontends/qt/GuiWorkArea.h
index 22e8bfd..6aae1df 100644
--- a/src/frontends/qt/GuiWorkArea.h
+++ b/src/frontends/qt/GuiWorkArea.h
@@ -212,7 +212,7 @@ class TabWorkArea : public QTabWidget
 {
 	Q_OBJECT
 public:
-	TabWorkArea(QWidget * parent = 0);
+	TabWorkArea(QWidget * parent = nullptr);
 
 	/// hide QTabWidget methods
 	GuiWorkAreaContainer * currentWidget() const;
@@ -293,7 +293,7 @@ protected:
 
 public:
 	/// wa != 0
-	GuiWorkAreaContainer(GuiWorkArea * wa, QWidget * parent = 0);
+	GuiWorkAreaContainer(GuiWorkArea * wa, QWidget * parent = nullptr);
 	/// non-null
 	GuiWorkArea * workArea() const { return wa_; }
 };


More information about the lyx-cvs mailing list