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.c7
-rw-r--r--src/HTML.c23
-rw-r--r--src/LYMain.c6
-rw-r--r--src/structdump.h52
4 files changed, 48 insertions, 40 deletions
diff --git a/src/GridText.c b/src/GridText.c
index 032a3703..813f03dc 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.c,v 1.310 2018/03/11 23:12:39 tom Exp $
+ * $LynxId: GridText.c,v 1.311 2018/04/01 14:22:01 tom Exp $
  *
  *		Character grid hypertext object
  *		===============================
@@ -10100,8 +10100,9 @@ int HText_beginInput(HText *text,
     /*
      * Set up VALUE.
      */
-    if (I->value)
+    if (I->value) {
 	StrAllocCopy(IValue, I->value);
+    }
     if (IValue &&
 	IS_CJK_TTY &&
 	((I->type == NULL) || strcasecomp(I->type, "hidden"))) {
@@ -10435,6 +10436,8 @@ int HText_beginInput(HText *text,
 	 * Save value for submit/reset buttons so they
 	 * will be visible when printing the page.  - LE
 	 */
+	if (f->type == F_SUBMIT_TYPE)
+	    FREE(I->value);
 	I->value = f->value;
 	break;
 
diff --git a/src/HTML.c b/src/HTML.c
index 8355dd83..b7553e61 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTML.c,v 1.188 2018/03/07 10:26:46 tom Exp $
+ * $LynxId: HTML.c,v 1.190 2018/04/01 15:37:53 tom Exp $
  *
  *		Structured stream to Rich hypertext converter
  *		============================================
@@ -4230,6 +4230,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
 	{
 	    InputFieldData I;
 	    int chars;
+	    BOOL faked_button = FALSE;
 
 	    /* init */
 	    memset(&I, 0, sizeof(I));
@@ -4292,11 +4293,10 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		/*
 		 * Convert any HTML entities or decimal escaping.  - FM
 		 */
-		StrAllocCopy(I_value, value[HTML_BUTTON_VALUE]);
+		StrAllocCopy(I.value, value[HTML_BUTTON_VALUE]);
 		me->UsePlainSpace = TRUE;
-		TRANSLATE_AND_UNESCAPE_ENTITIES(&I_value, TRUE, me->HiddenValue);
+		TRANSLATE_AND_UNESCAPE_ENTITIES(&I.value, TRUE, me->HiddenValue);
 		me->UsePlainSpace = FALSE;
-		I.value = I_value;
 		/*
 		 * Convert any newlines or tabs to spaces, and trim any lead or
 		 * trailing spaces.  - FM
@@ -4307,6 +4307,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		    StrAllocCopy(I.value, I.name);
 		} else {
 		    StrAllocCopy(I.value, "BUTTON");
+		    faked_button = TRUE;
 		}
 	    } else if (I.value == 0) {
 		StrAllocCopy(I.value, "BUTTON");
@@ -4348,7 +4349,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		 * We have a submit or reset button in a PRE block, so output
 		 * the entire value from the markup.  If it extends to the
 		 * right margin, it will wrap there, and only the portion
-		 * before that wrap will be hightlighted on screen display
+		 * before that wrap will be highlighted on screen display
 		 * (Yuk!) but we may as well show the rest of the full value on
 		 * the next or more lines.  - FM
 		 */
@@ -4386,7 +4387,8 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		HTML_put_character(me, ' ');
 		me->in_word = NO;
 	    }
-	    FREE(I_value);
+	    if (faked_button)
+		FREE(I.value);
 	    FREE(I_name);
 	}
 	break;
@@ -4623,7 +4625,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		    me->UsePlainSpace = TRUE;
 		}
 
-		StrAllocCopy(I_value,
+		StrAllocCopy(I.value,
 			     ((UseALTasVALUE == TRUE)
 			      ? value[HTML_INPUT_ALT]
 			      : value[HTML_INPUT_VALUE]));
@@ -4631,14 +4633,13 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		    I.value_cs = current_char_set;
 		}
 		CTRACE((tfp, "4.Ok, we're trying type=[%s]\n", NONNULL(I.type)));
-		TRANSLATE_AND_UNESCAPE_ENTITIES6(&I_value,
+		TRANSLATE_AND_UNESCAPE_ENTITIES6(&I.value,
 						 ATTR_CS_IN,
 						 I.value_cs,
 						 (BOOL) (me->UsePlainSpace &&
 							 !me->HiddenValue),
 						 me->UsePlainSpace,
 						 me->HiddenValue);
-		I.value = I_value;
 		if (me->UsePlainSpace == TRUE) {
 		    /*
 		     * Convert any newlines or tabs to spaces, and trim any
@@ -4663,8 +4664,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		 * If we didn't put up a link, then HText_beginInput() will use
 		 * "[IMAGE]-Submit".  - FM
 		 */
-		StrAllocCopy(I_value, "Submit");
-		I.value = I_value;
+		StrAllocCopy(I.value, "Submit");
 	    } else if (ImageSrc) {
 		/* [IMAGE]-Submit with verbose images and not clickable images.
 		 * Use ImageSrc if no other alt or value is supplied. --LE
@@ -4854,7 +4854,6 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		HText_endInput(me->text);
 	    }
 	    FREE(ImageSrc);
-	    FREE(I_value);
 	    FREE(I_name);
 	}
 	break;
diff --git a/src/LYMain.c b/src/LYMain.c
index 054db9e1..db9112b9 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMain.c,v 1.278 2018/03/28 21:41:50 tom Exp $
+ * $LynxId: LYMain.c,v 1.279 2018/03/30 09:22:45 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -2059,10 +2059,10 @@ int main(int argc,
 #ifdef USE_PRETTYSRC
     if (!dump_output_immediately) {
 	HTMLSRC_init_caches(FALSE);	/* do it before terminal is initialized */
+    }
 #ifdef LY_FIND_LEAKS
-	atexit(html_src_clean_data);
+    atexit(html_src_clean_data);
 #endif
-    }
 #endif
 
     if (!dump_output_immediately) {
diff --git a/src/structdump.h b/src/structdump.h
index a084486b..78e25db8 100644
--- a/src/structdump.h
+++ b/src/structdump.h
@@ -32,9 +32,9 @@ CTRACE((tfp, "\n" \
             (L), sizeof(*((L))), \
             (L)->lname, (L)->lname, (L)->target, (L)->target, \
             (L)->l_hightext, (L)->l_hightext, \
-	    (L)->l_hightext2, (L)->l_hightext2, \
+            (L)->l_hightext2, (L)->l_hightext2, \
             (L)->l_hightext2_offset, \
-	    (L)->inUnderline, (L)->lx, (L)->ly, \
+            (L)->inUnderline, (L)->lx, (L)->ly, \
             (L)->type, (L)->anchor_number, (L)->anchor_line_num, (L)->form)); \
 }else{ \
 CTRACE((tfp, "\n" \
@@ -46,18 +46,14 @@ CTRACE_FLUSH(tfp);
 #define   DUMPSTRUCT_ANCHOR(A,X) \
 if ((A)) { \
 CTRACE((tfp, "\n" \
-            "KED:   anchor_ptr=%p  sizeof=%d  ["X"]\n" \
+            "KED:   anchor_ptr=%p  sizeof=%lu  ["X"]\n" \
             "TextAnchor struct {\n"      \
             "            *next=%p\n"     \
+            "            *prev=%p\n"     \
             "           number=%d\n"     \
             "         line_pos=%d\n"     \
             "           extent=%d\n"     \
             "         line_num=%d\n"     \
-            "        *hightext=%p\n"     \
-            "         hightext=|%s|\n"   \
-            "       *hightext2=%p\n"     \
-            "        hightext2=|%s|\n"   \
-            "  hightext2offset=%d\n"     \
             "        link_type=%d\n"     \
             "     *input_field=%p\n"     \
             "      input_field=|%s|\n"   \
@@ -66,12 +62,14 @@ CTRACE((tfp, "\n" \
             "   expansion_anch=%1x\n"    \
             "          *anchor=%p\n"     \
             "}\n", \
-            (A), sizeof(*((A))), \
-            (A)->next, (A)->number, (A)->line_pos, \
+            (A), (unsigned long) sizeof(*((A))), \
+            (A)->next, (A)->prev, \
+            (A)->number, (A)->line_pos, \
             (A)->extent, (A)->line_num, \
-            (A)->hightext, (A)->hightext, (A)->hightext2, (A)->hightext2, \
-            (A)->hightext2offset, (A)->link_type, \
-            (A)->input_field, (A)->input_field->name, (A)->show_anchor, \
+            (A)->link_type, \
+            (A)->input_field, \
+            (A)->input_field ? NonNull((A)->input_field->name) : "", \
+            (A)->show_anchor, \
             (A)->inUnderline, (A)->expansion_anch, (A)->anchor)); \
 }else{ \
 CTRACE((tfp, "\n" \
@@ -83,7 +81,7 @@ CTRACE_FLUSH(tfp);
 #define   DUMPSTRUCT_FORMINFO(F,X) \
 if ((F)) { \
 CTRACE((tfp, "\n" \
-            "KED: forminfo_ptr=%p  sizeof=%d  ["X"]\n" \
+            "KED: forminfo_ptr=%p  sizeof=%lu  ["X"]\n" \
             "FormInfo   struct {\n"      \
             "            *name=%p\n"     \
             "             name=|%s|\n"   \
@@ -94,7 +92,7 @@ CTRACE((tfp, "\n" \
             "      *orig_value=%p\n"     \
             "       orig_value=|%s|\n"   \
             "             size=%d\n"     \
-            "        maxlength=%d\n"     \
+            "        maxlength=%lu\n"    \
             "            group=%d\n"     \
             "        num_value=%d\n"     \
             "           hrange=%d\n"     \
@@ -114,15 +112,23 @@ CTRACE((tfp, "\n" \
             "         value_cs=%d\n"     \
             "        accept_cs=|%s|\n"   \
             "}\n", \
-            (F), sizeof(*((F))), \
-            (F)->name, (F)->name, (F)->number, (F)->type, \
-            (F)->value, (F)->value, (F)->orig_value, (F)->orig_value, \
-            (F)->size, (F)->maxlength, (F)->group, (F)->num_value, \
-            (F)->hrange, (F)->lrange, (F)->select_list, (F)->submit_action, \
-            (F)->submit_method, (F)->submit_enctype, (F)->submit_title, \
-            (F)->no_cache, (F)->cp_submit_value, (F)->orig_submit_value, \
+            (F), (unsigned long) sizeof(*((F))), \
+            (F)->name, NonNull((F)->name), \
+            (F)->number, (F)->type, \
+            (F)->value, NonNull((F)->value), \
+            (F)->orig_value, NonNull((F)->orig_value), \
+            (F)->size, (unsigned long) (F)->maxlength, \
+            (F)->group, (F)->num_value, \
+            (F)->hrange, (F)->lrange, (F)->select_list, \
+            NonNull((F)->submit_action), \
+            (F)->submit_method, \
+            NonNull((F)->submit_enctype), \
+            NonNull((F)->submit_title), \
+            (F)->no_cache, \
+            NonNull((F)->cp_submit_value), \
+            NonNull((F)->orig_submit_value), \
             (F)->size_l, (F)->disabled, (F)->readonly, (F)->name_cs, (F)->value_cs, \
-            (F)->accept_cs)); \
+            NonNull((F)->accept_cs))); \
 } else { \
 CTRACE((tfp, "\n" \
             "KED: forminfo_ptr=0x00000000  (NULL)     ["X"]\n")); \