summaryrefslogtreecommitdiff
path: root/pcre_newline.c
diff options
context:
space:
mode:
authorzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-12-05 20:12:24 +0000
committerzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-12-05 20:12:24 +0000
commita9839b968cee5828bf35dbcb05a31859a49ab7a2 (patch)
tree836125e6c0ea7958e295ccda9f7d060b05102430 /pcre_newline.c
parent216818740b54b629e7bd59cd49f783c72e244e23 (diff)
downloadpcre-a9839b968cee5828bf35dbcb05a31859a49ab7a2.tar.gz
Improving UTF-16 support by fixing a lot of issues.
git-svn-id: svn://vcs.exim.org/pcre/code/branches/pcre16@785 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_newline.c')
-rw-r--r--pcre_newline.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/pcre_newline.c b/pcre_newline.c
index 0c2ddcd..d618b80 100644
--- a/pcre_newline.c
+++ b/pcre_newline.c
@@ -77,7 +77,15 @@ PRIV(is_newline)(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR endptr, int *lenptr,
BOOL utf)
{
int c;
-if (utf) { GETCHAR(c, ptr); } else c = *ptr;
+(void)utf;
+#ifdef SUPPORT_UTF
+if (utf)
+ {
+ GETCHAR(c, ptr);
+ }
+else
+#endif /* SUPPORT_UTF8 */
+ c = *ptr;
if (type == NLTYPE_ANYCRLF) switch(c)
{
@@ -96,9 +104,15 @@ else switch(c)
case 0x000c: *lenptr = 1; return TRUE; /* FF */
case 0x000d: *lenptr = (ptr < endptr - 1 && ptr[1] == 0x0a)? 2 : 1;
return TRUE; /* CR */
+#ifdef COMPILE_PCRE8
case 0x0085: *lenptr = utf? 2 : 1; return TRUE; /* NEL */
case 0x2028: /* LS */
case 0x2029: *lenptr = 3; return TRUE; /* PS */
+#else
+ case 0x0085: /* NEL */
+ case 0x2028: /* LS */
+ case 0x2029: *lenptr = 1; return TRUE; /* PS */
+#endif /* COMPILE_PCRE8 */
default: return FALSE;
}
}
@@ -127,17 +141,17 @@ PRIV(was_newline)(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR startptr, int *lenptr,
BOOL utf)
{
int c;
+(void)utf;
ptr--;
-#ifdef SUPPORT_UTF8
+#ifdef SUPPORT_UTF
if (utf)
{
BACKCHAR(ptr);
GETCHAR(c, ptr);
}
-else c = *ptr;
-#else /* no UTF-8 support */
-c = *ptr;
+else
#endif /* SUPPORT_UTF8 */
+ c = *ptr;
if (type == NLTYPE_ANYCRLF) switch(c)
{
@@ -154,9 +168,15 @@ else switch(c)
case 0x000b: /* VT */
case 0x000c: /* FF */
case 0x000d: *lenptr = 1; return TRUE; /* CR */
+#ifdef COMPILE_PCRE8
case 0x0085: *lenptr = utf? 2 : 1; return TRUE; /* NEL */
case 0x2028: /* LS */
case 0x2029: *lenptr = 3; return TRUE; /* PS */
+#else
+ case 0x0085: /* NEL */
+ case 0x2028: /* LS */
+ case 0x2029: *lenptr = 1; return TRUE; /* PS */
+#endif /* COMPILE_PCRE8 */
default: return FALSE;
}
}