diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2013-02-14 09:54:52 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2013-02-14 09:54:52 +0000 |
commit | c202861e939e64336fd2eb2efc614cbbeeb8bf8e (patch) | |
tree | 134ad4a5c3fccc714dfc30ae8e090abba329f00e /plugins/Variables/src/parse_regexp.cpp | |
parent | 262a20f04f06f4e51eca2afeff172b1f75138d88 (diff) |
correct fix for [3590]
git-svn-id: http://svn.miranda-ng.org/main/trunk@3595 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables/src/parse_regexp.cpp')
-rw-r--r-- | plugins/Variables/src/parse_regexp.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp index a973d4c0e0..774b64275a 100644 --- a/plugins/Variables/src/parse_regexp.cpp +++ b/plugins/Variables/src/parse_regexp.cpp @@ -27,12 +27,9 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) {
const char *err;
- int erroffset, nmat;
- pcre_extra *extra;
- pcre *ppat;
+ int erroffset;
char szVal[34], *arg1, *arg2;
int offsets[99];
- TCHAR *res;
if (ai->argc != 3) {
return NULL;
@@ -42,21 +39,21 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) { arg1 = mir_t2a(ai->targv[1]);
arg2 = mir_t2a(ai->targv[2]);
- ppat = pcre_compile(arg1, 0, &err, &erroffset, NULL);
+ pcre *ppat = pcre_compile(arg1, 0, &err, &erroffset, NULL);
if (ppat == NULL) {
mir_free(arg1);
mir_free(arg2);
return NULL;
}
- extra = pcre_study(ppat, 0, &err);
- nmat = pcre_exec(ppat, extra, arg2, strlen(arg2), 0, 0, offsets, 99);
+ pcre_extra *extra = pcre_study(ppat, 0, &err);
+ int nmat = pcre_exec(ppat, extra, arg2, strlen(arg2), 0, 0, offsets, 99);
mir_free(arg1);
mir_free(arg2);
if (nmat > 0) {
ai->flags &= ~AIF_FALSE;
_ltoa(nmat, szVal, 10);
- res = mir_a2t(szVal);
+ TCHAR *res = mir_a2t(szVal);
return res;
}
@@ -71,9 +68,7 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) { const char *err, *substring;
char *res, *arg1, *arg2, *arg3;
- int erroffset, nmat, number;
- pcre_extra *extra;
- pcre *ppat;
+ int erroffset, number;
int offsets[99];
TCHAR *tres;
@@ -93,15 +88,15 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) { return NULL;
}
ai->flags = AIF_FALSE;
- ppat = pcre_compile(arg1, 0, &err, &erroffset, NULL);
+ pcre *ppat = pcre_compile(arg1, 0, &err, &erroffset, NULL);
if (ppat == NULL) {
mir_free(arg1);
mir_free(arg2);
mir_free(arg3);
return NULL;
}
- extra = pcre_study(ppat, 0, &err);
- nmat = pcre_exec(ppat, extra, arg2, strlen(arg2), 0, 0, offsets, 99);
+ pcre_extra *extra = pcre_study(ppat, 0, &err);
+ int nmat = pcre_exec(ppat, extra, arg2, strlen(arg2), 0, 0, offsets, 99);
if (nmat >= 0) {
ai->flags &= ~AIF_FALSE;
}
@@ -131,8 +126,8 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) { int registerRegExpTokens() {
- registerIntToken(_T(REGEXPCHECK), parseRegExpCheck, TRF_FUNCTION, Translate("Regular Expressions\t(x,y)\t(ANSI input only) the number of substring matches found in y with pattern x"));
- registerIntToken(_T(REGEXPSUBSTR), parseRegExpSubstr, TRF_FUNCTION, Translate("Regular Expressions\t(x,y,z)\t(ANSI input only) substring match number z found in subject y with pattern x"));
+ registerIntToken(_T(REGEXPCHECK), parseRegExpCheck, TRF_FUNCTION, LPGEN("Regular Expressions")"\t(x,y)\t"LPGEN("(ANSI input only) the number of substring matches found in y with pattern x"));
+ registerIntToken(_T(REGEXPSUBSTR), parseRegExpSubstr, TRF_FUNCTION, LPGEN("Regular Expressions")"\t(x,y,z)\t"LPGEN("(ANSI input only) substring match number z found in subject y with pattern x"));
return 0;
|