summaryrefslogtreecommitdiff
path: root/Ivy/IvyBinding.cxx
diff options
context:
space:
mode:
authorfcolin2009-06-18 14:07:58 +0000
committerfcolin2009-06-18 14:07:58 +0000
commitb62585c0d4dec9b1cec86f808b3d8b0eddd0437c (patch)
tree566ae0fd54ccd6119de8117143b558f81742aefc /Ivy/IvyBinding.cxx
parentbab8b091f69679c373e4f8ccfa794cd52419db8f (diff)
downloadivy-cplusplus-b62585c0d4dec9b1cec86f808b3d8b0eddd0437c.zip
ivy-cplusplus-b62585c0d4dec9b1cec86f808b3d8b0eddd0437c.tar.gz
ivy-cplusplus-b62585c0d4dec9b1cec86f808b3d8b0eddd0437c.tar.bz2
ivy-cplusplus-b62585c0d4dec9b1cec86f808b3d8b0eddd0437c.tar.xz
correction bug sur limite d'argument dans une expression reguliere PCRE
Diffstat (limited to 'Ivy/IvyBinding.cxx')
-rw-r--r--Ivy/IvyBinding.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/Ivy/IvyBinding.cxx b/Ivy/IvyBinding.cxx
index c365b71..0a17d4d 100644
--- a/Ivy/IvyBinding.cxx
+++ b/Ivy/IvyBinding.cxx
@@ -39,6 +39,7 @@ IvyBinding::IvyBinding()
#ifdef USE_PCRE
regexp = NULL;
inspect = NULL;
+ ovector = NULL;
#else /* we don't USE_PCRE */
regexp = NULL;
@@ -52,12 +53,15 @@ IvyBinding::~IvyBinding()
pcre_free(inspect);
if (regexp!=NULL)
pcre_free(regexp);
+ if ( ovector != NULL )
+ delete [] ovector;
#else /* we don't USE_PCRE */
delete regexp;
#endif /* USE_PCRE */
}
bool IvyBinding::Compile( const char * expression, int *erroffset, const char **errmessage )
{
+ int capture_count = 0;
bool compile = false;
#ifdef USE_PCRE
regexp = pcre_compile(expression, PCRE_CASELESS, &err_buf, &err_offset, NULL);
@@ -68,6 +72,12 @@ bool IvyBinding::Compile( const char * expression, int *erroffset, const char *
{
printf("Error studying %s, message: %s\n",expression,err_buf);
}
+ pcre_fullinfo( regexp, inspect, PCRE_INFO_CAPTURECOUNT, &capture_count );
+ if ( ovector != NULL )
+ delete [] ovector;
+ // + 1 pour la capture totale
+ ovectorsize = (capture_count+1) * 3;
+ ovector = new int[ovectorsize];
compile = true;
}
else
@@ -106,7 +116,7 @@ int IvyBinding::Exec( const char * message )
0, /* debut */
0, /* no other regexp option */
ovector,
- OVECSIZE);
+ ovectorsize);
if (nb_match<1) return 0; /* no match */
#else /* we don't USE_PCRE */
if ( !regexp->Match( message ) )