Merge branch '2123_fix'

* 2123_fix:
  Ticket #2123: Fix to properly parse the replacement string
This commit is contained in:
Slava Zanko 2010-07-08 22:20:25 +03:00
commit b3bd656fe4
2 changed files with 5 additions and 8 deletions

View File

@ -135,11 +135,9 @@ mc_search__translate_replace_glob_to_regex (gchar * str)
if (!escaped_mode)
{
escaped_mode = TRUE;
continue;
} else {
g_string_append_c (buff, c);
}
break;
g_string_append_c (buff, c);
continue;
case '*':
case '?':
if (!escaped_mode)
@ -194,7 +192,6 @@ mc_search__run_glob (mc_search_t * lc_mc_search, const void *user_data,
/* --------------------------------------------------------------------------------------------- */
GString *
mc_search_glob_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str)
{

View File

@ -320,7 +320,7 @@ mc_search_regex__get_max_num_of_replace_tokens (const gchar * str, gsize len)
gsize loop;
for (loop = 0; loop < len - 1; loop++)
{
if (str[loop] == '\\' && (str[loop + 1] & (char) 0xf0) == 0x30 /* 0-9 */ )
if (str[loop] == '\\' && g_ascii_isdigit(str[loop + 1]) )
{
if (strutils_is_char_escaped (str, &str[loop]))
continue;
@ -421,9 +421,9 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
return -1;
}
if ((*(curr_str + 1) & (char) 0xf0) == 0x30)
if ( g_ascii_isdigit(*(curr_str + 1)))
{
ret = *(curr_str + 1) - '0';
ret = g_ascii_digit_value (*(curr_str + 1));
*skip_len = 2; /* \\ and one digit */
return ret;
}