diff options
author | fox <fox@pkgsrc.org> | 2018-11-26 09:15:53 +0000 |
---|---|---|
committer | fox <fox@pkgsrc.org> | 2018-11-26 09:15:53 +0000 |
commit | 5c9ba7ec0ceed04b073b0af405311ee34a93ea67 (patch) | |
tree | 60f6170167872c5d68522e27d2ca8df276899d3e /editors | |
parent | f37a93f8494cf1a72234726a9132db4f963c43c0 (diff) | |
download | pkgsrc-5c9ba7ec0ceed04b073b0af405311ee34a93ea67.tar.gz |
editors/hnb: Fixed segfault in amd64 builds.
Diffstat (limited to 'editors')
38 files changed, 1961 insertions, 61 deletions
diff --git a/editors/hnb/Makefile b/editors/hnb/Makefile index 8e66b876151..ebe1ca5b5b2 100644 --- a/editors/hnb/Makefile +++ b/editors/hnb/Makefile @@ -1,14 +1,15 @@ -# $NetBSD: Makefile,v 1.27 2015/09/08 11:57:49 jperkin Exp $ +# $NetBSD: Makefile,v 1.28 2018/11/26 09:15:53 fox Exp $ # DISTNAME= hnb-1.9.17 -PKGREVISION= 4 +PKGREVISION= 5 CATEGORIES= editors MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=hnb/} MAINTAINER= pkgsrc-users@NetBSD.org HOMEPAGE= http://hnb.sourceforge.net/ COMMENT= Hierarchical data organizer +LICENSE= gnu-gpl-v2 USE_TOOLS+= gmake diff --git a/editors/hnb/distinfo b/editors/hnb/distinfo index 45c7fb1cafa..6ec3f63acd1 100644 --- a/editors/hnb/distinfo +++ b/editors/hnb/distinfo @@ -1,9 +1,40 @@ -$NetBSD: distinfo,v 1.6 2015/11/03 03:32:17 agc Exp $ +$NetBSD: distinfo,v 1.7 2018/11/26 09:15:53 fox Exp $ SHA1 (hnb-1.9.17.tar.gz) = b5204a9bda13b42ef04921e71f52e5bfe5412f13 RMD160 (hnb-1.9.17.tar.gz) = 1363eac8a785a3bad2ac319ae38726cd826268cf SHA512 (hnb-1.9.17.tar.gz) = 48ca89336027b54ddec31064294595498f10927d9b69a115bfbdecf79ebc720873c0cc70dc646422f196cff7aa4fda68fc2f68f4ddacfac53d4363ed295d2e7a Size (hnb-1.9.17.tar.gz) = 143700 bytes -SHA1 (patch-aa) = f44cef4b2a3ccf20513420a1f57946e342aa2ee3 -SHA1 (patch-ab) = 9c87fbe5ddfb7525941cb8e1d66d377fbe726811 -SHA1 (patch-ac) = 88778957d3a52aa6c8b9811133dfe4f2ceca213e +SHA1 (patch-ac) = d750eae0a0fbb61a75fce3d427bf2afdbeb806c6 +SHA1 (patch-src_actions.c) = 5c2f340e205c982d759415385f6f0038ee7ca404 +SHA1 (patch-src_cal.c) = 162a4acfa9a388ec5a1b1e9d8b5ac69f93715745 +SHA1 (patch-src_cli__macro.c) = 593bfaf56dd083ef0da45c3f320af095cd411bd1 +SHA1 (patch-src_clipboard.c) = 4dde4765825e5362f66c8b7c63ba40c1e154c63c +SHA1 (patch-src_evilloop.c) = 4f55e0dabdeede6f33cebeb18d5c6b64c51bfbf7 +SHA1 (patch-src_expanded.c) = 772d71db739164ce59c9fe3d3b93b862063f3ee3 +SHA1 (patch-src_file.c) = 884445d3b5a2d9590ea6e1e0a1e6df98cf69bdab +SHA1 (patch-src_file__ascii.c) = 7b523b941791b6337a13c11ce1a70c99a170b707 +SHA1 (patch-src_file__help.c) = 7a9604126a1fb4af182a1236eb5a873b82ae1690 +SHA1 (patch-src_file__hnb.c) = c2549af8b806eaef4fc760712657860d4f7b31ca +SHA1 (patch-src_file__html.c) = 162f68b3e417b2eeb7a889ad23836dc4c79b2049 +SHA1 (patch-src_file__opml.c) = 588e1b339f0991c105d30fe077a8fa95bbdf6f9d +SHA1 (patch-src_file__ps.c) = 7789097bd9e5ca1950e53295903a2edcb47a983e +SHA1 (patch-src_file__xml.c) = 1bcda1d25bd1aa22e10c7eea40c7e99c05377f75 +SHA1 (patch-src_libcli_cli.c) = baabda1de8c8e24f370d06efbd9b0bd09262224d +SHA1 (patch-src_libcli_cli.h) = c6b2ace10000bfd176418e2ecbcd8a2abb04a1e1 +SHA1 (patch-src_libcli_cli__tokenize.c) = 503d4cdd51a40773b75fe2fa8bbbafc3d1e16941 +SHA1 (patch-src_node.c) = cd6541ab5a2da5759106126d5e36e59b8b12e600 +SHA1 (patch-src_query.c) = 8f55f91444f9691655c54163c25ccb6bbad16bd0 +SHA1 (patch-src_search.c) = c7a88b365eb489a0e27d9badb1c67477aaa39b1c +SHA1 (patch-src_spell.c) = eb05674a5c2c48e779412ba011b76a774a8087a0 +SHA1 (patch-src_statcmds.c) = 439c85247d7c2a3622cd5e09683932aac251bef6 +SHA1 (patch-src_state.c) = 24d5c9d710c8b90447f4aa2ea9431d9f2f571bed +SHA1 (patch-src_tree__misc.c) = e8bbc96c577d77614d37f2d73ec8373304cdd245 +SHA1 (patch-src_tree__sort.c) = 95780063a609fa7b9dd1c3230e2d23dfb96ad8b5 +SHA1 (patch-src_tree__todo.c) = 43837efeddab88b4f03caa54d983f68042bda35e +SHA1 (patch-src_ui__binding.c) = 334b952a2851d84a2e39d7256a68a584691534ca +SHA1 (patch-src_ui__cli.c) = aa8663c7244122aac7f92f6c73369d31f41e36ad +SHA1 (patch-src_ui__draw.c) = 637fc52cd1c44574a7f7342d92800be40e1092d6 +SHA1 (patch-src_ui__edit.c) = 6f01ecd0c0f9eaf9b05fa679b912de2ffeafb00d +SHA1 (patch-src_ui__menu.c) = b6a7136b364f6c8f5e1afc01876601ad4f93dbf5 +SHA1 (patch-src_ui__overlay.c) = a8684a61bb97ebe85f4c3eec76ae77bcaa3c70b7 +SHA1 (patch-src_ui__style.c) = 0dbe1533587cb2bda9e077884a16df275269746e diff --git a/editors/hnb/patches/patch-aa b/editors/hnb/patches/patch-aa deleted file mode 100644 index 2fe423133c9..00000000000 --- a/editors/hnb/patches/patch-aa +++ /dev/null @@ -1,27 +0,0 @@ -$NetBSD: patch-aa,v 1.3 2005/03/11 21:22:24 rillig Exp $ - -In NetBSD-1.6.2, the <stdlib.h> header uses the word bufsize as a -parameter name in a function prototype. The "file.h" header #defines -bufsize to 4096, which leads to a parser error. - ---- src/cal.c.orig Sun Mar 9 19:18:01 2003 -+++ src/cal.c Fri Mar 11 20:07:15 2005 -@@ -19,14 +19,14 @@ - */ - - /**************/ -+#include <stdlib.h> -+#include <stdio.h> -+#include <time.h> -+ - #include "tree.h" - #include "cli.h" - #include "ui.h" - #include "file.h" -- --#include <stdlib.h> --#include <stdio.h> --#include <time.h> - - static char *const wday[] = - { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", " "}; diff --git a/editors/hnb/patches/patch-ab b/editors/hnb/patches/patch-ab deleted file mode 100644 index 418642ea9cb..00000000000 --- a/editors/hnb/patches/patch-ab +++ /dev/null @@ -1,27 +0,0 @@ -$NetBSD: patch-ab,v 1.3 2005/03/11 21:22:24 rillig Exp $ - -In NetBSD-1.6.2, the <stdlib.h> header uses the word bufsize as a -parameter name in a function prototype. The "file.h" header #defines -bufsize to 4096, which leads to a parser error. - ---- src/ui_cli.c.orig Fri Mar 14 05:55:14 2003 -+++ src/ui_cli.c Fri Mar 11 20:19:55 2005 -@@ -22,14 +22,15 @@ - #include <config.h> - #endif - -+#include <stdio.h> -+#include <stdlib.h> -+#include <string.h> -+ - #include "tree.h" - #include "file.h" - #include "path.h" - #include "prefs.h" - #include "cli.h" --#include <stdio.h> --#include <stdlib.h> --#include <string.h> - #include "ui_cli.h" - - diff --git a/editors/hnb/patches/patch-ac b/editors/hnb/patches/patch-ac index 6c31eee28cb..d58961ce345 100644 --- a/editors/hnb/patches/patch-ac +++ b/editors/hnb/patches/patch-ac @@ -1,4 +1,6 @@ -$NetBSD: patch-ac,v 1.1 2005/10/01 18:52:03 kristerw Exp $ +$NetBSD: patch-ac,v 1.2 2018/11/26 09:15:53 fox Exp $ + +Added the curses library path for pkgsrc. --- src/Makefile.orig Sat Oct 1 20:43:07 2005 +++ src/Makefile Sat Oct 1 20:43:40 2005 diff --git a/editors/hnb/patches/patch-src_actions.c b/editors/hnb/patches/patch-src_actions.c new file mode 100644 index 00000000000..bbcdb58277b --- /dev/null +++ b/editors/hnb/patches/patch-src_actions.c @@ -0,0 +1,55 @@ +$NetBSD: patch-src_actions.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/actions.c.orig 2003-03-14 01:06:36.000000000 +0000 ++++ src/actions.c +@@ -32,7 +32,7 @@ + static char web_command[255] = "galeon -n *"; + static char mail_command[255] = "rxvt -rv +sb -e mutt *"; + +-static int cmd_system(int argc, char **argv, void *data){ ++static uint64_t cmd_system(int argc, char **argv, void *data){ + Node *pos=(Node *)data; + int ui_was_inited = ui_inited; + if (argc>1) { +@@ -42,7 +42,7 @@ + if (ui_was_inited) + ui_init (); + } +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + + static int action_node (Node *node) +@@ -136,21 +136,21 @@ + * url/email address substring,.. and launches an app based on that? + * + */ +-static int cmd_action (int argc, char **argv, void *data) ++static uint64_t cmd_action (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + Node *node = node_right (pos); + + while (node) { + if (!action_node (node)) +- return (int) pos; ++ return PTR_TO_UINT64(pos); + node = node_down (node); + } + if (!action_node (pos)) { +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } else { + cli_outfunf ("nothing to do"); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /*** diff --git a/editors/hnb/patches/patch-src_cal.c b/editors/hnb/patches/patch-src_cal.c new file mode 100644 index 00000000000..a71ae303485 --- /dev/null +++ b/editors/hnb/patches/patch-src_cal.c @@ -0,0 +1,64 @@ +$NetBSD: patch-src_cal.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +In NetBSD-1.6.2, the <stdlib.h> header uses the word bufsize as a +parameter name in a function prototype. The "file.h" header #defines +bufsize to 4096, which leads to a parser error. + +Above fix made by rilling on 2005/03/11 + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/cal.c.orig 2003-03-14 01:06:36.000000000 +0000 ++++ src/cal.c +@@ -19,15 +19,15 @@ + */ + + /**************/ ++#include <stdlib.h> ++#include <stdio.h> ++#include <time.h> ++ + #include "tree.h" + #include "cli.h" + #include "ui.h" + #include "file.h" + +-#include <stdlib.h> +-#include <stdio.h> +-#include <time.h> +- + static char *const wday[] = + { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", " "}; + +@@ -35,7 +35,7 @@ + "", "January", "February", "March", "April", "May" ,"June", "July", + "August", "September", "October", "November" , "December"}; + +-static int insert_cal(int argc, char **argv, void *data){ ++static uint64_t insert_cal(int argc, char **argv, void *data){ + Node *pos=(void *)data; + + int year; +@@ -44,7 +44,7 @@ + + if( (argc!=3) || (atoi(argv[1])>12 )){ + cli_outfunf("usage: %s <month> <year>", argv[0]); +- return (int)data; ++ return PTR_TO_UINT64(data); + } + + month=atoi(argv[1]); +@@ -96,7 +96,7 @@ + } + } + +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_cli__macro.c b/editors/hnb/patches/patch-src_cli__macro.c new file mode 100644 index 00000000000..db0be6ed887 --- /dev/null +++ b/editors/hnb/patches/patch-src_cli__macro.c @@ -0,0 +1,47 @@ +$NetBSD: patch-src_cli__macro.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/cli_macro.c.orig 2003-03-09 20:44:27.000000000 +0000 ++++ src/cli_macro.c +@@ -80,7 +80,7 @@ + return pos; + } + +-static int cmd_macro (int argc, char **argv, void *data) ++static uint64_t cmd_macro (int argc, char **argv, void *data) + { + Node *pos=(Node *)data; + if(argc==1){ +@@ -88,7 +88,7 @@ + } else if(argc==2){ + MacroT *tmacro=lookup_macro(argv[1]); + if(tmacro){ +- return (int)do_macro(tmacro,pos); ++ return PTR_TO_UINT64(do_macro(tmacro,pos)); + } else { + cli_outfunf("no such macro defined '%s'",argv[1]); + } +@@ -97,7 +97,7 @@ + if(!strcmp(argv[1],"define") ){ + if(lookup_macro(argv[2])){ + cli_outfunf("error macro %s already exist,.. this might turn out badly,.. " ,argv[2]); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } else { + MacroT *tmacro; + if(!macro){ +@@ -119,7 +119,7 @@ + + } + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + diff --git a/editors/hnb/patches/patch-src_clipboard.c b/editors/hnb/patches/patch-src_clipboard.c new file mode 100644 index 00000000000..69cb32cc2af --- /dev/null +++ b/editors/hnb/patches/patch-src_clipboard.c @@ -0,0 +1,55 @@ +$NetBSD: patch-src_clipboard.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/clipboard.c.orig 2003-03-09 17:42:20.000000000 +0000 ++++ src/clipboard.c +@@ -29,7 +29,7 @@ + + static Node *clipboard = NULL; + +-static int copy_cmd (int argc,char **argv, void *data) ++static uint64_t copy_cmd (int argc,char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -39,10 +39,10 @@ static int copy_cmd (int argc,char **arg + clipboard = node_new (); + + clipboard = tree_duplicate (pos, clipboard); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-static int cut_cmd (int argc,char **argv, void *data) ++static uint64_t cut_cmd (int argc,char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -53,10 +53,10 @@ static int cut_cmd (int argc,char **argv + + clipboard = tree_duplicate (pos, clipboard); + pos = node_remove (pos); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-static int paste_cmd (int argc,char **argv, void *data) ++static uint64_t paste_cmd (int argc,char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -68,7 +68,7 @@ static int paste_cmd (int argc,char **ar + temp = node_insert_down (pos); + tree_duplicate (clipboard, temp); + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_evilloop.c b/editors/hnb/patches/patch-src_evilloop.c new file mode 100644 index 00000000000..92102c3a040 --- /dev/null +++ b/editors/hnb/patches/patch-src_evilloop.c @@ -0,0 +1,24 @@ +$NetBSD: patch-src_evilloop.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/evilloop.c.orig 2003-03-14 04:40:35.000000000 +0000 ++++ src/evilloop.c +@@ -122,10 +122,10 @@ + + int quit_hnb=0; + +-static int cmd_quit(int argc,char **argv,void *data){ ++static uint64_t cmd_quit(int argc,char **argv,void *data){ + Node *pos=(Node *)data; + quit_hnb=1; +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_expanded.c b/editors/hnb/patches/patch-src_expanded.c new file mode 100644 index 00000000000..e271bd69a5f --- /dev/null +++ b/editors/hnb/patches/patch-src_expanded.c @@ -0,0 +1,72 @@ +$NetBSD: patch-src_expanded.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/expanded.c.orig 2003-03-13 21:31:18.000000000 +0000 ++++ src/expanded.c +@@ -18,16 +18,18 @@ + * Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + ++#include <string.h> ++ + #include "tree.h" + #include "cli.h" +-#define NULL 0 ++//#define NULL 0 + + #include "evilloop.h" + #include "ctype.h" + #include "ui_binding.h" + + +-static int cmd_expand (int argc,char **argv, void *data) ++static uint64_t cmd_expand (int argc,char **argv, void *data) + { + Node *pos = (Node *) data; + if(argc==1){ +@@ -36,7 +36,7 @@ + inputbuf[strlen (inputbuf) + 1] = 0; + inputbuf[strlen (inputbuf)] = lastbinding->key; + } +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + node_setflag(pos,F_expanded,1); + } else if((!strcmp(argv[1],"-a"))||(!strcmp(argv[1],"--all"))){ +@@ -48,10 +48,10 @@ + } + cli_outfun ("expanded all nodes"); + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-static int cmd_collapse (int argc,char **argv, void *data) ++static uint64_t cmd_collapse (int argc,char **argv, void *data) + { + Node *pos = (Node *) data; + if(argc==1){ +@@ -60,7 +60,7 @@ + inputbuf[strlen (inputbuf) + 1] = 0; + inputbuf[strlen (inputbuf)] = lastbinding->key; + } +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + node_setflag(pos,F_expanded,0); + } else if((!strcmp(argv[1],"-a"))||(!strcmp(argv[1],"--all"))){ +@@ -73,7 +73,7 @@ + cli_outfun ("collapsed all nodes"); + } + +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_file.c b/editors/hnb/patches/patch-src_file.c new file mode 100644 index 00000000000..5c4c3bbb8f2 --- /dev/null +++ b/editors/hnb/patches/patch-src_file.c @@ -0,0 +1,42 @@ +$NetBSD: patch-src_file.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/file.c.orig 2003-03-13 22:55:13.000000000 +0000 ++++ src/file.c +@@ -150,7 +150,7 @@ + } + + +-static int cmd_save (int argc,char **argv, void *data) ++static uint64_t cmd_save (int argc,char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -167,10 +167,10 @@ + docmd (node_root (pos), buf); + } + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-static int cmd_revert (int argc,char **argv, void *data) ++static uint64_t cmd_revert (int argc,char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -185,7 +185,7 @@ + pos=docmd (pos, buf); + } + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + diff --git a/editors/hnb/patches/patch-src_file__ascii.c b/editors/hnb/patches/patch-src_file__ascii.c new file mode 100644 index 00000000000..8494e521dcd --- /dev/null +++ b/editors/hnb/patches/patch-src_file__ascii.c @@ -0,0 +1,65 @@ +$NetBSD: patch-src_file__ascii.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/file_ascii.c.orig 2003-03-14 00:37:39.000000000 +0000 ++++ src/file_ascii.c +@@ -34,7 +34,7 @@ + + static int ascii_margin = -1; + +-static int import_ascii (int argc, char **argv, void *data) ++static uint64_t import_ascii (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc==2?argv[1]:""; +@@ -46,7 +46,7 @@ + file = fopen (filename, "r"); + if (file == NULL) { + cli_outfunf ("ascii import, unable to open \"%s\"", filename); +- return (int) (node); ++ return PTR_TO_UINT64 (node); + } + + init_import (&ist, node); +@@ -73,7 +73,7 @@ + cli_outfunf ("ascii import, imported \"%s\"", filename); + + +- return (int) (node); ++ return PTR_TO_UINT64 (node); + } + + static void ascii_export_node (FILE * file, int level, int flags, char *data) +@@ -95,7 +95,7 @@ + } + } + +-static int export_ascii (int argc, char **argv, void *data) ++static uint64_t export_ascii (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc==2?argv[1]:""; +@@ -110,7 +110,7 @@ + file = fopen (filename, "w"); + if (!file) { + cli_outfunf ("ascii export, unable to open \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + startlevel = nodes_left (node); + +@@ -130,7 +130,7 @@ + + cli_outfunf ("ascii export, wrote output to \"%s\"", filename); + +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + diff --git a/editors/hnb/patches/patch-src_file__help.c b/editors/hnb/patches/patch-src_file__help.c new file mode 100644 index 00000000000..edaeed14310 --- /dev/null +++ b/editors/hnb/patches/patch-src_file__help.c @@ -0,0 +1,51 @@ +$NetBSD: patch-src_file__help.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/file_help.c.orig 2003-03-14 00:37:23.000000000 +0000 ++++ src/file_help.c +@@ -42,7 +42,7 @@ static char *helpquote[]={ + + /* *INDENT-ON* */ + +-static int export_help (int argc, char **argv, void *data) ++static uint64_t export_help (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc==2?argv[1]:""; +@@ -55,7 +55,7 @@ static int export_help (int argc, char * + if (!file) { + cli_outfunf ("help export, unable to open \"%s\"", filename); + +- return (int) node; ++ return PTR_TO_UINT64(node); + } + startlevel = nodes_left (node); + +@@ -86,10 +86,10 @@ static int export_help (int argc, char * + fclose (file); + + cli_outfunf ("help export, wrote data to \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + +-static int import_help (int argc, char **argv, void *data) ++static uint64_t import_help (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + import_state_t ist; +@@ -100,7 +100,7 @@ static int import_help (int argc, char * + if (node_getflag (node, F_temp)) + node = node_remove (node); + +- return (int) (node); ++ return PTR_TO_UINT64(node); + } + + /* diff --git a/editors/hnb/patches/patch-src_file__hnb.c b/editors/hnb/patches/patch-src_file__hnb.c new file mode 100644 index 00000000000..7bbfd1e9f3b --- /dev/null +++ b/editors/hnb/patches/patch-src_file__hnb.c @@ -0,0 +1,69 @@ +$NetBSD: patch-src_file__hnb.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t. +2. Replaced pointer to int type cast with a macro to help + convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/file_hnb.c.orig 2003-03-14 00:37:13.000000000 +0000 ++++ src/file_hnb.c +@@ -105,7 +105,7 @@ static void hnb_export_nodes (FILE * fil + } + } + +-static int export_hnb (int argc, char **argv, void *data) ++static uint64_t export_hnb (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc>=2?argv[1]:""; +@@ -118,7 +118,7 @@ static int export_hnb (int argc, char ** + + if (!file) { + cli_outfunf ("hnb export, unable to open \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + fprintf (file, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><?pos=\"%s\"?>\n\ +@@ -143,11 +143,11 @@ static int export_hnb (int argc, char ** + + cli_outfunf ("hnb export, wrote data to \"%s\"", filename); + +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + +-static int import_hnb (int argc, char **argv, void *data) ++static uint64_t import_hnb (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc==2?argv[1]:""; +@@ -170,7 +170,7 @@ static int import_hnb (int argc, char ** + file = fopen (filename, "r"); + if (!file) { + cli_outfunf ("hnb import, unable to open \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + s = xml_tok_init (file); + init_import (&ist, node); +@@ -180,7 +180,7 @@ static int import_hnb (int argc, char ** + cli_outfunf ("hnb import error, parsing og '%s' line:%i, %s", filename, + s->line_no, rdata); + fclose (file); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + if (in_tree) { + if (type == t_tag && !strcmp (rdata, "node")) { +@@ -263,7 +263,7 @@ static int import_hnb (int argc, char ** + + xml_tok_cleanup (s); + +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + /* diff --git a/editors/hnb/patches/patch-src_file__html.c b/editors/hnb/patches/patch-src_file__html.c new file mode 100644 index 00000000000..971958bf533 --- /dev/null +++ b/editors/hnb/patches/patch-src_file__html.c @@ -0,0 +1,65 @@ +$NetBSD: patch-src_file__html.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/file_html.c.orig 2003-03-14 00:36:52.000000000 +0000 ++++ src/file_html.c +@@ -52,7 +52,7 @@ static char *htmlquote[]={ + /* *INDENT-ON* */ + + +-static int export_html (int argc, char **argv, void *data) ++static uint64_t export_html (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc==2?argv[1]:""; +@@ -67,7 +67,7 @@ static int export_html (int argc, char * + file = fopen (filename, "w"); + if (!file) { + cli_outfunf ("html export, unable to open \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + startlevel = nodes_left (node); +@@ -130,7 +130,7 @@ static int export_html (int argc, char * + fclose (file); + + cli_outfunf ("html export, saved output in \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + static void htmlcss_export_nodes (FILE * file, Node *node, int level) +@@ -162,7 +162,7 @@ static void htmlcss_export_nodes (FILE * + } + + +-static int export_htmlcss (int argc, char **argv, void *data) ++static uint64_t export_htmlcss (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc==2?argv[1]:""; +@@ -174,7 +174,7 @@ static int export_htmlcss (int argc, cha + file = fopen (filename, "w"); + if (!file) { + cli_outfunf ("html export, unable to open \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + fprintf (file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\ +@@ -224,7 +224,7 @@ div.level2 {\n\ + fclose (file); + + cli_outfunf ("html css export, saved output in \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + /* diff --git a/editors/hnb/patches/patch-src_file__opml.c b/editors/hnb/patches/patch-src_file__opml.c new file mode 100644 index 00000000000..cbc4a570e25 --- /dev/null +++ b/editors/hnb/patches/patch-src_file__opml.c @@ -0,0 +1,69 @@ +$NetBSD: patch-src_file__opml.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/file_opml.c.orig 2003-03-14 00:36:39.000000000 +0000 ++++ src/file_opml.c +@@ -90,7 +90,7 @@ static void opml_export_nodes (FILE * fi + } + } + +-static int export_opml (int argc, char **argv, void *data) ++static uint64_t export_opml (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc>=2?argv[1]:""; +@@ -103,7 +103,7 @@ static int export_opml (int argc, char * + + if (!file) { + cli_outfunf ("opml export, unable to open \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + fprintf (file, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><?pos=\"%s\"?>\n\ +@@ -133,10 +133,10 @@ static int export_opml (int argc, char * + + cli_outfunf ("opml export, wrote data to \"%s\"", filename); + +- return (int) node; ++ return PTR_TO_UINT64(node); + } + +-static int import_opml (int argc, char **argv, void *data) ++static uint64_t import_opml (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc==2?argv[1]:""; +@@ -154,7 +154,7 @@ static int import_opml (int argc, char * + file = fopen (filename, "r"); + if (!file) { + cli_outfunf ("opml import, unable to open \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + s = xml_tok_init (file); + init_import (&ist, node); +@@ -164,7 +164,7 @@ static int import_opml (int argc, char * + cli_outfunf ("opml import error, parsing og '%s', line:%i %s", filename, + s->line_no, rdata); + fclose (file); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + if (in_body) { + if (type == t_tag && !strcmp (rdata, "outline")) { +@@ -208,7 +208,7 @@ static int import_opml (int argc, char * + + cli_outfunf ("opml import - imported \"%s\" %i lines", filename, s->line_no); + xml_tok_cleanup (s); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + diff --git a/editors/hnb/patches/patch-src_file__ps.c b/editors/hnb/patches/patch-src_file__ps.c new file mode 100644 index 00000000000..c6c28e12126 --- /dev/null +++ b/editors/hnb/patches/patch-src_file__ps.c @@ -0,0 +1,38 @@ +$NetBSD: patch-src_file__ps.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/file_ps.c.orig 2003-03-14 00:36:23.000000000 +0000 ++++ src/file_ps.c +@@ -60,7 +60,7 @@ static void ps_export_node (FILE * file, + free(quoted); + } + +-static int export_ps (int argc, char **argv, void *data) ++static uint64_t export_ps (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc==2?argv[1]:""; +@@ -75,7 +75,7 @@ static int export_ps (int argc, char **a + file = fopen (filename, "w"); + if (!file) { + cli_outfunf ("postscript export, unable to open \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + startlevel = nodes_left (node); + +@@ -225,7 +225,7 @@ close\n\ + cli_outfunf ("postscript export, saved output to \"%s\"", filename); + if (file != stdout) + fclose (file); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + /* diff --git a/editors/hnb/patches/patch-src_file__xml.c b/editors/hnb/patches/patch-src_file__xml.c new file mode 100644 index 00000000000..037fec05107 --- /dev/null +++ b/editors/hnb/patches/patch-src_file__xml.c @@ -0,0 +1,74 @@ +$NetBSD: patch-src_file__xml.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/file_xml.c.orig 2003-03-14 00:36:08.000000000 +0000 ++++ src/file_xml.c +@@ -147,7 +147,7 @@ static void xml_export_nodes (FILE * fil + } + } + +-static int export_xml (int argc, char **argv, void *data) ++static uint64_t export_xml (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc==2?argv[1]:""; +@@ -159,7 +159,7 @@ static int export_xml (int argc, char ** + file = fopen (filename, "w"); + if (!file) { + cli_outfunf ("xml export, unable to open \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + xml_export_nodes (file, node, 0); +@@ -170,7 +170,7 @@ static int export_xml (int argc, char ** + cli_outfunf ("xml export, wrote data to \"%s\"", filename); + + +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + /* joins up tags with data if there is data as the first child +@@ -202,7 +202,7 @@ static Node *xml_cuddle_nodes (Node *nod + } + + +-static int import_xml (int argc, char **argv, void *data) ++static uint64_t import_xml (int argc, char **argv, void *data) + { + Node *node = (Node *) data; + char *filename = argc==2?argv[1]:""; +@@ -221,7 +221,7 @@ static int import_xml (int argc, char ** + file = fopen (filename, "r"); + if (!file) { + cli_outfunf ("xml import, unable to open \"%s\"", filename); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + s = xml_tok_init (file); + init_import (&ist, node); +@@ -231,7 +231,7 @@ static int import_xml (int argc, char ** + cli_outfunf ("xml import error, parsing og '%s', line:%i %s", filename, + s->line_no,rdata); + fclose (file); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + switch (type) { +@@ -328,7 +328,7 @@ static int import_xml (int argc, char ** + + cli_outfunf ("xml import - imported \"%s\" %i lines", filename, s->line_no); + xml_tok_cleanup (s); +- return (int) node; ++ return PTR_TO_UINT64(node); + } + + /* diff --git a/editors/hnb/patches/patch-src_libcli_cli.c b/editors/hnb/patches/patch-src_libcli_cli.c new file mode 100644 index 00000000000..c4068436023 --- /dev/null +++ b/editors/hnb/patches/patch-src_libcli_cli.c @@ -0,0 +1,104 @@ +$NetBSD: patch-src_libcli_cli.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/libcli/cli.c.orig 2003-03-14 02:32:38.000000000 +0000 ++++ src/libcli/cli.c +@@ -113,7 +113,7 @@ static int item_matches (const char *it + + typedef struct ItemT { + char *name; /* what the user types */ +- int (*func) (int argc,char **argv, void *data); /* function that is the command */ ++ uint64_t (*func) (int argc,char **argv, void *data); /* function that is the command */ + int *integer; /* pointer to integer (set to NULL if string) */ + char *string; /* pointer to string (set to NULL if integer) */ + char *usage; /* helptext for this command */ +@@ -130,7 +130,7 @@ static ItemT *items = NULL; + void + cli_add_item (char *name, + int *integer, char *string, +- int (*func) (int argc,char **argv, void *data), char *usage) ++ uint64_t (*func) (int argc,char **argv, void *data), char *usage) + { + ItemT *titem = items; + +@@ -191,8 +191,8 @@ void cli_add_help(char *name, char *help + } + + +-static int help (int argc,char **argv, void *data); +-static int vars (int argc,char **argv, void *data); ++static uint64_t help (int argc,char **argv, void *data); ++static uint64_t vars (int argc,char **argv, void *data); + + static int inited = 0; + +@@ -224,13 +224,13 @@ + + int cli_calllevel=0; + +-int cli_docmd (char *commandline, void *data) ++uint64_t cli_docmd (char *commandline, void *data) + { + int largc=0; + char **largv; + + ItemT *titem = items; +- int ret=(int)data; ++ uint64_t ret=(uint64_t)data; + cli_calllevel++; + + if (cli_precmd) +@@ -382,7 +382,7 @@ char *cli_complete (const char *commandl + + /* internal commands */ + +-static int help (int argc,char **argv, void *data) ++static uint64_t help (int argc,char **argv, void *data) + { + if (argc == 1) { /* show all help */ + ItemT *titem = items; +@@ -410,17 +410,17 @@ + cli_outfun (""); + cli_outfun(titem->help); + } +- return(int)data; ++ return(uint64_t)data; + } + } + titem = titem->next; + } + cli_outfunf ("unknown command '%s'", argv[1]); + } +- return(int)data; ++ return(uint64_t)data; + } + +-static int vars (int argc, char **argv, void *data) ++static uint64_t vars (int argc, char **argv, void *data) + { + ItemT *titem = items; + +@@ -446,7 +446,7 @@ static int vars (int argc, char **argv, + + cli_outfunf ("----------------"); + cli_outfunf ("to change a variable: \"variablename newvalue\""); +- return(int)data; ++ return(uint64_t)data; + } + + char *cli_getstring(char *variable){ +@@ -467,7 +467,7 @@ char *cli_getstring(char *variable){ + + #include <stdio.h> + +-int cli_load_file(char *filename){ ++uint64_t cli_load_file(char *filename){ + char buf[255]; + FILE *file; + diff --git a/editors/hnb/patches/patch-src_libcli_cli.h b/editors/hnb/patches/patch-src_libcli_cli.h new file mode 100644 index 00000000000..6a86aa4820f --- /dev/null +++ b/editors/hnb/patches/patch-src_libcli_cli.h @@ -0,0 +1,43 @@ +$NetBSD: patch-src_libcli_cli.h,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/libcli/cli.h.orig 2003-03-12 12:20:05.000000000 +0000 ++++ src/libcli/cli.h +@@ -29,6 +29,9 @@ + #define LIBCLI_H + + #include <stdarg.h> ++#include <stdint.h> ++ ++#define PTR_TO_UINT64(x) (uint64_t)(uintptr_t)(x) + + void argv_sanity(void); + +@@ -41,7 +44,7 @@ void cli_cleanup(void); + void + cli_add_item (char *name, + int *integer, char *string, +- int (*func) (int argc,char **argv, void *data), char *usage); ++ uint64_t (*func) (int argc,char **argv, void *data), char *usage); + + #define cli_add_int(name,integer,usage)\ + cli_add_item (name, integer, NULL, NULL, usage) +@@ -52,10 +52,10 @@ + #define cli_add_command(name,func,usage) \ + cli_add_item(name, NULL, NULL, func, usage) + +-int cli_load_file(char *filename); ++uint64_t cli_load_file(char *filename); + + char *cli_complete (const char *commandline); /* returns a completed commandline */ +-int cli_docmd (char *commandline, void *data); /* run commandline */ ++uint64_t cli_docmd (char *commandline, void *data); /* run commandline */ + + + extern void (*cli_outfun) (char *); /* the outputting function diff --git a/editors/hnb/patches/patch-src_libcli_cli__tokenize.c b/editors/hnb/patches/patch-src_libcli_cli__tokenize.c new file mode 100644 index 00000000000..816f2079529 --- /dev/null +++ b/editors/hnb/patches/patch-src_libcli_cli__tokenize.c @@ -0,0 +1,24 @@ +$NetBSD: patch-src_libcli_cli__tokenize.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +Replaced char * with unsigned char * since this is how the function +is used, also prevents compiler from spweing out warnings. + +--- src/libcli/cli_tokenize.c.orig 2003-03-14 03:23:22.000000000 +0000 ++++ src/libcli/cli_tokenize.c +@@ -68,14 +68,14 @@ typedef struct { + + #ifdef TESTit + #define cli_getstring dummy_get_variable +-static char * dummy_get_variable(char *name){ ++static char * dummy_get_variable(unsigned char *name){ + static char *dummy="<variable expansion not implemented yet>"; + return dummy; + } + #endif + + #ifndef TESTit +-char *cli_getstring(char *variable); ++char *cli_getstring(unsigned char *variable); + #endif + + static rule_entry state_table[s_end][max_rules]; diff --git a/editors/hnb/patches/patch-src_node.c b/editors/hnb/patches/patch-src_node.c new file mode 100644 index 00000000000..45c7b8b89ad --- /dev/null +++ b/editors/hnb/patches/patch-src_node.c @@ -0,0 +1,79 @@ +$NetBSD: patch-src_node.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/node.c.orig 2003-03-09 17:33:35.000000000 +0000 ++++ src/node.c +@@ -138,48 +138,48 @@ + #include <stdio.h> + + +-int cmd_att_set (int argc, char **argv, void *data) ++uint64_t cmd_att_set (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + + if(argc!=3){ + cli_outfunf("usage: %s <attribute> <value>",argv[0]); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + node_set (pos, argv[1], argv[2]); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-int cmd_att_get (int argc, char **argv, void *data) ++uint64_t cmd_att_get (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + char *cdata; + + if(argc!=2){ + cli_outfunf("usage: %s <attribute>",argv[0]); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + cdata = node_get (pos, argv[1]); + + if (cdata) + cli_outfun (cdata); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-int cmd_att_clear (int argc, char **argv, void *data) ++uint64_t cmd_att_clear (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + if(argc!=2){ + cli_outfunf("usage: %s <attribute>",argv[0]); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + node_unset (pos, argv[1]); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-int cmd_att_list (int argc,char **argv, void *data) ++uint64_t cmd_att_list (int argc,char **argv, void *data) + { + Node_AttItem *att; + Node *pos = (Node *) data; +@@ -189,7 +189,7 @@ int cmd_att_list (int argc,char **argv, + cli_outfunf ("%s: [%s]", att->name, att->data); + att = att->next; + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_query.c b/editors/hnb/patches/patch-src_query.c new file mode 100644 index 00000000000..eb501ea4636 --- /dev/null +++ b/editors/hnb/patches/patch-src_query.c @@ -0,0 +1,29 @@ +$NetBSD: patch-src_query.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/query.c.orig 2003-03-14 02:29:13.000000000 +0000 ++++ src/query.c +@@ -27,7 +27,7 @@ + + static char query[100]; + +-static int getquery_cmd (int argc, char **argv, void *data) ++static uint64_t getquery_cmd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -36,7 +36,7 @@ static int getquery_cmd (int argc, char + ui_getstr (argv[1], &query[0]); + else + ui_getstr ("enter string", &query[0]); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_search.c b/editors/hnb/patches/patch-src_search.c new file mode 100644 index 00000000000..717c54dc26e --- /dev/null +++ b/editors/hnb/patches/patch-src_search.c @@ -0,0 +1,54 @@ +$NetBSD: patch-src_search.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/search.c.orig 2003-03-14 02:19:21.000000000 +0000 ++++ src/search.c +@@ -28,7 +28,7 @@ + + /************** search ************************/ + +-static int search(int argc,char **argv,void *data){ ++static uint64_t search(int argc,char **argv,void *data){ + Node *pos=(Node *)data; + + if(argc==2){ +@@ -37,7 +37,7 @@ + if (pos == NULL) { + docmdf (pos, "status 'reached bottom of tree and \\'%s\\' not found'", + argv[1]); +- return (int) data; ++ return PTR_TO_UINT64(data); + } + } + } else if(argc>2){ +@@ -46,20 +46,20 @@ + if (pos == NULL) { + docmdf (pos, "status 'reached top of tree and \\'%s\\' not found'", + argv[2]); +- return (int) data; ++ return PTR_TO_UINT64(data); + } + } else if(!strcmp(argv[1],"-f")){ + pos=node_recursive_match( argv[2],pos); + if (pos == NULL) { + docmdf (pos, "status 'reached bottom of tree and \\'%s\\' not found'", + argv[2]); +- return (int) data; ++ return PTR_TO_UINT64(data); + } + } +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + cli_outfunf("usage: %s [-b|-f] <string>",argv[0]); +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_spell.c b/editors/hnb/patches/patch-src_spell.c new file mode 100644 index 00000000000..f44d5a781be --- /dev/null +++ b/editors/hnb/patches/patch-src_spell.c @@ -0,0 +1,29 @@ +$NetBSD: patch-src_spell.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/spell.c.orig 2003-03-09 17:29:01.000000000 +0000 ++++ src/spell.c +@@ -68,7 +68,7 @@ static void spell_node (Node *node) + ui_init (); + } + +-static int spell_cmd (int argc, char **argv, void *data) ++static uint64_t spell_cmd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -85,7 +85,7 @@ static int spell_cmd (int argc, char **a + } else { + spell_node (pos); + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_statcmds.c b/editors/hnb/patches/patch-src_statcmds.c new file mode 100644 index 00000000000..e0483a5c6ca --- /dev/null +++ b/editors/hnb/patches/patch-src_statcmds.c @@ -0,0 +1,65 @@ +$NetBSD: patch-src_statcmds.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/statcmds.c.orig 2003-03-09 17:28:26.000000000 +0000 ++++ src/statcmds.c +@@ -25,7 +25,7 @@ + + #ifndef WIN32 + +-static int mem_cmd (int argc, char **argv, void *data) ++static uint64_t mem_cmd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -35,7 +35,7 @@ static int mem_cmd (int argc, char **arg + + file = fopen ("/proc/self/stat", "r"); + if (!file) +- return (int) pos; ++ return PTR_TO_UINT64(pos); + + fscanf (file, + "%*i %*s %*s %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %i", +@@ -53,7 +53,7 @@ static int mem_cmd (int argc, char **arg + + file = fopen ("/proc/meminfo", "r"); + if (!file) +- return (int) pos; ++ return PTR_TO_UINT64(pos); + + fscanf (file, "%*s %*s %*s %*s %*s %*s %*s %*i %*i %i %i %i", + &free, &buffers, &cached); +@@ -64,7 +64,7 @@ static int mem_cmd (int argc, char **arg + (float) ((free + buffers + cached) / 1024.0 / 1024.0)); + } + +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + #endif + /* +@@ -97,7 +97,7 @@ static int count_words (unsigned char *s + return words; + } + +-static int stats_cmd (int argc, char **argv, void *data) ++static uint64_t stats_cmd (int argc, char **argv, void *data) + { + int words = 0, leaves = 0, nodes = 0; + Node *pos = (Node *) data; +@@ -114,7 +114,7 @@ static int stats_cmd (int argc, char **a + + cli_outfunf ("nodes:%i, leaves:%i words:%i", nodes, leaves, words); + +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_state.c b/editors/hnb/patches/patch-src_state.c new file mode 100644 index 00000000000..dedf7187272 --- /dev/null +++ b/editors/hnb/patches/patch-src_state.c @@ -0,0 +1,42 @@ +$NetBSD: patch-src_state.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/state.c.orig 2003-03-09 17:28:07.000000000 +0000 ++++ src/state.c +@@ -29,7 +29,7 @@ + + static Node *savedtree = NULL; + +-static int save_state_cmd (int argc, char **argv, void *data) ++static uint64_t save_state_cmd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + Node *i; +@@ -58,10 +58,10 @@ static int save_state_cmd (int argc, cha + savedtree = node_recurse (savedtree); + } + +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-static int restore_state_cmd (int argc, char **argv, void *data) ++static uint64_t restore_state_cmd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -74,7 +74,7 @@ static int restore_state_cmd (int argc, + tree_free (savedtree); + savedtree = NULL; + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_tree__misc.c b/editors/hnb/patches/patch-src_tree__misc.c new file mode 100644 index 00000000000..2f59ffd3171 --- /dev/null +++ b/editors/hnb/patches/patch-src_tree__misc.c @@ -0,0 +1,164 @@ +$NetBSD: patch-src_tree__misc.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/tree_misc.c.orig 2003-03-14 00:31:02.000000000 +0000 ++++ src/tree_misc.c +@@ -27,12 +27,12 @@ + #include "ui_cli.h" + #include "evilloop.h" + +-static int cmd_movenode (int argc, char **argv, void *data) ++static uint64_t cmd_movenode (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + if(argc<2){ + cli_outfunf("usage: %s <left|right|up|down>",argv[0]); +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + if (!strcmp (argv[1], "left")) { + if (node_left (pos)) { +@@ -64,7 +64,7 @@ static int cmd_movenode (int argc, char + node_swap (pos, node_down (pos)); + } + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* +@@ -75,12 +75,12 @@ + cli_add_command ("movenode", cmd_movenode, "<up|left|right|down>"); + } + +-static int cmd_go(int argc, char **argv, void *data){ ++static uint64_t cmd_go(int argc, char **argv, void *data){ + Node *pos=(Node *)data; + + if(argc!=2){ + cli_outfunf("usage: %s <up|down|left|right|recurse|backrecurse|root|top|bottom>"); +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + + if(!strcmp(argv[1],"up")){ +@@ -110,7 +110,7 @@ + } + + +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + + /* +@@ -126,7 +126,7 @@ void init_go () + #include "ctype.h" + #include "ui_binding.h" + +-static int cmd_outdent (int argc, char **argv, void *data) ++static uint64_t cmd_outdent (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -135,7 +135,7 @@ + inputbuf[strlen (inputbuf) + 1] = 0; + inputbuf[strlen (inputbuf)] = lastbinding->key; + } +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + + if (node_left (pos)) { +@@ -166,12 +166,12 @@ static int cmd_outdent (int argc, char * + target_node->right = NULL; + } + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* FIXME: no real need for a temporary node */ + +-static int cmd_indent (int argc, char **argv, void *data) ++static uint64_t cmd_indent (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -180,7 +180,7 @@ + inputbuf[strlen (inputbuf) + 1] = 0; + inputbuf[strlen (inputbuf)] = lastbinding->key; + } +- return (int)pos; ++ return PTR_TO_UINT64(pos); + } + + if (node_up (pos)) { +@@ -205,7 +205,7 @@ static int cmd_indent (int argc, char ** + } + node_remove (node_down (pos)); + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* +@@ -221,7 +221,7 @@ void init_outdent_indent () + "moves the active item and the following siblings one level to the right"); + } + +-static int remove_cmd (int argc, char **argv, void *data) ++static uint64_t remove_cmd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -242,7 +242,7 @@ static int remove_cmd (int argc, char ** + docmd (pos, "save_state"); + pos = node_remove (pos); + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* +@@ -256,7 +256,7 @@ void init_remove () + } + + +-static int commandline_cmd (int argc, char **argv, void *data) ++static uint64_t commandline_cmd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -271,7 +271,7 @@ static int commandline_cmd (int argc, ch + if (commandline[0]) + pos = docmd (pos, commandline); + } while (commandline[0] && strcmp(commandline,"q") && strcmp(commandline,"quit")); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* +@@ -284,7 +284,7 @@ void init_commandline () + "Invokes the interactive commandline in curses mode."); + } + +-static int insert_below_cmd (int argc, char **argv, void *data) ++static uint64_t insert_below_cmd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -299,7 +299,7 @@ static int insert_below_cmd (int argc, c + } + } + inputbuf[0] = 0; +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_tree__sort.c b/editors/hnb/patches/patch-src_tree__sort.c new file mode 100644 index 00000000000..daeab15b4ca --- /dev/null +++ b/editors/hnb/patches/patch-src_tree__sort.c @@ -0,0 +1,29 @@ +$NetBSD: patch-src_tree__sort.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/tree_sort.c.orig 2003-03-14 00:12:44.000000000 +0000 ++++ src/tree_sort.c +@@ -141,7 +141,7 @@ static int cmp_descending(Node *a,Node * + return cmp_todo(b,a); + } + +-static int sort_cmd (int argc, char **argv, void *data) ++static uint64_t sort_cmd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + int (*cmp) (Node *a, Node *b)=cmp_todo; +@@ -155,7 +155,7 @@ static int sort_cmd (int argc, char **ar + node_mergesort (node_top (pos), nodes_down (node_top (pos)) + 1, cmp); + if (node_left (pos)) + node_left (pos)->right = node_top (pos); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_tree__todo.c b/editors/hnb/patches/patch-src_tree__todo.c new file mode 100644 index 00000000000..2efd63aee0e --- /dev/null +++ b/editors/hnb/patches/patch-src_tree__todo.c @@ -0,0 +1,48 @@ +$NetBSD: patch-src_tree__todo.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/tree_todo.c.orig 2003-03-09 17:23:18.000000000 +0000 ++++ src/tree_todo.c +@@ -260,7 +260,7 @@ int calc_percentage_size (Node *node, in + + #include "cli.h" + +-static int toggle_todo_cmd (int argc, char **argv, void *data) ++static uint64_t toggle_todo_cmd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -271,15 +271,15 @@ static int toggle_todo_cmd (int argc, ch + node_unset(pos,"type"); + } + +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-static int toggle_done_cmd (int argc, char **argv, void *data) ++static uint64_t toggle_done_cmd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + + if (strcmp(fixnullstring(node_get(pos,"type")),"todo")) { /* bail out if not todo info set */ +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + if (!strcmp(fixnullstring(node_get(pos,"done")),"yes")) { /* bail out if not todo info set */ +@@ -288,7 +288,7 @@ static int toggle_done_cmd (int argc, ch + node_set(pos,"done","yes"); + } + +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_ui__binding.c b/editors/hnb/patches/patch-src_ui__binding.c new file mode 100644 index 00000000000..49e8c285b21 --- /dev/null +++ b/editors/hnb/patches/patch-src_ui__binding.c @@ -0,0 +1,68 @@ +$NetBSD: patch-src_ui__binding.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/ui_binding.c.orig 2003-03-13 20:53:14.000000000 +0000 ++++ src/ui_binding.c +@@ -250,14 +250,14 @@ static int string2keycode (char *str) + + int ui_current_scope = 0; + +-static int ui_context_cmd (int argc, char **argv, void *data) ++static uint64_t ui_context_cmd (int argc, char **argv, void *data) + { + if(argc<2){ + cli_outfunf("usage: %s <contextname>",argv[0]); +- return(int)data; ++ return PTR_TO_UINT64(data); + } + ui_current_scope = string2scope (argv[1]); +- return (int) data; ++ return PTR_TO_UINT64(data); + } + + static void makebinding (int scope_no, int key, int action, char *action_name, +@@ -272,7 +272,7 @@ static void makebinding (int scope_no, i + ui_binding_count[scope_no]++; + } + +-static int ui_bind_cmd (int argc, char **argv, void *data) ++static uint64_t ui_bind_cmd (int argc, char **argv, void *data) + { + /* char context[40];*/ + char *key; +@@ -280,7 +280,7 @@ static int ui_bind_cmd (int argc, char * + + if(argc<3){ + cli_outfunf("error in bindings %s %s %s %s\n",argv[0],argv[1],argv[2],argv[3]); +- return (int)data; ++ return PTR_TO_UINT64(data); + } + key=argv[1]; + action=argv[2]; +@@ -293,7 +293,7 @@ static int ui_bind_cmd (int argc, char * + ui_action_command, "command", action); + } + +- return (int) data; ++ return PTR_TO_UINT64(data); + } + + +@@ -395,9 +395,9 @@ char *tidy_keyname (const char *keyname) + !init_ui_binding(); + */ + +-static int dummy_cmd (int argc, char **argv, void *data) ++static uint64_t dummy_cmd (int argc, char **argv, void *data) + { +- return (int) data; ++ return PTR_TO_UINT64(data); + } + + void init_ui_binding () diff --git a/editors/hnb/patches/patch-src_ui__cli.c b/editors/hnb/patches/patch-src_ui__cli.c new file mode 100644 index 00000000000..dbf43a7c8e0 --- /dev/null +++ b/editors/hnb/patches/patch-src_ui__cli.c @@ -0,0 +1,153 @@ +$NetBSD: patch-src_ui__cli.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +In NetBSD-1.6.2, the <stdlib.h> header uses the word bufsize as a +parameter name in a function prototype. The "file.h" header #defines +bufsize to 4096, which leads to a parser error. + +Above fix made by rilling on 2005/03/11 + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. +3. Replaced (32bit) int references with proper Node * references. + +This prevents the segfault on startup in amd64 systems. + +--- src/ui_cli.c.orig 2003-03-14 04:55:14.000000000 +0000 ++++ src/ui_cli.c +@@ -22,14 +22,15 @@ + #include <config.h> + #endif + ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++ + #include "tree.h" + #include "file.h" + #include "path.h" + #include "prefs.h" + #include "cli.h" +-#include <stdio.h> +-#include <stdlib.h> +-#include <string.h> + #include "ui_cli.h" + + +@@ -49,7 +50,7 @@ static char *path_strip (char *path) + return path; + } + +-static int add (int argc,char **argv, void *data) ++static uint64_t add (int argc,char **argv, void *data) + { + Node *pos = (Node *) data; + Node *tnode; +@@ -65,10 +66,10 @@ static int add (int argc,char **argv, vo + + tnode = node_insert_down (node_bottom (pos)); + node_set (tnode, TEXT, argv[1]); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-static int addc (int argc,char **argv, void *data) ++static uint64_t addc (int argc,char **argv, void *data) + { + Node *pos = (Node *) data; + Node *tnode; +@@ -81,7 +82,7 @@ static int addc (int argc,char **argv, v + tnode = node_exact_match (argv[1], pos); + if (!tnode) { + cli_outfun ("specified parent not found"); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + if (node_right (tnode)) { +@@ -95,30 +95,30 @@ + else + node_set (tnode, TEXT, argv[2]); + +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-static int pwd (int argc,char **argv, void *data) ++static uint64_t pwd (int argc,char **argv, void *data) + { + Node *pos = (Node *) data; + + cli_outfun (path_strip (node2path (pos))); + cli_outfun ("\n"); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + +-static int cd (int argc, char **argv, void *data) ++static uint64_t cd (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + Node *tnode = pos; + + if(argc==1){ +- return (int)node_root(pos); ++ return PTR_TO_UINT64(node_root(pos)); + } + + if (!strcmp (argv[1], "..")){ + if (node_left (tnode) != 0) +- return (int) (node_left (tnode)); ++ return PTR_TO_UINT64((node_left (tnode))); + } + + +@@ -128,11 +129,11 @@ static int cd (int argc, char **argv, vo + } + if (!tnode) { + cli_outfun ("no such node\n"); +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } +- return (int) tnode; ++ return PTR_TO_UINT64(tnode); + +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + #include <ctype.h> +@@ -151,7 +152,7 @@ static void pre_command (char *commandli + } + } + +-static int ls (int argc, char **argv, void *data) ++static uint64_t ls (int argc, char **argv, void *data) + { + Node *pos = (Node *) data; + +@@ -188,7 +189,7 @@ static int ls (int argc, char **argv, vo + tnode = node_down (tnode); + } + } +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + /* +@@ -216,11 +216,12 @@ + + Node *docmd (Node *pos, const char *commandline) + { +- int ret; ++ Node * ret; + char *cmdline = strdup (commandline); + +- ret = cli_docmd (cmdline, pos); ++ ret = (Node *)cli_docmd (cmdline, pos); + free (cmdline); ++ + return (Node *) ret; + } + diff --git a/editors/hnb/patches/patch-src_ui__draw.c b/editors/hnb/patches/patch-src_ui__draw.c new file mode 100644 index 00000000000..0b7003f99ad --- /dev/null +++ b/editors/hnb/patches/patch-src_ui__draw.c @@ -0,0 +1,38 @@ +$NetBSD: patch-src_ui__draw.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/ui_draw.c.orig 2003-03-10 00:44:29.000000000 +0000 ++++ src/ui_draw.c +@@ -525,7 +525,7 @@ static struct { + + /* FIXME: make backup?,.. and make sure data is present,.., make possiblity to write back? */ + +-int display_format_cmd (int argc, char **argv, void *data) ++uint64_t display_format_cmd (int argc, char **argv, void *data) + { + char *p = argv[1]; + int width; +@@ -533,7 +533,7 @@ int display_format_cmd (int argc, char * + int col_no = 0; + + if(argc<2){ +- return (int)data; ++ return PTR_TO_UINT64(data); + } + + do { +@@ -618,7 +618,7 @@ int display_format_cmd (int argc, char * + + col_def[col_no].type = col_terminate; + +- return (int) data; ++ return PTR_TO_UINT64(data); + } + + diff --git a/editors/hnb/patches/patch-src_ui__edit.c b/editors/hnb/patches/patch-src_ui__edit.c new file mode 100644 index 00000000000..0dd7d72f404 --- /dev/null +++ b/editors/hnb/patches/patch-src_ui__edit.c @@ -0,0 +1,38 @@ +$NetBSD: patch-src_ui__edit.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/ui_edit.c.orig 2003-03-09 23:28:30.000000000 +0000 ++++ src/ui_edit.c +@@ -28,7 +28,7 @@ + #include "evilloop.h" + #include <stdlib.h> + +-static int ui_edit_cmd (int argc, char **argv, void *data) ++static uint64_t ui_edit_cmd (int argc, char **argv, void *data) + { + Tbinding *c; + int stop = 0; +@@ -61,7 +61,7 @@ static int ui_edit_cmd (int argc, char * + } + } + ui_current_scope = tempscope; +- return (int) pos; ++ return PTR_TO_UINT64(pos); + } + + node_backup = node_duplicate (pos); +@@ -208,7 +208,7 @@ static int ui_edit_cmd (int argc, char * + } + node_free (node_backup); + ui_current_scope = tempscope; +- return (int) data; ++ return PTR_TO_UINT64(data); + } + + int ui_getstr_loc (char *input, int x, int y, int maxlen) diff --git a/editors/hnb/patches/patch-src_ui__menu.c b/editors/hnb/patches/patch-src_ui__menu.c new file mode 100644 index 00000000000..270feffa215 --- /dev/null +++ b/editors/hnb/patches/patch-src_ui__menu.c @@ -0,0 +1,33 @@ +$NetBSD: patch-src_ui__menu.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/ui_menu.c.orig 2003-03-14 03:54:52.000000000 +0000 ++++ src/ui_menu.c +@@ -109,10 +109,10 @@ static Node *menu_do(Node *pos){ + return pos; + } + +-static int cmd_menu(int argc,char **argv,void *data){ ++static uint64_t cmd_menu(int argc,char **argv,void *data){ + Node *pos=(Node *)data; + if(argc==1){ /* draw menu */ +- return (int)menu_do(pos); ++ return PTR_TO_UINT64(menu_do(pos)); + } else if(argc==4){ + char *submenu=argv[1]; + char *label=argv[2]; +@@ -142,7 +142,7 @@ + if(menu[col][row].width>menu[col][0].width) + menu[col][0].width=menu[col][row].width; + } +- return(int)pos; ++ return PTR_TO_UINT64(pos); + } + + /* diff --git a/editors/hnb/patches/patch-src_ui__overlay.c b/editors/hnb/patches/patch-src_ui__overlay.c new file mode 100644 index 00000000000..f8450369ab1 --- /dev/null +++ b/editors/hnb/patches/patch-src_ui__overlay.c @@ -0,0 +1,43 @@ +$NetBSD: patch-src_ui__overlay.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/ui_overlay.c.orig 2003-03-14 00:35:14.000000000 +0000 ++++ src/ui_overlay.c +@@ -44,11 +44,11 @@ + + static char *ui_helptext[MAX_SCOPES] = { 0 }; + +-static int ui_helptext_cmd (int argc, char **argv, void *data) ++static uint64_t ui_helptext_cmd (int argc, char **argv, void *data) + { + if(argc>1) + ui_helptext[ui_current_scope] = strdup (argv[1]); +- return (int) data; ++ return PTR_TO_UINT64(data); + } + + #define MAX_STATUS_LINES 100 +@@ -129,7 +129,7 @@ void set_status (char *message) + } + + +-static int ui_status_cmd (int argc, char **argv, void *data) ++static uint64_t ui_status_cmd (int argc, char **argv, void *data) + { + if(argc==2 && (!strcmp(argv[1],"-c") || !strcmp(argv[1],"--clear"))){ + status_ttl=0; +@@ -138,7 +138,7 @@ static int ui_status_cmd (int argc, char + if(!ui_inited) + cli_outfun(argv[1]); + } +- return (int) data; ++ return PTR_TO_UINT64(data); + } + + diff --git a/editors/hnb/patches/patch-src_ui__style.c b/editors/hnb/patches/patch-src_ui__style.c new file mode 100644 index 00000000000..d8bbf98c143 --- /dev/null +++ b/editors/hnb/patches/patch-src_ui__style.c @@ -0,0 +1,47 @@ +$NetBSD: patch-src_ui__style.c,v 1.1 2018/11/26 09:15:53 fox Exp $ + +1. Replaced int with uint64_t to avoid truncating pointer to (32bit) + int by using a wider type. +2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to + help convert the pointer to uint64_t. + +This prevents the segfault on startup in amd64 systems. + +--- src/ui_style.c.orig 2003-03-09 18:25:19.000000000 +0000 ++++ src/ui_style.c +@@ -116,7 +116,7 @@ void ui_style_restore_color () + } + } + +-static int ui_style_cmd (int argc, char **argv, void *data) ++static uint64_t ui_style_cmd (int argc, char **argv, void *data) + { + char *item; + char *colors; +@@ -124,7 +124,7 @@ static int ui_style_cmd (int argc, char + + if(argc!=4){ + cli_outfunf("usage: %i <item> <fg/bg> <atts>"); +- return (int)data; ++ return PTR_TO_UINT64(data); + } + + item=argv[1]; +@@ -137,7 +137,7 @@ static int ui_style_cmd (int argc, char + + if (style_no == -1) { + printf ("unknown style 'style [%s] %s %s'\n", item, colors, atts); +- return (int) data; ++ return PTR_TO_UINT64(data); + } + color2 = strchr (colors, '/'); + color2[0] = '\0'; +@@ -166,7 +166,7 @@ static int ui_style_cmd (int argc, char + bkgdset (' ' + COLOR_PAIR (ui_style_background)); + } + } +- return (int) data; ++ return PTR_TO_UINT64(data); + } + + /* |