search: change types of start and end search positions from gsize to off_t.

editor: related changes.
viewer: likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-12-26 11:00:29 +03:00
parent fcecbf003c
commit 2980010b53
11 changed files with 25 additions and 25 deletions

View File

@ -19,9 +19,9 @@
typedef enum mc_search_cbret_t mc_search_cbret_t;
typedef mc_search_cbret_t (*mc_search_fn) (const void *user_data, gsize char_offset,
typedef mc_search_cbret_t (*mc_search_fn) (const void *user_data, off_t char_offset,
int *current_char);
typedef mc_search_cbret_t (*mc_update_fn) (const void *user_data, gsize char_offset);
typedef mc_search_cbret_t (*mc_update_fn) (const void *user_data, off_t char_offset);
#define MC_SEARCH__NUM_REPLACE_ARGS 64
@ -180,8 +180,8 @@ void mc_search_free (mc_search_t * lc_mc_search);
gboolean mc_search_prepare (mc_search_t * mc_search);
gboolean mc_search_run (mc_search_t * mc_search, const void *user_data, gsize start_search,
gsize end_search, gsize * found_len);
gboolean mc_search_run (mc_search_t * mc_search, const void *user_data, off_t start_search,
off_t end_search, gsize * found_len);
gboolean mc_search_is_type_avail (mc_search_type_t search_type);

View File

@ -188,7 +188,7 @@ mc_search__cond_struct_new_init_glob (const char *charset, mc_search_t *lc_mc_se
gboolean
mc_search__run_glob (mc_search_t *lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize *found_len)
off_t start_search, off_t end_search, gsize *found_len)
{
return mc_search__run_regex (lc_mc_search, user_data, start_search, end_search, found_len);
}

View File

@ -216,7 +216,7 @@ mc_search__cond_struct_new_init_hex (const char *charset, mc_search_t *lc_mc_sea
gboolean
mc_search__run_hex (mc_search_t *lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize *found_len)
off_t start_search, off_t end_search, gsize *found_len)
{
return mc_search__run_regex (lc_mc_search, user_data, start_search, end_search, found_len);
}

View File

@ -54,7 +54,7 @@ GString *mc_search__toupper_case_str (const char *charset, const GString * str);
void mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_search,
mc_search_cond_t * mc_search_cond);
gboolean mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize * found_len);
off_t start_search, off_t end_search, gsize * found_len);
GString *mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
/* search/normal.c : */
@ -62,7 +62,7 @@ GString *mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GStrin
void mc_search__cond_struct_new_init_normal (const char *charset, mc_search_t * lc_mc_search,
mc_search_cond_t * mc_search_cond);
gboolean mc_search__run_normal (mc_search_t * lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize * found_len);
off_t start_search, off_t end_search, gsize * found_len);
GString *mc_search_normal_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
/* search/glob.c : */
@ -70,7 +70,7 @@ GString *mc_search_normal_prepare_replace_str (mc_search_t * lc_mc_search, GStri
void mc_search__cond_struct_new_init_glob (const char *charset, mc_search_t * lc_mc_search,
mc_search_cond_t * mc_search_cond);
gboolean mc_search__run_glob (mc_search_t * lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize * found_len);
off_t start_search, off_t end_search, gsize * found_len);
GString *mc_search_glob_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
/* search/hex.c : */
@ -78,7 +78,7 @@ GString *mc_search_glob_prepare_replace_str (mc_search_t * lc_mc_search, GString
void mc_search__cond_struct_new_init_hex (const char *charset, mc_search_t * lc_mc_search,
mc_search_cond_t * mc_search_cond);
gboolean mc_search__run_hex (mc_search_t * lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize * found_len);
off_t start_search, off_t end_search, gsize * found_len);
GString *mc_search_hex_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
/*** inline functions ****************************************************************************/

View File

@ -94,7 +94,7 @@ mc_search__cond_struct_new_init_normal (const char *charset, mc_search_t *lc_mc_
gboolean
mc_search__run_normal (mc_search_t *lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize *found_len)
off_t start_search, off_t end_search, gsize *found_len)
{
return mc_search__run_regex (lc_mc_search, user_data, start_search, end_search, found_len);
}

View File

