View | Details | Raw Unified | Return to bug 240770 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-12 / +11 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	hnb
4
PORTNAME=	hnb
5
PORTVERSION=	1.9.17
5
PORTVERSION=	1.9.17
6
PORTREVISION=	1
6
PORTREVISION=	2
7
CATEGORIES=	editors
7
CATEGORIES=	editors
8
MASTER_SITES=	SF
8
MASTER_SITES=	SF
9
9
Lines 11-26 Link Here
11
COMMENT=	Hierarchical NoteBook a data organizer
11
COMMENT=	Hierarchical NoteBook a data organizer
12
12
13
LICENSE=	GPLv2+
13
LICENSE=	GPLv2+
14
LICENSE_FILE=	${WRKSRC}/../COPYING
14
LICENSE_FILE=	${WRKSRC}/COPYING
15
15
16
ONLY_FOR_ARCHS=	i386
16
USES=		gmake
17
17
18
USES=		gmake
19
ALL_TARGET=	# empty
20
MAKE_JOBS_UNSAFE=	yes
18
MAKE_JOBS_UNSAFE=	yes
21
19
22
WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}/src
23
24
PLIST_FILES=	bin/${PORTNAME} \
20
PLIST_FILES=	bin/${PORTNAME} \
25
		man/man1/${PORTNAME}.1.gz
21
		man/man1/${PORTNAME}.1.gz
26
PORTDOCS=	*
22
PORTDOCS=	*
Lines 29-43 Link Here
29
25
30
post-patch:
26
post-patch:
31
	@${REINPLACE_CMD} -e 's|^CFLAGS=|CFLAGS+=|; s|make|$${MAKE}|' \
27
	@${REINPLACE_CMD} -e 's|^CFLAGS=|CFLAGS+=|; s|make|$${MAKE}|' \
32
		${WRKSRC}/Makefile
28
		${WRKSRC}/src/Makefile
33
	@${REINPLACE_CMD} -e '/^CFLAGS/d' ${WRKSRC}/libcli/Makefile
29
	@${REINPLACE_CMD} -e '/^CFLAGS/d' ${WRKSRC}/src/libcli/Makefile
34
30
31
do-build:
32
	cd ${WRKSRC}/src && ${GMAKE}
33
35
do-install:
34
do-install:
36
	${INSTALL_PROGRAM} ${WRKSRC}/hnb ${STAGEDIR}${PREFIX}/bin
35
	${INSTALL_PROGRAM} ${WRKSRC}/src/hnb ${STAGEDIR}${PREFIX}/bin
37
	${INSTALL_MAN}	${WRKSRC}/../doc/hnb.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
36
	${INSTALL_MAN}	${WRKSRC}/doc/hnb.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
38
	${MKDIR} ${STAGEDIR}${DOCSDIR}
37
	${MKDIR} ${STAGEDIR}${DOCSDIR}
39
.for FILE in Documentation.hnb Documentation.html hnbrc
38
.for FILE in Documentation.hnb Documentation.html hnbrc
40
	${INSTALL_DATA} ${WRKSRC}/../doc/${FILE} ${STAGEDIR}${DOCSDIR}
39
	${INSTALL_DATA} ${WRKSRC}/doc/${FILE} ${STAGEDIR}${DOCSDIR}
41
.endfor
40
.endfor
42
41
43
.include <bsd.port.mk>
42
.include <bsd.port.mk>
(-)distinfo (+1 lines)
Lines 1-2 Link Here
1
TIMESTAMP = 1567488547
1
SHA256 (hnb-1.9.17.tar.gz) = c233c00aaef5b7fb93759d7888c885f99f40aec689a7f3e0d5d8b5797bf80cd4
2
SHA256 (hnb-1.9.17.tar.gz) = c233c00aaef5b7fb93759d7888c885f99f40aec689a7f3e0d5d8b5797bf80cd4
2
SIZE (hnb-1.9.17.tar.gz) = 143700
3
SIZE (hnb-1.9.17.tar.gz) = 143700
(-)files/patch-src_Makefile (+33 lines)
Line 0 Link Here
1
Added the curses library path for ports.
2
3
--- src/Makefile.orig	2003-03-13 01:09:46 UTC
4
+++ src/Makefile
5
@@ -1,5 +1,5 @@
6
-LIBS=-lncurses libcli/libcli.a
7
-CFLAGS=-I.. -Ilibcli -DHAVE_CONFIG_H -Wall -pedantic -g
8
+LIBS=-Wl,-R${PREFIX}/lib -lncurses libcli/libcli.a
9
+CFLAGS+=-I.. -Ilibcli -DHAVE_CONFIG_H -Wall -pedantic -g
10
 
11
 CFILES=$(wildcard *.c)
12
 OBJS=$(patsubst %.c,%.o,$(CFILES))
13
@@ -11,9 +11,9 @@ hnb: libcli/libcli.a Makefile $(OBJS) init_subsystems.
14
 	$(CC) -o hnb $(OBJS) $(LIBS) $(CFLAGS)
15
 #	strip hnb
16
 libcli/libcli.a: libcli/*.c
17
-	(cd libcli;make libcli.a)
18
+	(cd libcli;${MAKE} libcli.a)
19
 libcli/libcli_p.a: libcli/*.c
20
-	(cd libcli;make libcli_p.a)
21
+	(cd libcli;${MAKE} libcli_p.a)
22
 init_subsystems.c: *.c
23
 	echo "/* this file is autogenerated, do not edit */">init_subsystems.c
24
 	cat *.c | grep "^\!init_" | sort | sed -e "s/^\!/void /g">>init_subsystems.c
25
@@ -23,7 +23,7 @@ init_subsystems.c: *.c
26
 	echo "}">>init_subsystems.c
27
 clean:
28
 	rm -f xml_debug hnb $(OBJS) *~ cli_*.inc
29
-	(cd libcli;make clean)
30
+	(cd libcli;${MAKE} clean)
31
 hnb_p: *.c libcli/libcli_p.a init_subsystems.c
32
 	$(CC) -o hnb_p *.c -pg -lncurses_p libcli/libcli_p.a -I.. -Ilibcli -DHAVE_CONFIG_H
33
 
