lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev fix to verbose images


From: Bill Schiavo
Subject: Re: lynx-dev fix to verbose images
Date: Tue, 18 Aug 1998 13:11:48 -0400 (EDT)

Hello Laura and Everyone. 

Thank you for fixing the verbose images feature.  Although I am not the
author of the patch, I had a hand in getting it incorporated into Lynx.  I
didn't realize that the core dumps were happening when clickable images
was on.  

Sorry about that Doug but I never use clickable_images.

Bill
On Tue, 18 Aug 1998, Laura Eaves wrote:

> Hm -- a little messy to fix, but all confined to HTML.c
> This patch is against dev17.  I don't know if HTML.c has changed since then.
> 
> Fixed: Verbose images now work with [IMAGE]-Submit
> Also, I fixed the core dump when clickable_images is on.
> The problem was an oversight in MakeNewTitle() (see patch).
> 
> Try running it on the website(s) that caused the core dump.
> --le
> 
> --- old/HTML.c        Thu Jun  4 10:19:50 1998
> +++ src/HTML.c        Tue Aug 18 00:25:14 1998
> @@ -113,10 +113,11 @@
>  /*
>   * If we have verbose_img set, display labels for images.
>   */
> -#define VERBOSE_IMG(value,string) \
> -      ((verbose_img) ? (newtitle = MakeNewTitle(value)): string)
> +#define VERBOSE_IMG(value,src_type,string) \
> +      ((verbose_img) ? (newtitle = MakeNewTitle(value,src_type)): string)
>  
> -PRIVATE char * MakeNewTitle PARAMS((CONST char ** value));
> +PRIVATE char * MakeNewTitle PARAMS((CONST char ** value, int src_type));
> +PRIVATE char * MakeNewImageValue PARAMS((CONST char ** value));
>  
>  /*   Set an internal flag that the next call to a stack-affecting method
>  **   is only internal and the stack manipulation should be skipped. - kw
> @@ -2721,7 +2722,7 @@
>                   } else if (me->inA == TRUE && dest) {
>                       StrAllocCopy(alt_string, (title ?
>                                                 title :
> -                                               VERBOSE_IMG(value, 
> "[LINK]")));
> +                                               VERBOSE_IMG(value, 
> HTML_IMG_SRC, "[LINK]")));
>  
>                   } else {
>                       StrAllocCopy(alt_string,
> @@ -2729,7 +2730,7 @@
>                                                 ((present &&
>                                                   present[HTML_IMG_ISOBJECT]) 
> ?
>                                                   "(OBJECT)" :
> -                                                 VERBOSE_IMG(value, 
> "[INLINE]"))));
> +                                                 VERBOSE_IMG(value, 
> HTML_IMG_SRC, "[INLINE]"))));
>                   }
>               }
>           }
> @@ -2746,7 +2747,7 @@
>       } else if (me->inA == TRUE && dest) {
>           StrAllocCopy(alt_string, (title ?
>                                     title :
> -                                   VERBOSE_IMG(value, "[LINK]")));
> +                                   VERBOSE_IMG(value, HTML_IMG_SRC, 
> "[LINK]")));
>  
>       } else {
>           if (pseudo_inline_alts || clickable_images)
> @@ -2754,7 +2755,7 @@
>                         ((present &&
>                           present[HTML_IMG_ISOBJECT]) ?
>                                            "(OBJECT)" :
> -                                          VERBOSE_IMG(value, "[INLINE]"))));
> +                                          VERBOSE_IMG(value, HTML_IMG_SRC, 
> "[INLINE]"))));
>           else
>               StrAllocCopy(alt_string, (title ?
>                                         title : ""));
> @@ -2883,7 +2884,7 @@
>                              present[HTML_IMG_ISOBJECT]) ?
>                  ((map_href || dest_ismap) ?
>                                  "(IMAGE)" : "(OBJECT)") :
> -                                VERBOSE_IMG(value, "[IMAGE]")));
> +                                VERBOSE_IMG(value, HTML_IMG_SRC, 
> "[IMAGE]")));
>               if (id_string && !map_href) {
>                   if ((ID_A = HTAnchor_findChildAndLink(
>                                 me->node_anchor,      /* Parent */
> @@ -2938,7 +2939,7 @@
>                            ((present &&
>                              present[HTML_IMG_ISOBJECT]) ?
>                                                "(IMAGE)" :
> -                                              VERBOSE_IMG(value, 
> "[IMAGE]")));
> +                                              VERBOSE_IMG(value, 
> HTML_IMG_SRC, "[IMAGE]")));
>           } else {
>               HTML_put_character(me, ' ');  /* space char may be ignored */
>               me->in_word = NO;
> @@ -4207,6 +4208,7 @@
>           int chars;
>           BOOL UseALTasVALUE = FALSE;
>           BOOL HaveSRClink = FALSE;
> +         char* ImageSrc = NULL;
>           BOOL IsSubmitOrReset = FALSE;
>  
>           /* init */
> @@ -4365,7 +4367,12 @@
>                */
>               UseALTasVALUE = TRUE;
>           }
> -         if (clickable_images == TRUE &&
> +         if (verbose_img && !clickable_images &&
> +             present && present[HTML_INPUT_SRC] &&
> +             value[HTML_INPUT_SRC] && *value[HTML_INPUT_SRC] &&
> +             I.type && !strcasecomp(I.type, "image")) {
> +             ImageSrc = MakeNewImageValue(value);
> +         } else if (clickable_images == TRUE &&
>               present && present[HTML_INPUT_SRC] &&
>               value[HTML_INPUT_SRC] && *value[HTML_INPUT_SRC] &&
>               I.type && !strcasecomp(I.type, "image")) {
> @@ -4411,7 +4418,7 @@
>                   HText_beginAnchor(me->text, me->inUnderline, me->CurrentA);
>                   if (me->inBoldH == FALSE)
>                       HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
> -                 HTML_put_string(me, VERBOSE_IMG(value, "[IMAGE]"));
> +                 HTML_put_string(me, 
> VERBOSE_IMG(value,HTML_INPUT_SRC,"[IMAGE]"));
>                   if (me->inBoldH == FALSE)
>                       HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
>                   HText_endAnchor(me->text, 0);
> @@ -4492,6 +4499,11 @@
>                */
>               StrAllocCopy(I_value, "Submit");
>               I.value = I_value;
> +         } else if ( ImageSrc ) {
> +             /* [IMAGE]-Submit with verbose images and not clickable images.
> +              * Use ImageSrc if no other alt or value is supplied. --LE
> +              */
> +             I.value = ImageSrc;
>           }
>           if (present && present[HTML_INPUT_CHECKED])
>               I.checked = YES;
> @@ -7438,18 +7450,33 @@
>  }
>  
>  
> -PRIVATE char * MakeNewTitle ARGS1(CONST char **, value)
> +PRIVATE char * MakeNewTitle ARGS2(CONST char **, value, int, src_type)
>  {
>      char *ptr;
>      char *newtitle = NULL;
>  
>      StrAllocCopy(newtitle, "[");
> -    ptr = strrchr(value[HTML_IMG_SRC], '/');
> +    ptr = strrchr(value[src_type], '/');
>      if (!ptr) {
> -     StrAllocCat(newtitle, value[HTML_IMG_SRC]);
> +     StrAllocCat(newtitle, value[src_type]);
>      } else {
>       StrAllocCat(newtitle, ptr + 1);
>      }
>      StrAllocCat(newtitle, "]");
> +    return newtitle;
> +}
> +PRIVATE char * MakeNewImageValue ARGS1(CONST char **, value)
> +{
> +    char *ptr;
> +    char *newtitle = NULL;
> +
> +    StrAllocCopy(newtitle, "[");
> +    ptr = strrchr(value[HTML_INPUT_SRC], '/');
> +    if (!ptr) {
> +     StrAllocCat(newtitle, value[HTML_INPUT_SRC]);
> +    } else {
> +     StrAllocCat(newtitle, ptr + 1);
> +    }
> +    StrAllocCat(newtitle, "]-Submit");
>      return newtitle;
>  }
> 

reply via email to

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