fix to work on 64bit (again)
commit72d97db3d2949e7798351e0b350ead7e23f0136a
authorrofl0r <retnyg@gmx.net>
Fri, 25 Jul 2014 09:54:26 +0000 (25 11:54 +0200)
committerrofl0r <retnyg@gmx.net>
Fri, 25 Jul 2014 09:54:30 +0000 (25 11:54 +0200)
treefa4d0bc7ef315aabf14074fa97cbc1dae8d4c908
parentfd0fd6e0889c4e13905b3ddc31566857a51b23c5
fix to work on 64bit (again)

segfaults were encountered again due to bogus int -> pointer conversions
in functions like tree.additem (sometimes called with ints like 10,20,
sometimes with char*s, sometimes even with C++ iterators...), .addleaf, etc.

since the code is big it's hard to figure out why those intcasts were being
done and how the same functionality could be implemented without invoking UB.

after several tries to remove the offending calls, i reverted everything
and decided to use intptr_t *everywhere*.

- converted every occurence of int to INT so it can be overridden
with CPP directives to intptr_t.
- manually reverted the few ones that were conflicting with called
libc functions.
- when 0 was used as an arg in an overloaded function call expecting
INT or void*, NULL is used now to use the pointer version (the
INT version is just a wrapper around the respective void* version).

used this regex for .h/.cc
find . -name '*.h' -exec sed -i \
's/^int$/INT/g;s/^int\([^a-zA-Z0-9_]\)/INT\1/g;s/\([^a-zA-Z0-9_]\)int$/\1INT/g;s/\([^a-zA-Z0-9_]\)int\([^a-zA-Z0-9]\)/\1INT\2/g' \
{} \;
74 files changed:
Makefile
kkconsui/include/abstractui.h
kkconsui/include/cmenus.h
kkconsui/include/conscommon.h
kkconsui/include/dialogbox.h
kkconsui/include/fileselector.h
kkconsui/include/horizontalbar.h
kkconsui/include/linkedlist.h
kkconsui/include/screenarea.h
kkconsui/include/textbrowser.h
kkconsui/include/texteditor.h
kkconsui/include/textinputline.h
kkconsui/include/textwindow.h
kkconsui/include/treeview.h
kkconsui/src/cmenus.cc
kkconsui/src/conscommon.cc
kkconsui/src/dialogbox.cc
kkconsui/src/fileselector.cc
kkconsui/src/horizontalbar.cc
kkconsui/src/linkedlist.cc
kkconsui/src/screenarea.cc
kkconsui/src/textbrowser.cc
kkconsui/src/texteditor.cc
kkconsui/src/textinputline.cc
kkconsui/src/textwindow.cc
kkconsui/src/treeview.cc
kkstrtext/kkstrtext.cc
kkstrtext/kkstrtext.h
kksystr/include/kkfsys.h
kksystr/include/kkiproc.h
kksystr/src/kkfsys.cc
kksystr/src/kkiproc.cc
parser/include/parlist.h
parser/include/parser.h
src/configuration/extkey.cc
src/configuration/motorconfiguration.cc
src/configuration/motorconfiguration.h
src/debugger/breakpoint.cc
src/debugger/breakpoint.h
src/debugger/debuggermessage.cc
src/debugger/debuggermessage.h
src/debugger/motordebugger.cc
src/debugger/motordebugger.h
src/executor/motorexecutor.h
src/executor/parserule.cc
src/grepper/motorgrepper.cc
src/grepper/motorgrepper.h
src/manager/motormanager.cc
src/manager/motormanager.h
src/project/motorfolder.cc
src/project/motorfolder.h
src/project/motorproject.cc
src/project/motorproject.h
src/project/projectdesk.cc
src/project/projectdesk.h
src/project/projectfiles.cc
src/tagbrowser/motortagbrowser.h
src/ui/motorui.cc
src/ui/motorui.h
src/ui/ncurses/ncursesui.cc
src/ui/ncurses/ncursesui.h
src/ui/ncurses/uiconfiguration.cc
src/ui/ncurses/uiconfiguration.h
src/ui/ncurses/uidefs.h
src/ui/ncurses/uieditor.cc
src/ui/ncurses/uieditor.h
src/ui/ncurses/uigrepper.cc
src/ui/ncurses/uigrepper.h
src/ui/ncurses/uiregexper.cc
src/ui/ncurses/uitagbrowser.cc
src/ui/ncurses/uitagbrowser.h
src/ui/ncurses/uivcs.cc
src/ui/ncurses/uiwatcher.cc
src/ui/ncurses/uiwatcher.h