mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Search engine: fix return number of found bytes
Some reidentation of code
This commit is contained in:
parent
a3e6a1147d
commit
d9500ec836
14
src/search.c
14
src/search.c
@ -146,7 +146,8 @@ mc_search__toupper_case_str (const char *charset, const char *str, gsize str_len
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
static mc_search_cond_t *
|
||||
mc_search__cond_struct_new (const char *str, gsize str_len, const char *charset, gboolean case_sentitive)
|
||||
mc_search__cond_struct_new (const char *str, gsize str_len, const char *charset,
|
||||
gboolean case_sentitive)
|
||||
{
|
||||
mc_search_cond_t *mc_search_cond;
|
||||
mc_search_cond = g_malloc0 (sizeof (mc_search_cond_t));
|
||||
@ -163,7 +164,8 @@ mc_search__cond_struct_new (const char *str, gsize str_len, const char *charset,
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static GPtrArray *
|
||||
mc_search__conditions_new (const char *str, gsize str_len, gboolean all_charsets, gboolean case_sentitive)
|
||||
mc_search__conditions_new (const char *str, gsize str_len, gboolean all_charsets,
|
||||
gboolean case_sentitive)
|
||||
{
|
||||
GPtrArray *ret;
|
||||
ret = g_ptr_array_new ();
|
||||
@ -311,7 +313,7 @@ mc_search__run_normal (mc_search_t * mc_search, const void *user_data,
|
||||
|
||||
case COND__FOUND_CHAR_LAST:
|
||||
mc_search->normal_offset = current_pos;
|
||||
*found_len = search_pos;
|
||||
*found_len = search_pos + 1;
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
@ -399,9 +401,9 @@ mc_search_run (mc_search_t * mc_search, const void *user_data, gsize start_searc
|
||||
return FALSE;
|
||||
|
||||
if (!mc_search->conditions)
|
||||
mc_search->conditions = mc_search__conditions_new (mc_search->original, mc_search->original_len,
|
||||
mc_search->is_all_charsets,
|
||||
mc_search->is_case_sentitive);
|
||||
mc_search->conditions =
|
||||
mc_search__conditions_new (mc_search->original, mc_search->original_len,
|
||||
mc_search->is_all_charsets, mc_search->is_case_sentitive);
|
||||
|
||||
mc_search->error = MC_SEARCH_E_OK;
|
||||
if (mc_search->error_str) {
|
||||
|
@ -93,6 +93,7 @@ mc_search_t *mc_search_new (const gchar * original, gsize original_len);
|
||||
|
||||
void mc_search_free (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 * founded_len);
|
||||
gboolean mc_search_run (mc_search_t * mc_search, const void *user_data, gsize start_search,
|
||||
gsize end_search, gsize * founded_len);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user