Attachment #508009: Patch from comment #37 for bug #626195

View | Details | Raw Unified | Return to bug 626195
Collapse All | Expand All

(-)a/extensions/spellcheck/hunspell/src/affixmgr.cpp (-4 / +8 lines)
Line     Link Here 
 Lines 2471-2488   struct hentry * AffixMgr::suffix_check ( Link Here 
2471
                if (rv) {
2471
                if (rv) {
2472
                    sfx=se; // BUG: sfx not stateless
2472
                    sfx=se; // BUG: sfx not stateless
2473
                    return rv;
2473
                    return rv;
2474
                }
2474
                }
2475
            }
2475
            }
2476
        }
2476
        }
2477
       se = se->getNext();
2477
       se = se->getNext();
2478
    }
2478
    }
2479
  
2479
2480
    // now handle the general case
2480
    // now handle the general case
2481
    if (len == 0) return NULL; // FULLSTRIP
2481
    unsigned char sp = *((const unsigned char *)(word + len - 1));
2482
    unsigned char sp = *((const unsigned char *)(word + len - 1));
2482
    SfxEntry * sptr = sStart[sp];
2483
    SfxEntry * sptr = sStart[sp];
2483
2484
2484
    while (sptr) {
2485
    while (sptr) {
2485
        if (isRevSubset(sptr->getKey(), word + len - 1, len)
2486
        if (isRevSubset(sptr->getKey(), word + len - 1, len)
2486
        ) {
2487
        ) {
2487
            // suffixes are not allowed in beginning of compounds
2488
            // suffixes are not allowed in beginning of compounds
2488
            if ((((in_compound != IN_CPD_BEGIN)) || // && !cclass
2489
            if ((((in_compound != IN_CPD_BEGIN)) || // && !cclass
 Lines 2538-2555   struct hentry * AffixMgr::suffix_check_t Link Here 
2538
    while (se) {
2539
    while (se) {
2539
        if (contclasses[se->getFlag()])
2540
        if (contclasses[se->getFlag()])
2540
        {
2541
        {
2541
            rv = se->check_twosfx(word,len, sfxopts, ppfx, needflag);
2542
            rv = se->check_twosfx(word,len, sfxopts, ppfx, needflag);
2542
            if (rv) return rv;
2543
            if (rv) return rv;
2543
        }
2544
        }
2544
        se = se->getNext();
2545
        se = se->getNext();
2545
    }
2546
    }
2546
  
2547
2547
    // now handle the general case
2548
    // now handle the general case
2549
    if (len == 0) return NULL; // FULLSTRIP
2548
    unsigned char sp = *((const unsigned char *)(word + len - 1));
2550
    unsigned char sp = *((const unsigned char *)(word + len - 1));
2549
    SfxEntry * sptr = sStart[sp];
2551
    SfxEntry * sptr = sStart[sp];
2550
2552
2551
    while (sptr) {
2553
    while (sptr) {
2552
        if (isRevSubset(sptr->getKey(), word + len - 1, len)) {
2554
        if (isRevSubset(sptr->getKey(), word + len - 1, len)) {
2553
            if (contclasses[sptr->getFlag()])
2555
            if (contclasses[sptr->getFlag()])
2554
            {
2556
            {
2555
                rv = sptr->check_twosfx(word,len, sfxopts, ppfx, needflag);
2557
                rv = sptr->check_twosfx(word,len, sfxopts, ppfx, needflag);
 Lines 2600-2617   char * AffixMgr::suffix_check_twosfx_mor Link Here 
2600
                    mystrcat(result, " ", MAXLNLEN);
2602
                    mystrcat(result, " ", MAXLNLEN);
2601
                    mystrcat(result, se->getMorph(), MAXLNLEN);
2603
                    mystrcat(result, se->getMorph(), MAXLNLEN);
2602
                } else debugflag(result, se->getFlag());
2604
                } else debugflag(result, se->getFlag());
2603
                mystrcat(result, "\n", MAXLNLEN);
2605
                mystrcat(result, "\n", MAXLNLEN);
2604
            }
2606
            }
2605
        }
2607
        }
2606
        se = se->getNext();
2608
        se = se->getNext();
2607
    }
2609
    }
2608
  
2610
2609
    // now handle the general case
2611
    // now handle the general case
2612
    if (len == 0) return NULL; // FULLSTRIP
2610
    unsigned char sp = *((const unsigned char *)(word + len - 1));
2613
    unsigned char sp = *((const unsigned char *)(word + len - 1));
2611
    SfxEntry * sptr = sStart[sp];
2614
    SfxEntry * sptr = sStart[sp];
2612
2615
2613
    while (sptr) {
2616
    while (sptr) {
2614
        if (isRevSubset(sptr->getKey(), word + len - 1, len)) {
2617
        if (isRevSubset(sptr->getKey(), word + len - 1, len)) {
2615
            if (contclasses[sptr->getFlag()]) 
2618
            if (contclasses[sptr->getFlag()]) 
2616
            {
2619
            {
2617
                st = sptr->check_twosfx_morph(word,len, sfxopts, ppfx, needflag);
2620
                st = sptr->check_twosfx_morph(word,len, sfxopts, ppfx, needflag);
 Lines 2706-2723   char * AffixMgr::suffix_check_morph(cons Link Here 
2706
                mystrcat(result, se->getMorph(), MAXLNLEN);
2709
                mystrcat(result, se->getMorph(), MAXLNLEN);
2707
            } else debugflag(result, se->getFlag());
2710
            } else debugflag(result, se->getFlag());
2708
            mystrcat(result, "\n", MAXLNLEN);
2711
            mystrcat(result, "\n", MAXLNLEN);
2709
            rv = se->get_next_homonym(rv, sfxopts, ppfx, cclass, needflag);
2712
            rv = se->get_next_homonym(rv, sfxopts, ppfx, cclass, needflag);
2710
         }
2713
         }
2711
       }
2714
       }
2712
       se = se->getNext();
2715
       se = se->getNext();
2713
    }
2716
    }
2714
  
2717
2715
    // now handle the general case
2718
    // now handle the general case
2719
    if (len == 0) return NULL; // FULLSTRIP
2716
    unsigned char sp = *((const unsigned char *)(word + len - 1));
2720
    unsigned char sp = *((const unsigned char *)(word + len - 1));
2717
    SfxEntry * sptr = sStart[sp];
2721
    SfxEntry * sptr = sStart[sp];
2718
2722
2719
    while (sptr) {
2723
    while (sptr) {
2720
        if (isRevSubset(sptr->getKey(), word + len - 1, len)
2724
        if (isRevSubset(sptr->getKey(), word + len - 1, len)
2721
        ) {
2725
        ) {
2722
            // suffixes are not allowed in beginning of compounds
2726
            // suffixes are not allowed in beginning of compounds
2723
            if (((((in_compound != IN_CPD_BEGIN)) || // && !cclass
2727
            if (((((in_compound != IN_CPD_BEGIN)) || // && !cclass

Return to bug 626195