w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 689852ddefb4a2da67ac1da70017111069ef70da
parent 1b23cbc1ec77a912f1daaacd28c121565d6bbfce
Author: ukai <ukai>
Date:   Thu,  9 Jan 2003 15:30:20 +0000

[w3m-dev 03619] Re: Error occured while reset
* file.c (process_img): check image.ext
	(HTMLlineproc2body): check image.ext
	(loadImageBuffer): url, ext is in URLFile
* frame.c (unloadFrame): no need to push to fileToDelete
	(copyFrame): no need to reset FB_TODELETE
	(resetFrameElement): f_body->source, buf->sourcefile
	(frame_download_source): buf->source
			buf->sourcefile reset
* frame.h (FB_NOCACHE): deleted
	(FB_TODELETE): deleted
* main.c (vmSrc): Currentbuf->sourcefile
		need_reshape if images exist
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>

Diffstat:
MChangeLog | 16++++++++++++++++
Mfile.c | 12+++++++-----
Mframe.c | 33++++-----------------------------
Mframe.h | 4+---
Mmain.c | 5+++++
5 files changed, 33 insertions(+), 37 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,19 @@ +2003-01-10 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 03619] Re: Error occured while reset + * file.c (process_img): check image.ext + (HTMLlineproc2body): check image.ext + (loadImageBuffer): url, ext is in URLFile + * frame.c (unloadFrame): no need to push to fileToDelete + (copyFrame): no need to reset FB_TODELETE + (resetFrameElement): f_body->source, buf->sourcefile + (frame_download_source): buf->source + buf->sourcefile reset + * frame.h (FB_NOCACHE): deleted + (FB_TODELETE): deleted + * main.c (vmSrc): Currentbuf->sourcefile + need_reshape if images exist + 2003-01-09 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> * [w3m-dev 03617] sourcefile when Content-Encoding: is specified. diff --git a/file.c b/file.c @@ -3122,7 +3122,8 @@ process_img(struct parsed_tag *tag, int width) parseURL2(p, &u, cur_baseURL); #endif image.url = parsedURL2Str(&u)->ptr; - image.ext = filename_extension(u.file, TRUE); + if (!uncompressed_file_type(u.file, &image.ext)) + image.ext = filename_extension(u.file, TRUE); image.cache = NULL; image.width = w; image.height = i; @@ -5171,7 +5172,8 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) parseURL2(a_img->url, &u, cur_baseURL); a_img->image = image = New(Image); image->url = parsedURL2Str(&u)->ptr; - image->ext = filename_extension(u.file, TRUE); + if (!uncompressed_file_type(u.file, &image->ext)) + image->ext = filename_extension(u.file, TRUE); image->cache = NULL; image->width = (w > MAX_IMAGE_SIZE) ? MAX_IMAGE_SIZE : w; @@ -6843,8 +6845,8 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) loadImage(IMG_FLAG_STOP); image = New(Image); - image->url = parsedURL2Str(cur_baseURL)->ptr; - image->ext = filename_extension(cur_baseURL->file, 1); + image->url = uf->url; + image->ext = uf->ext; image->width = -1; image->height = -1; cache = getImage(image, cur_baseURL, IMG_FLAG_AUTO); @@ -6876,7 +6878,7 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) if (newBuf == NULL) newBuf = newBuffer(INIT_BUFFER_WIDTH); cache->loaded |= IMG_FLAG_DONT_REMOVE; - if (uf->scheme != SCM_LOCAL) + if (newBuf->sourcefile == NULL && uf->scheme != SCM_LOCAL) newBuf->sourcefile = cache->file; tmp = Sprintf("<img src=\"%s\"><br><br>", html_quote(image->url)); diff --git a/frame.c b/frame.c @@ -107,8 +107,6 @@ newFrame(struct parsed_tag *tag, Buffer *buf) static void unloadFrame(struct frame_body *b) { - if (b->source && b->flags & FB_TODELETE) - pushText(fileToDelete, b->source); b->attr = F_UNLOADED; } @@ -177,7 +175,6 @@ copyFrame(struct frame_body *ob) rb = New(struct frame_body); bcopy((const void *)ob, (void *)rb, sizeof(struct frame_body)); - rb->flags &= ~FB_TODELETE; return rb; } @@ -316,21 +313,12 @@ resetFrameElement(union frameset_element *f_element, f_body->attr = F_BODY; f_body->name = f_name; f_body->url = parsedURL2Str(&buf->currentURL)->ptr; + f_body->source = buf->sourcefile; + buf->sourcefile = NULL; if (buf->mailcap_source) { f_body->source = buf->mailcap_source; - f_body->flags |= FB_TODELETE; buf->mailcap_source = NULL; } - else if (buf->real_scheme == SCM_LOCAL) { - f_body->source = buf->sourcefile; - } - else { - Str tmp = tmpfname(TMPF_FRAME, NULL); - rename(buf->sourcefile, tmp->ptr); - f_body->source = tmp->ptr; - f_body->flags |= FB_TODELETE; - buf->sourcefile = NULL; - } f_body->type = buf->type; f_body->referer = referer; f_body->request = request; @@ -345,7 +333,6 @@ frame_download_source(struct frame_body *b, ParsedURL *currentURL, { Buffer *buf; struct frameset *ret_frameset = NULL; - Str tmp; ParsedURL url; if (b == NULL || b->url == NULL || b->url[0] == '\0') @@ -381,25 +368,13 @@ frame_download_source(struct frame_body *b, ParsedURL *currentURL, return NULL; } b->url = parsedURL2Str(&buf->currentURL)->ptr; - b->source = buf->sourcefile; b->type = buf->type; + b->source = buf->sourcefile; + buf->sourcefile = NULL; if (buf->mailcap_source) { b->source = buf->mailcap_source; - b->flags |= FB_TODELETE; buf->mailcap_source = NULL; } - else if ((buf->real_scheme != SCM_LOCAL) -#ifdef USE_IMAGE - || (activeImage && !useExtImageViewer && - buf->real_type && !strncasecmp(buf->real_type, "image/", 6)) -#endif - ) { - tmp = tmpfname(TMPF_FRAME, NULL); - rename(buf->sourcefile, tmp->ptr); - b->source = tmp->ptr; - b->flags |= FB_TODELETE; - buf->sourcefile = NULL; - } b->attr = F_BODY; if (buf->frameset) { ret_frameset = buf->frameset; diff --git a/frame.h b/frame.h @@ -15,9 +15,7 @@ struct frame_element { struct frame_body { char attr; char flags; -#define FB_NOCACHE 0x01 -#define FB_TODELETE 0x02 -#define FB_NO_BUFFER 0x04 +#define FB_NO_BUFFER 0x01 char *name; char *url; ParsedURL *baseURL; diff --git a/main.c b/main.c @@ -4392,6 +4392,7 @@ vwSrc(void) saveBuffer(Currentbuf, f); fclose(f); fn = tmpf->ptr; + Currentbuf->sourcefile = fn; } else { return; @@ -4441,6 +4442,10 @@ vwSrc(void) Sprintf("HTML view of %s", Currentbuf->buffername)->ptr; buf->linkBuffer[LB_SOURCE] = Currentbuf; Currentbuf->linkBuffer[LB_N_SOURCE] = buf; +#ifdef USE_IMAGE + if (buf->img) + buf->need_reshape = TRUE; +#endif } else { return;