summaryrefslogtreecommitdiff
path: root/x11/xview-lib/patches/patch-eg
blob: 73418d40a4b521b4719711ba467bc539430237fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
$NetBSD: patch-eg,v 1.1 2006/01/05 18:25:57 joerg Exp $

--- lib/libxview/textsw/txt_once.c.orig	2006-01-04 11:09:00.000000000 +0000
+++ lib/libxview/textsw/txt_once.c
@@ -18,6 +18,7 @@ static char	sccsid[] = "@(#)txt_once.c 2
 #include <xview/textsw.h>
 #include <xview_private/txt_impl.h>
 #include <fcntl.h>
+#include <limits.h>
 #include <signal.h>
 #include <pixrect/pr_util.h>
 
@@ -548,13 +549,21 @@ textsw_init_internal(folio, status, defa
     Es_handle       ps_esh;
     Ei_handle       plain_text_eih;
     char	   *name = 0;
+#ifdef NAME_MAX
+    CHAR	    scratch_name[NAME_MAX];
+#else
     CHAR	    scratch_name[MAXNAMLEN];
+#endif
     Es_status       es_status;
     Frame	    frame;
     Xv_Notice	    text_notice;
     extern void     textsw_split_init_proc();
 #ifdef OW_I18N
+#ifdef NAME_MAX
+    CHAR	    name_wc[NAME_MAX];
+#else
     CHAR	    name_wc[MAXNAMLEN];
+#endif
 #ifdef FULL_R5
     XVaNestedList   va_nested_list;
 #endif /* FULL_R5 */	
@@ -642,18 +651,30 @@ textsw_init_internal(folio, status, defa
 	name = (char *) defaults[1];
 #ifdef OW_I18N
 	if (name)
+#ifdef NAME_MAX
+	    (void) mbstowcs(name_wc, name, NAME_MAX);
+#else
 	    (void) mbstowcs(name_wc, name, MAXNAMLEN);
 #endif
+#endif
     }
 
 #ifdef OW_I18N
     defaults = attr_find(attrs, TEXTSW_FILE_WCS);
     if (*defaults) {
+#ifdef NAME_MAX
+	char	name_mb[NAME_MAX];
+#else
 	char	name_mb[MAXNAMLEN];
+#endif
 
 	ATTR_CONSUME(*defaults);
 	STRCPY(name_wc, (CHAR  *) defaults[1]);
+#ifdef NAME_MAX
+	(void) wcstombs(name_mb, name_wc, NAME_MAX);
+#else
 	(void) wcstombs(name_mb, name_wc, MAXNAMLEN);
+#endif
 	name = name_mb;
     }
     if (name_wc[0] != NULL) {		/* } for match */