bug-global
[Top][All Lists]
Advanced

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

Re: Binary recognition is to narrow.


From: Shigio YAMAGUCHI
Subject: Re: Binary recognition is to narrow.
Date: Thu, 19 Nov 2009 16:18:15 +0900

Hi
> The function is_binary is a bit naive and therefore tags to much as binary
> content. It is quite common with names in the first 32 bytes and it's also
> common with strange characters in names. Strange as in char > 127.
> 
> I have rewritten the function a bit and think you probably should
> incorporate this fix or one of your own in a future release.
> 
> Here is my version...

I agree. It's a good idea.

>         if (((float)strange)/size > 0.3f)
>             return 1;

I would like to make the 0.3 a customizable variable like follows:

[File gtags.conf]
+----------------------------
|...
|       :binary_boundary=30:... ---+    (0-100%)
|                                  |
                                   |
[Initial processing]               |
                                   |
Load binary_boundary               |
                                   |
        binary_boundary = 0.3; <---+

[Function is_binary()]

        if (((float)strange)/size > binary_boundary)
              return 1;

The default of binary_boundary might be 0 (same as the current spec).
Any comment?
--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]