lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev HTML.c pre.6 patch


From: Klaus Weide
Subject: lynx-dev HTML.c pre.6 patch
Date: Wed, 19 Apr 2000 15:54:41 -0500 (CDT)

* Correct handling of CHARSET attributes on LINK and A.  Basically this
  reverts back to original 2.7.2ac logic.
* Enable handling of CHARSET attributes on LINK - it was disabled,
  probably accidentally.
* Prevent CHARSET attributes from modifying the charset assumption
  for the _current_ document.

(Someone found a bug in this a while ago, in connection with setting
ASSUME_UNREC_CHARSET, but the thread died.)

* Correct errors in HTML.c that could result in infinite loop (iteration 
  counter was not incremented).

Index: 1.35/src/HTML.c
--- 1.35/src/HTML.c Tue, 18 Apr 2000 10:26:31 -0500 lynxdev (Lynx28/d/47_HTML.c 
1.1.1.7.1.1.1.4.1.3.1.1.1.1.1.3 644)
+++ 1.35(w)/src/HTML.c Wed, 19 Apr 2000 15:44:34 -0500 lynxdev 
(Lynx28/d/47_HTML.c 1.1.1.7.1.1.1.4.1.3.1.1.1.1.1.3 644)
@@ -942,7 +942,7 @@
     char *I_value = NULL;
     char *I_name = NULL;
     char *temp = NULL;
-    int dest_char_set = UCLYhndl_for_unrec;
+    int dest_char_set = -1;
     HTParentAnchor *dest = NULL;            /* An anchor's destination */
     BOOL dest_ismap = FALSE;                /* Is dest an image map script? */
     BOOL UseBASE = TRUE;                    /* Resolved vs. BASE if present? */
@@ -1598,16 +1598,18 @@
                                      )) != NULL) {
                if (pdoctitle && !HTAnchor_title(dest))
                    HTAnchor_setTitle(dest, *pdoctitle);
-               dest = NULL;
+
+               /* Don't allow CHARSET attribute to change *this* document's
+                  charset assumption. - kw */
+               if (dest == me->node_anchor)
+                   dest = NULL;
                if (present[HTML_LINK_CHARSET] &&
                    value[HTML_LINK_CHARSET] && *value[HTML_LINK_CHARSET] != 
'\0') {
                    dest_char_set = 
UCGetLYhndl_byMIME(value[HTML_LINK_CHARSET]);
                    if (dest_char_set < 0)
                        dest_char_set = UCLYhndl_for_unrec;
-                   if (dest_char_set < 0)  /* recover if not defined :-( */
-                       dest_char_set = UCLYhndl_for_unspec; /* always >= 0 */
                }
-               if (dest)
+               if (dest && dest_char_set >= 0)
                    HTAnchor_setUCInfoStage(dest, dest_char_set,
                                            UCT_STAGE_PARSER,
                                            UCT_SETBY_LINK);
@@ -3153,8 +3155,6 @@
                dest_char_set = UCGetLYhndl_byMIME(temp);
                if (dest_char_set < 0) {
                        dest_char_set = UCLYhndl_for_unrec;
-               if (dest_char_set < 0) /* recover if not defined :-( */
-                       dest_char_set = UCLYhndl_for_unspec; /* always >= 0 */
                }
            }
            if (title != NULL || dest_ismap == TRUE || dest_char_set >= 0) {
@@ -3166,7 +3166,9 @@
                HTAnchor_setTitle(dest, title);
            if (dest && dest_ismap)
                dest->isISMAPScript = TRUE;
-           if (dest) {
+           /* Don't allow CHARSET attribute to change *this* document's
+              charset assumption. - kw */
+           if (dest && dest != me->node_anchor && dest_char_set >= 0) {
                /*
                **  Load the anchor's chartrans structures.
                **  This should be done more intelligently
@@ -4939,7 +4941,7 @@
                                       (I.value[i] ==  ' ' ?
                                        HT_NON_BREAK_SPACE : I.value[i]));
                }
-               while (i < chars) {
+               while (i++ < chars) {
                    HTML_put_character(me, HT_NON_BREAK_SPACE);
                }
            }
@@ -5373,7 +5375,7 @@
                 *  ignore them.  Note that if we somehow get tripped
                 *  up and a wrap still does occur before all 6 of the
                 *  underscores are output, the wrapped ones won't be
-                *   treated as part of the editing window, nor be
+                *  treated as part of the editing window, nor be
                 *  highlighted when not editing (Yuk!). - FM
                 */
                for (i = 0; i < 6; i++) {
@@ -5436,7 +5438,7 @@
                        HTML_put_character(me,
                                           (I.value[i] ==  ' ' ?
                                            HT_NON_BREAK_SPACE : I.value[i]));
-                   while (i < chars)
+                   while (i++ < chars)
                        HTML_put_character(me, HT_NON_BREAK_SPACE);
                }
                if (HTCJK == JAPANESE) {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]