Fix problem when compiling without Unicode support.
This commit is contained in:
parent
940627c83a
commit
a6237da13e
|
@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
|
||||||
|
|
||||||
Written by Philip Hazel
|
Written by Philip Hazel
|
||||||
Original API code Copyright (c) 1997-2012 University of Cambridge
|
Original API code Copyright (c) 1997-2012 University of Cambridge
|
||||||
New API code Copyright (c) 2016-2017 University of Cambridge
|
New API code Copyright (c) 2016-2018 University of Cambridge
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -40,7 +40,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
/* This module contains an internal function that is used to match a Unicode
|
/* This module contains an internal function that is used to match a Unicode
|
||||||
extended grapheme sequence. It is used by both pcre2_match() and
|
extended grapheme sequence. It is used by both pcre2_match() and
|
||||||
pcre2_def_match(). */
|
pcre2_def_match(). However, it is called only when Unicode support is being
|
||||||
|
compiled. Nevertheless, we provide a dummy function when there is no Unicode
|
||||||
|
support, because some compilers do not like functionless source files. */
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
|
@ -50,19 +52,38 @@ pcre2_def_match(). */
|
||||||
|
|
||||||
#include "pcre2_internal.h"
|
#include "pcre2_internal.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Dummy function */
|
||||||
|
|
||||||
|
#ifndef SUPPORT_UNICODE
|
||||||
|
PCRE2_SPTR
|
||||||
|
PRIV(extuni)(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR start_subject,
|
||||||
|
PCRE2_SPTR end_subject, BOOL utf, int *xcount)
|
||||||
|
{
|
||||||
|
(void)c;
|
||||||
|
(void)eptr;
|
||||||
|
(void)start_subject;
|
||||||
|
(void)end_subject;
|
||||||
|
(void)utf;
|
||||||
|
(void)xcount;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
* Match an extended grapheme sequence *
|
* Match an extended grapheme sequence *
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Arguments:
|
Arguments:
|
||||||
c the first character
|
c the first character
|
||||||
eptr pointer to next character
|
eptr pointer to next character
|
||||||
start_subject pointer to start of subject
|
start_subject pointer to start of subject
|
||||||
end_subject pointer to end of subject
|
end_subject pointer to end of subject
|
||||||
utf TRUE if in UTF mode
|
utf TRUE if in UTF mode
|
||||||
xcount pointer to count of additional characters,
|
xcount pointer to count of additional characters,
|
||||||
or NULL if count not needed
|
or NULL if count not needed
|
||||||
|
|
||||||
Returns: pointer after the end of the sequence
|
Returns: pointer after the end of the sequence
|
||||||
*/
|
*/
|
||||||
|
@ -75,7 +96,7 @@ int lgb = UCD_GRAPHBREAK(c);
|
||||||
|
|
||||||
while (eptr < end_subject)
|
while (eptr < end_subject)
|
||||||
{
|
{
|
||||||
int rgb;
|
int rgb;
|
||||||
int len = 1;
|
int len = 1;
|
||||||
if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
|
if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
|
||||||
rgb = UCD_GRAPHBREAK(c);
|
rgb = UCD_GRAPHBREAK(c);
|
||||||
|
@ -88,23 +109,19 @@ while (eptr < end_subject)
|
||||||
{
|
{
|
||||||
int ricount = 0;
|
int ricount = 0;
|
||||||
PCRE2_SPTR bptr = eptr - 1;
|
PCRE2_SPTR bptr = eptr - 1;
|
||||||
#ifdef SUPPORT_UNICODE
|
|
||||||
if (utf) BACKCHAR(bptr);
|
if (utf) BACKCHAR(bptr);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* bptr is pointing to the left-hand character */
|
/* bptr is pointing to the left-hand character */
|
||||||
|
|
||||||
while (bptr > start_subject)
|
while (bptr > start_subject)
|
||||||
{
|
{
|
||||||
bptr--;
|
bptr--;
|
||||||
#ifdef SUPPORT_UNICODE
|
|
||||||
if (utf)
|
if (utf)
|
||||||
{
|
{
|
||||||
BACKCHAR(bptr);
|
BACKCHAR(bptr);
|
||||||
GETCHAR(c, bptr);
|
GETCHAR(c, bptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
c = *bptr;
|
c = *bptr;
|
||||||
if (UCD_GRAPHBREAK(c) != ucp_gbRegionalIndicator) break;
|
if (UCD_GRAPHBREAK(c) != ucp_gbRegionalIndicator) break;
|
||||||
ricount++;
|
ricount++;
|
||||||
|
@ -120,10 +137,12 @@ while (eptr < end_subject)
|
||||||
lgb = rgb;
|
lgb = rgb;
|
||||||
|
|
||||||
eptr += len;
|
eptr += len;
|
||||||
if (xcount != NULL) *xcount += 1;
|
if (xcount != NULL) *xcount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return eptr;
|
return eptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* SUPPORT_UNICODE */
|
||||||
|
|
||||||
/* End of pcre2_extuni.c */
|
/* End of pcre2_extuni.c */
|
||||||
|
|
Loading…
Reference in New Issue