Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit53ef36c

Browse files
committed
Fix recently introduced bugs about parsing ispell/hunspell files.
In most cases it cause because of unneeded lowercasing of flags.Per experiment with regression checks with ispell dictionary.
1 parent21c27af commit53ef36c

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

‎src/backend/tsearch/spell.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.3 2007/09/1010:39:56 teodor Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.4 2007/09/1020:27:12 teodor Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -647,12 +647,10 @@ NIImportOOAffixes(IspellDict * Conf, const char *filename)
647647
gotonextline;
648648
flag=*sflag;
649649
isSuffix= (STRNCMP(ptype,"sfx")==0) ? true : false;
650-
pfind=lowerstr_ctx(find);
651-
if (t_iseq(find,'y'))
650+
if (t_iseq(find,'y')||t_iseq(find,'Y'))
652651
flagflags=FF_CROSSPRODUCT;
653652
else
654653
flagflags=0;
655-
pfree(pfind);
656654
}
657655
else
658656
{
@@ -666,7 +664,7 @@ NIImportOOAffixes(IspellDict * Conf, const char *filename)
666664
if ((ptr=strchr(prepl,'/'))!=NULL)
667665
{
668666
*ptr='\0';
669-
ptr++;
667+
ptr=repl+ (ptr-prepl)+1;
670668
while (*ptr)
671669
{
672670
aflg |=Conf->flagval[(unsignedint)*ptr];
@@ -704,8 +702,7 @@ NIImportOOAffixes(IspellDict * Conf, const char *filename)
704702
void
705703
NIImportAffixes(IspellDict*Conf,constchar*filename)
706704
{
707-
charstr[BUFSIZ],
708-
*pstr=NULL;
705+
char*pstr=NULL;
709706
charmask[BUFSIZ];
710707
charfind[BUFSIZ];
711708
charrepl[BUFSIZ];
@@ -742,13 +739,15 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
742739

743740
if (STRNCMP(pstr,"compoundwords")==0)
744741
{
745-
s=findchar(str,'l');
742+
s=findchar(pstr,'l');
746743
if (s)
747744
{
745+
s=recoded+ (s-pstr );/* we need non-lowercased string */
748746
while (*s&& !t_isspace(s))
749747
s++;
750748
while (*s&&t_isspace(s))
751749
s++;
750+
752751
if (*s&&pg_mblen(s)==1)
753752
{
754753
Conf->flagval[(unsignedint)*s]=FF_COMPOUNDFLAG;
@@ -774,7 +773,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
774773
}
775774
if (STRNCMP(pstr,"flag")==0)
776775
{
777-
s=str+4;
776+
s=recoded+4;/* we need non-lowercased string */
778777
flagflags=0;
779778

780779
while (*s&&t_isspace(s))
@@ -1333,7 +1332,7 @@ addToResult(char **forms, char **cur, char *word)
13331332
}
13341333

13351334
staticchar**
1336-
NormalizeSubWord(IspellDict*Conf,char*word,charflag)
1335+
NormalizeSubWord(IspellDict*Conf,char*word,intflag)
13371336
{
13381337
AffixNodeData*suffix=NULL,
13391338
*prefix=NULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp