diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index f12cb3957e..b32dd8c5ef 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -3413,7 +3413,7 @@ string Buffer::filePath() const
 	string const abs = d->filename.onlyPath().absFileName();
 	if (abs.empty())
 		return abs;
-	int last = abs.length() - 1;
+	size_type last = abs.length() - 1;
 
 	return abs[last] == '/' ? abs : abs + '/';
 }
diff --git a/src/client/client.cpp b/src/client/client.cpp
index 70a6125a3e..50d130a93d 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -304,9 +304,9 @@ bool LyXDataSocket::connected() const
 // The line read is split and stored in 'key' and 'value'
 bool LyXDataSocket::readln(string & line)
 {
-	int const charbuf_size = 100;
+	string::size_type const charbuf_size = 100;
 	char charbuf[charbuf_size]; // buffer for the ::read() system call
-	int count;
+	ssize_t count;
 	string::size_type pos;
 
 	// read and store characters in buffer
@@ -337,9 +337,9 @@ bool LyXDataSocket::readln(string & line)
 void LyXDataSocket::writeln(string const & line)
 {
 	string linen(line + '\n');
-	int size = linen.size();
-	int written = ::write(fd_, linen.c_str(), size);
-	if (written < size) { // Always mean end of connection.
+	string::size_type size = linen.size();
+	ssize_t written = ::write(fd_, linen.c_str(), size);
+	if (written < (ssize_t)size) { // Always mean end of connection.
 		if ((written == -1) && (errno == EPIPE)) {
 			// The program will also receive a SIGPIPE
 			// that must be caught
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index 75489d2d98..62579d3fda 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -536,7 +536,7 @@ public:
 	virtual bool allowSpellCheck() const { return false; }
 
 	/// if this insets owns text cells (e.g. InsetText) return cell idx
-	virtual Text * getText(int /*idx*/) const { return 0; }
+	virtual Text * getText(idx_type /*idx*/) const { return nullptr; }
 
 	/** Adds a LaTeX snippet to the Preview Loader for transformation
 	 *  into a bitmap image. Does not start the loading process.
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index ff9490a4ea..6d62146931 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -8284,9 +8284,9 @@ void InsetTabular::getSelection(Cursor & cur,
 }
 
 
-Text * InsetTabular::getText(int idx) const
+Text * InsetTabular::getText(idx_type idx) const
 {
-	return size_t(idx) < nargs() ? cell(idx)->getText(0) : nullptr;
+	return idx < nargs() ? cell(idx)->getText(0) : nullptr;
 }
 
 
diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h
index b385ba8346..756657a94f 100644
--- a/src/insets/InsetTabular.h
+++ b/src/insets/InsetTabular.h
@@ -1186,7 +1186,7 @@ public:
 	///
 	std::shared_ptr<InsetTableCell> cell(idx_type);
 	///
-	Text * getText(int) const override;
+	Text * getText(idx_type) const override;
 
 	/// does the inset contain changes ?
 	bool isChanged() const override;
diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h
index 459ae558af..b6f4fe240f 100644
--- a/src/insets/InsetText.h
+++ b/src/insets/InsetText.h
@@ -118,7 +118,7 @@ public:
 	///
 	void setFrameColor(ColorCode);
 	///
-	Text * getText(int idx) const override {
+	Text * getText(idx_type idx) const override {
 		return (idx == 0) ? const_cast<Text*>(&text_) : nullptr;
 	}
 	///
