From cd6ce3298f1a2a1243e45ae29f52194d06f6d0af Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 2 Aug 2014 17:42:41 +0000 Subject: project cleanup variables use pcre16 git-svn-id: http://svn.miranda-ng.org/main/trunk@10028 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/Variables_12.vcxproj | 21 +++++++++++++-------- plugins/Variables/src/parse_regexp.cpp | 30 ++++++++++++------------------ plugins/Variables/src/variables.h | 5 ++--- 3 files changed, 27 insertions(+), 29 deletions(-) (limited to 'plugins/Variables') diff --git a/plugins/Variables/Variables_12.vcxproj b/plugins/Variables/Variables_12.vcxproj index f660042168..e8e04a9a2f 100644 --- a/plugins/Variables/Variables_12.vcxproj +++ b/plugins/Variables/Variables_12.vcxproj @@ -91,12 +91,12 @@ ..\..\include\msapi - pcred.lib;pdh.lib;Ws2_32.lib;UxTheme.lib;%(AdditionalDependencies) + pdh.lib;Ws2_32.lib;UxTheme.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib Windows - src\pcre\lib;$(ProfileDir)..\..\bin12\lib + $(ProfileDir)..\..\bin12\lib false @@ -119,14 +119,14 @@ ..\..\include\msapi - pcre.lib;pdh.lib;Ws2_32.lib;UxTheme.lib;%(AdditionalDependencies) + pdh.lib;Ws2_32.lib;UxTheme.lib;%(AdditionalDependencies) true true true false $(IntDir)$(TargetName).lib Windows - src\pcre\lib;$(ProfileDir)..\..\bin12\lib + $(ProfileDir)..\..\bin12\lib @@ -144,14 +144,14 @@ false - pcre.lib;pdh.lib;Ws2_32.lib;UxTheme.lib;%(AdditionalDependencies) + pdh.lib;Ws2_32.lib;UxTheme.lib;%(AdditionalDependencies) true $(IntDir)$(TargetName).lib true true Windows false - src\pcre\lib64;$(ProfileDir)..\..\bin12\lib + $(ProfileDir)..\..\bin12\lib ..\..\include\msapi @@ -171,12 +171,12 @@ false - pcred.lib;pdh.lib;Ws2_32.lib;UxTheme.lib;%(AdditionalDependencies) + pdh.lib;Ws2_32.lib;UxTheme.lib;%(AdditionalDependencies) true $(IntDir)$(TargetName).lib Windows false - src\pcre\lib64;$(ProfileDir)..\..\bin12\lib + $(ProfileDir)..\..\bin12\lib ..\..\include\msapi @@ -234,6 +234,11 @@ + + + {6124e997-426e-4a0b-9617-d6d577d5e7d7} + + diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp index ee191f95fa..0510464c97 100644 --- a/plugins/Variables/src/parse_regexp.cpp +++ b/plugins/Variables/src/parse_regexp.cpp @@ -34,15 +34,12 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) ai->flags = AIF_FALSE; - ptrA arg1(mir_t2a(ai->targv[1])); - ptrA arg2(mir_t2a(ai->targv[2])); - - pcre *ppat = pcre_compile(arg1, 0, &err, &erroffset, NULL); + pcre16 *ppat = pcre16_compile(ai->targv[1], 0, &err, &erroffset, NULL); if (ppat == NULL) return NULL; - pcre_extra *extra = pcre_study(ppat, 0, &err); - int nmat = pcre_exec(ppat, extra, arg2, (int)strlen(arg2), 0, 0, offsets, 99); + pcre16_extra *extra = pcre16_study(ppat, 0, &err); + int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)lstrlen(ai->targv[2]), 0, 0, offsets, 99); if (nmat > 0) { ai->flags &= ~AIF_FALSE; _ltoa(nmat, szVal, 10); @@ -57,36 +54,33 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) */ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) { - const char *err, *substring; + const char *err; + const TCHAR *substring; int erroffset, number; int offsets[99]; if (ai->argc != 4) return NULL; - ptrA arg1(mir_t2a(ai->targv[1])); - ptrA arg2(mir_t2a(ai->targv[2])); - ptrA arg3(mir_t2a(ai->targv[3])); - - number = atoi(arg3); + number = _ttoi(ai->targv[3]); if (number < 0) return NULL; ai->flags = AIF_FALSE; - pcre *ppat = pcre_compile(arg1, 0, &err, &erroffset, NULL); + pcre16 *ppat = pcre16_compile(ai->targv[1], 0, &err, &erroffset, NULL); if (ppat == NULL) return NULL; - pcre_extra *extra = pcre_study(ppat, 0, &err); - int nmat = pcre_exec(ppat, extra, arg2, (int)strlen(arg2), 0, 0, offsets, 99); + pcre16_extra *extra = pcre16_study(ppat, 0, &err); + int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)lstrlen(ai->targv[2]), 0, 0, offsets, 99); if (nmat >= 0) ai->flags &= ~AIF_FALSE; - if (pcre_get_substring(arg2, offsets, nmat, number, &substring) < 0) + if (pcre16_get_substring(ai->targv[2], offsets, nmat, number, &substring) < 0) ai->flags |= AIF_FALSE; else { - TCHAR *tres = mir_a2t(substring); - pcre_free_substring(substring); + TCHAR *tres = mir_tstrdup(substring); + pcre16_free_substring(substring); return tres; } diff --git a/plugins/Variables/src/variables.h b/plugins/Variables/src/variables.h index 8818f1fdc7..6014c0ba55 100644 --- a/plugins/Variables/src/variables.h +++ b/plugins/Variables/src/variables.h @@ -19,7 +19,6 @@ #define _CRT_NON_CONFORMING_SWPRINTFS #define _CRT_SECURE_NO_WARNINGS -#define PCRE_STATIC #include #include @@ -44,13 +43,13 @@ #include #include #include +#include #include -#include #include "..\helpers\gen_helpers.h" -#include "pcre\include\pcre.h" +#include "..\pcre16\src\pcre.h" #include "resource.h" #include "version.h" -- cgit v1.2.3