--- code/trunk/pcreposix.c 2007/02/24 21:38:09 7 +++ code/trunk/pcreposix.c 2007/02/24 21:38:49 27 @@ -12,7 +12,7 @@ Written by: Philip Hazel - Copyright (c) 1997 University of Cambridge + Copyright (c) 1997-1999 University of Cambridge ----------------------------------------------------------------------------- Permission is granted to anyone to use this software for any purpose on any @@ -42,7 +42,7 @@ static const char *estring[] = { ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9, ERR10, ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, ERR20, - ERR21, ERR22, ERR23 }; + ERR21, ERR22, ERR23, ERR24, ERR25 }; static int eint[] = { REG_EESCAPE, /* "\\ at end of pattern" */ @@ -67,7 +67,12 @@ REG_ESIZE, /* "regular expression too large" */ REG_ESPACE, /* "failed to get memory" */ REG_EPAREN, /* "unmatched brackets" */ - REG_ASSERT /* "internal error: code overflow" */ + REG_ASSERT, /* "internal error: code overflow" */ + REG_BADPAT, /* "unrecognized character after (?<" */ + REG_BADPAT, /* "lookbehind assertion is not fixed length" */ + REG_BADPAT, /* "malformed number after (?(" */ + REG_BADPAT, /* "conditional group containe more than two branches" */ + REG_BADPAT /* "assertion expected after (?(" */ }; /* Table of texts corresponding to POSIX error codes */ @@ -135,7 +140,7 @@ if (errbuf_size > 0) { if (addlength > 0 && errbuf_size >= length + addlength) - sprintf(errbuf, "%s%s%-6d", message, addmessage, preg->re_erroffset); + sprintf(errbuf, "%s%s%-6d", message, addmessage, (int)preg->re_erroffset); else { strncpy(errbuf, message, errbuf_size - 1); @@ -186,7 +191,7 @@ if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS; if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE; -preg->re_pcre = pcre_compile(pattern, options, &errorptr, &erroffset); +preg->re_pcre = pcre_compile(pattern, options, &errorptr, &erroffset, NULL); preg->re_erroffset = erroffset; if (preg->re_pcre == NULL) return pcre_posix_error_code(errorptr); @@ -212,7 +217,7 @@ if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL; if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL; -preg->re_erroffset = -1; /* Only has meaning after compile */ +preg->re_erroffset = (size_t)(-1); /* Only has meaning after compile */ rc = pcre_exec(preg->re_pcre, NULL, string, (int)strlen(string), options, (int *)pmatch, nmatch * 2); @@ -229,7 +234,6 @@ else switch(rc) { case PCRE_ERROR_NOMATCH: return REG_NOMATCH; - case PCRE_ERROR_BADREF: return REG_ESUBREG; case PCRE_ERROR_NULL: return REG_INVARG; case PCRE_ERROR_BADOPTION: return REG_INVARG; case PCRE_ERROR_BADMAGIC: return REG_INVARG;