Hi

When I generate spelling checker files using main.aap in
vim/runtime/spell/* with Vim-7.2.411 using Ubuntu-9.10,
I then get error E763 when trying to use the dictionaries.

Attached patch fixes it.

I initially saw this when creating the Breton dictionary but
I see this error for all other dictionaries that I tried to create:
- it.utf-8.spl
- es.utf-8.spl
- eo.utf-8.spl
- cy.utf-8.spl
- br.utf-8.spl

After generating the dictionary and copying it into ~/.vim/spell,
E763 happens when doing this for example:

  vim -u NONE
  :set spell
  :setlocal spelllang=cy

The problem happens because spelltab.st_fold[] is of type 'char_u'
but init_spell_chartab() initializes it with utf_fold(i) which can return
a value greater than 256. So value gets truncated (which does not
make sense). It happens at least when i is 181=0xb5 since foldCase[]
table contains entry...

        {0xb5,0xb5,-1,775},

... so utf_fold(181) returns 181 + 775 == 0x3BC which then becomes
0xBC = 188 when converted to char_u.

Attached patch fixes it but please verify it.

A few things a unclear to me though:

- why is a table of 256 char needed when using Unicode?
- why is spelltab.st_fold[] table initialized differently
  whether clear_spell_chartab() or init_spell_chartab()
  is called?
- why don't I get E763 with official Vim dictionary files,
  but I got it (before my patch) when I generated dictionary
  myself?

Cheers
-- Dominique

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

To unsubscribe, reply using "remove me" as the subject.
diff -r 24100651daa9 src/spell.c
--- a/src/spell.c	Tue Mar 23 18:22:46 2010 +0100
+++ b/src/spell.c	Wed Apr 14 20:13:24 2010 +0200
@@ -9780,10 +9780,13 @@
     {
 	for (i = 128; i < 256; ++i)
 	{
+	    int f = utf_fold(i);
+	    int u = utf_toupper(i);
+
+	    spelltab.st_fold[i] = (f < 256) ? f : i;
+	    spelltab.st_upper[i] = (u < 256) ? u : i;
 	    spelltab.st_isu[i] = utf_isupper(i);
 	    spelltab.st_isw[i] = spelltab.st_isu[i] || utf_islower(i);
-	    spelltab.st_fold[i] = utf_fold(i);
-	    spelltab.st_upper[i] = utf_toupper(i);
 	}
     }
     else

Raspunde prin e-mail lui