about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c36
-rw-r--r--src/HTFWriter.c15
-rw-r--r--src/HTML.c21
-rw-r--r--src/LYCharUtils.c154
-rw-r--r--src/LYCurses.c13
-rw-r--r--src/LYHash.c5
-rw-r--r--src/LYUtils.c7
-rw-r--r--src/Xsystem.c8
-rw-r--r--src/chrtrans/makeuctb.c7
9 files changed, 128 insertions, 138 deletions
diff --git a/src/GridText.c b/src/GridText.c
index 88a4462c..285ca604 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.c,v 1.264 2013/05/06 00:06:53 tom Exp $
+ * $LynxId: GridText.c,v 1.266 2013/06/12 21:03:36 tom Exp $
  *
  *		Character grid hypertext object
  *		===============================
@@ -45,15 +45,6 @@
 #include <LYexit.h>
 #include <LYLeaks.h>
 
-/*#define DEBUG_APPCH 1*/
-/*#define DEBUG_STYLE 1*/
-
-#ifdef DEBUG_STYLE
-#define CTRACE_STYLE(p) CTRACE2(TRACE_STYLE, p)
-#else
-#define CTRACE_STYLE(p)		/* nothing */
-#endif
-
 #ifdef USE_COLOR_STYLE
 #include <AttrList.h>
 #include <LYHash.h>
@@ -2535,14 +2526,6 @@ void HText_beginAppend(HText *text)
  *		the finished line is displayed.
  */
 
-/* #define DEBUG_SPLITLINE */
-
-#ifdef DEBUG_SPLITLINE
-#define CTRACE_SPLITLINE(p)	CTRACE(p)
-#else
-#define CTRACE_SPLITLINE(p)	/*nothing */
-#endif
-
 static int set_style_by_embedded_chars(char *s,
 				       char *e,
 				       unsigned start_c,
@@ -2749,6 +2732,12 @@ static HTLine *insert_blanks_in_line(HTLine *line, int line_number,
 }
 
 #if defined(USE_COLOR_STYLE)
+#define direction2s(d) ((d) == STACK_OFF \
+			? "OFF" \
+			: ((d) == STACK_ON \
+			   ? "ON" \
+			   : "*ON"))
+
 /*
  * Found an OFF change not part of an adjacent matched pair.
  *
@@ -2767,15 +2756,16 @@ static HTStyleChange *skip_matched_and_correct_offsets(HTStyleChange *end,
     int level = 0;
     HTStyleChange *tmp = end;
 
-    CTRACE_STYLE((tfp, "SKIP Style %d %d (%d)\n",
+    CTRACE_STYLE((tfp, "SKIP Style %d %d (%s), split %u\n",
 		  tmp->sc_horizpos,
 		  tmp->sc_style,
-		  tmp->sc_direction));
+		  direction2s(tmp->sc_direction),
+		  split_pos));
     for (; tmp >= start; tmp--) {
-	CTRACE_STYLE((tfp, "... %d %d (%d)\n",
+	CTRACE_STYLE((tfp, "... %d %d (%s)\n",
 		      tmp->sc_horizpos,
 		      tmp->sc_style,
-		      tmp->sc_direction));
+		      direction2s(tmp->sc_direction)));
 	if (tmp->sc_style == end->sc_style) {
 	    if (tmp->sc_direction == STACK_OFF) {
 		level--;
@@ -3097,7 +3087,7 @@ static void split_line(HText *text, unsigned split)
 		    CTRACE_STYLE((tfp,
 				  "split_line, %d:style[%d] %d (dir=%d)\n",
 				  s_pre,
-				  at_end - from,
+				  (int) (at_end - from),
 				  scan->sc_style,
 				  at_end->sc_direction));
 		}
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index d26ed86f..be2b63be 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFWriter.c,v 1.104 2013/05/04 13:52:11 tom Exp $
+ * $LynxId: HTFWriter.c,v 1.105 2013/07/21 00:41:24 tom Exp $
  *
  *		FILE WRITER				HTFWrite.h
  *		===========
@@ -159,7 +159,6 @@ static void HTFWriter_free(HTStream *me)
     BOOLEAN found = FALSE;
 
 #ifdef WIN_EX
-    int status;
     HANDLE cur_handle;
 
     cur_handle = GetForegroundWindow();
@@ -365,7 +364,7 @@ static void HTFWriter_free(HTStream *me)
 #ifdef WIN_EX
 			    if (focus_window) {
 				HTInfoMsg(gettext("Set focus1"));
-				status = SetForegroundWindow(cur_handle);
+				(void) SetForegroundWindow(cur_handle);
 			    }
 #else
 			    start_curses();
@@ -423,7 +422,7 @@ static void HTFWriter_free(HTStream *me)
 #ifdef WIN_EX
 		if (focus_window) {
 		    HTInfoMsg(gettext("Set focus2"));
-		    status = SetForegroundWindow(cur_handle);
+		    (void) SetForegroundWindow(cur_handle);
 		}
 #else
 		start_curses();
@@ -441,7 +440,7 @@ static void HTFWriter_free(HTStream *me)
 #ifdef WIN_EX
 		if (focus_window) {
 		    HTInfoMsg(gettext("Set focus3"));
-		    status = SetForegroundWindow(cur_handle);
+		    (void) SetForegroundWindow(cur_handle);
 		}
 #else
 		start_curses();
@@ -658,7 +657,7 @@ HTStream *HTSaveAndExecute(HTPresentation *pres,
 	if (!StrNCmp(anchor->address, "file://localhost", 16)) {
 
 	    /* 1998/01/23 (Fri) 17:38:26 */