(-)files/patch-src_actions.c (+53 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/actions.c.orig	2003-03-14 01:06:36 UTC
9
+++ src/actions.c
10
@@ -32,7 +32,7 @@ static char address[1024]="";*/
11
 static char web_command[255] = "galeon -n *";
12
 static char mail_command[255] = "rxvt -rv +sb -e mutt *";
13
 
14
-static int cmd_system(int argc, char **argv, void *data){
15
+static uint64_t cmd_system(int argc, char **argv, void *data){
16
 	Node *pos=(Node *)data;
17
 	int ui_was_inited = ui_inited;
18
 	if (argc>1) {
19
@@ -42,7 +42,7 @@ static int cmd_system(int argc, char **argv, void *dat
20
 		if (ui_was_inited)
21
 			ui_init ();
22
 	}
23
-	return (int)pos;
24
+	return PTR_TO_UINT64(pos);
25
 }
26
 
27
 static int action_node (Node *node)
28
@@ -136,21 +136,21 @@ static int action_node (Node *node)
29
  * url/email address substring,.. and launches an app based on that?
30
  *
31
  */
32
-static int cmd_action (int argc, char **argv, void *data)
33
+static uint64_t cmd_action (int argc, char **argv, void *data)
34
 {
35
 	Node *pos = (Node *) data;
36
 	Node *node = node_right (pos);
37
 
38
 	while (node) {
39
 		if (!action_node (node))
40
-			return (int) pos;
41
+			return PTR_TO_UINT64(pos);
42
 		node = node_down (node);
43
 	}
44
 	if (!action_node (pos)) {
45
-		return (int) pos;
46
+		return PTR_TO_UINT64(pos);
47
 	} else {
48
 		cli_outfunf ("nothing to do");
49
-		return (int) pos;
50
+		return PTR_TO_UINT64(pos);
51
 	}
52
 
53
 	/***
(-)files/patch-src_cal.c (+59 lines)
Line 0 Link Here
1
1. The <stdlib.h> header uses the word bufsize as a parameter name in
2
   a function prototype. The "file.h" header #defines bufsize to 4096,
3
   which leads to a parser error.
4
2. Replaced int with uint64_t to avoid truncating pointer to (32bit)
5
   int by using a wider type.
6
3. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
7
   help convert the pointer to uint64_t.
8
9
This prevents the segfault on startup in amd64 systems. 
10
11
--- src/cal.c.orig	2003-03-09 18:18:01 UTC
12
+++ src/cal.c
13
@@ -19,15 +19,15 @@
14
  */
15
 
16
 /**************/
17
+#include <stdlib.h>
18
+#include <stdio.h>
19
+#include <time.h>
20
+
21
 #include "tree.h"
22
 #include "cli.h"
23
 #include "ui.h"
24
 #include "file.h"
25
 
26
-#include <stdlib.h>
27
-#include <stdio.h>
28
-#include <time.h>
29
-
30
 static char *const wday[] = 
31
 	{ "Sun", "Mon", "Tue",  "Wed", "Thu", "Fri", "Sat", "   "};
32
 
33
@@ -35,7 +35,7 @@ static char *const mname[] = {
34
 	  "", "January", "February", "March", "April", "May" ,"June", "July",
35
 	  "August", "September", "October", "November" , "December"};
36
 
37
-static int insert_cal(int argc, char **argv, void *data){
38
+static uint64_t insert_cal(int argc, char **argv, void *data){
39
 	Node *pos=(void *)data;
40
 
41
 	int year;
42
@@ -44,7 +44,7 @@ static int insert_cal(int argc, char **argv, void *dat
43
 	
44
 	if( (argc!=3) || (atoi(argv[1])>12 )){
45
 		cli_outfunf("usage: %s <month> <year>", argv[0]);
46
-		return (int)data;
47
+		return PTR_TO_UINT64(data);
48
 	}
49
 
50
 	month=atoi(argv[1]);
51
@@ -96,7 +96,7 @@ static int insert_cal(int argc, char **argv, void *dat
52
 		}
53
 	}	
54
 
55
-	return (int)pos;
56
+	return PTR_TO_UINT64(pos);
57
 }
58
 
59
 /*
(-)files/patch-src_cli__macro.c (+45 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/cli_macro.c.orig	2003-03-09 20:44:27 UTC
9
+++ src/cli_macro.c
10
@@ -80,7 +80,7 @@ static Node *do_macro(MacroT *macro, Node *pos){
11
 	return pos;
12
 }
13
 
14
-static int cmd_macro (int argc, char **argv, void *data)
15
+static uint64_t cmd_macro (int argc, char **argv, void *data)
16
 {
17
 	Node *pos=(Node *)data;
18
 	if(argc==1){
19
@@ -88,7 +88,7 @@ static int cmd_macro (int argc, char **argv, void *dat
20
 	} else if(argc==2){
21
 		MacroT *tmacro=lookup_macro(argv[1]);
22
 		if(tmacro){
23
-			return (int)do_macro(tmacro,pos);
24
+			return PTR_TO_UINT64(do_macro(tmacro,pos));
25
 		} else {
26
 			cli_outfunf("no such macro defined '%s'",argv[1]);
27
 		}
28
@@ -97,7 +97,7 @@ static int cmd_macro (int argc, char **argv, void *dat
29
 		if(!strcmp(argv[1],"define") ){
30
 			if(lookup_macro(argv[2])){
31
 				cli_outfunf("error macro %s already exist,.. this might turn out badly,.. " ,argv[2]);
32
-				return (int) pos;
33
+				return PTR_TO_UINT64(pos);
34
 			} else {
35
 				MacroT *tmacro;
36
 				if(!macro){
37
@@ -119,7 +119,7 @@ static int cmd_macro (int argc, char **argv, void *dat
38
 			
39
 		}
40
 	}
41
-	return (int) pos;
42
+	return PTR_TO_UINT64(pos);
43
 }
44
 
45
 
(-)files/patch-src_clipboard.c (+53 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/clipboard.c.orig	2003-03-09 17:42:20 UTC
9
+++ src/clipboard.c
10
@@ -29,7 +29,7 @@
11
 
12
 static Node *clipboard = NULL;
13
 
14
-static int copy_cmd (int argc,char **argv, void *data)
15
+static uint64_t copy_cmd (int argc,char **argv, void *data)
16
 {
17
 	Node *pos = (Node *) data;
18
 
19
@@ -39,10 +39,10 @@ static int copy_cmd (int argc,char **argv, void *data)
20
 	clipboard = node_new ();
21
 
22
 	clipboard = tree_duplicate (pos, clipboard);
23
-	return (int) pos;
24
+	return PTR_TO_UINT64(pos);
25
 }
26
 
27
-static int cut_cmd (int argc,char **argv, void *data)
28
+static uint64_t cut_cmd (int argc,char **argv, void *data)
29
 {
30
 	Node *pos = (Node *) data;
31
 
32
@@ -53,10 +53,10 @@ static int cut_cmd (int argc,char **argv, void *data)
33
 
34
 	clipboard = tree_duplicate (pos, clipboard);
35
 	pos = node_remove (pos);
36
-	return (int) pos;
37
+	return PTR_TO_UINT64(pos);
38
 }
39
 
40
-static int paste_cmd (int argc,char **argv, void *data)
41
+static uint64_t paste_cmd (int argc,char **argv, void *data)
42
 {
43
 	Node *pos = (Node *) data;
44
 
45
@@ -68,7 +68,7 @@ static int paste_cmd (int argc,char **argv, void *data
46
 		temp = node_insert_down (pos);
47
 		tree_duplicate (clipboard, temp);
48
 	}
49
-	return (int) pos;
50
+	return PTR_TO_UINT64(pos);
51
 }
52
 
53
 /*
(-)files/patch-src_evilloop.c (+22 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/evilloop.c.orig	2003-03-14 04:40:35 UTC
9
+++ src/evilloop.c
10
@@ -122,10 +122,10 @@ static char *keep_inputbuf[]={
11
 
12
 int quit_hnb=0;
13
 
14
-static int cmd_quit(int argc,char **argv,void *data){
15
+static uint64_t cmd_quit(int argc,char **argv,void *data){
16
 	Node *pos=(Node *)data;
17
 	quit_hnb=1;
18
-	return (int)pos;
19
+	return PTR_TO_UINT64(pos);
20
 }
21
 
22
 /*
(-)files/patch-src_expanded.c (+70 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/expanded.c.orig	2003-03-13 21:31:18 UTC
9
+++ src/expanded.c
10
@@ -18,16 +18,18 @@
11
  * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
12
  */
13
 
14
+#include <string.h>
15
+
16
 #include "tree.h"
17
 #include "cli.h"
18
-#define NULL 0
19
+//#define NULL 0
20
 
21
 #include "evilloop.h"
22
 #include "ctype.h"
23
 #include "ui_binding.h"
24
 
25
 
26
-static int cmd_expand (int argc,char **argv, void *data)
27
+static uint64_t cmd_expand (int argc,char **argv, void *data)
28
 {
29
 	Node *pos = (Node *) data;
30
 	if(argc==1){
31
@@ -36,7 +38,7 @@ static int cmd_expand (int argc,char **argv, void *dat
32
 				inputbuf[strlen (inputbuf) + 1] = 0;
33
 				inputbuf[strlen (inputbuf)] = lastbinding->key;
34
 			}
35
-			return (int)pos;
36
+			return PTR_TO_UINT64(pos);
37
 		}
38
 		node_setflag(pos,F_expanded,1);
39
 	} else if((!strcmp(argv[1],"-a"))||(!strcmp(argv[1],"--all"))){
40
@@ -48,10 +50,10 @@ static int cmd_expand (int argc,char **argv, void *dat
41
 		}
42
 		cli_outfun ("expanded all nodes");
43
 	}
44
-	return (int) pos;
45
+	return PTR_TO_UINT64(pos);
46
 }
47
 
48
-static int cmd_collapse (int argc,char **argv, void *data)
49
+static uint64_t cmd_collapse (int argc,char **argv, void *data)
50
 {
51
 	Node *pos = (Node *) data;
52
 	if(argc==1){
53
@@ -60,7 +62,7 @@ static int cmd_collapse (int argc,char **argv, void *d
54
 				inputbuf[strlen (inputbuf) + 1] = 0;
55
 				inputbuf[strlen (inputbuf)] = lastbinding->key;
56
 			}		
57
-			return (int)pos;
58
+			return PTR_TO_UINT64(pos);
59
 		}
60
 		node_setflag(pos,F_expanded,0);
61
 	} else if((!strcmp(argv[1],"-a"))||(!strcmp(argv[1],"--all"))){
62
@@ -73,7 +75,7 @@ static int cmd_collapse (int argc,char **argv, void *d
63
 		cli_outfun ("collapsed all nodes");
64
 	}
65
 	
66
-	return (int) pos;
67
+	return PTR_TO_UINT64(pos);
68
 }
69
 
70
 /*
(-)files/patch-src_file.c (+40 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/file.c.orig	2003-03-13 22:55:13 UTC
9
+++ src/file.c
10
@@ -150,7 +150,7 @@ int file_check (char *filename)
11
 }
12
 
13
 
14
-static int cmd_save (int argc,char **argv, void *data)
15
+static uint64_t cmd_save (int argc,char **argv, void *data)
16
 {
17
 	Node *pos = (Node *) data;
18
 
19
@@ -167,10 +167,10 @@ static int cmd_save (int argc,char **argv, void *data)
20
 			docmd (node_root (pos), buf);
21
 		}
22
 	}
23
-	return (int) pos;
24
+	return PTR_TO_UINT64(pos);
25
 }
26
 
27
-static int cmd_revert (int argc,char **argv, void *data)
28
+static uint64_t cmd_revert (int argc,char **argv, void *data)
29
 {
30
 	Node *pos = (Node *) data;
31
 
32
@@ -185,7 +185,7 @@ static int cmd_revert (int argc,char **argv, void *dat
33
 			pos=docmd (pos, buf);
34
 		}
35
 	}
36
-	return (int) pos;
37
+	return PTR_TO_UINT64(pos);
38
 }
39
 
40
 
(-)files/patch-src_file__ascii.c (+63 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/file_ascii.c.orig	2003-03-14 00:37:39 UTC
9
+++ src/file_ascii.c
10
@@ -34,7 +34,7 @@
11
 
12
 static int ascii_margin = -1;
13
 
14
-static int import_ascii (int argc, char **argv, void *data)
15
+static uint64_t import_ascii (int argc, char **argv, void *data)
16
 {
17
 	Node *node = (Node *) data;
18
 	char *filename = argc==2?argv[1]:"";
19
@@ -46,7 +46,7 @@ static int import_ascii (int argc, char **argv, void *
20
 	file = fopen (filename, "r");
21
 	if (file == NULL) {
22
 		cli_outfunf ("ascii import, unable to open \"%s\"", filename);
23
-		return (int) (node);
24
+		return PTR_TO_UINT64 (node);
25
 	}
26
 
27
 	init_import (&ist, node);
28
@@ -73,7 +73,7 @@ static int import_ascii (int argc, char **argv, void *
29
 	cli_outfunf ("ascii import, imported \"%s\"", filename);
30
 
31
 
32
-	return (int) (node);
33
+	return PTR_TO_UINT64 (node);
34
 }
35
 
36
 static void ascii_export_node (FILE * file, int level, int flags, char *data)
37
@@ -95,7 +95,7 @@ static void ascii_export_node (FILE * file, int level,
38
 	}
39
 }
40
 
41
-static int export_ascii (int argc, char **argv, void *data)
42
+static uint64_t export_ascii (int argc, char **argv, void *data)
43
 {
44
 	Node *node = (Node *) data;
45
 	char *filename = argc==2?argv[1]:"";
46
@@ -110,7 +110,7 @@ static int export_ascii (int argc, char **argv, void *
47
 		file = fopen (filename, "w");
48
 	if (!file) {
49
 		cli_outfunf ("ascii export, unable to open \"%s\"", filename);
50
-		return (int) node;
51
+		return PTR_TO_UINT64(node);
52
 	}
53
 	startlevel = nodes_left (node);
54
 
55
@@ -130,7 +130,7 @@ static int export_ascii (int argc, char **argv, void *
56
 
57
 	cli_outfunf ("ascii export, wrote output to \"%s\"", filename);
58
 
59
-	return (int) node;
60
+	return PTR_TO_UINT64(node);
61
 }
62
 
63
 
(-)files/patch-src_file__help.c (+49 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/file_help.c.orig	2003-03-14 00:37:23 UTC
9
+++ src/file_help.c
10
@@ -42,7 +42,7 @@ static char *helpquote[]={
11
 
12
 /* *INDENT-ON* */
13
 
14
-static int export_help (int argc, char **argv, void *data)
15
+static uint64_t export_help (int argc, char **argv, void *data)
16
 {
17
 	Node *node = (Node *) data;
18
 	char *filename = argc==2?argv[1]:"";
19
@@ -55,7 +55,7 @@ static int export_help (int argc, char **argv, void *d
20
 	if (!file) {
21
 		cli_outfunf ("help export, unable to open \"%s\"", filename);
22
 
23
-		return (int) node;
24
+		return PTR_TO_UINT64(node);
25
 	}
26
 	startlevel = nodes_left (node);
27
 
28
@@ -86,10 +86,10 @@ static int export_help (int argc, char **argv, void *d
29
 	fclose (file);
30
 
31
 	cli_outfunf ("help export, wrote data to \"%s\"", filename);
32
-	return (int) node;
33
+	return PTR_TO_UINT64(node);
34
 }
35
 
36
-static int import_help (int argc, char **argv, void *data)
37
+static uint64_t import_help (int argc, char **argv, void *data)
38
 {
39
 	Node *node = (Node *) data;
40
 	import_state_t ist;
41
@@ -100,7 +100,7 @@ static int import_help (int argc, char **argv, void *d
42
 	if (node_getflag (node, F_temp))
43
 		node = node_remove (node);
44
 
45
-	return (int) (node);
46
+	return PTR_TO_UINT64(node);
47
 }
48
 
49
 /*
(-)files/patch-src_file__hnb.c (+67 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t.
2
2. Replaced pointer to int type cast with a macro to help
3
   convert the pointer to uint64_t.
4
5
This prevents the segfault on startup in amd64 systems.
6
7
--- src/file_hnb.c.orig	2003-03-14 00:37:13 UTC
8
+++ src/file_hnb.c
9
@@ -105,7 +105,7 @@ static void hnb_export_nodes (FILE * file, Node *node,
10
 	}
11
 }
12
 
13
-static int export_hnb (int argc, char **argv, void *data)
14
+static uint64_t export_hnb (int argc, char **argv, void *data)
15
 {
16
 	Node *node = (Node *) data;
17
 	char *filename = argc>=2?argv[1]:"";
18
@@ -118,7 +118,7 @@ static int export_hnb (int argc, char **argv, void *da
19
 
20
 	if (!file) {
21
 		cli_outfunf ("hnb export, unable to open \"%s\"", filename);
22
-		return (int) node;
23
+		return PTR_TO_UINT64(node);
24
 	}
25
 
26
 	fprintf (file, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><?pos=\"%s\"?>\n\
27
@@ -143,11 +143,11 @@ static int export_hnb (int argc, char **argv, void *da
28
 
29
 	cli_outfunf ("hnb export, wrote data to \"%s\"", filename);
30
 
31
-	return (int) node;
32
+	return PTR_TO_UINT64(node);
33
 }
34
 
35
 
36
-static int import_hnb (int argc, char **argv, void *data)
37
+static uint64_t import_hnb (int argc, char **argv, void *data)
38
 {
39
 	Node *node = (Node *) data;
40
 	char *filename = argc==2?argv[1]:"";
41
@@ -170,7 +170,7 @@ static int import_hnb (int argc, char **argv, void *da
42
 	file = fopen (filename, "r");
43
 	if (!file) {
44
 		cli_outfunf ("hnb import, unable to open \"%s\"", filename);
45
-		return (int) node;
46
+		return PTR_TO_UINT64(node);
47
 	}
48
 	s = xml_tok_init (file);
49
 	init_import (&ist, node);
50
@@ -180,7 +180,7 @@ static int import_hnb (int argc, char **argv, void *da
51
 			cli_outfunf ("hnb import error, parsing og '%s' line:%i, %s", filename,
52
 						 s->line_no, rdata);
53
 			fclose (file);
54
-			return (int) node;
55
+			return PTR_TO_UINT64(node);
56
 		}
57
 		if (in_tree) {
58
 			if (type == t_tag && !strcmp (rdata, "node")) {
59
@@ -263,7 +263,7 @@ static int import_hnb (int argc, char **argv, void *da
60
 
61
 	xml_tok_cleanup (s);
62
 
63
-	return (int) node;
64
+	return PTR_TO_UINT64(node);
65
 }
66
 
67
 /*
(-)files/patch-src_file__html.c (+63 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/file_html.c.orig	2003-03-14 00:36:52 UTC
9
+++ src/file_html.c
10
@@ -52,7 +52,7 @@ static char *htmlquote[]={
11
 /* *INDENT-ON* */
12
 
13
 
14
-static int export_html (int argc, char **argv, void *data)
15
+static uint64_t export_html (int argc, char **argv, void *data)
16
 {
17
 	Node *node = (Node *) data;
18
 	char *filename = argc==2?argv[1]:"";
19
@@ -67,7 +67,7 @@ static int export_html (int argc, char **argv, void *d
20
 		file = fopen (filename, "w");
21
 	if (!file) {
22
 		cli_outfunf ("html export, unable to open \"%s\"", filename);
23
-		return (int) node;
24
+		return PTR_TO_UINT64(node);
25
 	}
26
 
27
 	startlevel = nodes_left (node);
28
@@ -130,7 +130,7 @@ static int export_html (int argc, char **argv, void *d
29
 		fclose (file);
30
 
31
 	cli_outfunf ("html export, saved output in \"%s\"", filename);
32
-	return (int) node;
33
+	return  PTR_TO_UINT64(node);
34
 }
35
 
36
 static void htmlcss_export_nodes (FILE * file, Node *node, int level)
37
@@ -162,7 +162,7 @@ static void htmlcss_export_nodes (FILE * file, Node *n
38
 }
39
 
40
 
41
-static int export_htmlcss (int argc, char **argv, void *data)
42
+static uint64_t export_htmlcss (int argc, char **argv, void *data)
43
 {
44
 	Node *node = (Node *) data;
45
 	char *filename = argc==2?argv[1]:"";
46
@@ -174,7 +174,7 @@ static int export_htmlcss (int argc, char **argv, void
47
 		file = fopen (filename, "w");
48
 	if (!file) {
49
 		cli_outfunf ("html export, unable to open \"%s\"", filename);
50
-		return (int) node;
51
+		return PTR_TO_UINT64(node);
52
 	}
53
 
54
 	fprintf (file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
55
@@ -224,7 +224,7 @@ div.level2 {\n\
56
 		fclose (file);
57
 
58
 	cli_outfunf ("html css export, saved output in \"%s\"", filename);
59
-	return (int) node;
60
+	return PTR_TO_UINT64(node);
61
 }
62
 
63
 /*
(-)files/patch-src_file__opml.c (+67 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/file_opml.c.orig	2003-03-14 00:36:39 UTC
9
+++ src/file_opml.c
10
@@ -90,7 +90,7 @@ static void opml_export_nodes (FILE * file, Node *node
11
 	}
12
 }
13
 
14
-static int export_opml (int argc, char **argv, void *data)
15
+static uint64_t export_opml (int argc, char **argv, void *data)
16
 {
17
 	Node *node = (Node *) data;
18
 	char *filename = argc>=2?argv[1]:"";
19
@@ -103,7 +103,7 @@ static int export_opml (int argc, char **argv, void *d
20
 
21
 	if (!file) {
22
 		cli_outfunf ("opml export, unable to open \"%s\"", filename);
23
-		return (int) node;
24
+		return PTR_TO_UINT64(node);
25
 	}
26
 
27
 	fprintf (file, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><?pos=\"%s\"?>\n\
28
@@ -133,10 +133,10 @@ static int export_opml (int argc, char **argv, void *d
29
 
30
 	cli_outfunf ("opml export, wrote data to \"%s\"", filename);
31
 
32
-	return (int) node;
33
+	return PTR_TO_UINT64(node);
34
 }
35
 
36
-static int import_opml (int argc, char **argv, void *data)
37
+static uint64_t import_opml (int argc, char **argv, void *data)
38
 {
39
 	Node *node = (Node *) data;
40
 	char *filename = argc==2?argv[1]:"";
41
@@ -154,7 +154,7 @@ static int import_opml (int argc, char **argv, void *d
42
 	file = fopen (filename, "r");
43
 	if (!file) {
44
 		cli_outfunf ("opml import, unable to open \"%s\"", filename);
45
-		return (int) node;
46
+		return PTR_TO_UINT64(node);
47
 	}
48
 	s = xml_tok_init (file);
49
 	init_import (&ist, node);
50
@@ -164,7 +164,7 @@ static int import_opml (int argc, char **argv, void *d
51
 			cli_outfunf ("opml import error, parsing og '%s', line:%i %s", filename,
52
 						 s->line_no, rdata);
53
 			fclose (file);
54
-			return (int) node;
55
+			return PTR_TO_UINT64(node);
56
 		}
57
 		if (in_body) {
58
 			if (type == t_tag && !strcmp (rdata, "outline")) {
59
@@ -208,7 +208,7 @@ static int import_opml (int argc, char **argv, void *d
60
 
61
 	cli_outfunf ("opml import - imported \"%s\" %i lines", filename, s->line_no);
62
 	xml_tok_cleanup (s);
63
-	return (int) node;
64
+	return PTR_TO_UINT64(node);
65
 }
66
 
67
 
(-)files/patch-src_file__ps.c (+36 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/file_ps.c.orig	2003-03-14 00:36:23 UTC
9
+++ src/file_ps.c
10
@@ -60,7 +60,7 @@ static void ps_export_node (FILE * file, int level, in
11
 	free(quoted);
12
 }
13
 
14
-static int export_ps (int argc, char **argv, void *data)
15
+static uint64_t export_ps (int argc, char **argv, void *data)
16
 {
17
 	Node *node = (Node *) data;
18
 	char *filename = argc==2?argv[1]:"";
19
@@ -75,7 +75,7 @@ static int export_ps (int argc, char **argv, void *dat
20
 		file = fopen (filename, "w");
21
 	if (!file) {
22
 		cli_outfunf ("postscript export, unable to open \"%s\"", filename);
23
-		return (int) node;
24
+		return PTR_TO_UINT64(node);
25
 	}
26
 	startlevel = nodes_left (node);
27
 
28
@@ -225,7 +225,7 @@ close\n\
29
 	cli_outfunf ("postscript export, saved output to \"%s\"", filename);
30
 	if (file != stdout)
31
 		fclose (file);
32
-	return (int) node;
33
+	return PTR_TO_UINT64(node);
34
 }
35
 
36
 /*
(-)files/patch-src_file__xml.c (+72 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/file_xml.c.orig	2003-03-14 00:36:08 UTC
9
+++ src/file_xml.c
10
@@ -147,7 +147,7 @@ static void xml_export_nodes (FILE * file, Node *node,
11
 	}
12
 }
13
 
14
-static int export_xml (int argc, char **argv, void *data)
15
+static uint64_t export_xml (int argc, char **argv, void *data)
16
 {
17
 	Node *node = (Node *) data;
18
 	char *filename = argc==2?argv[1]:"";
19
@@ -159,7 +159,7 @@ static int export_xml (int argc, char **argv, void *da
20
 		file = fopen (filename, "w");
21
 	if (!file) {
22
 		cli_outfunf ("xml export, unable to open \"%s\"", filename);
23
-		return (int) node;
24
+		return PTR_TO_UINT64(node);
25
 	}
26
 
27
 	xml_export_nodes (file, node, 0);
28
@@ -170,7 +170,7 @@ static int export_xml (int argc, char **argv, void *da
29
 	cli_outfunf ("xml export, wrote data to \"%s\"", filename);
30
 
31
 
32
-	return (int) node;
33
+	return PTR_TO_UINT64(node);
34
 }
35
 
36
 /* joins up tags with data if there is data as the first child
37
@@ -202,7 +202,7 @@ static Node *xml_cuddle_nodes (Node *node)
38
 }
39
 
40
 
41
-static int import_xml (int argc, char **argv, void *data)
42
+static uint64_t import_xml (int argc, char **argv, void *data)
43
 {
44
 	Node *node = (Node *) data;
45
 	char *filename = argc==2?argv[1]:"";
46
@@ -221,7 +221,7 @@ static int import_xml (int argc, char **argv, void *da
47
 	file = fopen (filename, "r");
48
 	if (!file) {
49
 		cli_outfunf ("xml import, unable to open \"%s\"", filename);
50
-		return (int) node;
51
+		return PTR_TO_UINT64(node);
52
 	}
53
 	s = xml_tok_init (file);
54
 	init_import (&ist, node);
55
@@ -231,7 +231,7 @@ static int import_xml (int argc, char **argv, void *da
56
 			cli_outfunf ("xml import error, parsing og '%s', line:%i %s", filename,
57
 						 s->line_no,rdata);
58
 			fclose (file);
59
-			return (int) node;
60
+			return PTR_TO_UINT64(node);
61
 		}
62
 
63
 		switch (type) {
64
@@ -328,7 +328,7 @@ static int import_xml (int argc, char **argv, void *da
65
 
66
 	cli_outfunf ("xml import - imported \"%s\" %i lines", filename, s->line_no);
67
 	xml_tok_cleanup (s);
68
-	return (int) node;
69
+	return PTR_TO_UINT64(node);
70
 }
71
 
72
 /*
(-)files/patch-src_libcli_cli.c (+102 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/libcli/cli.c.orig	2003-03-14 02:32:38 UTC
9
+++ src/libcli/cli.c
10
@@ -113,7 +113,7 @@ static  int item_matches (const char *itemname);
11
 
12
 typedef struct ItemT {
13
 	char *name;					/* what the user types */
14
-	int (*func) (int argc,char **argv, void *data);	/* function that is the command */
15
+	uint64_t (*func) (int argc,char **argv, void *data);	/* function that is the command */
16
 	int *integer;				/* pointer to integer (set to NULL if string) */
17
 	char *string;				/* pointer to string (set to NULL if integer) */
18
 	char *usage;					/* helptext for this command */
19
@@ -130,7 +130,7 @@ static ItemT *items = NULL;
20
 void
21
 cli_add_item (char *name,
22
 		  int *integer, char *string,
23
-		  int (*func) (int argc,char **argv, void *data), char *usage)
24
+		  uint64_t (*func) (int argc,char **argv, void *data), char *usage)
25
 {
26
 	ItemT *titem = items;
27
 
28
@@ -191,8 +191,8 @@ void cli_add_help(char *name, char *helptext){
29
 }
30
 
31
 
32
-static int help (int argc,char **argv, void *data);
33
-static int vars (int argc,char **argv, void *data);
34
+static uint64_t help (int argc,char **argv, void *data);
35
+static uint64_t vars (int argc,char **argv, void *data);
36
 
37
 static int inited = 0;
38
 
39
@@ -224,13 +224,13 @@ static void init_cli (void)
40
 
41
 int cli_calllevel=0;
42
 
43
-int cli_docmd (char *commandline, void *data)
44
+uint64_t cli_docmd (char *commandline, void *data)
45
 {
46
 	int largc=0;
47
 	char **largv;
48
 	
49
 	ItemT *titem = items;
50
-	int ret=(int)data;
51
+	uint64_t ret=(uint64_t)data;
52
 	cli_calllevel++;
53
 
54
 	if (cli_precmd)
55
@@ -382,7 +382,7 @@ char *cli_complete (const char *commandline)
56
 
57
 /* internal commands */
58
 
59
-static int help (int argc,char **argv, void *data)
60
+static uint64_t help (int argc,char **argv, void *data)
61
 {
62
 	if (argc == 1) {		/* show all help */
63
 		ItemT *titem = items;
64
@@ -410,17 +410,17 @@ static int help (int argc,char **argv, void *data)
65
 						cli_outfun ("");
66
 						cli_outfun(titem->help);
67
 					}
68
-					return(int)data;
69
+					return(uint64_t)data;
70
 				}
71
 			}
72
 			titem = titem->next;
73
 		}
74
 		cli_outfunf ("unknown command '%s'", argv[1]);
75
 	}
76
-	return(int)data;	
77
+	return(uint64_t)data;	
78
 }
79
 
80
-static int vars (int argc, char **argv, void *data)
81
+static uint64_t vars (int argc, char **argv, void *data)
82
 {
83
 	ItemT *titem = items;
84
 
85
@@ -446,7 +446,7 @@ static int vars (int argc, char **argv, void *data)
86
 
87
 	cli_outfunf ("----------------");
88
 	cli_outfunf ("to change a variable: \"variablename newvalue\"");
89
-	return(int)data;
90
+	return(uint64_t)data;
91
 }
92
 
93
 char *cli_getstring(char *variable){
94
@@ -467,7 +467,7 @@ char *cli_getstring(char *variable){
95
 
96
 #include <stdio.h>
97
 
98
-int cli_load_file(char *filename){
99
+uint64_t cli_load_file(char *filename){
100
 	char buf[255];
101
 	FILE *file;
102
 
(-)files/patch-src_libcli_cli.h (+42 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/libcli/cli.h.orig	2003-03-12 12:20:05 UTC
9
+++ src/libcli/cli.h
10
@@ -29,7 +29,10 @@
11
 #define LIBCLI_H
12
 
13
 #include <stdarg.h>
14
+#include <stdint.h>
15
 
16
+#define PTR_TO_UINT64(x) (uint64_t)(uintptr_t)(x)
17
+
18
 void argv_sanity(void);
19
 
20
 void cli_split(char *orig, char *head, char **tail);	
21
@@ -41,7 +44,7 @@ void cli_cleanup(void);
22
 void
23
 cli_add_item (char *name,
24
 		  int *integer, char *string,
25
-		  int (*func) (int argc,char **argv, void *data), char *usage);
26
+		  uint64_t (*func) (int argc,char **argv, void *data), char *usage);
27
 
28
 #define cli_add_int(name,integer,usage)\
29
 	cli_add_item (name, integer, NULL, NULL, usage)
30
@@ -52,10 +55,10 @@ cli_add_item (char *name,
31
 #define cli_add_command(name,func,usage) \
32
 	cli_add_item(name, NULL, NULL, func, usage)
33
 
34
-int cli_load_file(char *filename);
35
+uint64_t cli_load_file(char *filename);
36
 
37
 char *cli_complete (const char *commandline);	/* returns a completed commandline */
38
-int cli_docmd (char *commandline, void *data);	/* run commandline */
39
+uint64_t cli_docmd (char *commandline, void *data);	/* run commandline */
40
 
41
 
42
 extern void (*cli_outfun) (char *);	/* the outputting function 
(-)files/patch-src_libcli_cli__tokenize.c (+22 lines)
Line 0 Link Here
1
Replaced char * with unsigned char * since this is how the function
2
is used, also prevents compiler from spweing out warnings.
3
4
--- src/libcli/cli_tokenize.c.orig	2003-03-14 03:23:22 UTC
5
+++ src/libcli/cli_tokenize.c
6
@@ -68,14 +68,14 @@ typedef struct {
7
 
8
 #ifdef TESTit
9
 #define cli_getstring dummy_get_variable
10
-static char * dummy_get_variable(char *name){
11
+static char * dummy_get_variable(unsigned char *name){
12
 	static char *dummy="<variable expansion not implemented yet>";
13
 	return dummy;
14
 }
15
 #endif
16
 
17
 #ifndef TESTit
18
-char *cli_getstring(char *variable);
19
+char *cli_getstring(unsigned char *variable);
20
 #endif
21
 
22
 static rule_entry state_table[s_end][max_rules];
(-)files/patch-src_node.c (+77 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/node.c.orig	2003-03-09 17:33:35 UTC
9
+++ src/node.c
10
@@ -138,48 +138,48 @@ void node_unset (Node *node, char *name)
11
 #include <stdio.h>
12
 
13
 
14
-int cmd_att_set (int argc, char **argv, void *data)
15
+uint64_t cmd_att_set (int argc, char **argv, void *data)
16
 {
17
 	Node *pos = (Node *) data;
18
 
19
 	if(argc!=3){
20
 		cli_outfunf("usage: %s <attribute> <value>",argv[0]);
21
-		return (int) pos;
22
+		return PTR_TO_UINT64(pos);
23
 	}
24
 		
25
 	node_set (pos, argv[1], argv[2]);
26
-	return (int) pos;
27
+	return PTR_TO_UINT64(pos);
28
 }
29
 
30
-int cmd_att_get (int argc, char **argv, void *data)
31
+uint64_t cmd_att_get (int argc, char **argv, void *data)
32
 {
33
 	Node *pos = (Node *) data;
34
 	char *cdata;
35
 	
36
 	if(argc!=2){
37
 		cli_outfunf("usage: %s <attribute>",argv[0]);
38
-		return (int) pos;
39
+		return PTR_TO_UINT64(pos);
40
 	}
41
 			
42
 	cdata = node_get (pos, argv[1]);
43
 
44
 	if (cdata)
45
 		cli_outfun (cdata);
46
-	return (int) pos;
47
+	return PTR_TO_UINT64(pos);
48
 }
49
 
50
-int cmd_att_clear (int argc, char **argv, void *data)
51
+uint64_t cmd_att_clear (int argc, char **argv, void *data)
52
 {
53
 	Node *pos = (Node *) data;
54
 	if(argc!=2){
55
 		cli_outfunf("usage: %s <attribute>",argv[0]);
56
-		return (int) pos;
57
+		return PTR_TO_UINT64(pos);
58
 	}
59
 	node_unset (pos, argv[1]);
60
-	return (int) pos;
61
+	return PTR_TO_UINT64(pos);
62
 }
63
 
64
-int cmd_att_list (int argc,char **argv, void *data)
65
+uint64_t cmd_att_list (int argc,char **argv, void *data)
66
 {
67
 	Node_AttItem *att;
68
 	Node *pos = (Node *) data;
69
@@ -189,7 +189,7 @@ int cmd_att_list (int argc,char **argv, void *data)
70
 		cli_outfunf ("%s: [%s]", att->name, att->data);
71
 		att = att->next;
72
 	}
73
-	return (int) pos;
74
+	return PTR_TO_UINT64(pos);
75
 }
76
 
77
 /*
(-)files/patch-src_query.c (+27 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/query.c.orig	2003-03-14 02:29:13 UTC
9
+++ src/query.c
10
@@ -27,7 +27,7 @@
11
 
12
 static char query[100];
13
 
14
-static int getquery_cmd (int argc, char **argv, void *data)
15
+static uint64_t getquery_cmd (int argc, char **argv, void *data)
16
 {
17
 	Node *pos = (Node *) data;
18
 
19
@@ -36,7 +36,7 @@ static int getquery_cmd (int argc, char **argv, void *
20
 		ui_getstr (argv[1], &query[0]);
21
 	else
22
 		ui_getstr ("enter string", &query[0]);
23
-	return (int) pos;
24
+	return PTR_TO_UINT64(pos);
25
 }
26
 
27
 /*
(-)files/patch-src_search.c (+52 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/search.c.orig	2003-03-14 02:19:21 UTC
9
+++ src/search.c
10
@@ -28,7 +28,7 @@
11
 
12
 /************** search ************************/
13
 
14
-static int search(int argc,char **argv,void *data){
15
+static uint64_t search(int argc,char **argv,void *data){
16
 	Node *pos=(Node *)data;
17
 	
18
 	if(argc==2){
19
@@ -37,7 +37,7 @@ static int search(int argc,char **argv,void *data){
20
 			if (pos == NULL) {
21
 				docmdf (pos, "status 'reached bottom of tree and \\'%s\\' not found'",
22
 						argv[1]);
23
-				return (int) data;
24
+				return PTR_TO_UINT64(data);
25
 			}			
26
 		}
27
 	} else if(argc>2){
28
@@ -46,20 +46,20 @@ static int search(int argc,char **argv,void *data){
29
 			if (pos == NULL) {
30
 				docmdf (pos, "status 'reached top of tree and \\'%s\\' not found'",
31
 						argv[2]);
32
-				return (int) data;
33
+				return PTR_TO_UINT64(data);
34
 			}			
35
 		} else if(!strcmp(argv[1],"-f")){
36
 			pos=node_recursive_match( argv[2],pos);
37
 			if (pos == NULL) {
38
 				docmdf (pos, "status 'reached bottom of tree and \\'%s\\' not found'",
39
 						argv[2]);
40
-				return (int) data;
41
+				return PTR_TO_UINT64(data);
42
 			}
43
 		}
44
-		return (int)pos;
45
+		return PTR_TO_UINT64(pos);
46
 	} 
47
 	cli_outfunf("usage: %s [-b|-f] <string>",argv[0]);
48
-	return (int)pos;
49
+	return PTR_TO_UINT64(pos);
50
 }
51
 
52
 /*
(-)files/patch-src_spell.c (+27 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/spell.c.orig	2003-03-09 17:29:01 UTC
9
+++ src/spell.c
10
@@ -68,7 +68,7 @@ static void spell_node (Node *node)
11
 		ui_init ();
12
 }
13
 
14
-static int spell_cmd (int argc, char **argv, void *data)
15
+static uint64_t spell_cmd (int argc, char **argv, void *data)
16
 {
17
 	Node *pos = (Node *) data;
18
 
19
@@ -85,7 +85,7 @@ static int spell_cmd (int argc, char **argv, void *dat
20
 	} else {
21
 		spell_node (pos);
22
 	}
23
-	return (int) pos;
24
+	return PTR_TO_UINT64(pos);
25
 }
26
 
27
 /*
(-)files/patch-src_statcmds.c (+63 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/statcmds.c.orig	2003-03-09 17:28:26 UTC
9
+++ src/statcmds.c
10
@@ -25,7 +25,7 @@
11
 
12
 #ifndef WIN32
13
 
14
-static int mem_cmd (int argc, char **argv, void *data)
15
+static uint64_t mem_cmd (int argc, char **argv, void *data)
16
 {
17
 	Node *pos = (Node *) data;
18
 
19
@@ -35,7 +35,7 @@ static int mem_cmd (int argc, char **argv, void *data)
20
 
21
 		file = fopen ("/proc/self/stat", "r");
22
 		if (!file)
23
-			return (int) pos;
24
+			return PTR_TO_UINT64(pos);
25
 
26
 		fscanf (file,
27
 				"%*i %*s %*s %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %i",
28
@@ -53,7 +53,7 @@ static int mem_cmd (int argc, char **argv, void *data)
29
 
30
 		file = fopen ("/proc/meminfo", "r");
31
 		if (!file)
32
-			return (int) pos;
33
+			return PTR_TO_UINT64(pos);
34
 
35
 		fscanf (file, "%*s %*s %*s %*s %*s %*s %*s %*i %*i %i %i %i",
36
 				&free, &buffers, &cached);
37
@@ -64,7 +64,7 @@ static int mem_cmd (int argc, char **argv, void *data)
38
 					 (float) ((free + buffers + cached) / 1024.0 / 1024.0));
39
 	}
40
 
41
-	return (int) pos;
42
+	return PTR_TO_UINT64(pos);
43
 }
44
 #endif
45
 /*
46
@@ -97,7 +97,7 @@ static int count_words (unsigned char *str)
47
 	return words;
48
 }
49
 
50
-static int stats_cmd (int argc, char **argv, void *data)
51
+static uint64_t stats_cmd (int argc, char **argv, void *data)
52
 {
53
 	int words = 0, leaves = 0, nodes = 0;
54
 	Node *pos = (Node *) data;
55
@@ -114,7 +114,7 @@ static int stats_cmd (int argc, char **argv, void *dat
56
 
57
 	cli_outfunf ("nodes:%i, leaves:%i words:%i", nodes, leaves, words);
58
 
59
-	return (int) pos;
60
+	return PTR_TO_UINT64(pos);
61
 }
62
 
63
 /*
(-)files/patch-src_state.c (+40 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/state.c.orig	2003-03-09 17:28:07 UTC
9
+++ src/state.c
10
@@ -29,7 +29,7 @@
11
 
12
 static Node *savedtree = NULL;
13
 
14
-static int save_state_cmd (int argc, char **argv, void *data)
15
+static uint64_t save_state_cmd (int argc, char **argv, void *data)
16
 {
17
 	Node *pos = (Node *) data;
18
 	Node *i;
19
@@ -58,10 +58,10 @@ static int save_state_cmd (int argc, char **argv, void
20
 			savedtree = node_recurse (savedtree);
21
 	}
22
 
23
-	return (int) pos;
24
+	return PTR_TO_UINT64(pos);
25
 }
26
 
27
-static int restore_state_cmd (int argc, char **argv, void *data)
28
+static uint64_t restore_state_cmd (int argc, char **argv, void *data)
29
 {
30
 	Node *pos = (Node *) data;
31
 
32
@@ -74,7 +74,7 @@ static int restore_state_cmd (int argc, char **argv, v
33
 		tree_free (savedtree);
34
 		savedtree = NULL;
35
 	}
36
-	return (int) pos;
37
+	return PTR_TO_UINT64(pos);
38
 }
39
 
40
 /*
(-)files/patch-src_tree__misc.c (+162 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/tree_misc.c.orig	2003-03-14 00:31:02 UTC
9
+++ src/tree_misc.c
10
@@ -27,12 +27,12 @@
11
 #include "ui_cli.h"
12
 #include "evilloop.h"
13
 
14
-static int cmd_movenode (int argc, char **argv, void *data)
15
+static uint64_t  cmd_movenode (int argc, char **argv, void *data)
16
 {
17
 	Node *pos = (Node *) data;
18
 	if(argc<2){
19
 		cli_outfunf("usage: %s <left|right|up|down>",argv[0]);
20
-		return (int)pos;
21
+		return PTR_TO_UINT64(pos);
22
 	}
23
 	if (!strcmp (argv[1], "left")) {
24
 		if (node_left (pos)) {
25
@@ -64,7 +64,7 @@ static int cmd_movenode (int argc, char **argv, void *
26
 			node_swap (pos, node_down (pos));
27
 		}
28
 	}
29
-	return (int) pos;
30
+	return PTR_TO_UINT64(pos);
31
 }
32
 
33
 /*
34
@@ -75,12 +75,12 @@ void init_movenode ()
35
 	cli_add_command ("movenode", cmd_movenode, "<up|left|right|down>");
36
 }
37
 
38
-static int cmd_go(int argc, char **argv, void *data){
39
+static uint64_t cmd_go(int argc, char **argv, void *data){
40
 	Node *pos=(Node *)data;
41
 	
42
 	if(argc!=2){
43
 		cli_outfunf("usage: %s <up|down|left|right|recurse|backrecurse|root|top|bottom>");
44
-		return (int)pos;
45
+		return PTR_TO_UINT64(pos);
46
 	}
47
 	
48
 	if(!strcmp(argv[1],"up")){
49
@@ -110,7 +110,7 @@ static int cmd_go(int argc, char **argv, void *data){
50
 	}
51
 
52
 	
53
-	return (int)pos;
54
+	return PTR_TO_UINT64(pos);
55
 }
56
 
57
 /*
58
@@ -126,7 +126,7 @@ void init_go ()
59
 #include "ctype.h"
60
 #include "ui_binding.h"
61
 
62
-static int cmd_outdent (int argc, char **argv, void *data)
63
+static uint64_t cmd_outdent (int argc, char **argv, void *data)
64
 {
65
 	Node *pos = (Node *) data;
66
 
67
@@ -135,7 +135,7 @@ static int cmd_outdent (int argc, char **argv, void *d
68
 			inputbuf[strlen (inputbuf) + 1] = 0;
69
 			inputbuf[strlen (inputbuf)] = lastbinding->key;
70
 		}		
71
-		return (int)pos;
72
+		return PTR_TO_UINT64(pos);
73
 	}
74
 
75
 	if (node_left (pos)) {
76
@@ -166,12 +166,12 @@ static int cmd_outdent (int argc, char **argv, void *d
77
 			target_node->right = NULL;
78
 		}
79
 	}
80
-	return (int) pos;
81
+	return PTR_TO_UINT64(pos);
82
 }
83
 
84
 /*	FIXME: no real need for a temporary node */
85
 
86
-static int cmd_indent (int argc, char **argv, void *data)
87
+static uint64_t cmd_indent (int argc, char **argv, void *data)
88
 {
89
 	Node *pos = (Node *) data;
90
 
91
@@ -180,7 +180,7 @@ static int cmd_indent (int argc, char **argv, void *da
92
 			inputbuf[strlen (inputbuf) + 1] = 0;
93
 			inputbuf[strlen (inputbuf)] = lastbinding->key;
94
 		}		
95
-		return (int)pos;
96
+		return PTR_TO_UINT64(pos);
97
 	}
98
 
99
 	if (node_up (pos)) {
100
@@ -205,7 +205,7 @@ static int cmd_indent (int argc, char **argv, void *da
101
 		}
102
 		node_remove (node_down (pos));
103
 	}
104
-	return (int) pos;
105
+	return PTR_TO_UINT64(pos);
106
 }
107
 
108
 /*
109
@@ -221,7 +221,7 @@ void init_outdent_indent ()
110
 				  "moves the active item and the following siblings one level to the right");
111
 }
112
 
113
-static int remove_cmd (int argc, char **argv, void *data)
114
+static uint64_t remove_cmd (int argc, char **argv, void *data)
115
 {
116
 	Node *pos = (Node *) data;
117
 
118
@@ -242,7 +242,7 @@ static int remove_cmd (int argc, char **argv, void *da
119
 		docmd (pos, "save_state");
120
 		pos = node_remove (pos);
121
 	}
122
-	return (int) pos;
123
+	return PTR_TO_UINT64(pos);
124
 }
125
 
126
 /*
127
@@ -256,7 +256,7 @@ void init_remove ()
128
 }
129
 
130
 
131
-static int commandline_cmd (int argc, char **argv, void *data)
132
+static uint64_t commandline_cmd (int argc, char **argv, void *data)
133
 {
134
 	Node *pos = (Node *) data;
135
 
136
@@ -271,7 +271,7 @@ static int commandline_cmd (int argc, char **argv, voi
137
 		if (commandline[0])
138
 			pos = docmd (pos, commandline);
139
 	} while (commandline[0] && strcmp(commandline,"q") && strcmp(commandline,"quit"));
140
-	return (int) pos;
141
+	return PTR_TO_UINT64(pos);
142
 }
143
 
144
 /*
145
@@ -284,7 +284,7 @@ void init_commandline ()
146
 				  "Invokes the interactive commandline in curses mode.");
147
 }
148
 
149
-static int insert_below_cmd (int argc, char **argv, void *data)
150
+static uint64_t insert_below_cmd (int argc, char **argv, void *data)
151
 {
152
 	Node *pos = (Node *) data;
153
 
154
@@ -299,7 +299,7 @@ static int insert_below_cmd (int argc, char **argv, vo
155
 			}
156
 	}
157
 	inputbuf[0] = 0;
158
-	return (int) pos;
159
+	return PTR_TO_UINT64(pos);
160
 }
161
 
162
 /*
(-)files/patch-src_tree__sort.c (+27 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/tree_sort.c.orig	2003-03-14 00:12:44 UTC
9
+++ src/tree_sort.c
10
@@ -141,7 +141,7 @@ static int cmp_descending(Node *a,Node *b){
11
 	return cmp_todo(b,a);
12
 }
13
 
14
-static int sort_cmd (int argc, char **argv, void *data)
15
+static uint64_t sort_cmd (int argc, char **argv, void *data)
16
 {
17
 	Node *pos = (Node *) data;
18
 	int (*cmp) (Node *a, Node *b)=cmp_todo;
19
@@ -155,7 +155,7 @@ static int sort_cmd (int argc, char **argv, void *data
20
 	node_mergesort (node_top (pos), nodes_down (node_top (pos)) + 1, cmp);
21
 	if (node_left (pos))
22
 		node_left (pos)->right = node_top (pos);
23
-	return (int) pos;
24
+	return PTR_TO_UINT64(pos);
25
 }
26
 
27
 /*
(-)files/patch-src_tree__todo.c (+46 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/tree_todo.c.orig	2003-03-09 17:23:18 UTC
9
+++ src/tree_todo.c
10
@@ -260,7 +260,7 @@ int calc_percentage_size (Node *node, int *retsize)
11
 
12
 #include "cli.h"
13
 
14
-static int toggle_todo_cmd (int argc, char **argv, void *data)
15
+static uint64_t toggle_todo_cmd (int argc, char **argv, void *data)
16
 {
17
 	Node *pos = (Node *) data;
18
 
19
@@ -271,15 +271,15 @@ static int toggle_todo_cmd (int argc, char **argv, voi
20
 		node_unset(pos,"type");
21
 	}
22
 
23
-	return (int) pos;
24
+	return PTR_TO_UINT64(pos);
25
 }
26
 
27
-static int toggle_done_cmd (int argc, char **argv, void *data)
28
+static uint64_t toggle_done_cmd (int argc, char **argv, void *data)
29
 {
30
 	Node *pos = (Node *) data;
31
 
32
 	if (strcmp(fixnullstring(node_get(pos,"type")),"todo")) {	/* bail out if not todo info set */
33
-		return (int) pos;
34
+		return PTR_TO_UINT64(pos);
35
 	}
36
 
37
 	if (!strcmp(fixnullstring(node_get(pos,"done")),"yes")) {	/* bail out if not todo info set */
38
@@ -288,7 +288,7 @@ static int toggle_done_cmd (int argc, char **argv, voi
39
 		node_set(pos,"done","yes");
40
 	}
41
 
42
-	return (int) pos;
43
+	return PTR_TO_UINT64(pos);
44
 }
45
 
46
 /*
(-)files/patch-src_ui__binding.c (+66 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/ui_binding.c.orig	2003-03-13 20:53:14 UTC
9
+++ src/ui_binding.c
10
@@ -250,14 +250,14 @@ static int string2keycode (char *str)
11
 
12
 int ui_current_scope = 0;
13
 
14
-static int ui_context_cmd (int argc, char **argv, void *data)
15
+static uint64_t ui_context_cmd (int argc, char **argv, void *data)
16
 {
17
 	if(argc<2){
18
 		cli_outfunf("usage: %s <contextname>",argv[0]);
19
-		return(int)data;
20
+		return PTR_TO_UINT64(data);
21
 	}
22
 	ui_current_scope = string2scope (argv[1]);
23
-	return (int) data;
24
+	return PTR_TO_UINT64(data);
25
 }
26
 
27
 static void makebinding (int scope_no, int key, int action, char *action_name,
28
@@ -272,7 +272,7 @@ static void makebinding (int scope_no, int key, int ac
29
 	ui_binding_count[scope_no]++;
30
 }
31
 
32
-static int ui_bind_cmd (int argc, char **argv, void *data)
33
+static uint64_t ui_bind_cmd (int argc, char **argv, void *data)
34
 {
35
 /*	char context[40];*/
36
 	char *key;
37
@@ -280,7 +280,7 @@ static int ui_bind_cmd (int argc, char **argv, void *d
38
 
39
 	if(argc<3){
40
 		cli_outfunf("error in bindings %s %s %s %s\n",argv[0],argv[1],argv[2],argv[3]);
41
-		return (int)data;
42
+		return PTR_TO_UINT64(data);
43
 	}
44
 	key=argv[1];
45
 	action=argv[2];
46
@@ -293,7 +293,7 @@ static int ui_bind_cmd (int argc, char **argv, void *d
47
 					 ui_action_command, "command", action);
48
 	}
49
 
50
-	return (int) data;
51
+	return PTR_TO_UINT64(data);
52
 }
53
 
54
 
55
@@ -395,9 +395,9 @@ char *tidy_keyname (const char *keyname)
56
 !init_ui_binding();
57
 */
58
 
59
-static int dummy_cmd (int argc, char **argv, void *data)
60
+static uint64_t dummy_cmd (int argc, char **argv, void *data)
61
 {
62
-	return (int) data;
63
+	return PTR_TO_UINT64(data);
64
 }
65
 
66
 void init_ui_binding ()
(-)files/patch-src_ui__cli.c (+148 lines)
Line 0 Link Here
1
1. The <stdlib.h> header uses the word bufsize as a parameter name in
2
   a function prototype. The "file.h" header #defines bufsize to 4096,
3
   which leads to a parser error.
4
2. Replaced int with uint64_t to avoid truncating pointer to (32bit)
5
   int by using a wider type.
6
3. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
7
   help convert the pointer to uint64_t.
8
4. Replaced (32bit) int references with proper Node * references.
9
10
This prevents the segfault on startup in amd64 systems.
11
12
--- src/ui_cli.c.orig	2003-03-14 04:55:14 UTC
13
+++ src/ui_cli.c
14
@@ -22,14 +22,15 @@
15
 #include <config.h>
16
 #endif
17
 
18
+#include <stdio.h>
19
+#include <stdlib.h>
20
+#include <string.h>
21
+
22
 #include "tree.h"
23
 #include "file.h"
24
 #include "path.h"
25
 #include "prefs.h"
26
 #include "cli.h"
27
-#include <stdio.h>
28
-#include <stdlib.h>
29
-#include <string.h>
30
 #include "ui_cli.h"
31
 
32
 
33
@@ -49,7 +50,7 @@ static char *path_strip (char *path)
34
 	return path;
35
 }
36
 
37
-static int add (int argc,char **argv, void *data)
38
+static uint64_t add (int argc,char **argv, void *data)
39
 {
40
 	Node *pos = (Node *) data;
41
 	Node *tnode;
42
@@ -65,10 +66,10 @@ static int add (int argc,char **argv, void *data)
43
 
44
 	tnode = node_insert_down (node_bottom (pos));
45
 	node_set (tnode, TEXT, argv[1]);
46
-	return (int) pos;
47
+	return PTR_TO_UINT64(pos);
48
 }
49
 
50
-static int addc (int argc,char **argv, void *data)
51
+static uint64_t addc (int argc,char **argv, void *data)
52
 {
53
 	Node *pos = (Node *) data;
54
 	Node *tnode;
55
@@ -81,7 +82,7 @@ static int addc (int argc,char **argv, void *data)
56
 	tnode = node_exact_match (argv[1], pos);
57
 	if (!tnode) {
58
 		cli_outfun ("specified parent not found");
59
-		return (int) pos;
60
+		return PTR_TO_UINT64(pos);
61
 	}
62
 
63
 	if (node_right (tnode)) {
64
@@ -95,30 +96,30 @@ static int addc (int argc,char **argv, void *data)
65
 	else
66
 		node_set (tnode, TEXT, argv[2]);
67
 
68
-	return (int) pos;
69
+	return PTR_TO_UINT64(pos);
70
 }
71
 
72
-static int pwd (int argc,char **argv, void *data)
73
+static uint64_t pwd (int argc,char **argv, void *data)
74
 {
75
 	Node *pos = (Node *) data;
76
 
77
 	cli_outfun (path_strip (node2path (pos)));
78
 	cli_outfun ("\n");
79
-	return (int) pos;
80
+	return PTR_TO_UINT64(pos);
81
 }
82
 
83
-static int cd (int argc, char **argv, void *data)
84
+static uint64_t cd (int argc, char **argv, void *data)
85
 {
86
 	Node *pos = (Node *) data;
87
 	Node *tnode = pos;
88
 
89
 	if(argc==1){
90
-		return (int)node_root(pos);
91
+		return PTR_TO_UINT64(node_root(pos));
92
 	}
93
 
94
 	if (!strcmp (argv[1], "..")){
95
 		if (node_left (tnode) != 0)
96
-			return (int) (node_left (tnode));
97
+			return PTR_TO_UINT64((node_left (tnode)));
98
 	}
99
 		
100
 
101
@@ -128,11 +129,11 @@ static int cd (int argc, char **argv, void *data)
102
 	}
103
 	if (!tnode) {
104
 		cli_outfun ("no such node\n");
105
-		return (int) pos;
106
+		return PTR_TO_UINT64(pos);
107
 	}
108
-	return (int) tnode;
109
+	return PTR_TO_UINT64(tnode);
110
 
111
-	return (int) pos;
112
+	return PTR_TO_UINT64(pos);
113
 }
114
 
115
 #include <ctype.h>
116
@@ -151,7 +152,7 @@ static void pre_command (char *commandline)
117
 	}
118
 }
119
 
120
-static int ls (int argc, char **argv, void *data)
121
+static uint64_t ls (int argc, char **argv, void *data)
122
 {
123
 	Node *pos = (Node *) data;
124
 
125
@@ -188,7 +189,7 @@ static int ls (int argc, char **argv, void *data)
126
 			tnode = node_down (tnode);
127
 		}
128
 	}
129
-	return (int) pos;
130
+	return PTR_TO_UINT64(pos);
131
 }
132
 
133
 /*
134
@@ -216,11 +217,12 @@ void init_ui_cli (void)
135
 
136
 Node *docmd (Node *pos, const char *commandline)
137
 {
138
-	int ret;
139
+	Node * ret;
140
 	char *cmdline = strdup (commandline);
141
 
142
-	ret = cli_docmd (cmdline, pos);
143
+	ret = (Node *)cli_docmd (cmdline, pos);
144
 	free (cmdline);
145
+
146
 	return (Node *) ret;
147
 }
148
 
(-)files/patch-src_ui__draw.c (+36 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/ui_draw.c.orig	2003-03-10 00:44:29 UTC
9
+++ src/ui_draw.c
10
@@ -525,7 +525,7 @@ static struct {
11
 
12
 /* FIXME: make backup?,.. and make sure data is present,.., make possiblity to write back? */
13
 
14
-int display_format_cmd (int argc, char **argv, void *data)
15
+uint64_t display_format_cmd (int argc, char **argv, void *data)
16
 {
17
 	char *p = argv[1];
18
 	int width;
19
@@ -533,7 +533,7 @@ int display_format_cmd (int argc, char **argv, void *d
20
 	int col_no = 0;
21
 
22
 	if(argc<2){
23
-		return (int)data;
24
+		return PTR_TO_UINT64(data);
25
 	}
26
 
27
 	do {
28
@@ -618,7 +618,7 @@ int display_format_cmd (int argc, char **argv, void *d
29
 
30
 	col_def[col_no].type = col_terminate;
31
 
32
-	return (int) data;
33
+	return PTR_TO_UINT64(data);
34
 }
35
 
36
 
(-)files/patch-src_ui__edit.c (+36 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/ui_edit.c.orig	2003-03-09 23:28:30 UTC
9
+++ src/ui_edit.c
10
@@ -28,7 +28,7 @@
11
 #include "evilloop.h"
12
 #include <stdlib.h>
13
 
14
-static int ui_edit_cmd (int argc, char **argv, void *data)
15
+static uint64_t ui_edit_cmd (int argc, char **argv, void *data)
16
 {
17
 	Tbinding *c;
18
 	int stop = 0;
19
@@ -61,7 +61,7 @@ static int ui_edit_cmd (int argc, char **argv, void *d
20
 			}
21
 		}
22
 		ui_current_scope = tempscope;
23
-		return (int) pos;
24
+		return PTR_TO_UINT64(pos);
25
 	}
26
 
27
 	node_backup = node_duplicate (pos);
28
@@ -208,7 +208,7 @@ static int ui_edit_cmd (int argc, char **argv, void *d
29
 	}
30
 	node_free (node_backup);
31
 	ui_current_scope = tempscope;
32
-	return (int) data;
33
+	return PTR_TO_UINT64(data);
34
 }
35
 
36
 int ui_getstr_loc (char *input, int x, int y, int maxlen)
(-)files/patch-src_ui__menu.c (+31 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/ui_menu.c.orig	2003-03-14 03:54:52 UTC
9
+++ src/ui_menu.c
10
@@ -109,10 +109,10 @@ static Node *menu_do(Node *pos){
11
 	return pos;
12
 }
13
 
14
-static int cmd_menu(int argc,char **argv,void *data){
15
+static uint64_t cmd_menu(int argc,char **argv,void *data){
16
 	Node *pos=(Node *)data;
17
 	if(argc==1){ /* draw menu */
18
-		return (int)menu_do(pos);
19
+		return PTR_TO_UINT64(menu_do(pos));
20
 	} else if(argc==4){
21
 		char *submenu=argv[1];
22
 		char *label=argv[2];
23
@@ -142,7 +142,7 @@ static int cmd_menu(int argc,char **argv,void *data){
24
 		if(menu[col][row].width>menu[col][0].width)
25
 			menu[col][0].width=menu[col][row].width;	
26
 	}
27
-	return(int)pos;
28
+	return PTR_TO_UINT64(pos);
29
 }
30
 
31
 /*
(-)files/patch-src_ui__overlay.c (+41 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/ui_overlay.c.orig	2003-03-14 00:35:14 UTC
9
+++ src/ui_overlay.c
10
@@ -44,11 +44,11 @@
11
 
12
 static char *ui_helptext[MAX_SCOPES] = { 0 };
13
 
14
-static int ui_helptext_cmd (int argc, char **argv, void *data)
15
+static uint64_t ui_helptext_cmd (int argc, char **argv, void *data)
16
 {
17
 	if(argc>1)
18
 		ui_helptext[ui_current_scope] = strdup (argv[1]);
19
-	return (int) data;
20
+	return PTR_TO_UINT64(data);
21
 }
22
 
23
 #define MAX_STATUS_LINES 100
24
@@ -129,7 +129,7 @@ void set_status (char *message)
25
 }
26
 
27
 
28
-static int ui_status_cmd (int argc, char **argv, void *data)
29
+static uint64_t ui_status_cmd (int argc, char **argv, void *data)
30
 {
31
 	if(argc==2 && (!strcmp(argv[1],"-c") || !strcmp(argv[1],"--clear"))){
32
 		status_ttl=0;
33
@@ -138,7 +138,7 @@ static int ui_status_cmd (int argc, char **argv, void 
34
 		if(!ui_inited)
35
 		cli_outfun(argv[1]);
36
 	}
37
-	return (int) data;
38
+	return PTR_TO_UINT64(data);
39
 }
40
 
41
 
(-)files/patch-src_ui__style.c (+45 lines)
Line 0 Link Here
1
1. Replaced int with uint64_t to avoid truncating pointer to (32bit)
2
   int by using a wider type.
3
2. Replaced pointer to int type cast with a macro PTR_TO_UINT64(x) to
4
   help convert the pointer to uint64_t.
5
6
This prevents the segfault on startup in amd64 systems.
7
8
--- src/ui_style.c.orig	2003-03-09 18:25:19 UTC
9
+++ src/ui_style.c
10
@@ -116,7 +116,7 @@ void ui_style_restore_color ()
11
 	}
12
 }
13
 
14
-static int ui_style_cmd (int argc, char **argv, void *data)
15
+static uint64_t ui_style_cmd (int argc, char **argv, void *data)
16
 {
17
 	char *item;
18
 	char *colors;
19
@@ -124,7 +124,7 @@ static int ui_style_cmd (int argc, char **argv, void *
20
 
21
 	if(argc!=4){
22
 		cli_outfunf("usage: %i <item> <fg/bg> <atts>");
23
-		return (int)data;
24
+		return PTR_TO_UINT64(data);
25
 	}
26
 
27
 	item=argv[1];
28
@@ -137,7 +137,7 @@ static int ui_style_cmd (int argc, char **argv, void *
29
 
30
 		if (style_no == -1) {
31
 			printf ("unknown style 'style [%s] %s %s'\n", item, colors, atts);
32
-			return (int) data;
33
+			return PTR_TO_UINT64(data);
34
 		}
35
 		color2 = strchr (colors, '/');
36
 		color2[0] = '\0';
37
@@ -166,7 +166,7 @@ static int ui_style_cmd (int argc, char **argv, void *
38
 			bkgdset (' ' + COLOR_PAIR (ui_style_background));
39
 		}
40
 	}
41
-	return (int) data;
42
+	return PTR_TO_UINT64(data);
43
 }
44
 
45
 /*

Return to bug 240770