@ -905,10 +905,10 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t *lc_mc_s
gboolean
mc_search__run_regex (mc_search_t *lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize *found_len)
off_t start_search, off_t end_search, gsize *found_len)
{
mc_search_cbret_t ret = MC_SEARCH_CB_NOTFOUND;
gsize current_pos, virtual_pos;
off_t current_pos, virtual_pos;
gint start_pos;
gint end_pos;

View File

@ -273,7 +273,7 @@ mc_search_prepare (mc_search_t *lc_mc_search)
*/
gboolean
mc_search_run (mc_search_t *lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize *found_len)
off_t start_search, off_t end_search, gsize *found_len)
{
gboolean ret = FALSE;

View File

@ -704,11 +704,11 @@ edit_search_deinit (WEdit *edit)
/* --------------------------------------------------------------------------------------------- */
mc_search_cbret_t
edit_search_cmd_callback (const void *user_data, gsize char_offset, int *current_char)
edit_search_cmd_callback (const void *user_data, off_t char_offset, int *current_char)
{
WEdit *edit = ((const edit_search_status_msg_t *) user_data)->edit;
*current_char = edit_buffer_get_byte (&edit->buffer, (off_t) char_offset);
*current_char = edit_buffer_get_byte (&edit->buffer, char_offset);
return MC_SEARCH_CB_OK;
}
@ -716,11 +716,11 @@ edit_search_cmd_callback (const void *user_data, gsize char_offset, int *current
/* --------------------------------------------------------------------------------------------- */
mc_search_cbret_t
edit_search_update_callback (const void *user_data, gsize char_offset)
edit_search_update_callback (const void *user_data, off_t char_offset)
{
status_msg_t *sm = STATUS_MSG (user_data);
((edit_search_status_msg_t *) sm)->offset = (off_t) char_offset;
((edit_search_status_msg_t *) sm)->offset = char_offset;
return (sm->update (sm) == B_CANCEL ? MC_SEARCH_CB_ABORT : MC_SEARCH_CB_OK);
}

View File

@ -23,9 +23,9 @@ typedef struct
gboolean edit_search_init (WEdit * edit, const char *s);
void edit_search_deinit (WEdit * edit);
mc_search_cbret_t edit_search_cmd_callback (const void *user_data, gsize char_offset,
mc_search_cbret_t edit_search_cmd_callback (const void *user_data, off_t char_offset,
int *current_char);
mc_search_cbret_t edit_search_update_callback (const void *user_data, gsize char_offset);
mc_search_cbret_t edit_search_update_callback (const void *user_data, off_t char_offset);
int edit_search_status_update_cb (status_msg_t * sm);
void edit_search_cmd (WEdit * edit, gboolean again);

View File

@ -327,9 +327,9 @@ int mcview_nroff_seq_prev (mcview_nroff_t * nroff);
/* search.c: */
gboolean mcview_search_init (WView * view);
void mcview_search_deinit (WView * view);
mc_search_cbret_t mcview_search_cmd_callback (const void *user_data, gsize char_offset,
mc_search_cbret_t mcview_search_cmd_callback (const void *user_data, off_t char_offset,
int *current_char);
mc_search_cbret_t mcview_search_update_cmd_callback (const void *user_data, gsize char_offset);
mc_search_cbret_t mcview_search_update_cmd_callback (const void *user_data, off_t char_offset);
void mcview_search (WView * view, gboolean start_search);
/* --------------------------------------------------------------------------------------------- */

View File

@ -424,7 +424,7 @@ mcview_search_deinit (WView *view)
/* --------------------------------------------------------------------------------------------- */
mc_search_cbret_t
mcview_search_cmd_callback (const void *user_data, gsize char_offset, int *current_char)
mcview_search_cmd_callback (const void *user_data, off_t char_offset, int *current_char)
{
WView *view = ((const mcview_search_status_msg_t *) user_data)->view;
@ -479,7 +479,7 @@ mcview_search_cmd_callback (const void *user_data, gsize char_offset, int *curre
/* --------------------------------------------------------------------------------------------- */
mc_search_cbret_t
mcview_search_update_cmd_callback (const void *user_data, gsize char_offset)
mcview_search_update_cmd_callback (const void *user_data, off_t char_offset)
{
status_msg_t *sm = STATUS_MSG (user_data);
mcview_search_status_msg_t *vsm = (mcview_search_status_msg_t *) user_data;
@ -487,7 +487,7 @@ mcview_search_update_cmd_callback (const void *user_data, gsize char_offset)
gboolean do_update = FALSE;
mc_search_cbret_t result = MC_SEARCH_CB_OK;
vsm->offset = (off_t) char_offset;
vsm->offset = char_offset;
if (mcview_search_options.backwards)
{