bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] Another css url bug


From: Giuseppe Scrivano
Subject: Re: [Bug-wget] Another css url bug
Date: Fri, 08 Oct 2010 12:33:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Thanks, the patch looks good.  I have done some minor adjustments to
follow the gnu coding standards, I have attached it.

Can you please provide a ChangeLog entry?

Cheers,
Giuseppe



=== modified file 'src/html-url.c'
--- src/html-url.c      2010-07-29 23:00:26 +0000
+++ src/html-url.c      2010-10-08 10:30:01 +0000
@@ -364,12 +364,27 @@
 check_style_attr (struct taginfo *tag, struct map_context *ctx)
 {
   int attrind;
+  int raw_start;
+  int raw_len;
   char *style = find_attr (tag, "style", &attrind);
   if (!style)
     return;
 
-  /* raw pos and raw size include the quotes, hence the +1 -2 */
-  get_urls_css (ctx, ATTR_POS(tag,attrind,ctx)+1, ATTR_SIZE(tag,attrind)-2);
+  /* raw pos and raw size include the quotes, skip them when they are
+     present.  */
+  raw_start = ATTR_POS (tag, attrind, ctx);
+  raw_len  = ATTR_SIZE (tag, attrind);
+  if( *(char *)(ctx->text + raw_start) == '\''
+      || *(char *)(ctx->text + raw_start) == '"')
+    {
+      raw_start += 1;
+      raw_len -= 2;
+    }
+
+  if(raw_len <= 0)
+       return;
+
+  get_urls_css (ctx, raw_start, raw_len);
 }
 
 /* All the tag_* functions are called from collect_tags_mapper, as




reply via email to

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