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

Bug#484056: ncurses-hexedit: search is not working on 64 bit systems



Package: ncurses-hexedit
Version: 0.9.7-13
Tags: patch

search is not working on 64 bit systems because the function
boyer_moore_search() at search.c incorrectly assumes:
sizeof(int) == sizeof(long)

The code may still have some incoherences in some of the variable
types but the attached patch makes search work again on 64 bit
systems.

Maybe the best way to fix it would be to use memmem(3) function from glibc.
--- ncurses-hexedit/src/search.c~	1999-06-27 13:45:29.000000000 +0000
+++ ncurses-hexedit/src/search.c	2008-06-01 22:47:51.000000000 +0000
@@ -39,7 +39,7 @@
    if (!buf)
       return &found;
 
-   memset (l_table, 0, 256 * sizeof (int));
+   memset (l_table, 0, sizeof (l_table));
    i = 0;
    s = substr + len - 1;
    while (i < len)

Reply to: