Fix length calculation and typos in fixup function
This commit is contained in:
parent
60cb44c846
commit
4d7424adc4
1 changed files with 3 additions and 7 deletions
|
@ -1021,39 +1021,35 @@ adblock_fixup_regexp (const gchar* prefix,
|
||||||
{
|
{
|
||||||
case '*':
|
case '*':
|
||||||
g_string_append (str, ".*");
|
g_string_append (str, ".*");
|
||||||
|
len += 2;
|
||||||
break;
|
break;
|
||||||
/*case '.':
|
/*case '.':
|
||||||
g_string_append (str, "\\.");
|
g_string_append (str, "\\.");
|
||||||
break;*/
|
break;*/
|
||||||
case '?':
|
case '?':
|
||||||
g_string_append (str, "\\?");
|
g_string_append (str, "\\?");
|
||||||
|
len += 2;
|
||||||
break;
|
break;
|
||||||
case '|':
|
case '|':
|
||||||
g_string_append (str, "");
|
|
||||||
break;
|
|
||||||
/* FIXME: We actually need to match :[0-9]+ or '/'. Sign means
|
/* FIXME: We actually need to match :[0-9]+ or '/'. Sign means
|
||||||
"here could be port number or nothing". So bla.com^ will match
|
"here could be port number or nothing". So bla.com^ will match
|
||||||
bla.com/ or bla.com:8080/ but not bla.com.au/ */
|
bla.com/ or bla.com:8080/ but not bla.com.au/ */
|
||||||
case '^':
|
case '^':
|
||||||
g_string_append (str, "");
|
|
||||||
break;
|
|
||||||
case '+':
|
case '+':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_string_append_printf (str,"%c", *src);
|
g_string_append_printf (str,"%c", *src);
|
||||||
|
len++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
src++;
|
src++;
|
||||||
len++;
|
|
||||||
}
|
}
|
||||||
while (*src);
|
while (*src);
|
||||||
|
|
||||||
dst = g_string_free (str, FALSE);
|
dst = g_string_free (str, FALSE);
|
||||||
/* We dont need .* in the end of url. Thats stupid */
|
/* We dont need .* in the end of url. Thats stupid */
|
||||||
if (dst && dst[len-1] == '*' && dst[len-2] == '.')
|
if (dst && dst[len-1] == '*' && dst[len-2] == '.')
|
||||||
{
|
|
||||||
dst[len-2] = '\0';
|
dst[len-2] = '\0';
|
||||||
}
|
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue