11
11
#define MAXNORMLEN 256
12
12
13
13
#define STRNCASECMP (x ,y )pg_strncasecmp(x, y, strlen(y))
14
- #define GETWCHAR (W ,L ,N ,T ) ( ((uint8*)(W))[ ((T)=='p' ) ? (N) : ( (L) - 1 - (N) ) ] )
14
+ #define GETWCHAR (W ,L ,N ,T ) ( ((uint8*)(W))[ ((T)==FF_PREFIX ) ? (N) : ( (L) - 1 - (N) ) ] )
15
15
#define GETCHAR (A ,N ,T ) GETWCHAR( (A)->repl, (A)->replen, N, T )
16
16
17
17
@@ -103,7 +103,7 @@ cmpaffix(const void *s1, const void *s2)
103
103
return -1 ;
104
104
if (((const AFFIX * )s1 )-> type > ((const AFFIX * )s2 )-> type )
105
105
return 1 ;
106
- if (((const AFFIX * )s1 )-> type == 'p' )
106
+ if (((const AFFIX * )s1 )-> type == FF_PREFIX )
107
107
return (strcmp (((const AFFIX * )s1 )-> repl , ((const AFFIX * )s2 )-> repl ));
108
108
else
109
109
return (strbcmp (((const AFFIX * )s1 )-> repl , ((const AFFIX * )s2 )-> repl ));
@@ -620,7 +620,7 @@ NISortAffixes(IspellDict * Conf)
620
620
621
621
for (i = 0 ;i < Conf -> naffixes ;i ++ ) {
622
622
Affix = & (((AFFIX * )Conf -> Affix )[i ]);
623
- if (Affix -> type == 's' ) {
623
+ if (Affix -> type == FF_SUFFIX ) {
624
624
if (firstsuffix < 0 )firstsuffix = i ;
625
625
if (Affix -> flagflags & FF_COMPOUNDONLYAFX ) {
626
626
if ( !ptr -> affix || strbncmp ((ptr - 1 )-> affix ,Affix -> repl , (ptr - 1 )-> len ) ) {
@@ -635,8 +635,8 @@ NISortAffixes(IspellDict * Conf)
635
635
ptr -> affix = NULL ;
636
636
Conf -> CompoundAffix = (CMPDAffix * )realloc (Conf -> CompoundAffix ,sizeof (CMPDAffix )* (ptr - Conf -> CompoundAffix + 1 ) );
637
637
638
- Conf -> Prefix = mkANode (Conf ,0 ,firstsuffix ,0 ,'p' );
639
- Conf -> Suffix = mkANode (Conf ,firstsuffix ,Conf -> naffixes ,0 ,'s' );
638
+ Conf -> Prefix = mkANode (Conf ,0 ,firstsuffix ,0 ,FF_PREFIX );
639
+ Conf -> Suffix = mkANode (Conf ,firstsuffix ,Conf -> naffixes ,0 ,FF_SUFFIX );
640
640
mkVoidAffix (Conf ,1 ,firstsuffix );
641
641
mkVoidAffix (Conf ,0 ,firstsuffix );
642
642
}
@@ -773,7 +773,7 @@ NormalizeSubWord(IspellDict * Conf, char *word, char flag) {
773
773
pnode = Conf -> Prefix ;
774
774
plevel = 0 ;
775
775
while (pnode ) {
776
- prefix = FinfAffixes (pnode ,word ,wrdlen ,& plevel ,'p' );
776
+ prefix = FinfAffixes (pnode ,word ,wrdlen ,& plevel ,FF_PREFIX );
777
777
if (!prefix )break ;
778
778
for (j = 0 ;j < prefix -> naff ;j ++ ) {
779
779
if (CheckAffix (word ,wrdlen ,prefix -> aff [j ],flag ,newword ) ) {
@@ -792,7 +792,7 @@ NormalizeSubWord(IspellDict * Conf, char *word, char flag) {
792
792
/* Find all other NORMAL forms of the 'word' (check suffix and then prefix)*/
793
793
while (snode ) {
794
794
/* find possible suffix */
795
- suffix = FinfAffixes (snode ,word ,wrdlen ,& slevel ,'s' );
795
+ suffix = FinfAffixes (snode ,word ,wrdlen ,& slevel ,FF_SUFFIX );
796
796
if (!suffix )break ;
797
797
/* foreach suffix check affix */
798
798
for (i = 0 ;i < suffix -> naff ;i ++ ) {
@@ -809,7 +809,7 @@ NormalizeSubWord(IspellDict * Conf, char *word, char flag) {
809
809
plevel = 0 ;
810
810
swrdlen = strlen (newword );
811
811
while (pnode ) {
812
- prefix = FinfAffixes (pnode ,newword ,swrdlen ,& plevel ,'p' );
812
+ prefix = FinfAffixes (pnode ,newword ,swrdlen ,& plevel ,FF_PREFIX );
813
813
if (!prefix )break ;
814
814
for (j = 0 ;j < prefix -> naff ;j ++ ) {
815
815
if (CheckAffix (newword ,swrdlen ,prefix -> aff [j ],flag ,pnewword ) ) {
@@ -894,7 +894,7 @@ SplitToVariants( IspellDict * Conf, SPNode *snode, SplitVar * orig, char *word,
894
894
StopLow = node -> data ;
895
895
StopHigh = node -> data + node -> length ;
896
896
while (StopLow < StopHigh ) {
897
- StopMiddle = StopLow + (StopHigh - StopLow )/ 2 ;
897
+ StopMiddle = StopLow + (( StopHigh - StopLow )>> 1 ) ;
898
898
if (StopMiddle -> val == ((uint8 * )(word ))[level ] ) {
899
899
break ;
900
900
}else if (StopMiddle -> val < ((uint8 * )(word ))[level ] ) {