diff options
-rw-r--r-- | CHANGES | 11 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFile.c | 2 | ||||
-rw-r--r-- | WWW/Library/Implementation/UCMap.h | 2 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | lynx.cfg | 4 | ||||
-rw-r--r-- | makefile.msc | 1 | ||||
-rw-r--r-- | makelynx.bat | 26 | ||||
-rw-r--r-- | src/GridText.c | 88 | ||||
-rw-r--r-- | src/LYCurses.h | 4 | ||||
-rw-r--r-- | src/LYMain.c | 2 | ||||
-rw-r--r-- | src/LYMainLoop.c | 18 | ||||
-rw-r--r-- | src/LYUtils.c | 12 | ||||
-rw-r--r-- | userdefs.h | 4 |
13 files changed, 109 insertions, 67 deletions
diff --git a/CHANGES b/CHANGES index 7459d000..658023fb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,17 @@ Changes since Lynx 2.8 release =============================================================================== +2002-12-18 (2.8.5dev.12) +* remove a check in LYMain.c for cygwin's console, which does not work with + screen (report by Frederic L W Meunier) -TD +* undo line/pool logic, fixing a memory leak -LP +* changes proposed by Bela Lubkin, to optimize ALLOC_IN_POOL macro + substitution, pack bitfields in HTStyleChanges more compact on some systems -LP +* correct logic of do_check_recall(), broken in dev.9 cleanup of pathname + constants with LYIsDosDrive() (report by Frederic L W Meunier) -TD +* update makelynx.bat, built with slang configuration -TD +* turn on file-upload in makefile.msc -TD + 2002-12-01 (2.8.5dev.11) * fix a typo in changelog date -TD * add project version & date to lynx.cfg -TD diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c index e9d5e231..213e2e24 100644 --- a/WWW/Library/Implementation/HTFile.c +++ b/WWW/Library/Implementation/HTFile.c @@ -1790,7 +1790,7 @@ PRIVATE int print_local_dir ARGS5( LYAddPathSep(&tmpfilename); StrAllocCat(tmpfilename, dirbuf->d_name); - data = malloc(sizeof(DIRED) + strlen(dirbuf->d_name) + 4); + data = (DIRED *)malloc(sizeof(DIRED) + strlen(dirbuf->d_name) + 4); if (data == NULL) { /* FIXME */ } diff --git a/WWW/Library/Implementation/UCMap.h b/WWW/Library/Implementation/UCMap.h index b412dc1e..cc9a487d 100644 --- a/WWW/Library/Implementation/UCMap.h +++ b/WWW/Library/Implementation/UCMap.h @@ -46,6 +46,8 @@ extern int UCLYhndl_for_unrec; extern int UCLYhndl_HTFile_for_unspec; extern int UCLYhndl_HTFile_for_unrec; +#undef UTF8 /* defined in some broken header files */ + /* easy to type: */ extern int LATIN1; /* UCGetLYhndl_byMIME("iso-8859-1") */ extern int US_ASCII; /* UCGetLYhndl_byMIME("us-ascii") */ diff --git a/configure.in b/configure.in index 250a74b6..f14b00fa 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl by T.E.Dickey <dickey@invisible-island.net> dnl and Jim Spath <jspath@mail.bcpl.lib.md.us> dnl dnl ask PRCS to plug-in the project-version for the configure-script. -dnl $Format: AC_REVISION($ProjectVersion: 2.8.5dev.11 $\""$) +dnl $Format: AC_REVISION($ProjectVersion: 2.8.5dev.12 $\""$) AC_REVISION(none) # Save the original $CFLAGS so we can distinguish whether the user set those diff --git a/lynx.cfg b/lynx.cfg index d2769985..724a03da 100644 --- a/lynx.cfg +++ b/lynx.cfg @@ -3,10 +3,10 @@ # or Lynx_Dir:lynx.cfg (VMS) # # $Format: "#PRCS LYNX_VERSION \"$ProjectVersion$\""$ -#PRCS LYNX_VERSION "2.8.5dev.11" +#PRCS LYNX_VERSION "2.8.5dev.12" # # $Format: "#PRCS LYNX_DATE \"$ProjectDate$\""$ -#PRCS LYNX_DATE "Sun, 01 Dec 2002 18:19:26 -0800" +#PRCS LYNX_DATE "Wed, 18 Dec 2002 17:57:10 -0800" # # Definition pairs are of the form VARIABLE:DEFINITION # NO spaces are allowed between the pair items. diff --git a/makefile.msc b/makefile.msc index 628e9e67..b801fab6 100644 --- a/makefile.msc +++ b/makefile.msc @@ -43,6 +43,7 @@ DEFS = $(CS_DEFS) $(SOCK_DEFS) $(SSL_DEFS) \ /D "DOSPATH" \ /D "EXP_ALT_BINDINGS" \ /D "EXP_CMD_LOGGING" \ + /D "EXP_FILE_UPLOAD" \ /D "EXP_JUSTIFY_ELTS" \ /D "EXP_NESTED_TABLES" \ /D "EXP_PERSISTENT_COOKIES" \ diff --git a/makelynx.bat b/makelynx.bat index 1fd5fc11..48670416 100644 --- a/makelynx.bat +++ b/makelynx.bat @@ -1,24 +1,28 @@ +@echo off @echo Windows/Dos batch makefile for MingW32 and lynx.exe @echo Remember to precede this by "command /E:8192" and to set the @echo MingW32 C_INCLUDE_PATH and %C_INCLUDE_PATH%..\..\bin paths -@echo -@echo Usage: makelynx [all|src|link] +@echo. +@echo Usage: makelynx [option] @echo Default option: all @echo Specifying "src" causes the libwww code to be skipped. @echo Specifying "link" causes the batch file to skip to the final @echo linking phase. -@echo -PAUSE +@echo. @echo Note that you have to edit i386-mingw32\include\stdlib.h to put @echo an "#ifndef WIN_EX" around the declaration for `sleep', or the @echo compile won't work. There is also an "#ifndef PDCURSES" around -@echo the declaration for `beep' for the same reason. To change the -@echo console library from libslang to libpdcurses, uncomment the -@echo `SET LIBRARY' line below. +@echo the declaration for `beep' for the same reason. +@echo. +@echo To change the console library from libslang to libpdcurses, +@echo uncomment the `SET LIBRARY' line below. -PAUSE +rem SET LIBRARY=PDCURSES -REM SET LIBRARY=PDCURSES +rem Uncomment these lines if the slang/curses headers and libraries +rem are in the top-level lib directory: +rem set C_INCLUDE_PATH=..\lib;..\..\..\lib;%C_INCLUDE_PATH% +rem set LIBRARY_PATH=..\lib;..\..\..\lib;%LIBRARY_PATH% set CC=gcc @@ -28,6 +32,7 @@ echo #define ANSI_VARARGS 1 >> lynx_cfg.h echo #define BOXHORI 0 >> lynx_cfg.h echo #define BOXVERT 0 >> lynx_cfg.h echo #define HAVE_GETCWD 1 >> lynx_cfg.h +echo #define HAVE_STRERROR 1 >> lynx_cfg.h echo #define LYNX_CFG_FILE "./lynx.cfg" >> lynx_cfg.h echo #define LY_MAXPATH 1024 >> lynx_cfg.h echo #define USE_ALT_BLAT_MAILER 1 >> lynx_cfg.h @@ -36,7 +41,6 @@ echo #define _WIN_CC 1 >> lynx_cfg.h rem echo #define USE_SCROLLBAR 1 >> lynx_cfg.h SET DEFINES=-DCJK_EX -SET DEFINES=%DEFINES% -DHAVE_CONFIG_H SET DEFINES=%DEFINES% -DNO_CONFIG_INFO SET DEFINES=%DEFINES% -DSH_EX SET DEFINES=%DEFINES% -DWIN_EX @@ -298,7 +302,7 @@ if errorlevel 1 PAUSE :link if not "%LIBRARY%" == "PDCURSES" goto else2 -SET LIBS=-L..\WWW\Library\Implementation -lwww -lpdcurses -lpanel -lwsock32 -luser32 +SET LIBS=-L..\WWW\Library\Implementation -lwww -lpdcurses -lwsock32 -luser32 goto endif2 :else2 SET LIBS=-L..\WWW\Library\Implementation -lwww -lslang -lwsock32 -luser32 diff --git a/src/GridText.c b/src/GridText.c index 54bd8ebd..e070f164 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -149,16 +149,12 @@ PUBLIC int LYsb_begin = -1; PUBLIC int LYsb_end = -1; #endif -#ifndef CHAR_BIT -#define CHAR_BIT 8 -#endif - /*try to fit in 2 shorts*/ + /*try to fit in 32bit */ typedef struct { - unsigned int direction:2; /* on or off */ - unsigned int horizpos: (sizeof(short)*CHAR_BIT-2); - /* horizontal position of this change */ - unsigned short style; /* which style to change to */ + unsigned int direction:2; /* on or off */ + unsigned int horizpos:14; /* horizontal position of this change */ + unsigned int style:16; /* which style to change to */ } HTStyleChange; #if defined(USE_COLOR_STYLE) @@ -167,7 +163,7 @@ typedef struct { static HTStyleChange stylechanges_buffers[2][MAX_STYLES_ON_LINE]; #endif -#define POOL_SIZE (8192 - 4*sizeof(void*) - sizeof(struct _HTPool*) + sizeof(int)) / sizeof(HTStyleChange) +enum { POOL_SIZE = (8192 - 4*sizeof(void*) - sizeof(struct _HTPool*) - sizeof(int)) / sizeof(HTStyleChange) }; typedef struct _HTPool { HTStyleChange data[POOL_SIZE]; @@ -205,7 +201,7 @@ pool provided their length will never exceed N and is much smaller than N seems to be very efficient. [Several types of memory-hungry objects are stored in the pool now: styles, lines, anchors, and FormInfo. Arrays of HTStyleChange are stored as is, -other objects are aligned to sizeof(void*) bytes and stored using a cast.] +other objects are stored using a cast.] Pool are referenced by pointer to the chunk that contains free slots. Macros that allocate memory in pools update that pointer if needed. @@ -214,7 +210,7 @@ ALLOC_IN_POOL. Here is a description of those macros as C++ functions (with names mentioned above and with use of C++ references) -void ALLOC_IN_POOL( P*& pool, pool_type, int toalloc, T*& ptr, int align=1) +void ALLOC_IN_POOL( P*& pool, pool_type, int toalloc, T*& ptr) - allocates 'toalloc' items in the pool of type 'pool_type' pointed by 'pool', sets the pointer 'ptr' to the "allocated" memory and updates 'pool' if necessary. Sets 'ptr' to NULL if fails. @@ -230,18 +226,16 @@ void POOL_FREE( pool_type , P*& ptr) *************************************************************************/ /* - * void ALLOC_IN_POOL( P*& pool, pool_type, int toalloc, T*& ptr, int align=1) + * void ALLOC_IN_POOL( P*& pool, pool_type, int toalloc, T*& ptr) * - allocates 'toalloc' items in the pool of type 'pool_type' pointed by * 'pool', sets the pointer 'ptr' to the "allocated" memory and updates * 'pool' if necessary. Sets 'ptr' to NULL if fails. */ -#define ALLOC_IN_POOL(pool,pool_type,toalloc,ptr,align) \ +#define ALLOC_IN_POOL(pool,pool_type,toalloc,ptr) \ if (!pool) { \ ptr = NULL; \ } else { \ - if (align) \ - pool->used += (pool->used % align); \ - if (POOL_SIZE - pool->used >= toalloc) { \ + if (POOL_SIZE - pool->used >= toalloc) { \ ptr = pool->data + pool->used; \ pool->used += toalloc; \ } else { \ @@ -286,27 +280,25 @@ void POOL_FREE( pool_type , P*& ptr) } /**************************************************************************/ -#define _sz_ sizeof(HTStyleChange) /* 4 */ -#define _align_ (sizeof(void*)/_sz_) /*64bit OS!*/ -#define _round_(x) (x%_sz_ ? x/_sz_ + 1: x/_sz_) +#define _sz_ sizeof(HTStyleChange) /* 4 */ +#define _round_up_(x) (x%_sz_ ? x/_sz_ + 1: x/_sz_) #define POOLallocstyles(ptr, N) ALLOC_IN_POOL(HTMainText->pool,HTPool,\ N, \ - ptr, \ - 1) + ptr) #define POOLallocHTLine(ptr, size) { HTStyleChange* _tmp_; \ + int N = _round_up_(LINE_SIZE(size)); \ ALLOC_IN_POOL(HTMainText->pool,HTPool,\ - _round_(LINE_SIZE(size)), \ - _tmp_, \ - _align_); \ - ptr = (HTLine*)_tmp_; \ + N, \ + _tmp_); \ + ptr = (HTLine*)_tmp_; \ } #define POOLtypecalloc(T,ptr) { HTStyleChange* _tmp_; \ + int N = _round_up_(sizeof(T)); \ ALLOC_IN_POOL(HTMainText->pool,HTPool,\ - _round_(sizeof(T)), \ - _tmp_, \ - _align_); \ - ptr = (T*)_tmp_; \ + N, \ + _tmp_); \ + ptr = (T*)_tmp_; \ } typedef struct _line { @@ -1066,6 +1058,24 @@ PUBLIC void HText_free ARGS1( HTAnchor_setDocument(self->node_anchor, (HyperDoc *)0); + while (YES) { /* Free off line array */ + HTLine * l = self->last_line; + if (l) { + l->next->prev = l->prev; + l->prev->next = l->next; /* Unlink l */ + self->last_line = l->prev; + if (l != self->last_line) { + FREE(l); + } else { + free(l); + } + } + if (l == self->last_line) { /* empty */ + l = self->last_line = NULL; + break; + } + } + while (self->first_anchor) { /* Free off anchor array */ TextAnchor * l = self->first_anchor; self->first_anchor = l->next; @@ -2488,7 +2498,7 @@ PRIVATE void move_anchors_in_region ARGS7( * Some necessary changes for anchors starting on this line are also done * here if needed. * Returns a newly allocated HTLine* if changes were made - * (lines allocated in pool, caller should not free the old one). + * (caller has to free the old one). * Returns NULL if no changes needed. (Remove-spaces code may be buggy...) * - kw */ @@ -2532,7 +2542,7 @@ PRIVATE HTLine * insert_blanks_in_line ARGS7( if (!prev_anchor) prev_anchor = text->first_anchor; head_processed = (prev_anchor && prev_anchor->line_num < line_number); - memcpy(mod_line, line, LINE_SIZE(0)); + memcpy(mod_line, line, LINE_SIZE(1)); t = newdata = mod_line->data; ip = 0; while (ip <= ninserts) { @@ -2652,12 +2662,10 @@ PRIVATE void split_line ARGS2( HTLine * line = (HTLine *)LY_CALLOC(1, LINE_SIZE(MAX_LINE)+2); /* - * Set new line. + * Make new line. */ if (line == NULL) outofmem(__FILE__, "split_line_1"); - memset(line, 0, LINE_SIZE(0)); - ctrl_chars_on_this_line = 0; /*reset since we are going to a new line*/ utfxtra_on_this_line = 0; /*reset too, we'll count them*/ text->LastChar = ' '; @@ -2948,7 +2956,7 @@ PRIVATE void split_line ARGS2( { HTLine* temp; - POOLallocHTLine(temp, previous->size); + temp = allocHTLine(previous->size); if (!temp) outofmem(__FILE__, "split_line_2"); memcpy(temp, previous, LINE_SIZE(previous->size)); @@ -2958,6 +2966,7 @@ PRIVATE void split_line ARGS2( outofmem(__FILE__, "split_line_2"); memcpy(temp->styles, previous->styles, sizeof(HTStyleChange)*previous->numstyles); #endif + FREE(previous); previous = temp; } @@ -3242,6 +3251,8 @@ PRIVATE void split_line ARGS2( previous->next->prev = jline; previous->prev->next = jline; + FREE(previous); + previous = jline; } { /* (ht_num_runs==1) */ @@ -4519,6 +4530,7 @@ PRIVATE int HText_insertBlanksInStblLines ARGS2( lines_changed++; if (line == first_line) first_line = mod_line; + free(line); line = mod_line; #ifdef DISP_PARTIAL /* @@ -5529,6 +5541,7 @@ PUBLIC void HText_endAppend ARGS1( */ next_to_the_last_line->next = line_ptr; line_ptr->prev = next_to_the_last_line; + FREE(text->last_line); text->last_line = next_to_the_last_line; text->Lines--; CTRACE((tfp, "GridText: New bottom line: `%s'\n", @@ -8525,6 +8538,7 @@ PUBLIC void HText_RemovePreviousLine ARGS1( previous->next = text->last_line; text->last_line->prev = previous; text->Lines--; + FREE(line); } /* @@ -11712,7 +11726,7 @@ PRIVATE void insert_new_textarea_anchor ARGS2( * Clone and initialize the struct's needed to add a new TEXTAREA * anchor. */ - POOLallocHTLine(l, MAX_LINE); + l = allocHTLine(MAX_LINE); POOLtypecalloc(TextAnchor, a); POOLtypecalloc(FormInfo, f); if (a == NULL || l == NULL || f == NULL) @@ -12536,7 +12550,7 @@ PUBLIC int HText_InsertFile ARGS1( break; } - POOLallocHTLine(l, MAX_LINE); + l = allocHTLine(MAX_LINE); POOLtypecalloc(TextAnchor, a); POOLtypecalloc(FormInfo, f); if (a == NULL || l == NULL || f == NULL) diff --git a/src/LYCurses.h b/src/LYCurses.h index e0e0c357..e07d0e8f 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -170,6 +170,10 @@ typedef struct { #undef ERR /* all versions of curses define this */ #endif +#ifdef MOUSE_MOVED +#undef MOUSE_MOVED /* wincon.h or MINGW32's copy of it */ +#endif + #ifdef HAVE_CONFIG_H # ifdef HAVE_NCURSESW_NCURSES_H # undef GCC_PRINTFLIKE /* <libutf8.h> may define 'printf' */ diff --git a/src/LYMain.c b/src/LYMain.c index d59787ed..0e8733a8 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -920,7 +920,7 @@ PUBLIC int main ARGS2( #endif /* _WINDOWS */ -#if defined(__CYGWIN__) +#if 0 /* defined(__CYGWIN__) - does not work with screen */ if (strcmp(ttyname(fileno(stdout)), "/dev/conout") != 0) { printf("please \"$CYGWIN=notty\"\n"); exit(EXIT_SUCCESS); diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 95054600..9260f128 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -707,14 +707,16 @@ PRIVATE BOOL do_check_recall ARGS7( && LYIsDosDrive(user_input_buffer + len - 2)) LYAddPathSep0(user_input_buffer); - } else if (len == 2 && LYIsDosDrive(user_input_buffer)) { - LYAddPathSep0(user_input_buffer); - } else { - HTUserMsg2(WWW_ILLEGAL_URL_MESSAGE, user_input_buffer); - LYstrncpy(user_input_buffer, *old_user_input, MAX_LINE - 1); - FREE(*old_user_input); - ret = FALSE; - break; + } else if (len == 2 && user_input_buffer[1] == ':') { + if (LYIsDosDrive(user_input_buffer)) { + LYAddPathSep0(user_input_buffer); + } else { + HTUserMsg2(WWW_ILLEGAL_URL_MESSAGE, user_input_buffer); + LYstrncpy(user_input_buffer, *old_user_input, MAX_LINE - 1); + FREE(*old_user_input); + ret = FALSE; + break; + } } #endif /* diff --git a/src/LYUtils.c b/src/LYUtils.c index 599577de..5fbe1965 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -1532,7 +1532,7 @@ PUBLIC int HTCheckForInterrupt NOARGS int c; int cmd; #ifndef VMS /* UNIX stuff: */ -#if !defined(USE_SLANG) && (defined(UNIX) || defined(__DJGPP__)) +#if !defined(USE_SLANG) && (defined(UNIX) || defined(__DJGPP__) || defined(__MINGW32__)) struct timeval socket_timeout; int ret = 0; fd_set readfds; @@ -4177,7 +4177,7 @@ PUBLIC int win32_check_interrupt(void) int c; if (kbhit()) { - c = wgetch(LYwin); + c = LYgetch(); /** Keyboard 'Z' or 'z', or Control-G or Control-C **/ if (LYCharIsINTERRUPT(c) || c == 0x1b) { return TRUE; @@ -4195,7 +4195,7 @@ void sleep(unsigned sec) for (i = 0; i < 10; i++) { Sleep(100); if (kbhit()) { - c = wgetch(LYwin); + c = LYgetch(); return; } } @@ -6917,9 +6917,11 @@ PUBLIC int LYSystem ARGS1( #ifdef _WIN_CC code = exec_command(command, TRUE); /* Wait exec */ -#else +#else /* !_WIN_CC */ +#ifdef SIGPIPE if (restore_sigpipe_for_children) signal(SIGPIPE, SIG_DFL); /* Some commands expect the default */ +#endif #if defined(HAVE_SIGACTION) && defined(SIGTSTP) && !defined(USE_SLANG) if (!dump_output_immediately && !LYCursesON && !no_suspend) sigtstp_saved = LYToggleSigDfl(SIGTSTP, &saved_sigtstp_act, 1); @@ -6930,10 +6932,12 @@ PUBLIC int LYSystem ARGS1( if (sigtstp_saved) LYToggleSigDfl(SIGTSTP, &saved_sigtstp_act, 0); #endif +#ifdef SIGPIPE if (restore_sigpipe_for_children) signal(SIGPIPE, SIG_IGN); /* Ignore it again - kw */ #endif #endif +#endif #ifdef __DJGPP__ __djgpp_set_ctrl_c(1); diff --git a/userdefs.h b/userdefs.h index 4b5df08c..dc430509 100644 --- a/userdefs.h +++ b/userdefs.h @@ -1347,11 +1347,11 @@ * the version definition with the Project Version on checkout. Just * ignore it. - kw */ /* $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$ */ -#define LYNX_VERSION "2.8.5dev.11" +#define LYNX_VERSION "2.8.5dev.12" #define LYNX_WWW_HOME "http://lynx.browser.org/" #define LYNX_WWW_DIST "http://lynx.isc.org/current/" /* $Format: "#define LYNX_DATE \"$ProjectDate$\""$ */ -#define LYNX_DATE "Sun, 01 Dec 2002 18:19:26 -0800" +#define LYNX_DATE "Wed, 18 Dec 2002 17:57:10 -0800" #define LYNX_DATE_OFF 5 /* truncate the automatically-generated date */ #define LYNX_DATE_LEN 11 /* truncate the automatically-generated date */ |