diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-25 17:42:17 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-25 17:42:17 +0000 |
commit | 6e58e83e1237f1d9ba3dda1aa0cb054253bc4d0e (patch) | |
tree | cbccee3a42bd309dd2fe85a5dbbb1b12ba29bfb7 | |
parent | fix indent (diff) | |
download | w3m-6e58e83e1237f1d9ba3dda1aa0cb054253bc4d0e.tar.gz w3m-6e58e83e1237f1d9ba3dda1aa0cb054253bc4d0e.zip |
[w3m-dev 03686] Re: fold patch
* buffer.c (writeBufferCache): rewrite
(readBufferCache): rewrite
* etc.c (calcPosition): short -> int realColumn
* fm.h (Line): short -> int len,width,size,bpos,bwidth
(BufferPoint): short->int pos
(Buffer): short->int currentColumn,pos,visualpos
(BufferPos): short->int currentColumn,pos
* frame.h (frameset_queue): short->int pos,currentColumn
* main.c (clear_mark): short->int pos
(dispincsrch): short->int pos
(backBf): short->int pos
(set_buffer_environ): short->int prev_pos
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | buffer.c | 54 | ||||
-rw-r--r-- | etc.c | 6 | ||||
-rw-r--r-- | fm.h | 24 | ||||
-rw-r--r-- | frame.h | 6 | ||||
-rw-r--r-- | main.c | 12 |
6 files changed, 81 insertions, 39 deletions
@@ -1,3 +1,19 @@ +2003-01-26 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 03686] Re: fold patch + * buffer.c (writeBufferCache): rewrite + (readBufferCache): rewrite + * etc.c (calcPosition): short -> int realColumn + * fm.h (Line): short -> int len,width,size,bpos,bwidth + (BufferPoint): short->int pos + (Buffer): short->int currentColumn,pos,visualpos + (BufferPos): short->int currentColumn,pos + * frame.h (frameset_queue): short->int pos,currentColumn + * main.c (clear_mark): short->int pos + (dispincsrch): short->int pos + (backBf): short->int pos + (set_buffer_environ): short->int prev_pos + 2003-01-25 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> * [w3m-dev 03684] Re: fold patch @@ -6853,4 +6869,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.716 2003/01/24 17:57:07 ukai Exp $ +$Id: ChangeLog,v 1.717 2003/01/25 17:42:17 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: buffer.c,v 1.22 2003/01/24 17:30:50 ukai Exp $ */ +/* $Id: buffer.c,v 1.23 2003/01/25 17:42:17 ukai Exp $ */ #include "fm.h" #ifdef USE_MOUSE @@ -637,16 +637,25 @@ writeBufferCache(Buffer *buf) fwrite1(l->usrflags, cache) || fwrite1(l->width, cache) || fwrite1(l->len, cache) || - fwrite(l->lineBuf, 1, l->len, cache) < l->len || - fwrite(l->propBuf, sizeof(Lineprop), l->len, cache) < l->len) + fwrite1(l->size, cache) || + fwrite1(l->bpos, cache) || + fwrite1(l->bwidth, cache)) goto _error; + if (l->bpos == 0) { + if (fwrite(l->lineBuf, 1, l->size, cache) < l->size || + fwrite(l->propBuf, sizeof(Lineprop), l->size, cache) < l->size) + goto _error; + } #ifdef USE_ANSI_COLOR colorflag = l->colorBuf ? 1 : 0; if (fwrite1(colorflag, cache)) goto _error; if (colorflag) { - if (fwrite(l->colorBuf, sizeof(Linecolor), l->len, cache) < l->len) - goto _error; + if (l->bpos == 0) { + if (fwrite(l->colorBuf, sizeof(Linecolor), l->size, cache) < + l->size) + goto _error; + } } #endif } @@ -665,7 +674,7 @@ int readBufferCache(Buffer *buf) { FILE *cache; - Line *l = NULL, *prevl = NULL; + Line *l = NULL, *prevl = NULL, *basel = NULL; long lnum = 0, clnum, tlnum; #ifdef USE_ANSI_COLOR int colorflag; @@ -696,19 +705,36 @@ readBufferCache(Buffer *buf) buf->topLine = l; if (fread1(l->real_linenumber, cache) || fread1(l->usrflags, cache) || - fread1(l->width, cache) || fread1(l->len, cache)) + fread1(l->width, cache) || + fread1(l->len, cache) || + fread1(l->size, cache) || + fread1(l->bpos, cache) || + fread1(l->bwidth, cache)) + break; + if (l->bpos == 0) { + basel = l; + l->lineBuf = NewAtom_N(char, l->size + 1); + fread(l->lineBuf, 1, l->size, cache); + l->lineBuf[l->size] = '\0'; + l->propBuf = NewAtom_N(Lineprop, l->size); + fread(l->propBuf, sizeof(Lineprop), l->size, cache); + } + else if (basel) { + l->lineBuf = basel->lineBuf + l->bpos; + l->propBuf = basel->propBuf + l->bpos; + } + else break; - l->lineBuf = NewAtom_N(char, l->len + 1); - fread(l->lineBuf, 1, l->len, cache); - l->lineBuf[l->len] = '\0'; - l->propBuf = NewAtom_N(Lineprop, l->len); - fread(l->propBuf, sizeof(Lineprop), l->len, cache); #ifdef USE_ANSI_COLOR if (fread1(colorflag, cache)) break; if (colorflag) { - l->colorBuf = NewAtom_N(Linecolor, l->len); - fread(l->colorBuf, sizeof(Linecolor), l->len, cache); + if (l->bpos == 0) { + l->colorBuf = NewAtom_N(Linecolor, l->size); + fread(l->colorBuf, sizeof(Linecolor), l->size, cache); + } + else + l->colorBuf = basel->colorBuf + l->bpos; } else { l->colorBuf = NULL; @@ -1,4 +1,4 @@ -/* $Id: etc.c,v 1.59 2003/01/23 18:38:06 ukai Exp $ */ +/* $Id: etc.c,v 1.60 2003/01/25 17:42:17 ukai Exp $ */ #include "fm.h" #include <pwd.h> #include "myctype.h" @@ -481,7 +481,7 @@ checkType(Str s, Lineprop **oprop int calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode) { - static short *realColumn = NULL; + static int *realColumn = NULL; static int size = 0; static char *prevl = NULL; int i, j; @@ -494,7 +494,7 @@ calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode) } if (size < len + 1) { size = (len + 1 > LINELEN) ? (len + 1) : LINELEN; - realColumn = New_Reuse(short, realColumn, size); + realColumn = New_Reuse(int, realColumn, size); } prevl = l; j = bpos; @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.107 2003/01/23 18:37:20 ukai Exp $ */ +/* $Id: fm.h,v 1.108 2003/01/25 17:42:17 ukai Exp $ */ /* * w3m: WWW wo Miru utility * @@ -310,19 +310,19 @@ typedef struct _Line { #endif struct _Line *next; struct _Line *prev; - short len; - short width; + int len; + int width; long linenumber; /* on buffer */ long real_linenumber; /* on file */ unsigned short usrflags; - short size; - short bpos; - short bwidth; + int size; + int bpos; + int bwidth; } Line; typedef struct { int line; - short pos; + int pos; } BufferPoint; #ifdef USE_IMAGE @@ -413,11 +413,11 @@ typedef struct _Buffer { char *real_type; int allLine; short bufferprop; - short currentColumn; + int currentColumn; short cursorX; short cursorY; - short pos; - short visualpos; + int pos; + int visualpos; short rootX; short rootY; short COLS; @@ -469,8 +469,8 @@ typedef struct _Buffer { typedef struct _BufferPos { long top_linenumber; long cur_linenumber; - short currentColumn; - short pos; + int currentColumn; + int pos; struct _BufferPos *next; struct _BufferPos *prev; } BufferPos; @@ -1,4 +1,4 @@ -/* $Id: frame.h,v 1.5 2003/01/09 15:30:46 ukai Exp $ */ +/* $Id: frame.h,v 1.6 2003/01/25 17:42:17 ukai Exp $ */ /* * frame support */ @@ -54,8 +54,8 @@ struct frameset_queue { struct frameset *frameset; long linenumber; long top_linenumber; - short pos; - short currentColumn; + int pos; + int currentColumn; struct _anchorList *formitem; }; @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.199 2003/01/23 18:38:08 ukai Exp $ */ +/* $Id: main.c,v 1.200 2003/01/25 17:42:17 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -1545,7 +1545,7 @@ rdrwSc(void) static void clear_mark(Line *l) { - short pos; + int pos; if (!l) return; for (pos = 0; pos < l->size; pos++) @@ -1592,7 +1592,7 @@ dispincsrch(int ch, Str buf, Lineprop *prop) { static Buffer sbuf; static Line *currentLine; - static short pos; + static int pos; char *str; int do_next_search = FALSE; @@ -3770,8 +3770,8 @@ backBf(void) struct frameset *fs; long linenumber = buf->frameQ->linenumber; long top = buf->frameQ->top_linenumber; - short pos = buf->frameQ->pos; - short currentColumn = buf->frameQ->currentColumn; + int pos = buf->frameQ->pos; + int currentColumn = buf->frameQ->currentColumn; AnchorList *formitem = buf->frameQ->formitem; fs = popFrameTree(&(buf->frameQ)); @@ -5344,7 +5344,7 @@ set_buffer_environ(Buffer *buf) { static Buffer *prev_buf = NULL; static Line *prev_line = NULL; - static short prev_pos = -1; + static int prev_pos = -1; Line *l; if (buf == NULL) |