1
1

Use off_t instead of long for all variables related to position in file:

...offset, cursor position, etc.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
Ilia Maslakov 2012-08-10 13:28:18 +04:00 коммит произвёл Andrew Borodin
родитель 72f50b458b
Коммит ad0f58e51e
7 изменённых файлов: 240 добавлений и 202 удалений

Просмотреть файл

@ -182,24 +182,24 @@ void user_menu (WEdit * edit, const char *menu_file, int selected_entry);
void edit_init_menu (struct WMenuBar *menubar);
void edit_save_mode_cmd (void);
gboolean edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch);
int edit_get_byte (WEdit * edit, long byte_index);
int edit_get_utf (WEdit * edit, long byte_index, int *char_width);
long edit_count_lines (WEdit * edit, long current, long upto);
long edit_move_forward (WEdit * edit, long current, long lines, long upto);
long edit_move_forward3 (WEdit * edit, long current, long cols, long upto);
long edit_move_backward (WEdit * edit, long current, long lines);
int edit_get_byte (WEdit * edit, off_t byte_index);
int edit_get_utf (WEdit * edit, off_t byte_index, int *char_width);
long edit_count_lines (WEdit * edit, off_t current, off_t upto);
off_t edit_move_forward (WEdit * edit, off_t current, long lines, off_t upto);
off_t edit_move_forward3 (WEdit * edit, off_t current, long cols, off_t upto);
off_t edit_move_backward (WEdit * edit, off_t current, long lines);
void edit_scroll_screen_over_cursor (WEdit * edit);
void edit_render_keypress (WEdit * edit);
void edit_scroll_upward (WEdit * edit, long i);
void edit_scroll_downward (WEdit * edit, long i);
void edit_scroll_right (WEdit * edit, long i);
void edit_scroll_left (WEdit * edit, long i);
void edit_move_up (WEdit * edit, long i, gboolean do_scroll);
void edit_move_up (WEdit * edit, long i, gboolean do_scroll);
void edit_move_down (WEdit * edit, long i, gboolean do_scroll);
void edit_move_to_prev_col (WEdit * edit, long p);
void edit_move_to_prev_col (WEdit * edit, off_t p);
long edit_get_col (WEdit * edit);
long edit_bol (WEdit * edit, long current);
long edit_eol (WEdit * edit, long current);
off_t edit_bol (WEdit * edit, off_t current);
off_t edit_eol (WEdit * edit, off_t current);
void edit_update_curs_row (WEdit * edit);
void edit_update_curs_col (WEdit * edit);
void edit_find_bracket (WEdit * edit);
@ -214,12 +214,12 @@ void edit_delete_line (WEdit * edit);
int edit_delete (WEdit * edit, const int byte_delete);
int edit_backspace (WEdit * edit, const int byte_delete);
void edit_insert (WEdit * edit, int c);
void edit_cursor_move (WEdit * edit, long increment);
void edit_cursor_move (WEdit * edit, off_t increment);
void edit_push_undo_action (WEdit * edit, long c, ...);
void edit_push_redo_action (WEdit * edit, long c, ...);
void edit_push_key_press (WEdit * edit);
void edit_insert_ahead (WEdit * edit, int c);
long edit_write_stream (WEdit * edit, FILE * f);
off_t edit_write_stream (WEdit * edit, FILE * f);
char *edit_get_write_filter (const vfs_path_t * write_name_vpath,
const vfs_path_t * filename_vpath);
gboolean edit_save_confirm_cmd (WEdit * edit);
@ -235,7 +235,7 @@ gboolean edit_close_cmd (WEdit * edit);
void edit_mark_cmd (WEdit * edit, gboolean unmark);
void edit_mark_current_word_cmd (WEdit * edit);
void edit_mark_current_line_cmd (WEdit * edit);
void edit_set_markers (WEdit * edit, long m1, long m2, long c1, long c2);
void edit_set_markers (WEdit * edit, off_t m1, off_t m2, long c1, long c2);
void edit_push_markers (WEdit * edit);
void edit_replace_cmd (WEdit * edit, int again);
void edit_search_cmd (WEdit * edit, gboolean again);
@ -250,14 +250,16 @@ void edit_spellcheck_file (WEdit * edit);
void edit_set_spell_lang (void);
#endif
gboolean edit_save_block (WEdit * edit, const char *filename, long start, long finish);
gboolean edit_save_block (WEdit * edit, const char *filename, off_t start, off_t finish);
gboolean edit_save_block_cmd (WEdit * edit);
gboolean edit_insert_file_cmd (WEdit * edit);
void edit_insert_over (WEdit * edit);
int edit_insert_column_of_text_from_file (WEdit * edit, int file,
long *start_pos, long *end_pos, long *col1, long *col2);
off_t edit_insert_column_of_text_from_file (WEdit * edit, int file,
off_t * start_pos, off_t * end_pos, long *col1,
long *col2);
char *edit_get_word_from_pos (WEdit * edit, long start_pos, long *start, gsize * len, gsize * cut);
char *edit_get_word_from_pos (WEdit * edit, off_t start_pos, off_t * start, gsize * len,
gsize * cut);
long edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath);
gboolean edit_load_back_cmd (WEdit * edit);
gboolean edit_load_forward_cmd (WEdit * edit);
@ -269,7 +271,7 @@ void edit_show_margin_cmd (Dlg_head * h);
void edit_show_numbers_cmd (Dlg_head * h);
void edit_date_cmd (WEdit * edit);
void edit_goto_cmd (WEdit * edit);
int eval_marks (WEdit * edit, long *start_mark, long *end_mark);
int eval_marks (WEdit * edit, off_t * start_mark, off_t * end_mark);
void edit_status (WEdit * edit, gboolean active);
void edit_execute_key_command (WEdit * edit, unsigned long command, int char_for_insertion);
void edit_update_screen (WEdit * edit);
@ -303,7 +305,7 @@ void edit_set_filename (WEdit * edit, const vfs_path_t * name_vpath);
void edit_load_syntax (WEdit * edit, char ***pnames, const char *type);
void edit_free_syntax_rules (WEdit * edit);
void edit_get_syntax_color (WEdit * edit, long byte_index, int *color);
void edit_get_syntax_color (WEdit * edit, off_t byte_index, int *color);
void book_mark_insert (WEdit * edit, long line, int c);
int book_mark_query_color (WEdit * edit, long line, int c);
@ -318,7 +320,7 @@ void book_mark_restore (WEdit * edit, int color);
gboolean line_is_blank (WEdit * edit, long line);
gboolean is_break_char (char c);
long edit_indent_width (WEdit * edit, long p);
long edit_indent_width (WEdit * edit, off_t p);
void edit_insert_indent (WEdit * edit, int indent);
void edit_options_dialog (Dlg_head * h);
void edit_syntax_dialog (WEdit * edit);

