Commit 687776b1 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

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
No related merge requests found
Showing with 9 additions and 10 deletions
+9 -10
...@@ -89,10 +89,10 @@ CVS code - ...@@ -89,10 +89,10 @@ CVS code -
- When saving or changing file positions, be sure not to ignore - When saving or changing file positions, be sure not to ignore
placewewant. Changes to do_int_spell_fix(), findnextstr(), placewewant. Changes to do_int_spell_fix(), findnextstr(),
do_replace_loop(), and do_replace(). (DLR) do_replace_loop(), and do_replace(). (DLR)
- Convert current_x to a size_t, and convert some functions that - Convert current_x and mark_beginx to size_t's, and convert
use it as a parameter to use size_t as well. Also change some some functions that use them as a parameter to use size_t as
current_x-related assertions to handle it. (David Benbennick well. Also change some related assertions to handle them.
and DLR) (David Benbennick and DLR)
- files.c: - files.c:
do_insertfile() do_insertfile()
- Simplify by reusing variables whereever possible, and add a - Simplify by reusing variables whereever possible, and add a
......
...@@ -113,7 +113,7 @@ char *help_text; /* The text in the help window */ ...@@ -113,7 +113,7 @@ char *help_text; /* The text in the help window */
#ifndef NANO_SMALL #ifndef NANO_SMALL
filestruct *mark_beginbuf; /* The begin marker buffer */ 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 #endif
#ifndef DISABLE_OPERATINGDIR #ifndef DISABLE_OPERATINGDIR
......
...@@ -2365,7 +2365,7 @@ void do_justify(bool full_justify) ...@@ -2365,7 +2365,7 @@ void do_justify(bool full_justify)
filestruct *edittop_save = edittop, *current_save = current; filestruct *edittop_save = edittop, *current_save = current;
#ifndef NANO_SMALL #ifndef NANO_SMALL
filestruct *mark_beginbuf_save = mark_beginbuf; filestruct *mark_beginbuf_save = mark_beginbuf;
int mark_beginx_save = mark_beginx; size_t mark_beginx_save = mark_beginx;
#endif #endif
int kbinput; int kbinput;
bool meta_key, func_key; bool meta_key, func_key;
......
...@@ -165,7 +165,7 @@ typedef struct openfilestruct { ...@@ -165,7 +165,7 @@ typedef struct openfilestruct {
struct filestruct *file_mark_beginbuf; struct filestruct *file_mark_beginbuf;
/* Current file's beginning marked /* Current file's beginning marked
* line. */ * 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. */ * line's x-coordinate position. */
#endif #endif
size_t file_current_x; /* Current file's x-coordinate size_t file_current_x; /* Current file's x-coordinate
......
...@@ -37,7 +37,7 @@ extern int current_y; ...@@ -37,7 +37,7 @@ extern int current_y;
extern int totlines; extern int totlines;
extern size_t placewewant; extern size_t placewewant;
#ifndef NANO_SMALL #ifndef NANO_SMALL
extern int mark_beginx; extern size_t mark_beginx;
#endif #endif
extern long totsize; extern long totsize;
extern long flags; extern long flags;
......
...@@ -745,7 +745,7 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current, ...@@ -745,7 +745,7 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current,
if (i > 0 || replaceall) { /* Yes, replace it!!!! */ if (i > 0 || replaceall) { /* Yes, replace it!!!! */
char *copy; char *copy;
ssize_t length_change; size_t length_change;
if (i == 2) if (i == 2)
replaceall = TRUE; replaceall = TRUE;
...@@ -763,7 +763,6 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current, ...@@ -763,7 +763,6 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current,
} }
#endif #endif
assert(0 <= match_len + length_change);
if (current == real_current && current_x <= *real_current_x) { if (current == real_current && current_x <= *real_current_x) {
if (*real_current_x < current_x + match_len) if (*real_current_x < current_x + match_len)
*real_current_x = current_x + match_len; *real_current_x = current_x + match_len;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment