Fix conflict with POSIX getline; fix LP64 issues found by gcc.

This commit is contained in:
dholland 2011-10-03 01:45:21 +00:00
parent 60cec20e73
commit 568129cc51
3 changed files with 63 additions and 1 deletions

View file

@ -1,7 +1,9 @@
$NetBSD: distinfo,v 1.4 2005/12/19 16:22:56 joerg Exp $
$NetBSD: distinfo,v 1.5 2011/10/03 01:45:21 dholland Exp $
SHA1 (xgraph-11.3.2-hack.9.tar.gz) = 6e695d2008094e8aca54795c7c73ed239d0d5404
RMD160 (xgraph-11.3.2-hack.9.tar.gz) = 3d1344b9e97b72886faaedce92b697dbc9503a1b
Size (xgraph-11.3.2-hack.9.tar.gz) = 101979 bytes
SHA1 (patch-aa) = cc5f9a2c5d2ca604459f581b41fd3e6cc82633d5
SHA1 (patch-ab) = c04e437b082e3f06ba3c88f3bb605882ce5ad297
SHA1 (patch-dialog_c) = 9127063712889ebf8e7f197d9b8e6ee6ea64c494
SHA1 (patch-st_c) = bb47aa944b4cd0827a05fb211cee1f0920c69b68

View file

@ -0,0 +1,33 @@
$NetBSD: patch-dialog_c,v 1.1 2011/10/03 01:45:22 dholland Exp $
- fix conflict with POSIX getline
--- dialog.c~ 1998-05-22 12:19:06.000000000 +0000
+++ dialog.c
@@ -32,7 +32,7 @@ static short gray_bits[] = {
static void make_msg_box();
static void del_msg_box();
-static int getline();
+static int get_line(char **, char *);
#define D_VPAD 2
@@ -702,7 +702,7 @@ xtb_frame *frame; /* Returned frame */
new_info->lines = (Window *) malloc((unsigned) (sizeof(Window) * E_LINES));
lineptr = text;
- while (getline(&lineptr, line)) {
+ while (get_line(&lineptr, line)) {
if (new_info->num_lines >= new_info->alloc_lines) {
new_info->alloc_lines *= 2;
new_info->lines = (Window *) realloc((char *) new_info->lines,
@@ -800,7 +800,7 @@ char *err_text;
-static int getline(tptr, lptr)
+static int get_line(tptr, lptr)
char **tptr;
char *lptr;
/*

View file

@ -0,0 +1,27 @@
$NetBSD: patch-st_c,v 1.1 2011/10/03 01:45:22 dholland Exp $
- Fix LP64 issues.
--- st.c.orig 1998-05-22 12:27:04.000000000 +0000
+++ st.c
@@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include "copyright.h"
#include "st.h"
@@ -21,9 +22,9 @@
#define alloc(type) (type *) malloc(sizeof(type))
#define ABS(x) ((x) < 0 ? -(x) : (x))
-#define ST_NUMCMP(x,y) ((int) (x) - (int) (y))
-#define ST_NUMHASH(x,size) (ABS((int)x)%(size))
-#define ST_PTRHASH(x,size) ((int)((unsigned)(x)>>2)%size)
+#define ST_NUMCMP(x,y) ((intptr_t) (x) - (intptr_t) (y))
+#define ST_NUMHASH(x,size) (ABS((intptr_t)x)%(size))
+#define ST_PTRHASH(x,size) ((intptr_t)((uintptr_t)(x)>>2)%size)
#define EQUAL(func, x, y) \
((((func) == st_numcmp) || ((func) == st_ptrcmp)) ?\
(ST_NUMCMP((x),(y)) == 0) : ((*func)((x), (y)) == 0))