summaryrefslogtreecommitdiff
blob: 54036d6e01c7da978f18d35965fa2580b29b9319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Fix for pcre-8.30 and above

--- src/main/util.c.orig	2012-02-09 17:15:08.000000000 +0000
+++ src/main/util.c	2012-02-09 17:20:31.000000000 +0000
@@ -1257,8 +1257,18 @@
 }
 
 #include "pcre.h"
+
+/* This changed at 8.30 */
+#if  PCRE_MAJOR > 8 || PCRE_MINOR >= 30
+extern int _pcre_valid_utf(const char *string, int length, int *erroroffset);
+
+Rboolean utf8Valid(const char *str)
+{
+    int errp;
+    return  (_pcre_valid_utf(str, (int) strlen(str), &errp) == 0);
+}
 /* This changed at 8.13: we don't allow < 8.0 */
-#if  PCRE_MAJOR > 8 || PCRE_MINOR >= 13
+#elif  PCRE_MAJOR > 8 || PCRE_MINOR >= 13
 extern int _pcre_valid_utf8(const char *string, int length, int *erroroffset);
 
 Rboolean utf8Valid(const char *str)
@@ -1266,7 +1276,7 @@
     int errp;
     return  (_pcre_valid_utf8(str, (int) strlen(str), &errp) == 0);
 }
-#else
+#else 
 extern int _pcre_valid_utf8(const char *string, int length);
 
 Rboolean utf8Valid(const char *str)