From d404404dda40eab419b37f8136920e8edf38d401 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Tue, 20 Aug 2002 17:49:38 +0000 Subject: Debian Bug#157098: wrong file presentation on large files from "Eduard Bloch" * configure (clen_t): added (HAVE_STRTOLL): added (HAVE_STRTOQ): added (HAVE_ATOLL): added (HAVE_ATOQ): added * config.h.dist: ditto * file.c (current_content_length): s/int/clen_t/ (loadGeneralFile): s/atoi/strtoclen/ (convert_size): s/int/clen_t/ (convert_size2): s/int/clen_t/ (showProgress): s/int/clen_t/ (loadHTMLstream): s/int/clen_t/ linelen, trbyte (loadBuffer): ditto (getNextPage): s/int/clen_t/ linelen (save2tmp): s/int/clen_t/ linelen, trbye (_MoveFile): s/int/clen_t/ linelen, trbye * fm.h (_Buffer): s/int/clen_t/ linelen, trbye * ftp.c (size_int2str): s/long/clen_t/ (ex_ftpdir_name_size_date): s/long/clen_t/ * indep.c (strtoclen): added * indep.h (strtoclen): added * proto.h (showProgress): s/int/clen_t/ From: Fumitoshi UKAI --- ChangeLog | 29 ++++++++++++++++++- config.h.dist | 5 ++++ configure | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- file.c | 24 ++++++++-------- fm.h | 6 ++-- ftp.c | 8 +++--- indep.c | 18 +++++++++++- indep.h | 3 +- proto.h | 4 +-- 9 files changed, 161 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 473ed62..2d0cbcd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2002-08-21 Fumitoshi UKAI + + * Debian Bug#157098: wrong file presentation on large files + from "Eduard Bloch" + * configure (clen_t): added + (HAVE_STRTOLL): added + (HAVE_STRTOQ): added + (HAVE_ATOLL): added + (HAVE_ATOQ): added + * config.h.dist: ditto + * file.c (current_content_length): s/int/clen_t/ + (loadGeneralFile): s/atoi/strtoclen/ + (convert_size): s/int/clen_t/ + (convert_size2): s/int/clen_t/ + (showProgress): s/int/clen_t/ + (loadHTMLstream): s/int/clen_t/ linelen, trbyte + (loadBuffer): ditto + (getNextPage): s/int/clen_t/ linelen + (save2tmp): s/int/clen_t/ linelen, trbye + (_MoveFile): s/int/clen_t/ linelen, trbye + * fm.h (_Buffer): s/int/clen_t/ linelen, trbye + * ftp.c (size_int2str): s/long/clen_t/ + (ex_ftpdir_name_size_date): s/long/clen_t/ + * indep.c (strtoclen): added + * indep.h (strtoclen): added + * proto.h (showProgress): s/int/clen_t/ + 2002-07-31 Fumitoshi UKAI * Debian Bug#154766: w3m-img: support DirectColor framebuffer visuals? @@ -3683,4 +3710,4 @@ * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.415 2002/07/30 16:03:00 ukai Exp $ +$Id: ChangeLog,v 1.416 2002/08/20 17:49:38 ukai Exp $ diff --git a/config.h.dist b/config.h.dist index 94b8053..93985a9 100644 --- a/config.h.dist +++ b/config.h.dist @@ -179,6 +179,11 @@ MODEL=Linux.i686-monster-ja #undef USE_BINMODE_STREAM #define HAVE_TERMIOS_H #define HAVE_DIRENT_H +typedef long clen_t; +#undef HAVE_STRTOLL +#undef HAVE_STRTOQ +#undef HAVE_ATOLL +#undef HAVE_ATOQ #define HAVE_STRCASECMP #define HAVE_STRCASESTR #define HAVE_STRCHR diff --git a/configure b/configure index 52ce6de..dd57bba 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: configure,v 1.72 2002/07/18 06:07:25 ukai Exp $ +# $Id: configure,v 1.73 2002/08/20 17:49:38 ukai Exp $ # Configuration. # @@ -1283,6 +1283,88 @@ fi def_param use_help_cgi $have_perl +####### long long +cat > _zmachdep.c < /dev/null 2>&1 +then + echo "You have long long" + def_have_long_long="typedef long long clen_t;" + cat > _zmachdep.c < +main() +{ + const char *s = "1"; + long long ll = strtoll(s, NULL, 10); +} +EOF + if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1 + then + echo "You have strtoll()" + def_have_strtoll="#define HAVE_STRTOLL" + else + echo "You don't have strtoll()" + def_have_strtoll="#undef HAVE_STRTOLL" + fi + cat > _zmachdep.c < +#include +#include +main() +{ + const char *s = "1" + quad_t q = strtoq(s, NULL, 10); +} +EOF + if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1 + then + echo "You have strtoq()" + def_have_strtoq="#define HAVE_STRTOQ" + else + echo "You don't have strtoq()" + def_have_strtoq="#undef HAVE_STRTOQ" + fi + cat > _zmachdep.c < +main() +{ + const char *s = "1"; + long long ll = atoll(s); +} +EOF + if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1 + then + echo "You have atoll()" + def_have_atoll="#define HAVE_ATOLL" + else + echo "You don't have atoll()" + def_have_atoll="#undef HAVE_ATOLL" + fi + cat > _zmachdep.c < +main() +{ + const char *s = "1"; + long long ll = atoq(s); +} +EOF + if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1 + then + echo "You have atoq()" + def_have_atoq="#define HAVE_ATOQ" + else + echo "You don't have atoq()" + def_have_atoq="#undef HAVE_ATOQ" + fi +else + echo "You don't have long long" + def_have_long_long="typedef long clen_t;" +fi + ####### strcasecmp cat > _zmachdep.c << EOF #include @@ -2306,6 +2388,11 @@ $def_use_xface $def_use_binstream $def_term_if $def_dir_if +$def_have_long_long +$def_have_strtoll +$def_have_strtoq +$def_have_atoll +$def_have_atoq $def_have_strcasecmp $def_have_strcasestr $def_have_strchr diff --git a/file.c b/file.c index 5792768..827eeae 100644 --- a/file.c +++ b/file.c @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.94 2002/07/19 03:24:28 ukai Exp $ */ +/* $Id: file.c,v 1.95 2002/08/20 17:49:39 ukai Exp $ */ #include "fm.h" #include #include "myctype.h" @@ -120,7 +120,7 @@ static int forms_size = 0; #define cur_form_id ((form_sp >= 0)? form_stack[form_sp] : -1) static int form_sp = 0; -static int current_content_length; +static clen_t current_content_length; static int cur_hseq; #ifdef USE_IMAGE @@ -1950,7 +1950,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, current_content_length = 0; if ((p = checkHeader(t_buf, "Content-Length:")) != NULL) - current_content_length = atoi(p); + current_content_length = strtoclen(p); if (flag & RG_FRAME) { t_buf = newBuffer(INIT_BUFFER_WIDTH); @@ -5777,7 +5777,7 @@ static char *_size_unit[] = { "b", "kb", "Mb", "Gb", "Tb", }; char * -convert_size(int size, int usefloat) +convert_size(clen_t size, int usefloat) { float csize; int sizepos = 0; @@ -5793,7 +5793,7 @@ convert_size(int size, int usefloat) } char * -convert_size2(int size1, int size2, int usefloat) +convert_size2(clen_t size1, clen_t size2, int usefloat) { char **sizes = _size_unit; float csize, factor = 1; @@ -5811,7 +5811,7 @@ convert_size2(int size1, int size2, int usefloat) } void -showProgress(int *linelen, int *trbyte) +showProgress(clen_t *linelen, clen_t *trbyte) { int i, j, rate, duration, eta, pos; static time_t last_time, start_time; @@ -6052,8 +6052,8 @@ void loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) { struct environment envs[MAX_ENV_LEVEL]; - int linelen = 0; - int trbyte = 0; + clen_t linelen = 0; + clen_t trbyte = 0; Str lineBuf2 = Strnew(); char code; struct html_feed_environ htmlenv1; @@ -6396,7 +6396,7 @@ loadBuffer(URLFile *uf, Buffer *volatile newBuf) volatile char pre_lbuf = '\0'; int nlines; Str tmpf; - int linelen = 0, trbyte = 0; + clen_t linelen = 0, trbyte = 0; #ifdef USE_ANSI_COLOR int check_color; #endif @@ -6776,7 +6776,7 @@ getNextPage(Buffer *buf, int plen) Line *l, *fl, *pl = buf->lastLine; Line *rl = NULL; int len, i, nlines = 0; - int linelen = buf->linelen, trbyte = buf->trbyte; + clen_t linelen = buf->linelen, trbyte = buf->trbyte; Str lineBuf2; char pre_lbuf = '\0'; URLFile uf; @@ -6920,7 +6920,7 @@ save2tmp(URLFile uf, char *tmpf) { FILE *ff; int check; - int linelen = 0, trbyte = 0; + clen_t linelen = 0, trbyte = 0; MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL; static JMP_BUF env_bak; @@ -7073,7 +7073,7 @@ _MoveFile(char *path1, char *path2) InputStream f1; FILE *f2; int is_pipe; - int linelen = 0, trbyte = 0; + clen_t linelen = 0, trbyte = 0; Str buf; f1 = openIS(path1); diff --git a/fm.h b/fm.h index c6748a5..da12859 100644 --- a/fm.h +++ b/fm.h @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.61 2002/07/22 16:27:31 ukai Exp $ */ +/* $Id: fm.h,v 1.62 2002/08/20 17:49:39 ukai Exp $ */ /* * w3m: WWW wo Miru utility * @@ -419,8 +419,8 @@ typedef struct _Buffer { struct frameset *frameset; struct frameset_queue *frameQ; int *clone; - int linelen; - int trbyte; + size_t linelen; + size_t trbyte; char check_url; #ifdef JP_CHARSET char document_code; diff --git a/ftp.c b/ftp.c index d3301a7..800ad7a 100644 --- a/ftp.c +++ b/ftp.c @@ -1,4 +1,4 @@ -/* $Id: ftp.c,v 1.11 2002/02/19 15:50:18 ukai Exp $ */ +/* $Id: ftp.c,v 1.12 2002/08/20 17:49:39 ukai Exp $ */ #include #include #include @@ -711,7 +711,7 @@ ftp_system(FTP ftp) }\ } -static Str size_int2str(unsigned long); +static Str size_int2str(clen_t); static int ex_ftpdir_name_size_date(char *line, char **name, char **date, char **sizep) @@ -719,7 +719,7 @@ ex_ftpdir_name_size_date(char *line, char **name, char **date, char **sizep) int ftype = FTPDIR_NONE; char *cp, *endp; Str date_str, name_str, size_str; - unsigned long size; + clen_t size; if (strlen(line) < 11) { goto done; @@ -805,7 +805,7 @@ ex_ftpdir_name_size_date(char *line, char **name, char **date, char **sizep) } static Str -size_int2str(unsigned long size) +size_int2str(clen_t size) { Str size_str; int unit; diff --git a/indep.c b/indep.c index a535748..25884a4 100644 --- a/indep.c +++ b/indep.c @@ -1,4 +1,4 @@ -/* $Id: indep.c,v 1.22 2002/06/07 15:46:44 ukai Exp $ */ +/* $Id: indep.c,v 1.23 2002/08/20 17:49:39 ukai Exp $ */ #include "fm.h" #include #include @@ -11,6 +11,22 @@ #include "myctype.h" #include "entity.h" +clen_t +strtoclen(const char *s) +{ +#ifdef HAVE_STRTOLL + return strtoll(s, NULL, 10); +#elif HAVE_STRTOQ + return strtoq(s, NULL, 10); +#elif HAVE_ATOLL + return atoll(s); +#elif HAVE_ATOQ + return atoq(s); +#else + return atoi(s); +#endif +} + #ifndef HAVE_BCOPY void bcopy(const void *src, void *dest, int len) diff --git a/indep.h b/indep.h index 5965d06..9f5fa1b 100644 --- a/indep.h +++ b/indep.h @@ -1,4 +1,4 @@ -/* $Id: indep.h,v 1.8 2002/06/07 15:46:44 ukai Exp $ */ +/* $Id: indep.h,v 1.9 2002/08/20 17:49:39 ukai Exp $ */ #ifndef INDEP_H #define INDEP_H #include "gc.h" @@ -16,6 +16,7 @@ #define HTML_MODE 1 #define HEADER_MODE 2 +extern clen_t strtoclen(const char *s); extern char *conv_entity(int ch); extern int getescapechar(char **s); extern char *getescapecmd(char **s); diff --git a/proto.h b/proto.h index 695d16e..5ff9aa5 100644 --- a/proto.h +++ b/proto.h @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.44 2002/06/09 16:09:25 ukai Exp $ */ +/* $Id: proto.h,v 1.45 2002/08/20 17:49:39 ukai Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -176,7 +176,7 @@ extern void HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal); #define HTMLlineproc1(x,y) HTMLlineproc0(x,y,TRUE) extern Buffer *loadHTMLBuffer(URLFile *f, Buffer *newBuf); -extern void showProgress(int *linelen, int *trbyte); +extern void showProgress(clen_t *linelen, clen_t *trbyte); extern void init_henv(struct html_feed_environ *, struct readbuffer *, struct environment *, int, TextLineList *, int, int); extern void completeHTMLstream(struct html_feed_environ *, -- cgit v1.2.3