/[pcre]/code/trunk/pcreposix.c
ViewVC logotype

Diff of /code/trunk/pcreposix.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 521 by ph10, Sat May 22 19:03:35 2010 UTC revision 836 by ph10, Wed Dec 28 17:16:11 2011 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2010 University of Cambridge             Copyright (c) 1997-2012 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 57  previously been set. */ Line 57  previously been set. */
57  #  define PCREPOSIX_EXP_DEFN __declspec(dllexport)  #  define PCREPOSIX_EXP_DEFN __declspec(dllexport)
58  #endif  #endif
59    
60    /* We include pcre.h before pcre_internal.h so that the PCRE library functions
61    are declared as "import" for Windows by defining PCRE_EXP_DECL as "import".
62    This is needed even though pcre_internal.h itself includes pcre.h, because it
63    does so after it has set PCRE_EXP_DECL to "export" if it is not already set. */
64    
65    #include "pcre.h"
66  #include "pcre_internal.h"  #include "pcre_internal.h"
67  #include "pcreposix.h"  #include "pcreposix.h"
68    
# Line 145  static const int eint[] = { Line 151  static const int eint[] = {
151    REG_BADPAT,  /* different names for subpatterns of the same number are not allowed */    REG_BADPAT,  /* different names for subpatterns of the same number are not allowed */
152    REG_BADPAT,  /* (*MARK) must have an argument */    REG_BADPAT,  /* (*MARK) must have an argument */
153    REG_INVARG,  /* this version of PCRE is not compiled with PCRE_UCP support */    REG_INVARG,  /* this version of PCRE is not compiled with PCRE_UCP support */
154      REG_BADPAT,  /* \c must be followed by an ASCII character */
155      REG_BADPAT,  /* \k is not followed by a braced, angle-bracketed, or quoted name */
156      /* 70 */
157      REG_BADPAT,  /* internal error: unknown opcode in find_fixedlength() */
158      REG_BADPAT,  /* \N is not supported in a class */
159      REG_BADPAT,  /* too many forward references */
160      REG_BADPAT,  /* disallowed UTF-8/16 code point (>= 0xd800 && <= 0xdfff) */
161  };  };
162    
163  /* Table of texts corresponding to POSIX error codes */  /* Table of texts corresponding to POSIX error codes */
# Line 215  return length + addlength; Line 228  return length + addlength;
228  PCREPOSIX_EXP_DEFN void PCRE_CALL_CONVENTION  PCREPOSIX_EXP_DEFN void PCRE_CALL_CONVENTION
229  regfree(regex_t *preg)  regfree(regex_t *preg)
230  {  {
231  (pcre_free)(preg->re_pcre);  (PUBL(free))(preg->re_pcre);
232  }  }
233    
234    
# Line 264  if (preg->re_pcre == NULL) Line 277  if (preg->re_pcre == NULL)
277      eint[errorcode] : REG_BADPAT;      eint[errorcode] : REG_BADPAT;
278    }    }
279    
280  preg->re_nsub = pcre_info((const pcre *)preg->re_pcre, NULL, NULL);  (void)pcre_fullinfo((const pcre *)preg->re_pcre, NULL, PCRE_INFO_CAPTURECOUNT,
281      &(preg->re_nsub));
282  return 0;  return 0;
283  }  }
284    
# Line 338  if ((eflags & REG_STARTEND) != 0) Line 352  if ((eflags & REG_STARTEND) != 0)
352  else  else
353    {    {
354    so = 0;    so = 0;
355    eo = strlen(string);    eo = (int)strlen(string);
356    }    }
357    
358  rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string + so, (eo - so),  rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string + so, (eo - so),
359    0, options, ovector, nmatch * 3);    0, options, ovector, (int)(nmatch * 3));
360    
361  if (rc == 0) rc = nmatch;    /* All captured slots were filled in */  if (rc == 0) rc = (int)nmatch;    /* All captured slots were filled in */
362    
363  /* Successful match */  /* Successful match */
364    
# Line 390  switch(rc) Line 404  switch(rc)
404    case PCRE_ERROR_MATCHLIMIT: return REG_ESPACE;    case PCRE_ERROR_MATCHLIMIT: return REG_ESPACE;
405    case PCRE_ERROR_BADUTF8: return REG_INVARG;    case PCRE_ERROR_BADUTF8: return REG_INVARG;
406    case PCRE_ERROR_BADUTF8_OFFSET: return REG_INVARG;    case PCRE_ERROR_BADUTF8_OFFSET: return REG_INVARG;
407      case PCRE_ERROR_BADMODE: return REG_INVARG;
408    default: return REG_ASSERT;    default: return REG_ASSERT;
409    }    }
410  }  }

Legend:
Removed from v.521  
changed lines
  Added in v.836

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12