about summary refs log tree commit diff stats
path: root/src/LYCurses.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/LYCurses.c')
-rw-r--r--src/LYCurses.c59
1 files changed, 36 insertions, 23 deletions
diff --git a/src/LYCurses.c b/src/LYCurses.c
index 77300aa1..77d29f23 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYCurses.c,v 1.136 2008/09/10 19:48:30 tom Exp $ */
+/* $LynxId: LYCurses.c,v 1.137 2009/01/03 00:36:42 tom Exp $ */
 #include <HTUtils.h>
 #include <HTAlert.h>
 
@@ -260,7 +260,7 @@ static char *attr_to_string(int code)
     int bold = (pair != 0 && (code & A_BOLD) != 0);
 
     if (bold)
-	code &= ~A_BOLD;
+	code &= (int) ~A_BOLD;
 
     *result = 0;
     for (i = 0; i < TABLESIZE(Mono_Attrs); i++) {
@@ -337,12 +337,25 @@ void LYbox(WINDOW * win, BOOLEAN formfield GCC_UNUSED)
      */
     LynxWChangeStyle(win, s_menu_frame, STACK_ON);
 #ifdef HAVE_WBORDER
-    if (!boxvert || !boxhori)
-	box(win, boxvert, boxhori);
-    else if (boxvert == '*' || boxhori == '*')
-	wborder(win, boxvert, boxvert, boxhori, boxhori, '*', '*', '*', '*');
-    else
-	wborder(win, boxvert, boxvert, boxhori, boxhori, '/', '\\', '\\', '/');
+    if (!boxvert || !boxhori) {
+	box(win,
+	    (chtype) boxvert,
+	    (chtype) boxhori);
+    } else if (boxvert == '*' || boxhori == '*') {
+	wborder(win,
+		(chtype) boxvert,
+		(chtype) boxvert,
+		(chtype) boxhori,
+		(chtype) boxhori,
+		'*', '*', '*', '*');
+    } else {
+	wborder(win,
+		(chtype) boxvert,
+		(chtype) boxvert,
+		(chtype) boxhori,
+		(chtype) boxhori,
+		'/', '\\', '\\', '/');
+    }
 #else
     box(win, boxvert, boxhori);
 #endif
@@ -652,7 +665,7 @@ static int encode_color_attr(int color_attr)
 
 static int decode_mono_code(int mono_code)
 {
-    int result = 0;
+    unsigned result = 0;
 
     if (mono_code & 1)
 	result |= A_BOLD;
@@ -661,7 +674,7 @@ static int decode_mono_code(int mono_code)
     if (mono_code & 4)
 	result |= A_UNDERLINE;
 
-    return result;
+    return (int) result;
 }
 
 /*
@@ -690,7 +703,7 @@ char *LYgetTableString(int code)
     int mask = decode_mono_code(code);
     int second = encode_color_attr(mask);
     int pair = PAIR_NUMBER(second);
-    int mono = mask & A_ATTRIBUTES;
+    int mono = (int) (mask & A_ATTRIBUTES);
     int fg = lynx_color_pairs[pair].fg;
     int bg = lynx_color_pairs[pair].bg;
     unsigned n;
@@ -820,7 +833,7 @@ static void lynx_init_colors(void)
 	lynx_color_cfg[0].bg = default_bg;
 
 	for (n = 0; n < TABLESIZE(lynx_color_cfg); n++) {
-	    lynx_init_color_pair(n);
+	    lynx_init_color_pair((int) n);
 	}
     } else if (LYShowColor != SHOW_COLOR_NEVER) {
 	LYShowColor = SHOW_COLOR_OFF;
@@ -1699,18 +1712,17 @@ void LYsubAttr(int a)
  * color to a uniform width in the popup-menu.
  */
 #ifndef USE_SLANG
-void LYpaddstr(WINDOW * the_window, int width,
-	       const char *the_string)
+void LYpaddstr(WINDOW * the_window, int width, const char *the_string)
 {
     int y, x;
-    int actual = strlen(the_string);
+    int actual = (int) strlen(the_string);
 
     getyx(the_window, y, x);
     if (width + x > LYcolLimit)
 	width = LYcolLimit - x;
     if (actual > width)
 	actual = width;
-    LYwaddnstr(the_window, the_string, actual);
+    LYwaddnstr(the_window, the_string, (size_t) actual);
     width -= actual;
     while (width-- > 0)
 	waddstr(the_window, " ");
@@ -1736,7 +1748,7 @@ void LYsubwindow(WINDOW * param)
 	{
 	    long b = LYgetattrs(my_subwindow);
 
-	    wbkgd(my_subwindow, b | ' ');
+	    wbkgd(my_subwindow, (chtype) (b | ' '));
 	}
 	LynxWChangeStyle(my_subwindow, s_menu_bg, STACK_OFF);
 #elif defined(HAVE_GETBKGD)	/* not defined in ncurses 1.8.7 */
@@ -1949,7 +1961,7 @@ int LYstrExtent(const char *string, int len, int maxCells)
     int used;
 
     if (len < 0)
-	used = strlen(string);
+	used = (int) strlen(string);
     else
 	used = len;
 
@@ -2010,7 +2022,7 @@ int LYstrExtent2(const char *string, int len)
  */
 int LYstrCells(const char *string)
 {
-    return LYstrExtent2(string, strlen(string));
+    return LYstrExtent2(string, (int) strlen(string));
 }
 
 #ifdef VMS
@@ -2525,7 +2537,7 @@ void LYnormalColor(void)
 	int color = displayStyles[DSTYLE_NORMAL].color;
 
 	if (color >= 0) {
-	    wbkgd(LYwin, color | ' ');
+	    wbkgd(LYwin, (chtype) (color | ' '));
 	    LYrefresh();
 	}
     }
@@ -2859,19 +2871,20 @@ static void make_blink_boldbg(void)
  */
 long LYgetattrs(WINDOW * win)
 {
+    long result;
 #if ( defined(HAVE_GETATTRS) && ( !defined(NCURSES_VERSION_MAJOR) || NCURSES_VERSION_MAJOR < 5 ) )
-    long result = 0;
 
     result = getattrs(win);
 #else
-    attr_t result = 0;
+    attr_t attrs = 0;
     short pair = 0;
 
     /*
      * FIXME: this ignores the color-pair, which for most implementations is
      * not stored in the attribute value.
      */
-    wattr_get(win, &result, &pair, NULL);
+    wattr_get(win, &attrs, &pair, NULL);
+    result = (long) attrs;
 #endif
     return result;
 }