-	    unsigned char *cp, *view_fname;
+	    char *cp, *view_fname;
 
 	    me->fp = NULL;
 
@@ -676,7 +675,7 @@ HTStream *HTSaveAndExecute(HTPresentation *pres,
 	    /* 1998/04/21 (Tue) 11:04:16 */
 	    cp = view_fname;
 	    while (*cp) {
-		if (IS_SJIS_HI1(*cp) || IS_SJIS_HI2(*cp)) {
+		if (IS_SJIS_HI1(UCH(*cp)) || IS_SJIS_HI2(UCH(*cp))) {
 		    cp += 2;
 		    continue;
 		} else if (*cp == '/') {
@@ -685,7 +684,7 @@ HTStream *HTSaveAndExecute(HTPresentation *pres,
 		cp++;
 	    }
 	    if (strchr(view_fname, ' '))
-		view_fname = (unsigned char *) quote_pathname(view_fname);
+		view_fname = quote_pathname(view_fname);
 
 	    StrAllocCopy(me->viewer_command, pres->command);
 
diff --git a/src/HTML.c b/src/HTML.c
index 11cdf936..f16d72c4 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTML.c,v 1.159 2013/05/02 11:03:41 tom Exp $
+ * $LynxId: HTML.c,v 1.161 2013/06/12 09:18:40 tom Exp $
  *
  *		Structured stream to Rich hypertext converter
  *		============================================
@@ -2386,10 +2386,14 @@ static int HTML_start_element(HTStructured * me, int element_number,
 	break;
 
     case HTML_ADDRESS:
-	change_paragraph_style(me, styles[ElementNumber]);
-	UPDATE_STYLE;
-	if (me->sp->tag_number == (int) ElementNumber)
-	    LYEnsureDoubleSpace(me);
+	if (me->List_Nesting_Level < 0) {
+	    change_paragraph_style(me, styles[ElementNumber]);
+	    UPDATE_STYLE;
+	    if (me->sp->tag_number == (int) ElementNumber)
+		LYEnsureDoubleSpace(me);
+	} else {
+	    LYHandlePlike(me, present, value, include, -1, TRUE);
+	}
 	CHECK_ID(HTML_ADDRESS_ID);
 	break;
 
@@ -5614,10 +5618,6 @@ static int HTML_start_element(HTStructured * me, int element_number,
  *	stack for an element with a defined style. (In fact, the styles
  *	should be linked to the whole stack not just the top one.)
  *	TBL 921119
- *
- *	We don't turn on "CAREFUL" check because the parser produces
- *	(internal code errors apart) good nesting.  The parser checks
- *	incoming code errors, not this module.
  */
 static int HTML_end_element(HTStructured * me, int element_number,
 			    char **include)
@@ -5675,9 +5675,6 @@ static int HTML_end_element(HTStructured * me, int element_number,
 		(me->sp->tag_number < 0) ? "*invalid tag*" :
 		(me->sp->tag_number >= HTML_ELEMENTS) ? "special tag" :
 		HTML_dtd.tags[me->sp->tag_number].name));
-#ifdef CAREFUL			/* parser assumed to produce good nesting */
-	/* panic */
-#endif /* CAREFUL */
     }
 
     /*
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index 9b21aae2..cb455aac 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCharUtils.c,v 1.120 2013/05/02 00:17:41 tom Exp $
+ * $LynxId: LYCharUtils.c,v 1.123 2013/06/04 20:42:47 tom Exp $
  *
  *  Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM
  *  ==========================================================================
@@ -2582,99 +2582,95 @@ void LYHandlePlike(HTStructured * me, const BOOL *present,
 		   int align_idx,
 		   int start)
 {
-    if (TRUE) {
-	/*
-	 * FIG content should be a true block, which like P inherits the
-	 * current style.  APPLET is like character elements or an ALT
-	 * attribute, unless it content contains a block element.  If we
-	 * encounter a P in either's content, we set flags to treat the content
-	 * as a block.  - FM
-	 */
-	if (start) {
-	    if (me->inFIG)
-		me->inFIGwithP = TRUE;
+    /*
+     * FIG content should be a true block, which like P inherits the current
+     * style.  APPLET is like character elements or an ALT attribute, unless
+     * its content contains a block element.  If we encounter a P in either's
+     * content, we set flags to treat the content as a block - FM
+     */
+    if (start) {
+	if (me->inFIG)
+	    me->inFIGwithP = TRUE;
 
-	    if (me->inAPPLET)
-		me->inAPPLETwithP = TRUE;
-	}
+	if (me->inAPPLET)
+	    me->inAPPLETwithP = TRUE;
+    }
 
-	UPDATE_STYLE;
-	if (me->List_Nesting_Level >= 0) {
-	    /*
-	     * We're in a list.  Treat P as an instruction to create one blank
-	     * line, if not already present, then fall through to handle
-	     * attributes, with the "second line" margins.  - FM
-	     */
-	    if (me->inP) {
-		if (me->inFIG || me->inAPPLET ||
-		    me->inCAPTION || me->inCREDIT ||
-		    me->sp->style->spaceAfter > 0 ||
-		    (start && me->sp->style->spaceBefore > 0)) {
-		    LYEnsureDoubleSpace(me);
-		} else {
-		    LYEnsureSingleSpace(me);
-		}
-	    }
-	} else if (me->sp[0].tag_number == HTML_ADDRESS) {
-	    /*
-	     * We're in an ADDRESS.  Treat P as an instruction to start a
-	     * newline, if needed, then fall through to handle attributes.  -
-	     * FM
-	     */
-	    if (!HText_LastLineEmpty(me->text, FALSE)) {
-		HText_setLastChar(me->text, ' ');	/* absorb white space */
-		HText_appendCharacter(me->text, '\r');
-	    }
-	} else {
-	    if (start) {
-		if (!(me->inLABEL && !me->inP)) {
-		    HText_appendParagraph(me->text);
-		}
-	    } else if (me->sp->style->spaceAfter > 0) {
+    UPDATE_STYLE;
+    if (me->List_Nesting_Level >= 0) {
+	/*
+	 * We're in a list.  Treat P as an instruction to create one blank
+	 * line, if not already present, then fall through to handle
+	 * attributes, with the "second line" margins - FM
+	 */
+	if (me->inP) {
+	    if (me->inFIG || me->inAPPLET ||
+		me->inCAPTION || me->inCREDIT ||
+		me->sp->style->spaceAfter > 0 ||
+		(start && me->sp->style->spaceBefore > 0)) {
 		LYEnsureDoubleSpace(me);
 	    } else {
 		LYEnsureSingleSpace(me);
 	    }
-	    me->inLABEL = FALSE;
 	}
-	me->in_word = NO;
-
-	if (LYoverride_default_alignment(me)) {
-	    me->sp->style->alignment = LYstyles(me->sp[0].tag_number)->alignment;
-	} else if ((me->List_Nesting_Level >= 0 &&
-		    (me->sp->style->id == ST_DivCenter ||
-		     me->sp->style->id == ST_DivLeft ||
-		     me->sp->style->id == ST_DivRight)) ||
-		   ((me->Division_Level < 0) &&
-		    (me->sp->style->id == ST_Normal ||
-		     me->sp->style->id == ST_Preformatted))) {
-	    me->sp->style->alignment = HT_LEFT;
-	} else {
-	    me->sp->style->alignment = (short) me->current_default_alignment;
+    } else if (me->sp[0].tag_number == HTML_ADDRESS) {
+	/*
+	 * We're in an ADDRESS.  Treat P as an instruction to start a newline,
+	 * if needed, then fall through to handle attributes - FM
+	 */
+	if (!HText_LastLineEmpty(me->text, FALSE)) {
+	    HText_setLastChar(me->text, ' ');	/* absorb white space */
+	    HText_appendCharacter(me->text, '\r');
 	}
-
+    } else {
 	if (start) {
-	    if (present && present[align_idx] && value[align_idx]) {
-		if (!strcasecomp(value[align_idx], "center") &&
-		    !(me->List_Nesting_Level >= 0 && !me->inP))
-		    me->sp->style->alignment = HT_CENTER;
-		else if (!strcasecomp(value[align_idx], "right") &&
-			 !(me->List_Nesting_Level >= 0 && !me->inP))
-		    me->sp->style->alignment = HT_RIGHT;
-		else if (!strcasecomp(value[align_idx], "left") ||
-			 !strcasecomp(value[align_idx], "justify"))
-		    me->sp->style->alignment = HT_LEFT;
+	    if (!(me->inLABEL && !me->inP)) {
+		HText_appendParagraph(me->text);
 	    }
+	} else if (me->sp->style->spaceAfter > 0) {
+	    LYEnsureDoubleSpace(me);
+	} else {
+	    LYEnsureSingleSpace(me);
+	}
+	me->inLABEL = FALSE;
+    }
+    me->in_word = NO;
 
+    if (LYoverride_default_alignment(me)) {
+	me->sp->style->alignment = LYstyles(me->sp[0].tag_number)->alignment;
+    } else if ((me->List_Nesting_Level >= 0 &&
+		(me->sp->style->id == ST_DivCenter ||
+		 me->sp->style->id == ST_DivLeft ||
+		 me->sp->style->id == ST_DivRight)) ||
+	       ((me->Division_Level < 0) &&
+		(me->sp->style->id == ST_Normal ||
+		 me->sp->style->id == ST_Preformatted))) {
+	me->sp->style->alignment = HT_LEFT;
+    } else {
+	me->sp->style->alignment = (short) me->current_default_alignment;
+    }
+
+    if (start && align_idx >= 0) {
+	if (present && present[align_idx] && value[align_idx]) {
+	    if (!strcasecomp(value[align_idx], "center") &&
+		!(me->List_Nesting_Level >= 0 && !me->inP))
+		me->sp->style->alignment = HT_CENTER;
+	    else if (!strcasecomp(value[align_idx], "right") &&
+		     !(me->List_Nesting_Level >= 0 && !me->inP))
+		me->sp->style->alignment = HT_RIGHT;
+	    else if (!strcasecomp(value[align_idx], "left") ||
+		     !strcasecomp(value[align_idx], "justify"))
+		me->sp->style->alignment = HT_LEFT;
 	}
 
-	/*
-	 * Mark that we are starting a new paragraph and don't have any of it's
-	 * text yet.  - FM
-	 */
-	me->inP = FALSE;
     }
 
+    /*
+     * Mark that we are starting a new paragraph and don't have any of its
+     * text yet - FM
+     */
+    me->inP = FALSE;
+
     return;
 }
 
diff --git a/src/LYCurses.c b/src/LYCurses.c
index 0959b716..b8934930 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYCurses.c,v 1.173 2013/06/02 18:20:02 tom Exp $ */
+/* $LynxId: LYCurses.c,v 1.174 2013/07/21 00:40:06 tom Exp $ */
 #include <HTUtils.h>
 #include <HTAlert.h>
 
@@ -1020,8 +1020,9 @@ static void moveWindowHXY(HWND hwnd, int x, int y)
 
     if ((x != winrect.left) || (y != winrect.top)) {
 	MoveWindow(hwnd, x, y, win_width, win_height, TRUE);
-	CTRACE((tfp, "move window from (%d,%d) to (%d,%d).\n", winrect.left,
-		winrect.top, x, y));
+	CTRACE((tfp, "move window from (%d,%d) to (%d,%d).\n",
+		(int) winrect.left,
+		(int) winrect.top, x, y));
     }
 }
 
@@ -1045,7 +1046,8 @@ static void adjustWindowPos(void)
     win_height = winrect.bottom - winrect.top;
     CTRACE((tfp, "Display Size: (%4d,%3d)\n", disp_width, disp_height));
     CTRACE((tfp, "Orig WinRect: (%4d,%4d,%3d,%3d), ",
-	    winrect.left, winrect.right, winrect.top, winrect.bottom));
+	    (int) winrect.left, (int) winrect.right,
+	    (int) winrect.top, (int) winrect.bottom));
     CTRACE((tfp, "Size: (%4d,%3d)\n", win_width, win_height));
 
     newwin_left = winrect.left;
@@ -1093,7 +1095,8 @@ void maxmizeWindowSize(void)
 	win_width = winrect.right - winrect.left;
 	win_height = winrect.bottom - winrect.top;
 	CTRACE((tfp, "Current Rect: (%4d,%4d,%3d,%3d), ",
-		winrect.left, winrect.right, winrect.top, winrect.bottom));
+		(int) winrect.left, (int) winrect.right,
+		(int) winrect.top, (int) winrect.bottom));
 	CTRACE((tfp, "Size: (%4d,%3d)\n", win_width, win_height));
 
 	if (scrsize_x == 0) {
diff --git a/src/LYHash.c b/src/LYHash.c
index 9aaf146f..bdd029fa 100644
--- a/src/LYHash.c
+++ b/src/LYHash.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYHash.c,v 1.17 2010/09/24 09:43:18 tom Exp $
+ * $LynxId: LYHash.c,v 1.19 2013/06/12 09:21:21 tom Exp $
  *
  * A hash table for the (fake) CSS support in Lynx-rp
  * (c) 1996 Rob Partington
@@ -26,6 +26,7 @@ int hash_code(const char *string)
     for (p = string, hash = 0; *p; p++)
 	hash = HASH_OF(hash, *p);
 
+    CTRACE_STYLE((tfp, "hash_code(%s) = %d\n", string, hash));
     return hash;
 }
 
@@ -37,6 +38,7 @@ int hash_code_lowercase_on_fly(const char *string)
     for (p = string, hash = 0; *p; p++)
 	hash = HASH_OF(hash, TOLOWER(*p));
 
+    CTRACE_STYLE((tfp, "hash_code_lc(%s) = %d\n", string, hash));
     return hash;
 }
 
@@ -53,6 +55,7 @@ int hash_code_aggregate_lower_str(const char *string, int hash_was)
     for (p = string, hash = hash_was; *p; p++)
 	hash = HASH_OF(hash, TOLOWER(*p));
 
+    CTRACE_STYLE((tfp, "hash_code_lc2(%s) = %d\n", string, hash));
     return hash;
 }
 
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 011b15db..a84d08c9 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYUtils.c,v 1.239 2013/05/05 21:26:26 tom Exp $
+ * $LynxId: LYUtils.c,v 1.240 2013/07/21 00:40:35 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTCP.h>
@@ -3472,7 +3472,7 @@ static int fmt_tempname(char *result,
      */
 #ifdef HAVE_RAND_TEMPNAME
     if (first) {
-	lynx_srand((unsigned) ((long) time((time_t *) 0) + (long) result));
+	lynx_srand((unsigned) ((long) time((time_t *) NULL) + (long) result));
 	first = FALSE;
     }
 
@@ -4527,13 +4527,12 @@ int win32_check_interrupt(void)
 void sleep(unsigned sec)
 {
     unsigned int i, j;
-    int c;
 
     for (j = 0; j < sec; j++) {
 	for (i = 0; i < 10; i++) {
 	    Sleep(100);
 	    if (kbhit()) {
-		c = LYgetch();
+		(void) LYgetch();
 		return;
 	    }
 	}
diff --git a/src/Xsystem.c b/src/Xsystem.c
index bc7b8613..d5ee53c4 100644
--- a/src/Xsystem.c
+++ b/src/Xsystem.c
@@ -1,4 +1,4 @@
-/* $LynxId: Xsystem.c,v 1.26 2011/06/06 00:42:29 tom Exp $
+/* $LynxId: Xsystem.c,v 1.27 2013/07/21 00:18:04 tom Exp $
  *	like system("cmd") but return with exit code of "cmd"
  *	for Turbo-C/MS-C/LSI-C
  *  This code is in the public domain.
@@ -294,17 +294,17 @@ static int NEAR try3(char *cnm, PRO * p, int flag)
     char cmdb[STR_MAX];
     int rc;
 
-    sprintf(cmdb, "%.*s.com", sizeof(cmdb) - 5, cnm);
+    sprintf(cmdb, "%.*s.com", (int) sizeof(cmdb) - 5, cnm);
     if ((rc = open(cmdb, O_RDONLY)) >= 0) {
 	close(rc);
 	return spawnl(flag, cmdb, cmdb, p->arg, (char *) 0);
     }
-    sprintf(cmdb, "%.*s.exe", sizeof(cmdb) - 5, cnm);
+    sprintf(cmdb, "%.*s.exe", (int) sizeof(cmdb) - 5, cnm);
     if ((rc = open(cmdb, O_RDONLY)) >= 0) {
 	close(rc);
 	return spawnl(flag, cmdb, cmdb, p->arg, (char *) 0);
     }
-    sprintf(cmdb, "%.*s.bat", sizeof(cmdb) - 5, cnm);
+    sprintf(cmdb, "%.*s.bat", (int) sizeof(cmdb) - 5, cnm);
     if ((rc = open(cmdb, O_RDONLY)) >= 0) {
 	close(rc);
 	return csystem(p, flag);
diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c
index 1cd6a28d..4a0e734a 100644
--- a/src/chrtrans/makeuctb.c
+++ b/src/chrtrans/makeuctb.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: makeuctb.c,v 1.47 2012/07/04 20:58:29 tom Exp $
+ * $LynxId: makeuctb.c,v 1.48 2013/07/21 00:42:39 tom Exp $
  *
  *  makeuctb.c, derived from conmakehash.c   - kw
  *
@@ -30,7 +30,6 @@
 #define DONT_USE_SOCKS5
 #include <UCDefs.h>
 #include <UCkd.h>
-#include <ctype.h>
 
 /*
  *  Don't try to use LYexit() since this is a standalone file.
@@ -39,6 +38,10 @@
 #undef exit
 #endif /* exit */
 
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
 #define MAX_FONTLEN 256
 
 /*