From 687776b1a886261ea16af92d08c806543a871928 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sat, 30 Oct 2004 01:16:08 +0000
Subject: [PATCH] make mark_beginx a size_t instead of an int

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2035 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    | 8 ++++----
 src/global.c | 2 +-
 src/nano.c   | 2 +-
 src/nano.h   | 2 +-
 src/proto.h  | 2 +-
 src/search.c | 3 +--
 6 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e3ee9c6b..940f874d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -89,10 +89,10 @@ CVS code -
 	- When saving or changing file positions, be sure not to ignore
 	  placewewant.  Changes to do_int_spell_fix(), findnextstr(),
 	  do_replace_loop(), and do_replace(). (DLR)
-	- Convert current_x to a size_t, and convert some functions that
-	  use it as a parameter to use size_t as well.  Also change some
-	  current_x-related assertions to handle it. (David Benbennick
-	  and DLR)
+	- Convert current_x and mark_beginx to size_t's, and convert
+	  some functions that use them as a parameter to use size_t as
+	  well.  Also change some related assertions to handle them.
+	  (David Benbennick and DLR)
 - files.c:
   do_insertfile()
 	- Simplify by reusing variables whereever possible, and add a
diff --git a/src/global.c b/src/global.c
index e0ae6208..4713e450 100644
--- a/src/global.c
+++ b/src/global.c
@@ -113,7 +113,7 @@ char *help_text;		/* The text in the help window */
 
 #ifndef NANO_SMALL
 filestruct *mark_beginbuf;	/* The begin marker buffer */
-int mark_beginx;		/* X value in the string to start */
+size_t mark_beginx;		/* X value in the string to start */
 #endif
 
 #ifndef DISABLE_OPERATINGDIR
diff --git a/src/nano.c b/src/nano.c
index d6ee2865..31e558a0 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2365,7 +2365,7 @@ void do_justify(bool full_justify)
     filestruct *edittop_save = edittop, *current_save = current;
 #ifndef NANO_SMALL
     filestruct *mark_beginbuf_save = mark_beginbuf;
-    int mark_beginx_save = mark_beginx;
+    size_t mark_beginx_save = mark_beginx;
 #endif
     int kbinput;
     bool meta_key, func_key;
diff --git a/src/nano.h b/src/nano.h
index f50e8ced..c5ec71fc 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -165,7 +165,7 @@ typedef struct openfilestruct {
     struct filestruct *file_mark_beginbuf;
 				/* Current file's beginning marked
 				 * line. */
-    int file_mark_beginx;	/* Current file's beginning marked
+    size_t file_mark_beginx;	/* Current file's beginning marked
 				 * line's x-coordinate position. */
 #endif
     size_t file_current_x;	/* Current file's x-coordinate
diff --git a/src/proto.h b/src/proto.h
index cf0719e6..b290673a 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -37,7 +37,7 @@ extern int current_y;
 extern int totlines;
 extern size_t placewewant;
 #ifndef NANO_SMALL
-extern int mark_beginx;
+extern size_t mark_beginx;
 #endif
 extern long totsize;
 extern long flags;
diff --git a/src/search.c b/src/search.c
index 0c9b6c0b..6e8d268e 100644
--- a/src/search.c
+++ b/src/search.c
@@ -745,7 +745,7 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current,
 
 	if (i > 0 || replaceall) {	/* Yes, replace it!!!! */
 	    char *copy;
-	    ssize_t length_change;
+	    size_t length_change;
 
 	    if (i == 2)
 		replaceall = TRUE;
@@ -763,7 +763,6 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current,
 	    }
 #endif
 
-	    assert(0 <= match_len + length_change);
 	    if (current == real_current && current_x <= *real_current_x) {
 		if (*real_current_x < current_x + match_len)
 		    *real_current_x = current_x + match_len;
-- 
GitLab