[Pcre-svn] [483] code/trunk: Fix some discrepancies between …

Página Inicial
Delete this message
Autor: Subversion repository
Data:  
Para: pcre-svn
Assunto: [Pcre-svn] [483] code/trunk: Fix some discrepancies between "USPTR" and " unsigned char *".
Revision: 483
          http://vcs.pcre.org/viewvc?view=rev&revision=483
Author:   ph10
Date:     2010-01-04 16:19:17 +0000 (Mon, 04 Jan 2010)


Log Message:
-----------
Fix some discrepancies between "USPTR" and "unsigned char *".

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c
    code/trunk/pcre_internal.h


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2010-01-04 15:55:46 UTC (rev 482)
+++ code/trunk/ChangeLog    2010-01-04 16:19:17 UTC (rev 483)
@@ -90,7 +90,19 @@
     used.


 14. Change 8.00/11 was not quite complete: code had been accidentally omitted,
-    causing partial matching to fail where the end of the subject matched \W.
+    causing partial matching to fail when the end of the subject matched \W
+    in a UTF-8 pattern where \W was quantified with a minimum of 3.
+    
+15. There were some discrepancies between the declarations in pcre_internal.h
+    of _pcre_is_newline(), _pcre_was_newline(), and _pcre_valid_utf8() and 
+    their definitions. The declarations used "const uschar *" and the
+    definitions used USPTR. Even though USPTR is normally defined as "const
+    unsigned char *" (and uschar is typedeffed as "unsigned char"), it was
+    reported that: "This difference in casting confuses some C++ compilers, for
+    example, SunCC recognizes above declarations as different functions and
+    generates broken code for hbpcre." I have changed the declarations to use 
+    USPTR.
+        





Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2010-01-04 15:55:46 UTC (rev 482)
+++ code/trunk/pcre_compile.c    2010-01-04 16:19:17 UTC (rev 483)
@@ -6449,7 +6449,7 @@


 #ifdef SUPPORT_UTF8
 if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0 &&
-     (*erroroffset = _pcre_valid_utf8((uschar *)pattern, -1)) >= 0)
+     (*erroroffset = _pcre_valid_utf8((USPTR)pattern, -1)) >= 0)
   {
   errorcode = ERR44;
   goto PCRE_EARLY_ERROR_RETURN2;


Modified: code/trunk/pcre_internal.h
===================================================================
--- code/trunk/pcre_internal.h    2010-01-04 15:55:46 UTC (rev 482)
+++ code/trunk/pcre_internal.h    2010-01-04 16:19:17 UTC (rev 483)
@@ -1753,14 +1753,12 @@
 sense, but are not part of the PCRE public API. */


 extern const uschar *_pcre_find_bracket(const uschar *, BOOL, int);
-extern BOOL          _pcre_is_newline(const uschar *, int, const uschar *,
-                       int *, BOOL);
+extern BOOL          _pcre_is_newline(USPTR, int, USPTR, int *, BOOL);
 extern int           _pcre_ord2utf8(int, uschar *);
 extern real_pcre    *_pcre_try_flipped(const real_pcre *, real_pcre *,
                        const pcre_study_data *, pcre_study_data *);
-extern int           _pcre_valid_utf8(const uschar *, int);
-extern BOOL          _pcre_was_newline(const uschar *, int, const uschar *,
-                       int *, BOOL);
+extern int           _pcre_valid_utf8(USPTR, int);
+extern BOOL          _pcre_was_newline(USPTR, int, USPTR, int *, BOOL);
 extern BOOL          _pcre_xclass(int, const uschar *);