fc-glyphname bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Running fc-glyphname with the glyphlist.txt as an argument fails.

A binary search shows that it is OK with up to 3615 glyph names in the
files specified as args, but fails as soon as there are 3616 glyph names.

When there are 3616 glyph names, hash is 4549 and rehash is 4547,
and the spin starts when i is 896 in the 1st insert at:

,----(fontconfig/fc-glyphname/fc-glyphname.c:main())
|  for (i = 0; i < nraw; i++)
|  {
|      insert (raw[i], name_to_ucs, FcHashGlyphName (raw[i]->name));
|      insert (raw[i], ucs_to_name, raw[i]->ucs);
|  }
`----
    
Given that insert() does:

,----(fontconfig/fc-glyphname/fc-glyphname.c:insert())
|  i = (int) (h % hash);
|  while (table[i])
|  {
|      if (!r) r = (int) (h % rehash);
|      i += r;
|      if (i >= hash)
|          i -= hash;
|  }
|  table[i] = gn;
`----

i starts looping rather than finding an empty slot at that point.

A quick printf shows that i hits 4541 and remains there.

When h is 18188, i is 4541 and r is 0, since 18188 is 4 * 4547.

For the hell of it, I tried adding an i++ just before the i+=r,
and this at least avoided the spin, although I presume it is
less than optimal.


Is this why glyphlist is not getting included in making fcglyphname.h?


Cf my next post for why this came up.

-JimC
-- 
James Cloos <cloos@xxxxxxxxxxx>         OpenPGP: 1024D/ED7DAEA6
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux