summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-12-22 23:10:09 +0000
committerzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-12-22 23:10:09 +0000
commit92e93d45947095ebc17389b5705a9dfbc38499e0 (patch)
treed0cf2425770725def5a9b5ccd68ec36bd7ce9ec6
parent1e69e6b9e3629c2e915018d288aa08671c3648f7 (diff)
downloadpcre-92e93d45947095ebc17389b5705a9dfbc38499e0.tar.gz
dfa and other 16 bit fixes
git-svn-id: svn://vcs.exim.org/pcre/code/branches/pcre16@819 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--pcre_compile.c2
-rw-r--r--pcre_dfa_exec.c8
-rw-r--r--pcre_jit_compile.c2
-rw-r--r--pcretest.c29
4 files changed, 31 insertions, 10 deletions
diff --git a/pcre_compile.c b/pcre_compile.c
index 74ae41d..3dfce13 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -685,7 +685,7 @@ if (cd->workspace_size >= COMPILE_WORK_SIZE_MAX ||
newsize - cd->workspace_size < WORK_SIZE_SAFETY_MARGIN)
return ERR72;
-newspace = (PUBL(malloc))(newsize * sizeof(pcre_uchar));
+newspace = (PUBL(malloc))(IN_UCHARS(newsize));
if (newspace == NULL) return ERR21;
memcpy(newspace, cd->start_workspace, cd->workspace_size * sizeof(pcre_uchar));
cd->hwm = (pcre_uchar *)newspace + (cd->hwm - cd->start_workspace);
diff --git a/pcre_dfa_exec.c b/pcre_dfa_exec.c
index 6356e46..970d55c 100644
--- a/pcre_dfa_exec.c
+++ b/pcre_dfa_exec.c
@@ -2433,7 +2433,7 @@ for (;;)
if (clen > 0)
{
isinclass = (c > 255)? (codevalue == OP_NCLASS) :
- ((code[1 + c/8] & (1 << (c&7))) != 0);
+ ((((pcre_uint8 *)(code + 1))[c/8] & (1 << (c&7))) != 0);
}
}
@@ -2481,7 +2481,7 @@ for (;;)
{ ADD_ACTIVE(next_state_offset + 1 + 2 * IMM2_SIZE, 0); }
if (isinclass)
{
- int max = GET2(ecode, 3);
+ int max = GET2(ecode, 1 + IMM2_SIZE);
if (++count >= max && max != 0) /* Max 0 => no limit */
{ ADD_NEW(next_state_offset + 1 + 2 * IMM2_SIZE, 0); }
else
@@ -2591,10 +2591,10 @@ for (;;)
else if (condcode == OP_RREF || condcode == OP_NRREF)
{
- int value = GET2(code, LINK_SIZE+2);
+ int value = GET2(code, LINK_SIZE + 2);
if (value != RREF_ANY) return PCRE_ERROR_DFA_UCOND;
if (md->recursive != NULL)
- { ADD_ACTIVE(state_offset + LINK_SIZE + 4, 0); }
+ { ADD_ACTIVE(state_offset + LINK_SIZE + 2 + IMM2_SIZE, 0); }
else { ADD_ACTIVE(state_offset + codelink + LINK_SIZE + 1, 0); }
}
diff --git a/pcre_jit_compile.c b/pcre_jit_compile.c
index 2543fef..5a37c6e 100644
--- a/pcre_jit_compile.c
+++ b/pcre_jit_compile.c
@@ -6409,7 +6409,7 @@ else
}
common->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
common->ctypes = (sljit_w)(tables + ctypes_offset);
-common->name_table = (sljit_w)re + re->name_table_offset;
+common->name_table = (sljit_w)((pcre_uchar *)re + re->name_table_offset);
common->name_count = re->name_count;
common->name_entry_size = re->name_entry_size;
common->acceptlabel = NULL;
diff --git a/pcretest.c b/pcretest.c
index c85ef35..8dfff5d 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -3076,10 +3076,21 @@ while (!done)
options = 0;
+#if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16
+ if (use_pcre16)
+ {
+ *(PCRE_SCHAR16 *)copynames = 0;
+ *(PCRE_SCHAR16 *)getnames = 0;
+ }
+ else
+ {
+ *copynames = 0;
+ *getnames = 0;
+ }
+#else
*copynames = 0;
- copynames[1] = 0;
*getnames = 0;
- getnames[1] = 0;
+#endif
copynamesptr = copynames;
getnamesptr = getnames;
@@ -3928,8 +3939,18 @@ while (!done)
(obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANYCRLF)
&&
start_offset < len - 1 &&
- bptr[start_offset * CHAR_SIZE] == '\r' &&
- bptr[(start_offset + 1) * CHAR_SIZE] == '\n')
+#if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16
+ (use_pcre16?
+ ((PCRE_SPTR16)bptr)[start_offset] == '\r'
+ && ((PCRE_SPTR16)bptr)[start_offset + 1] == '\n'
+ :
+ bptr[start_offset] == '\r'
+ && bptr[start_offset + 1] == '\n')
+#else
+ bptr[start_offset] == '\r' &&
+ bptr[start_offset + 1] == '\n'
+#endif
+ )
onechar++;
else if (use_utf)
{