Просмотреть файл

@ -136,7 +136,7 @@ static const struct edit_filters
/* *INDENT-ON* */
};
static long last_bracket = -1;
static off_t last_bracket = -1;
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
@ -205,7 +205,7 @@ edit_init_buffers (WEdit * edit)
static gboolean
edit_load_file_fast (WEdit * edit, const vfs_path_t * filename_vpath)
{
long buf, buf2;
off_t buf, buf2;
int file = -1;
gboolean ret = FALSE;
@ -311,11 +311,11 @@ edit_get_filter (const vfs_path_t * filename_vpath)
/* --------------------------------------------------------------------------------------------- */
static long
static off_t
edit_insert_stream (WEdit * edit, FILE * f)
{
int c;
long i = 0;
off_t i = 0;
while ((c = fgetc (f)) >= 0)
{
edit_insert (edit, c);
@ -657,14 +657,14 @@ edit_modification (WEdit * edit)
/* --------------------------------------------------------------------------------------------- */
static char *
edit_get_byte_ptr (WEdit * edit, long byte_index)
edit_get_byte_ptr (WEdit * edit, off_t byte_index)
{
if (byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0)
return NULL;
if (byte_index >= edit->curs1)
{
unsigned long p;
off_t p;
p = edit->curs1 + edit->curs2 - byte_index - 1;
return (char *) (edit->buffers2[p >> S_EDIT_BUF_SIZE] +
@ -678,7 +678,7 @@ edit_get_byte_ptr (WEdit * edit, long byte_index)
/* --------------------------------------------------------------------------------------------- */
static int
edit_get_prev_utf (WEdit * edit, long byte_index, int *char_width)
edit_get_prev_utf (WEdit * edit, off_t byte_index, int *char_width)
{
int i, res;
gchar utf8_buf[3 * UTF8_CHAR_LEN + 1];
@ -733,7 +733,7 @@ edit_get_prev_utf (WEdit * edit, long byte_index, int *char_width)
static gboolean
is_in_indent (WEdit * edit)
{
long p;
off_t p;
for (p = edit_bol (edit, edit->curs1); p < edit->curs1; p++)
if (strchr (" \t", edit_get_byte (edit, p)) == NULL)
@ -752,9 +752,9 @@ is_in_indent (WEdit * edit)
*/
static gboolean
is_blank (WEdit * edit, long offset)
is_blank (WEdit * edit, off_t offset)
{
long s, f;
off_t s, f;
int c;
s = edit_bol (edit, offset);
@ -771,7 +771,7 @@ is_blank (WEdit * edit, long offset)
/* --------------------------------------------------------------------------------------------- */
/** returns the offset of line i */
static long
static off_t
edit_find_line (WEdit * edit, long line)
{
long i, j = 0;
@ -779,8 +779,8 @@ edit_find_line (WEdit * edit, long line)
if (!edit->caches_valid)
{
for (i = 0; i < N_LINE_CACHES; i++)
edit->line_numbers[i] = edit->line_offsets[i] = 0;
memset (edit->line_numbers, 0, sizeof (edit->line_numbers));
memset (edit->line_offsets, 0, sizeof (edit->line_offsets));
/* three offsets that we *know* are line 0 at 0 and these two: */
edit->line_numbers[1] = edit->curs_line;
edit->line_offsets[1] = edit_bol (edit, edit->curs1);
@ -1157,29 +1157,29 @@ edit_left_char_move_cmd (WEdit * edit)
*/
static void
edit_move_updown (WEdit * edit, long i, gboolean do_scroll, gboolean direction)
edit_move_updown (WEdit * edit, long lines, gboolean do_scroll, gboolean direction)
{
long p;
long l = direction ? edit->curs_line : edit->total_lines - edit->curs_line;
if (i > l)
i = l;
if (lines > l)
lines = l;
if (i == 0)
if (lines == 0)
return;
if (i > 1)
if (lines > 1)
edit->force |= REDRAW_PAGE;
if (do_scroll)
{
if (direction)
edit_scroll_upward (edit, i);
edit_scroll_upward (edit, lines);
else
edit_scroll_downward (edit, i);
edit_scroll_downward (edit, lines);
}
p = edit_bol (edit, edit->curs1);
p = direction ? edit_move_backward (edit, p, i) : edit_move_forward (edit, p, i, 0);
p = direction ? edit_move_backward (edit, p, lines) : edit_move_forward (edit, p, lines, 0);
edit_cursor_move (edit, p - edit->curs1);
@ -1287,12 +1287,14 @@ edit_do_undo (WEdit * edit)
if (ac >= MARK_1 - 2 && ac < MARK_2 - 2)
{
edit->mark1 = ac - MARK_1;
edit->column1 = edit_move_forward3 (edit, edit_bol (edit, edit->mark1), 0, edit->mark1);
edit->column1 =
(long) edit_move_forward3 (edit, edit_bol (edit, edit->mark1), 0, edit->mark1);
}
if (ac >= MARK_2 - 2 && ac < MARK_CURS - 2)
{
edit->mark2 = ac - MARK_2;
edit->column2 = edit_move_forward3 (edit, edit_bol (edit, edit->mark2), 0, edit->mark2);
edit->column2 =
(long) edit_move_forward3 (edit, edit_bol (edit, edit->mark2), 0, edit->mark2);
}
else if (ac >= MARK_CURS - 2 && ac < KEY_PRESS)
{
@ -1362,12 +1364,14 @@ edit_do_redo (WEdit * edit)
if (ac >= MARK_1 - 2 && ac < MARK_2 - 2)
{
edit->mark1 = ac - MARK_1;
edit->column1 = edit_move_forward3 (edit, edit_bol (edit, edit->mark1), 0, edit->mark1);
edit->column1 =
(long) edit_move_forward3 (edit, edit_bol (edit, edit->mark1), 0, edit->mark1);
}
else if (ac >= MARK_2 - 2 && ac < KEY_PRESS)
{
edit->mark2 = ac - MARK_2;
edit->column2 = edit_move_forward3 (edit, edit_bol (edit, edit->mark2), 0, edit->mark2);
edit->column2 =
(long) edit_move_forward3 (edit, edit_bol (edit, edit->mark2), 0, edit->mark2);
}
/* more than one pop usually means something big */
if (count++)
@ -1475,7 +1479,7 @@ left_of_four_spaces (WEdit * edit)
static void
edit_auto_indent (WEdit * edit)
{
long p;
off_t p;
char c;
p = edit->curs1;
/* use the previous line as a template */
@ -1560,7 +1564,9 @@ edit_tab_cmd (WEdit * edit)
static void
check_and_wrap_line (WEdit * edit)
{
int curs, c;
off_t curs;
int c;
if (!option_typewriter_wrap)
return;
edit_update_curs_col (edit);
@ -1578,7 +1584,7 @@ check_and_wrap_line (WEdit * edit)
}
if (c == ' ' || c == '\t')
{
int current = edit->curs1;
off_t current = edit->curs1;
edit_cursor_move (edit, curs - edit->curs1 + 1);
edit_insert (edit, '\n');
edit_cursor_move (edit, current - edit->curs1 + 1);
@ -1588,15 +1594,22 @@ check_and_wrap_line (WEdit * edit)
}
/* --------------------------------------------------------------------------------------------- */
/** this find the matching bracket in either direction, and sets edit->bracket */
/** this find the matching bracket in either direction, and sets edit->bracket
*
* @param edit editor object
* @param in_screen seach only on the current screen
* @param furthest_bracket_search count of the bytes for search
*
* @return position of the found bracket (-1 if no match)
*/
static long
edit_get_bracket (WEdit * edit, int in_screen, unsigned long furthest_bracket_search)
static off_t
edit_get_bracket (WEdit * edit, gboolean in_screen, unsigned long furthest_bracket_search)
{
const char *const b = "{}{[][()(", *p;
int i = 1, a, inc = -1, c, d, n = 0;
unsigned long j = 0;
long q;
off_t q;
edit_update_curs_row (edit);
c = edit_get_byte (edit, edit->curs1);
p = strchr (b, c);
@ -1604,7 +1617,7 @@ edit_get_bracket (WEdit * edit, int in_screen, unsigned long furthest_bracket_se
if (!furthest_bracket_search)
furthest_bracket_search--;
/* not on a bracket at all */
if (!p)
if (p == NULL)
return -1;
/* the matching bracket */
d = p[1];
@ -1633,7 +1646,7 @@ edit_get_bracket (WEdit * edit, int in_screen, unsigned long furthest_bracket_se
/* count bracket depth */
i += (a == c) - (a == d);
/* return if bracket depth is zero */
if (!i)
if (i == 0)
return q;
}
/* no match */
@ -1645,7 +1658,7 @@ edit_get_bracket (WEdit * edit, int in_screen, unsigned long furthest_bracket_se
static inline void
edit_goto_matching_bracket (WEdit * edit)
{
long q;
off_t q;
q = edit_get_bracket (edit, 0, 0);
if (q >= 0)
@ -1661,7 +1674,7 @@ edit_goto_matching_bracket (WEdit * edit)
static void
edit_move_block_to_right (WEdit * edit)
{
long start_mark, end_mark;
off_t start_mark, end_mark;
long cur_bol, start_bol;
if (eval_marks (edit, &start_mark, &end_mark))
@ -1694,8 +1707,8 @@ edit_move_block_to_right (WEdit * edit)
static void
edit_move_block_to_left (WEdit * edit)
{
long start_mark, end_mark;
long cur_bol, start_bol;
off_t start_mark, end_mark;
off_t cur_bol, start_bol;
int i;
if (eval_marks (edit, &start_mark, &end_mark))
@ -1766,8 +1779,8 @@ user_menu (WEdit * edit, const char *menu_file, int selected_entry)
{
char *block_file;
int nomark;
long curs;
long start_mark, end_mark;
off_t curs;
off_t start_mark, end_mark;
struct stat status;
vfs_path_t *block_file_vpath;
@ -1791,7 +1804,7 @@ user_menu (WEdit * edit, const char *menu_file, int selected_entry)
if (rc == 0)
{
long ins_len;
off_t ins_len;
ins_len = edit_insert_file (edit, block_file_vpath);
if (nomark == 0 && ins_len > 0)
@ -1813,9 +1826,9 @@ user_menu (WEdit * edit, const char *menu_file, int selected_entry)
/* --------------------------------------------------------------------------------------------- */
int
edit_get_byte (WEdit * edit, long byte_index)
edit_get_byte (WEdit * edit, off_t byte_index)
{
unsigned long p;
off_t p;
if (byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0)
return '\n';
@ -1833,7 +1846,7 @@ edit_get_byte (WEdit * edit, long byte_index)
/* --------------------------------------------------------------------------------------------- */
int
edit_get_utf (WEdit * edit, long byte_index, int *char_width)
edit_get_utf (WEdit * edit, off_t byte_index, int *char_width)
{
gchar *str = NULL;
int res = -1;
@ -1914,8 +1927,13 @@ edit_get_write_filter (const vfs_path_t * write_name_vpath, const vfs_path_t * f
}
/* --------------------------------------------------------------------------------------------- */
/**
* @param edit editor object
* @param f value of stream file
* @returns the length of the file
*/
long
off_t
edit_write_stream (WEdit * edit, FILE * f)
{
long i;
@ -2020,9 +2038,9 @@ is_break_char (char c)
/* --------------------------------------------------------------------------------------------- */
char *
edit_get_word_from_pos (WEdit * edit, long start_pos, long *start, gsize * len, gsize * cut)
edit_get_word_from_pos (WEdit * edit, off_t start_pos, off_t * start, gsize * len, gsize * cut)
{
long word_start;
off_t word_start;
long cut_len = 0;
GString *match_expr;
unsigned char *bufpos;
@ -2062,13 +2080,13 @@ long
edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath)
{
char *p;
long ins_len = 0;
off_t ins_len = 0;
p = edit_get_filter (filename_vpath);
if (p != NULL)
{
FILE *f;
long current = edit->curs1;
off_t current = edit->curs1;
f = (FILE *) popen (p, "r");
if (f != NULL)
@ -2099,8 +2117,9 @@ edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath)
}
else
{
int i, file, blocklen;
long current = edit->curs1;
int file;
off_t blocklen;
off_t current = edit->curs1;
int vertical_insertion = 0;
char *buf;
@ -2121,7 +2140,7 @@ edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath)
if (vertical_insertion)
{
long mark1, mark2;
off_t mark1, mark2;
long c1, c2;
blocklen = edit_insert_column_of_text_from_file (edit, file, &mark1, &mark2, &c1, &c2);
@ -2136,6 +2155,8 @@ edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath)
}
else
{
off_t i;
while ((blocklen = mc_read (file, (char *) buf, TEMP_BUF_LEN)) > 0)
{
for (i = 0; i < blocklen; i++)
@ -2857,7 +2878,7 @@ edit_backspace (WEdit * edit, const int byte_delete)
/** moves the cursor right or left: increment positive or negative respectively */
void
edit_cursor_move (WEdit * edit, long increment)
edit_cursor_move (WEdit * edit, off_t increment)
{
/* this is the same as a combination of two of the above routines, with only one push onto the undo stack */
int c;
@ -2866,7 +2887,7 @@ edit_cursor_move (WEdit * edit, long increment)
{
for (; increment < 0; increment++)
{
if (!edit->curs1)
if (edit->curs1 == 0)
return;
edit_push_undo_action (edit, CURS_RIGHT);
@ -2897,7 +2918,7 @@ edit_cursor_move (WEdit * edit, long increment)
{
for (; increment > 0; increment--)
{
if (!edit->curs2)
if (edit->curs2 == 0)
return;
edit_push_undo_action (edit, CURS_LEFT);
@ -2930,8 +2951,8 @@ edit_cursor_move (WEdit * edit, long increment)
/* --------------------------------------------------------------------------------------------- */
/** returns index of last char on line + 1 */
long
edit_eol (WEdit * edit, long current)
off_t
edit_eol (WEdit * edit, off_t current)
{
if (current >= edit->last_byte)
return edit->last_byte;
@ -2945,8 +2966,8 @@ edit_eol (WEdit * edit, long current)
/* --------------------------------------------------------------------------------------------- */
/** returns index of first char on line */
long
edit_bol (WEdit * edit, long current)
off_t
edit_bol (WEdit * edit, off_t current)
{
if (current <= 0)
return 0;
@ -2960,7 +2981,7 @@ edit_bol (WEdit * edit, long current)
/* --------------------------------------------------------------------------------------------- */
long
edit_count_lines (WEdit * edit, long current, long upto)
edit_count_lines (WEdit * edit, off_t current, off_t upto)
{
long lines = 0;
if (upto > edit->last_byte)
@ -2977,12 +2998,12 @@ edit_count_lines (WEdit * edit, long current, long upto)
/* If lines is zero this returns the count of lines from current to upto. */
/* If upto is zero returns index of lines forward current. */
long
edit_move_forward (WEdit * edit, long current, long lines, long upto)
off_t
edit_move_forward (WEdit * edit, off_t current, long lines, off_t upto)
{
if (upto)
if (upto != 0)
{
return edit_count_lines (edit, current, upto);
return (off_t) edit_count_lines (edit, current, upto);
}
else
{
@ -3004,8 +3025,8 @@ edit_move_forward (WEdit * edit, long current, long lines, long upto)
/* --------------------------------------------------------------------------------------------- */
/** Returns offset of 'lines' lines up from current */
long
edit_move_backward (WEdit * edit, long current, long lines)
off_t
edit_move_backward (WEdit * edit, off_t current, long lines)
{
if (lines < 0)
lines = 0;
@ -3019,13 +3040,13 @@ edit_move_backward (WEdit * edit, long current, long lines)
/* If cols is zero this returns the count of columns from current to upto. */
/* If upto is zero returns index of cols across from current. */
long
edit_move_forward3 (WEdit * edit, long current, long cols, long upto)
off_t
edit_move_forward3 (WEdit * edit, off_t current, long cols, off_t upto)
{
long p, q;
off_t p, q;
long col;
if (upto)
if (upto != 0)
{
q = upto;
cols = -10;
@ -3072,8 +3093,8 @@ edit_move_forward3 (WEdit * edit, long current, long cols, long upto)
col += TAB_SIZE - col % TAB_SIZE;
else if (c == '\n')
{
if (upto)
return col;
if (upto != 0)
return (off_t) col;
else
return p;
}
@ -3084,7 +3105,7 @@ edit_move_forward3 (WEdit * edit, long current, long cols, long upto)
else
col++;
}
return col;
return (off_t) col;
}
/* --------------------------------------------------------------------------------------------- */
@ -3093,7 +3114,7 @@ edit_move_forward3 (WEdit * edit, long current, long cols, long upto)
long
edit_get_col (WEdit * edit)
{
return edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0, edit->curs1);
return (long) edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0, edit->curs1);
}
/* --------------------------------------------------------------------------------------------- */
@ -3111,7 +3132,7 @@ edit_update_curs_row (WEdit * edit)
void
edit_update_curs_col (WEdit * edit)
{
edit->curs_col = edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0, edit->curs1);
edit->curs_col = (long) edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0, edit->curs1);
}
/* --------------------------------------------------------------------------------------------- */
@ -3193,17 +3214,19 @@ edit_scroll_left (WEdit * edit, long i)
/* --------------------------------------------------------------------------------------------- */
void
edit_move_to_prev_col (WEdit * edit, long p)
edit_move_to_prev_col (WEdit * edit, off_t p)
{
long prev = edit->prev_col;
long over = edit->over_col;
edit_cursor_move (edit, edit_move_forward3 (edit, p, prev + edit->over_col, 0) - edit->curs1);
if (option_cursor_beyond_eol)
{
long line_len = edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0,
edit_eol (edit, edit->curs1));
long line_len;
line_len = (long) edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0,
edit_eol (edit, edit->curs1));
if (line_len < prev + edit->over_col)
{
edit->over_col = prev + over - line_len;
@ -3227,12 +3250,15 @@ edit_move_to_prev_col (WEdit * edit, long p)
{
if (edit->curs_col % (HALF_TAB_SIZE * space_width))
{
int q = edit->curs_col;
int q;
q = edit->curs_col;
edit->curs_col -= (edit->curs_col % (HALF_TAB_SIZE * space_width));
p = edit_bol (edit, edit->curs1);
edit_cursor_move (edit,
edit_move_forward3 (edit, p, edit->curs_col,
0) - edit->curs1);
edit_cursor_move (edit, edit_move_forward3 (edit, p, edit->curs_col, 0)
- edit->curs1);
if (!left_of_four_spaces (edit))
edit_cursor_move (edit, edit_move_forward3 (edit, p, q, 0) - edit->curs1);
}
@ -3295,7 +3321,7 @@ edit_push_markers (WEdit * edit)
/* --------------------------------------------------------------------------------------------- */
void
edit_set_markers (WEdit * edit, long m1, long m2, long c1, long c2)
edit_set_markers (WEdit * edit, off_t m1, off_t m2, long c1, long c2)
{
edit->mark1 = m1;
edit->mark2 = m2;
@ -3419,12 +3445,15 @@ edit_delete_line (WEdit * edit)
/* --------------------------------------------------------------------------------------------- */
long
edit_indent_width (WEdit * edit, long p)
edit_indent_width (WEdit * edit, off_t p)
{
long q = p;
while (strchr ("\t ", edit_get_byte (edit, q)) && q < edit->last_byte - 1) /* move to the end of the leading whitespace of the line */
off_t q = p;
/* move to the end of the leading whitespace of the line */
while (strchr ("\t ", edit_get_byte (edit, q)) && q < edit->last_byte - 1)
q++;
return edit_move_forward3 (edit, p, 0, q); /* count the number of columns of indentation */
/* count the number of columns of indentation */
return (long) edit_move_forward3 (edit, p, 0, q);
}
/* --------------------------------------------------------------------------------------------- */
@ -3583,7 +3612,7 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
edit->column_highlight = 0;
if (edit->highlight == 0 || (edit->mark2 != -1 && edit->mark1 != edit->mark2))
{
edit_mark_cmd (edit, TRUE); /* clear */
edit_mark_cmd (edit, TRUE); /* clear */
edit_mark_cmd (edit, FALSE); /* marking on */
}
edit->highlight = 1;

Просмотреть файл

@ -132,7 +132,7 @@ edit_save_file (WEdit * edit, const vfs_path_t * filename_vpath)
{
char *p;
gchar *tmp;
long filelen = 0;
off_t filelen = 0;
int this_save_mode, fd = -1;
vfs_path_t *real_filename_vpath;
vfs_path_t *savename_vpath = NULL;
@ -285,7 +285,7 @@ edit_save_file (WEdit * edit, const vfs_path_t * filename_vpath)
}
else if (edit->lb == LB_ASIS)
{ /* do not change line breaks */
long buf;
off_t buf;
buf = 0;
filelen = edit->last_byte;
while (buf <= (edit->curs1 >> S_EDIT_BUF_SIZE) - 1)
@ -514,13 +514,15 @@ edit_load_file_from_filename (Dlg_head * h, const vfs_path_t * vpath)
static void
edit_delete_column_of_text (WEdit * edit)
{
long p, q, r, m1, m2;
long b, c, d, n;
off_t p, q, r;
off_t m1, m2;
off_t n;
long b, c, d;
eval_marks (edit, &m1, &m2);
n = edit_move_forward (edit, m1, 0, m2) + 1;
c = edit_move_forward3 (edit, edit_bol (edit, m1), 0, m1);
d = edit_move_forward3 (edit, edit_bol (edit, m2), 0, m2);
c = (long) edit_move_forward3 (edit, edit_bol (edit, m1), 0, m1);
d = (long) edit_move_forward3 (edit, edit_bol (edit, m2), 0, m2);
b = max (min (c, d), min (edit->column1, edit->column2));
c = max (c, max (edit->column1, edit->column2));
@ -553,8 +555,8 @@ edit_delete_column_of_text (WEdit * edit)
static int
edit_block_delete (WEdit * edit)
{
long count;
long start_mark, end_mark;
off_t count;
off_t start_mark, end_mark;
int curs_pos;
long curs_line, c1, c2;
@ -593,7 +595,7 @@ edit_block_delete (WEdit * edit)
{
if (edit->column_highlight)
{
int line_width;
long line_width;
if (edit->mark2 < 0)
edit_mark_cmd (edit, FALSE);
@ -601,8 +603,8 @@ edit_block_delete (WEdit * edit)
/* move cursor to the saved position */
edit_move_to_line (edit, curs_line);
/* calculate line width and cursor position before cut */
line_width = edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0,
edit_eol (edit, edit->curs1));
line_width = (long) edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0,
edit_eol (edit, edit->curs1));
if (option_cursor_beyond_eol && curs_pos > line_width)
edit->over_col = curs_pos - line_width;
}
@ -760,8 +762,8 @@ edit_calculate_start_of_current_line (WEdit * edit, off_t current_pos, char end_
static void
edit_search_fix_search_start_if_selection (WEdit * edit)
{
long start_mark = 0;
long end_mark = 0;
off_t start_mark = 0;
off_t end_mark = 0;
if (!edit_search_options.only_in_selection)
return;
@ -788,8 +790,8 @@ editcmd_find (WEdit * edit, gsize * len)
{
off_t search_start = edit->search_start;
off_t search_end;
long start_mark = 0;
long end_mark = edit->last_byte;
off_t start_mark = 0;
off_t end_mark = edit->last_byte;
int mark_res = 0;
char end_string_symbol;
@ -1008,7 +1010,7 @@ edit_search (WEdit * edit)
/** Return a null terminated length of text. Result must be g_free'd */
static unsigned char *
edit_get_block (WEdit * edit, long start, long finish, int *l)
edit_get_block (WEdit * edit, off_t start, off_t finish, int *l)
{
unsigned char *s, *r;
r = s = g_malloc0 (finish - start + 1);
@ -1019,7 +1021,8 @@ edit_get_block (WEdit * edit, long start, long finish, int *l)
while (start < finish)
{
int c;
long x;
off_t x;
x = edit_move_forward3 (edit, edit_bol (edit, start), 0, start);
c = edit_get_byte (edit, start);
if ((x >= edit->column1 && x < edit->column2)
@ -1045,7 +1048,7 @@ edit_get_block (WEdit * edit, long start, long finish, int *l)
/** copies a block to clipboard file */
static gboolean
edit_save_block_to_clip_file (WEdit * edit, long start, long finish)
edit_save_block_to_clip_file (WEdit * edit, off_t start, off_t finish)
{
gboolean ret;
gchar *tmp;
@ -1080,7 +1083,7 @@ pipe_mail (WEdit * edit, char *to, char *subject, char *cc)
if (p)
{
long i;
off_t i;
for (i = 0; i < edit->last_byte; i++)
fputc (edit_get_byte (edit, i), p);
pclose (p);
@ -1091,7 +1094,7 @@ pipe_mail (WEdit * edit, char *to, char *subject, char *cc)
/** find first character of current word */
static gboolean
edit_find_word_start (WEdit * edit, long *word_start, gsize * word_len)
edit_find_word_start (WEdit * edit, off_t * word_start, gsize * word_len)
{
int c, last;
gsize i;
@ -1100,7 +1103,7 @@ edit_find_word_start (WEdit * edit, long *word_start, gsize * word_len)
if (edit->curs1 <= 0)
return FALSE;
c = (unsigned char) edit_get_byte (edit, edit->curs1 - 1);
c = edit_get_byte (edit, edit->curs1 - 1);
/* return if not at end or in word */
if (is_break_char (c))
return FALSE;
@ -1113,7 +1116,7 @@ edit_find_word_start (WEdit * edit, long *word_start, gsize * word_len)
return FALSE;
last = c;
c = (unsigned char) edit_get_byte (edit, edit->curs1 - i);
c = edit_get_byte (edit, edit->curs1 - i);
if (is_break_char (c))
{
@ -1142,9 +1145,10 @@ edit_find_word_start (WEdit * edit, long *word_start, gsize * word_len)
*/
static char *
edit_collect_completions_get_current_word (WEdit * edit, mc_search_t * srch, long word_start)
edit_collect_completions_get_current_word (WEdit * edit, mc_search_t * srch, off_t word_start)
{
gsize len = 0, i;
gsize len = 0;
off_t i;
GString *temp;
if (!mc_search_run (srch, (void *) edit, word_start, edit->last_byte, &len))
@ -1168,7 +1172,7 @@ edit_collect_completions_get_current_word (WEdit * edit, mc_search_t * srch, lon
/** collect the possible completions */
static gsize
edit_collect_completions (WEdit * edit, long word_start, gsize word_len,
edit_collect_completions (WEdit * edit, off_t word_start, gsize word_len,
char *match_expr, struct selection *compl, gsize * num)
{
gsize len = 0;
@ -1177,7 +1181,7 @@ edit_collect_completions (WEdit * edit, long word_start, gsize word_len,
int skip;
GString *temp;
mc_search_t *srch;
long last_byte, start = -1;
off_t last_byte, start = -1;
char *current_word;
srch = mc_search_new (match_expr, -1);
@ -1216,7 +1220,7 @@ edit_collect_completions (WEdit * edit, long word_start, gsize word_len,
continue;
/* skip current word */
if (start + (long) i == word_start)
if (start + (off_t) i == word_start)
break;
g_string_append_c (temp, skip);
@ -1290,10 +1294,10 @@ edit_collect_completions (WEdit * edit, long word_start, gsize word_len,
static void
edit_insert_column_of_text (WEdit * edit, unsigned char *data, int size, int width,
long *start_pos, long *end_pos, int *col1, int *col2)
off_t * start_pos, off_t * end_pos, int *col1, int *col2)
{
long cursor;
int i, col;
off_t cursor;
long i, col;
cursor = edit->curs1;
col = edit_get_col (edit);
@ -1305,7 +1309,7 @@ edit_insert_column_of_text (WEdit * edit, unsigned char *data, int size, int wid
else
{ /* fill in and move to next line */
int l;
long p;
off_t p;
if (edit_get_byte (edit, edit->curs1) != '\n')
{
@ -2233,14 +2237,14 @@ edit_close_cmd (WEdit * edit)
*/
int
eval_marks (WEdit * edit, long *start_mark, long *end_mark)
eval_marks (WEdit * edit, off_t * start_mark, off_t * end_mark)
{
if (edit->mark1 != edit->mark2)
{
long start_bol, start_eol;
long end_bol, end_eol;
off_t start_bol, start_eol;
off_t end_bol, end_eol;
off_t diff1, diff2;
long col1, col2;
long diff1, diff2;
long end_mark_curs;
if (edit->end_mark_curs < 0)
@ -2271,12 +2275,10 @@ eval_marks (WEdit * edit, long *start_mark, long *end_mark)
col1 = min (edit->column1, edit->column2);
col2 = max (edit->column1, edit->column2);
diff1 =
edit_move_forward3 (edit, start_bol, col2, 0) - edit_move_forward3 (edit, start_bol,
col1, 0);
diff2 =
edit_move_forward3 (edit, end_bol, col2, 0) - edit_move_forward3 (edit, end_bol,
col1, 0);
diff1 = edit_move_forward3 (edit, start_bol, col2, 0) -
edit_move_forward3 (edit, start_bol, col1, 0);
diff2 = edit_move_forward3 (edit, end_bol, col2, 0) -
edit_move_forward3 (edit, end_bol, col1, 0);
*start_mark -= diff1;
*end_mark += diff2;
@ -2309,13 +2311,13 @@ edit_insert_over (WEdit * edit)
/* --------------------------------------------------------------------------------------------- */
int
off_t
edit_insert_column_of_text_from_file (WEdit * edit, int file,
long *start_pos, long *end_pos, long *col1, long *col2)
off_t * start_pos, off_t * end_pos, long *col1, long *col2)
{
long cursor;
off_t cursor;
int col;
int blocklen = -1, width = 0;
off_t blocklen = -1, width = 0;
unsigned char *data;
cursor = edit->curs1;
@ -2324,7 +2326,7 @@ edit_insert_column_of_text_from_file (WEdit * edit, int file,
while ((blocklen = mc_read (file, (char *) data, TEMP_BUF_LEN)) > 0)
{
int i;
off_t i;
for (width = 0; width < blocklen; width++)
{
if (data[width] == '\n')
@ -2334,8 +2336,8 @@ edit_insert_column_of_text_from_file (WEdit * edit, int file,
{
if (data[i] == '\n')
{ /* fill in and move to next line */
int l;
long p;
long l;
off_t p;
if (edit_get_byte (edit, edit->curs1) != '\n')
{
l = width - (edit_get_col (edit) - col);
@ -2387,9 +2389,9 @@ edit_insert_column_of_text_from_file (WEdit * edit, int file,
void
edit_block_copy_cmd (WEdit * edit)
{
long start_mark, end_mark, current = edit->curs1;
off_t start_mark, end_mark, current = edit->curs1;
long col_delta = 0;
long mark1, mark2;
off_t mark1, mark2;
int c1, c2;
int size;
unsigned char *copy_buf;
@ -2432,9 +2434,9 @@ edit_block_copy_cmd (WEdit * edit)
void
edit_block_move_cmd (WEdit * edit)
{
long current;
off_t current;
unsigned char *copy_buf = NULL;
long start_mark, end_mark;
off_t start_mark, end_mark;
long line;
if (eval_marks (edit, &start_mark, &end_mark))
@ -2447,7 +2449,7 @@ edit_block_move_cmd (WEdit * edit)
if (edit->column_highlight)
{
long mark1, mark2;
off_t mark1, mark2;
int size;
int b_width = 0;
int c1, c2;
@ -2494,7 +2496,7 @@ edit_block_move_cmd (WEdit * edit)
}
else
{
long count;
off_t count;
current = edit->curs1;
copy_buf = g_malloc0 (end_mark - start_mark);
@ -2527,7 +2529,7 @@ edit_block_move_cmd (WEdit * edit)
int
edit_block_delete_cmd (WEdit * edit)
{
long start_mark, end_mark;
off_t start_mark, end_mark;
if (eval_marks (edit, &start_mark, &end_mark))
{
edit_delete_line (edit);
@ -2771,7 +2773,7 @@ edit_replace_cmd (WEdit * edit, int again)
mc_search_cbret_t
edit_search_cmd_callback (const void *user_data, gsize char_offset, int *current_char)
{
*current_char = edit_get_byte ((WEdit *) user_data, (long) char_offset);
*current_char = edit_get_byte ((WEdit *) user_data, (off_t) char_offset);
return MC_SEARCH_CB_OK;
}
@ -2908,7 +2910,7 @@ edit_ok_to_exit (WEdit * edit)
/** save block, returns TRUE on success */
gboolean
edit_save_block (WEdit * edit, const char *filename, long start, long finish)
edit_save_block (WEdit * edit, const char *filename, off_t start, off_t finish)
{
int len, file;
vfs_path_t *vpath;
@ -2944,7 +2946,8 @@ edit_save_block (WEdit * edit, const char *filename, long start, long finish)
else
{
unsigned char *buf;
int i = start, end;
off_t i = start;
off_t end;
len = finish - start;
buf = g_malloc0 (TEMP_BUF_LEN);
@ -2977,7 +2980,7 @@ edit_paste_from_history (WEdit * edit)
gboolean
edit_copy_to_X_buf_cmd (WEdit * edit)
{
long start_mark, end_mark;
off_t start_mark, end_mark;
if (eval_marks (edit, &start_mark, &end_mark))
return TRUE;
@ -2997,7 +3000,7 @@ edit_copy_to_X_buf_cmd (WEdit * edit)
gboolean
edit_cut_to_X_buf_cmd (WEdit * edit)
{
long start_mark, end_mark;
off_t start_mark, end_mark;
if (eval_marks (edit, &start_mark, &end_mark))
return TRUE;
@ -3081,7 +3084,7 @@ edit_goto_cmd (WEdit * edit)
gboolean
edit_save_block_cmd (WEdit * edit)
{
long start_mark, end_mark;
off_t start_mark, end_mark;
char *exp, *tmp;
gboolean ret = FALSE;
@ -3154,7 +3157,7 @@ edit_sort_cmd (WEdit * edit)
{
static char *old = 0;
char *exp, *tmp, *tmp_edit_block_name, *tmp_edit_temp_name;
long start_mark, end_mark;
off_t start_mark, end_mark;
int e;
if (eval_marks (edit, &start_mark, &end_mark))
@ -3343,7 +3346,7 @@ void
edit_complete_word_cmd (WEdit * edit)
{
gsize i, max_len, word_len = 0, num_compl = 0;
long word_start = 0;
off_t word_start = 0;
unsigned char *bufpos;
char *match_expr;
struct selection compl[MAX_WORD_COMPLETIONS]; /* completions */
@ -3511,7 +3514,7 @@ edit_get_match_keyword_cmd (WEdit * edit)
gsize word_len = 0, max_len = 0;
int num_def = 0;
int i;
long word_start = 0;
off_t word_start = 0;
unsigned char *bufpos;
char *match_expr;
char *path = NULL;
@ -3576,7 +3579,7 @@ edit_suggest_current_word (WEdit * edit)
{
gsize cut_len = 0;
gsize word_len = 0;
long word_start = 0;
off_t word_start = 0;
int retval = B_SKIP_WORD;
char *match_word;

Просмотреть файл

@ -158,7 +158,7 @@ status_string (WEdit * edit, char *s, int w)
edit->overwrite == 0 ? '-' : 'O',
edit->curs_col + edit->over_col,
edit->curs_line + 1,
edit->total_lines + 1, edit->curs1, edit->last_byte, byte_str,
edit->total_lines + 1, (long) edit->curs1, (long) edit->last_byte, byte_str,
#ifdef HAVE_CHARSET
mc_global.source_codepage >=
0 ? get_codepage_id (mc_global.source_codepage) : ""
@ -177,7 +177,7 @@ status_string (WEdit * edit, char *s, int w)
edit->start_line + 1,
edit->curs_row,
edit->curs_line + 1,
edit->total_lines + 1, edit->curs1, edit->last_byte, byte_str,
edit->total_lines + 1, (long) edit->curs1, (long) edit->last_byte, byte_str,
#ifdef HAVE_CHARSET
mc_global.source_codepage >=
0 ? get_codepage_id (mc_global.source_codepage) : ""
@ -502,12 +502,13 @@ print_to_widget (WEdit * edit, long row, int start_col, int start_col_real,
/** b is a pointer to the beginning of the line */
static void
edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_col)
edit_draw_this_line (WEdit * edit, off_t b, long row, long start_col, long end_col)
{
struct line_s line[MAX_LINE_LEN];
struct line_s *p = line;
long m1 = 0, m2 = 0, q, c1, c2;
off_t m1 = 0, m2 = 0, q;
long c1, c2;
int col, start_col_real;
unsigned int c;
int color;
@ -569,7 +570,7 @@ edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_co
if (row <= edit->total_lines - edit->start_line)
{
long tws = 0;
off_t tws = 0;
if (tty_use_colors () && visible_tws)
{
tws = edit_eol (edit, b);
@ -592,8 +593,9 @@ edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_co
{
if (edit->column_highlight)
{
int x;
x = edit_move_forward3 (edit, b, 0, q);
long x;
x = (long) edit_move_forward3 (edit, b, 0, q);
c1 = min (edit->column1, edit->column2);
c2 = max (edit->column1, edit->column2);
if (x >= c1 && x < c2)
@ -828,9 +830,10 @@ edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_co
/* --------------------------------------------------------------------------------------------- */
static inline void
edit_draw_this_char (WEdit * edit, long curs, long row, long start_column, long end_column)
edit_draw_this_char (WEdit * edit, off_t curs, long row, long start_column, long end_column)
{
int b = edit_bol (edit, curs);
off_t b = edit_bol (edit, curs);
edit_draw_this_line (edit, b, row, start_column, end_column);
}
@ -841,7 +844,7 @@ static inline void
render_edit_text (WEdit * edit, long start_row, long start_column, long end_row, long end_column)
{
static long prev_curs_row = 0;
static long prev_curs = 0;
static off_t prev_curs = 0;
Widget *w = (Widget *) edit;
Dlg_head *h = w->owner;
@ -1073,7 +1076,7 @@ edit_scroll_screen_over_cursor (WEdit * edit)
l_extreme = EDIT_LEFT_EXTREME;
b_extreme = EDIT_BOTTOM_EXTREME;
t_extreme = EDIT_TOP_EXTREME;
if (edit->found_len)
if (edit->found_len != 0)
{
b_extreme = max (edit->widget.lines / 4, b_extreme);
t_extreme = max (edit->widget.lines / 4, t_extreme);

Просмотреть файл

@ -72,8 +72,8 @@ struct WEdit
vfs_path_t *dir_vpath; /* NULL if filename is absolute */
/* dynamic buffers and cursor position for editor: */
long curs1; /* position of the cursor from the beginning of the file. */
long curs2; /* position from the end of the file */
off_t curs1; /* position of the cursor from the beginning of the file. */
off_t curs2; /* position from the end of the file */
unsigned char *buffers1[MAXBUFF + 1]; /* all data up to curs1 */
unsigned char *buffers2[MAXBUFF + 1]; /* all data from end of file down to curs2 */
@ -88,12 +88,12 @@ struct WEdit
edit_search_line_t search_line_type;
char *last_search_string; /* String that have been searched */
long search_start; /* First character to start searching from */
off_t search_start; /* First character to start searching from */
unsigned long found_len; /* Length of found string or 0 if none was found */
long found_start; /* the found word from a search - start position */
off_t found_start; /* the found word from a search - start position */
/* display information */
long last_byte; /* Last byte of file */
off_t last_byte; /* Last byte of file */
long start_display; /* First char displayed */
long start_col; /* First displayed column, negative */
long max_column; /* The maximum cursor position ever reached used to calc hori scroll bar */
@ -117,17 +117,17 @@ struct WEdit
/* file info */
long total_lines; /* total lines in the file */
long mark1; /* position of highlight start */
long mark2; /* position of highlight end */
long end_mark_curs; /* position of cursor after end of highlighting */
off_t mark1; /* position of highlight start */
off_t mark2; /* position of highlight end */
off_t end_mark_curs; /* position of cursor after end of highlighting */
long column1; /* position of column highlight start */
long column2; /* position of column highlight end */
long bracket; /* position of a matching bracket */
off_t bracket; /* position of a matching bracket */
/* cache speedup for line lookups */
gboolean caches_valid;
long line_numbers[N_LINE_CACHES];
long line_offsets[N_LINE_CACHES];
off_t line_offsets[N_LINE_CACHES];
struct _book_mark *book_mark;
GArray *serialized_bookmarks;

Просмотреть файл

@ -549,7 +549,7 @@ apply_rules_going_right (WEdit * edit, long i, struct syntax_rule rule)
/* --------------------------------------------------------------------------------------------- */
static struct syntax_rule
edit_get_rule (WEdit * edit, long byte_index)
edit_get_rule (WEdit * edit, off_t byte_index)
{
long i;
@ -1415,7 +1415,7 @@ get_first_editor_line (WEdit * edit)
/* --------------------------------------------------------------------------------------------- */
void
edit_get_syntax_color (WEdit * edit, long byte_index, int *color)
edit_get_syntax_color (WEdit * edit, off_t byte_index, int *color)
{
if (!tty_use_colors ())
*color = 0;

Просмотреть файл

@ -71,7 +71,8 @@
static long
line_start (WEdit * edit, long line)
{
long p, l;
off_t p;
long l;
l = edit->curs_line;
p = edit->curs1;
@ -90,7 +91,7 @@ line_start (WEdit * edit, long line)
/* --------------------------------------------------------------------------------------------- */
static int
bad_line_start (WEdit * edit, long p)
bad_line_start (WEdit * edit, off_t p)
{
int c;
c = edit_get_byte (edit, p);
@ -174,7 +175,7 @@ end_paragraph (WEdit * edit, int force)
/* --------------------------------------------------------------------------------------------- */
static unsigned char *
get_paragraph (WEdit * edit, long p, long q, int indent, int *size)
get_paragraph (WEdit * edit, off_t p, off_t q, int indent, int *size)
{
unsigned char *s, *t;
#if 0
@ -348,7 +349,7 @@ replace_at (WEdit * edit, long q, int c)
/** replaces a block of text */
static inline void
put_paragraph (WEdit * edit, unsigned char *t, long p, int indent, int size)
put_paragraph (WEdit * edit, unsigned char *t, off_t p, int indent, int size)
{
long cursor;
int i, c = 0;
@ -367,7 +368,7 @@ put_paragraph (WEdit * edit, unsigned char *t, long p, int indent, int size)
}
else if (t[i - 1] == '\n')
{
long curs;
off_t curs;
edit_cursor_move (edit, p - edit->curs1);
curs = edit->curs1;
edit_insert_indent (edit, indent);
@ -397,7 +398,7 @@ put_paragraph (WEdit * edit, unsigned char *t, long p, int indent, int size)
/* --------------------------------------------------------------------------------------------- */
static inline int
test_indent (WEdit * edit, long p, long q)
test_indent (WEdit * edit, off_t p, off_t q)
{
int indent;
indent = edit_indent_width (edit, p++);