Split update_action_bits() into
[privoxy.git] / pcrs.h
diff --git a/pcrs.h b/pcrs.h
index a14b816..a99293f 100644 (file)
--- a/pcrs.h
+++ b/pcrs.h
  *
  * Revisions   :
  *    $Log: pcrs.h,v $
+ *    Revision 1.14  2006/12/24 17:27:37  fabiankeil
+ *    Increase pcrs error code offset to prevent overlaps
+ *    with pcre versions newer than our own.
+ *
+ *    Revision 1.13  2006/07/18 14:48:47  david__schmidt
+ *    Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
+ *    with what was really the latest development (the v_3_0_branch branch)
+ *
+ *    Revision 1.11  2002/03/08 14:18:23  oes
+ *    Fixing -Wconversion warnings
+ *
  *    Revision 1.10  2002/03/08 13:44:48  oes
  *    Hiding internal functions, preventing double inclusion of pcre.h
  *
@@ -59,7 +70,7 @@
  *
  *********************************************************************/
 
-#define PCRS_H_VERSION "$Id: pcrs.h,v 1.10 2002/03/08 13:44:48 oes Exp $"
+#define PCRS_H_VERSION "$Id: pcrs.h,v 1.14 2006/12/24 17:27:37 fabiankeil Exp $"
 \f
 
 #ifndef _PCRE_H
@@ -82,12 +93,20 @@ extern "C" {
 #define PCRS_MAX_MATCH_INIT  40     /* Initial amount of matches that can be stored in global searches */
 #define PCRS_MAX_MATCH_GROW  1.6    /* Factor by which storage for matches is extended if exhausted */
 
-/* Error codes */
-#define PCRS_ERR_NOMEM     -10      /* Failed to acquire memory. */
-#define PCRS_ERR_CMDSYNTAX -11      /* Syntax of s///-command */
-#define PCRS_ERR_STUDY     -12      /* pcre error while studying the pattern */
-#define PCRS_ERR_BADJOB    -13      /* NULL job pointer, pattern or substitute */
-#define PCRS_WARN_BADREF   -14      /* Backreference out of range */
+/*
+ * PCRS error codes
+ *
+ * They are supposed to be handled together with PCRE error
+ * codes and have to start with an offset to prevent overlaps.
+ *
+ * PCRE 6.7 uses error codes from -1 to -21, PCRS error codes
+ * below -100 should be safe for a while.
+ */
+#define PCRS_ERR_NOMEM     -100      /* Failed to acquire memory. */
+#define PCRS_ERR_CMDSYNTAX -101      /* Syntax of s///-command */
+#define PCRS_ERR_STUDY     -102      /* pcre error while studying the pattern */
+#define PCRS_ERR_BADJOB    -103      /* NULL job pointer, pattern or substitute */
+#define PCRS_WARN_BADREF   -104      /* Backreference out of range */
 
 /* Flags */
 #define PCRS_GLOBAL          1      /* Job should be applied globally, as with perl's g option */
@@ -103,6 +122,7 @@ extern "C" {
 
 typedef struct {
   char  *text;                                   /* The plaintext part of the substitute, with all backreferences stripped */
+  size_t length;                                 /* The substitute may not be a valid C string so we can't rely on strlen(). */
   int    backrefs;                               /* The number of backreferences */
   int    block_offset[PCRS_MAX_SUBMATCHES];      /* Array with the offsets of all plaintext blocks in text */
   size_t block_length[PCRS_MAX_SUBMATCHES];      /* Array with the lengths of all plaintext blocks in text */