Commit ad4b4507 authored by Axel Beckert's avatar Axel Beckert

Imported Upstream version 2.8.8dev.4

parent 7ea382da
-- $LynxId: CHANGES,v 1.472 2010/04/25 22:41:14 tom Exp $
-- $LynxId: CHANGES,v 1.491 2010/06/21 08:36:29 tom Exp $
===============================================================================
Changes since Lynx 2.8 release
===============================================================================
2010-06-21 (2.8.8dev.4)
* check for SSL error when reading response from "GET". This incidentally
exposes a longstanding bug in GNUTLS:
https://savannah.gnu.org/support/index.php?106987
(google the message "A TLS packet with unexpected length was received")
which prevents connection to
https://www.mynortonaccount.com/amsweb/default.do
(report by Ignac Vucko) -TD
* fix ifdef/define's in LYMain.c to show GNUTLS version in user-agent when
built with tidy_tls.c -TD
* improve format of X509_NAME_oneline() in tidy_tls.c, making it compatible
with the OpenSSL function so that no post-processing is needed -TD
* correct typo in configure --enable-gnutls-compat option, which sometimes made
it enabled as a side-effect of setting --with-gnutls -TD
* add configure option --enable-wais, for test-compiles with freeWAIS -TD
* fixes to build with VMS -Christoph J Gartmann
+ created [.src]multinet_ucx.opt with a single line
multinet_root:[multinet.library]ucx$ipc/LIBRARY
+ modified build.com to have an additional option "Multinet with
UCX emulation"
+ modified libmake.com for the same reason
+ modified [.www.library.implementation]www_tcp.h for the same reason
+ provide definition of IS_CJK_TTY for HTWAIS.c by adding include of
LYStrings.h
* fix typo in users's guide -PBM
* drop mkdirs.sh and MKINSTALLDIRS symbol from makefiles, using "mkdir -p" -TD
* limit parsed URIs with new config parameter MAX_URI_SIZE, default 8192
(RedHat #605286, forwarded by Vincent Danen). For arbitrarily long URIs,
alloca() could run out of stack space -TD
* several changes to configure script, from ongoing work on xterm, etc -TD
+ workaround for broken ".pc" file for X Toolkit, which omits the ICE
library.
+ modify CF_NCURSES_CONFIG to use CF_CURSES_HEADER to pick out the particular
flavor of ncurses.h, e.g., <ncursesw/curses.h>
+ add parameter to CF_CURSES_HEADER to allow looking for specific
subdirectory ncurses/ncursesw/etc + restructured CF_X_ATHENA to use
pkg-config, if available.
+ use CF_ADD_LIB/CF_ADD_LIBS
+ CF_GNUTLS eliminates duplicate libraries when configuring with pkg-config
+ modified several macros to quote params of ifelse()
+ CF_AR_FLAGS allows $ARFLAGS to override the choice of ar-flags, in
particular check if a given choice is part of the current $ARFLAGS
+ workaround CF_XOPEN_CURSES for (temporary) problem with ncurses headers,
which did not account for the fact that _XOPEN_SOURCE_EXTENDED may be
defined in a system header.
* remove redundant updates for CFLAGS and LIBS in configure script which are
now done in CF_FIND_LINKAGE macro -TD
* fix a problem with configure script which broke "--with-gnutls=/usr" (report
by Atsuhito Kohda) -TD
* resolve warnings from "clang --analyze", tested with Fedora 12 and clang
2.6-0.5.pre1.fc12, 2.7-1.fc12 -TD
* further improvements to print_wwwfile_to_fd() -TD
+ corrected length used for radio/checkboxes.
+ fill in wrapped fields.
2010-04-25 (2.8.8dev.3)
* modify print_wwwfile_to_fd() to add field values to the printed form (Debian
#574940) -TD
......@@ -23,7 +78,7 @@ Changes since Lynx 2.8 release
their respective target variables, not appending -TD
* improve configure macro CF_XOPEN_SOURCE by removing rather than undefining
preexisting symbols as they are added to the definitions -TD
* add configure check for -lnetwork, from tin
* add configure check for -lnetwork, from tin -TD
* when renaming/copying a bookmark file, e.g., to delete a bookmark, modify
its permissions for compatibility with IsOurFile() (Redhat #486070) -TD
* fix most gcc writable-strings warnings -TD
......@@ -34,8 +89,8 @@ Changes since Lynx 2.8 release
(Debian #460108) -TD
* document the various xxx_PATH settings in lynx.cfg -TD
* modify cfg2html.pl to improve formatting of cattoc.html -TD
* split-up top-level makefile install-html rule to allow generating the htmlized
cfg without doing an install -TD
* split-up top-level makefile install-html rule to allow generating the
htmlized cfg without doing an install -TD
* suppress positioning for editor when using it to edit files via dired -TD
* modify samples/lynx-demo.cfg to suppress external file-utilities, since the
intent is to make the installer work standalone, but allow extension -TD
......
......@@ -514,6 +514,9 @@ II. Compile instructions -- UNIX
--enable-warnings
Use this option to turn on GCC compiler warnings.
--enable-wais
Use this option to turn on configure check for freeWAIS library.
--enable-widec
Use this option to allow the configure script to look for wide-curses
features. If you do not specify the option, the configure script
......@@ -1381,4 +1384,4 @@ VIII. Acknowledgment
-- 1999/04/24 - H. Nelson <lynx-admin@irm.nara.kindai.ac.jp>
-- vile:txtmode
-- $LynxId: INSTALLATION,v 1.111 2010/04/20 09:44:11 tom Exp $
-- $LynxId: INSTALLATION,v 1.112 2010/06/19 17:22:59 tom Exp $
; version used for Inno Setup files.
; $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$
#define LYNX_VERSION "2.8.8dev.3"
#define LYNX_VERSION "2.8.8dev.4"
#define MyAppName "Lynx"
#define MyAppPublisher "Thomas E Dickey"
......
/*
* $LynxId: HTAABrow.c,v 1.30 2009/11/21 17:05:33 Bela.Lubkin Exp $
* $LynxId: HTAABrow.c,v 1.32 2010/06/17 00:37:22 tom Exp $
*
* MODULE HTAABrow.c
* BROWSER SIDE ACCESS AUTHORIZATION MODULE
......@@ -150,6 +150,8 @@ void HTAAForwardAuth_set(const char *scheme_name,
if ((HTAAForwardAuth = typecallocn(char, len)) == 0)
outofmem(__FILE__, "HTAAForwardAuth_set");
assert(HTAAForwardAuth != 0);
strcpy(HTAAForwardAuth, "Authorization: ");
if (scheme_name) {
strcat(HTAAForwardAuth, scheme_name);
......@@ -194,6 +196,8 @@ static HTAAServer *HTAAServer_new(const char *hostname,
if ((server = typecalloc(HTAAServer)) == 0)
outofmem(__FILE__, "HTAAServer_new");
assert(server != NULL);
server->hostname = NULL;
server->portnumber = (portnumber > 0 ? portnumber : 80);
server->IsProxy = IsProxy;
......@@ -395,6 +399,8 @@ static HTAASetup *HTAASetup_new(HTAAServer *server, char *ctemplate,
if ((setup = typecalloc(HTAASetup)) == 0)
outofmem(__FILE__, "HTAASetup_new");
assert(setup != NULL);
setup->retry = NO;
setup->server = server;
setup->ctemplate = NULL;
......@@ -517,6 +523,8 @@ static HTAARealm *HTAARealm_new(HTList *realm_table,
if ((realm = typecalloc(HTAARealm)) == 0)
outofmem(__FILE__, "HTAARealm_new");
assert(realm != NULL);
realm->realmname = NULL;
realm->username = NULL;
realm->password = NULL;
......@@ -623,9 +631,6 @@ static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, BOOL IsPr
* prompting function, but the password is NULL-ed and always replaced.
* - FM
*/
len = (strlen(realm->realmname) +
strlen(theHost ?
theHost : "??") + 50);
HTSprintf0(&msg, gettext("Username for '%s' at %s '%s%s':"),
realm->realmname,
(IsProxy ? "proxy" : "server"),
......@@ -674,6 +679,8 @@ static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, BOOL IsPr
if ((cleartext = typecallocn(char, len)) == 0)
outofmem(__FILE__, "compose_auth_string");
assert(cleartext != NULL);
if (realm->username)
strcpy(cleartext, realm->username);
else
......@@ -920,6 +927,8 @@ char *HTAA_composeAuth(const char *hostname,
if ((HTAA_composeAuthResult = typecallocn(char, len)) == 0)
outofmem(__FILE__, "HTAA_composeAuth");
assert(HTAA_composeAuthResult != NULL);
strcpy(HTAA_composeAuthResult, "Proxy-Authorization: ");
} else {
......@@ -998,6 +1007,8 @@ char *HTAA_composeAuth(const char *hostname,
if ((HTAA_composeAuthResult = typecallocn(char, len)) == 0)
outofmem(__FILE__, "HTAA_composeAuth");
assert(HTAA_composeAuthResult != NULL);
strcpy(HTAA_composeAuthResult, "Authorization: ");
}
......@@ -1036,7 +1047,7 @@ char *HTAA_composeAuth(const char *hostname,
* NO, otherwise.
*/
BOOL HTAA_shouldRetryWithAuth(char *start_of_headers,
int length,
size_t length,
int soc,
BOOL IsProxy)
{
......@@ -1096,6 +1107,9 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers,
if (!scheme_specifics)
outofmem(__FILE__, "HTAA_shouldRetryWithAuth");
assert(scheme_specifics != NULL);
for (i = 0; i < HTAA_MAX_SCHEMES; i++)
scheme_specifics[i] = NULL;
}
......
......@@ -102,7 +102,7 @@ Routines for Browser Side Recording of AA Info
* NO, otherwise.
*/
extern BOOL HTAA_shouldRetryWithAuth(char *start_of_headers,
int length,
size_t length,
int soc,
BOOL IsProxy);
......
/*
* $LynxId: HTAAProt.c,v 1.31 2009/03/10 00:27:20 tom Exp $
* $LynxId: HTAAProt.c,v 1.32 2010/04/29 09:30:57 tom Exp $
*
* MODULE HTAAProt.c
* PROTECTION FILE PARSING MODULE
......@@ -346,6 +346,8 @@ static HTAAProt *HTAAProt_new(const char *cur_docname,
if ((prot = typecalloc(HTAAProt)) == 0)
outofmem(__FILE__, "HTAAProt_new");
assert(prot != NULL);
prot->ctemplate = NULL;
prot->filename = NULL;
prot->uid_name = NULL;
......@@ -359,6 +361,9 @@ static HTAAProt *HTAAProt_new(const char *cur_docname,
fclose(fp);
if ((cache_item = typecalloc(HTAAProtCache)) == 0)
outofmem(__FILE__, "HTAAProt_new");
assert(cache_item != NULL);
cache_item->prot = prot;
cache_item->prot_filename = NULL;
StrAllocCopy(cache_item->prot_filename, prot_filename);
......
/*
* $LynxId: HTAAUtil.c,v 1.27 2008/12/31 22:04:39 tom Exp $
* $LynxId: HTAAUtil.c,v 1.29 2010/06/17 00:36:31 tom Exp $
*
* MODULE HTAAUtil.c
* COMMON PARTS OF ACCESS AUTHORIZATION MODULE
......@@ -234,7 +234,7 @@ BOOL HTAA_templateMatch(const char *ctemplate,
return YES; /* Equally long equal strings */
else if ('*' == *p) { /* Wildcard */
p++; /* Skip wildcard character */
m = strlen(q) - strlen(p); /* Amount to match to wildcard */
m = (int) (strlen(q) - strlen(p)); /* Amount to match to wildcard */
if (m < 0)
return NO; /* No match, filename too short */
else { /* Skip the matched characters and compare */
......@@ -284,7 +284,7 @@ BOOL HTAA_templateCaseMatch(const char *ctemplate,
return YES; /* Equally long equal strings */
else if ('*' == *p) { /* Wildcard */
p++; /* Skip wildcard character */
m = strlen(q) - strlen(p); /* Amount to match to wildcard */
m = (int) (strlen(q) - strlen(p)); /* Amount to match to wildcard */
if (m < 0)
return NO; /* No match, filename too short */
else { /* Skip the matched characters and compare */
......@@ -470,7 +470,7 @@ static void FreeHTAAUtil(void)
* proceed to read from socket.
*/
void HTAA_setupReader(char *start_of_headers,
int length,
size_t length,
int soc)
{
if (!start_of_headers)
......@@ -480,13 +480,16 @@ void HTAA_setupReader(char *start_of_headers,
if (buffer_length < BUFFER_SIZE) /* would fall below BUFFER_SIZE? */
buffer_length = BUFFER_SIZE;
buffer = (char *) malloc((size_t) (sizeof(char) * (buffer_length + 1)));
} else if (length > (int) buffer_length) { /* need more space? */
} else if (length > buffer_length) { /* need more space? */
buffer_length = length;
buffer = (char *) realloc((char *) buffer,
(size_t) (sizeof(char) * (buffer_length + 1)));
}
if (buffer == NULL)
outofmem(__FILE__, "HTAA_setupReader");
assert(buffer != NULL);
#ifdef LY_FIND_LEAKS
atexit(FreeHTAAUtil);
#endif
......
/* Utilities for the Authorization parts of libwww
COMMON PARTS OF AUTHORIZATION MODULE TO BOTH SERVER AND BROWSER
This module is the interface to the common parts of Access Authorization (AA) package
for both server and browser. Important to know about memory allocation:
Routines in this module use dynamic allocation, but free automatically all the memory
reserved by them.
Therefore the caller never has to (and never should) free() any object returned by
these functions.
Therefore also all the strings returned by this package are only valid until the next
call to the same function is made. This approach is selected, because of the nature of
access authorization: no string returned by the package needs to be valid longer than
until the next call.
This also makes it easy to plug the AA package in: you don't have to ponder whether to
free() something here or is it done somewhere else (because it is always done somewhere
else).
The strings that the package needs to store are copied so the original strings given as
parameters to AA functions may be freed or modified with no side effects.
Also note: The AA package does not free() anything else than what it has itself
allocated.
/*
* $LynxId: HTAAUtil.h,v 1.12 2010/06/17 00:36:04 tom Exp $
*
* Utilities for the Authorization parts of libwww
* COMMON PARTS OF AUTHORIZATION MODULE TO BOTH SERVER AND BROWSER
*
* This module is the interface to the common parts of Access Authorization (AA) package
* for both server and browser. Important to know about memory allocation:
*
* Routines in this module use dynamic allocation, but free automatically all the memory
* reserved by them.
*
* Therefore the caller never has to (and never should) free() any object returned by
* these functions.
*
* Therefore also all the strings returned by this package are only valid until the next
* call to the same function is made. This approach is selected, because of the nature of
* access authorization: no string returned by the package needs to be valid longer than
* until the next call.
*
* This also makes it easy to plug the AA package in: you don't have to ponder whether to
* free() something here or is it done somewhere else (because it is always done somewhere
* else).
*
* The strings that the package needs to store are copied so the original strings given as
* parameters to AA functions may be freed or modified with no side effects.
*
* Also note: The AA package does not free() anything else than what it has itself
* allocated.
*
*/
#ifndef HTAAUTIL_H
......@@ -282,7 +285,7 @@ Header Line Reader
* proceed to read from socket.
*/
extern void HTAA_setupReader(char *start_of_headers,
int length,
size_t length,
int soc);
/* PUBLIC HTAA_getUnfoldedLine()
......
/*
* $LynxId: HTAccess.c,v 1.68 2009/01/03 01:31:41 tom Exp $
* $LynxId: HTAccess.c,v 1.69 2010/04/29 09:30:51 tom Exp $
*
* Access Manager HTAccess.c
* ==============
......@@ -1275,6 +1275,8 @@ BOOL HTSearch(const char *keywords,
if (escaped == NULL)
outofmem(__FILE__, "HTSearch");
assert(escaped != NULL);
StrAllocCopy(address, here->isIndexAction);
/*
......
/*
* $LynxId: HTAnchor.c,v 1.63 2009/04/08 19:55:12 tom Exp $
* $LynxId: HTAnchor.c,v 1.67 2010/06/18 09:39:24 tom Exp $
*
* Hypertext "Anchor" Object HTAnchor.c
* ==========================
......@@ -53,7 +53,7 @@ static HASH_TYPE HASH_FUNCTION(const char *cp_address)
const unsigned char *p;
for (p = (const unsigned char *) cp_address, hash = 0; *p; p++)
hash = (int) (hash * 3 + (*(const unsigned char *) p)) % HASH_SIZE;
hash = (HASH_TYPE) (hash * 3 + (*(const unsigned char *) p)) % HASH_SIZE;
return (hash);
}
......@@ -86,6 +86,8 @@ static HTParentAnchor0 *HTParentAnchor0_new(const char *address,
if (newAnchor == NULL)
outofmem(__FILE__, "HTParentAnchor0_new");
assert(newAnchor != NULL);
newAnchor->parent = newAnchor; /* self */
StrAllocCopy(newAnchor->address, address);
newAnchor->adult_hash = hash;
......@@ -100,6 +102,8 @@ static HTParentAnchor *HTParentAnchor_new(HTParentAnchor0 *parent)
if (newAnchor == NULL)
outofmem(__FILE__, "HTParentAnchor_new");
assert(newAnchor != NULL);
newAnchor->parent = parent; /* cross reference */
parent->info = newAnchor; /* cross reference */
newAnchor->address = parent->address; /* copy pointer */
......@@ -120,6 +124,8 @@ static HTChildAnchor *HTChildAnchor_new(HTParentAnchor0 *parent)
if (p == NULL)
outofmem(__FILE__, "HTChildAnchor_new");
assert(p != NULL);
p->parent = parent; /* parent reference */
return p;
}
......@@ -132,6 +138,8 @@ static HTChildAnchor *HText_pool_ChildAnchor_new(HTParentAnchor *parent)
if (p == NULL)
outofmem(__FILE__, "HText_pool_ChildAnchor_new");
assert(p != NULL);
p->parent = parent->parent; /* parent reference */
return p;
}
......@@ -399,7 +407,6 @@ HTParentAnchor *HTAnchor_findAddress(const DocAddress *newdoc)
if (*tag) {
DocAddress parsed_doc;
HTParentAnchor0 *foundParent;
HTChildAnchor *foundAnchor;
parsed_doc.address = HTParse(newdoc->address, "",
PARSE_ALL_WITHOUT_ANCHOR);
......@@ -410,7 +417,7 @@ HTParentAnchor *HTAnchor_findAddress(const DocAddress *newdoc)
parsed_doc.safe = newdoc->safe;
foundParent = HTAnchor_findAddress_in_adult_table(&parsed_doc);
foundAnchor = HTAnchor_findNamedChild(foundParent, tag);
(void) HTAnchor_findNamedChild(foundParent, tag);
FREE(parsed_doc.address);
return HTAnchor_parent((HTAnchor *) foundParent);
}
......@@ -578,7 +585,9 @@ static void deleteLinks(HTChildAnchor *me)
* Recursive call. Test here to avoid calling overhead. Don't delete
* if document is loaded or being loaded.
*/
if ((me->parent != parent) && !parent->underway &&
if ((me->parent != parent) &&
parent != NULL &&
!parent->underway &&
(!parent->info || !parent->info->document)) {
HTAnchor_delete(parent);
}
......@@ -901,9 +910,9 @@ void HTAnchor_setPrompt(HTParentAnchor *me,
BOOL HTAnchor_isIndex(HTParentAnchor *me)
{
return (me
? (BOOL) me->isIndex
: NO);
return (BOOL) (me
? me->isIndex
: NO);
}
/* Whether Anchor has been designated as an ISMAP link
......@@ -911,9 +920,9 @@ BOOL HTAnchor_isIndex(HTParentAnchor *me)
*/
BOOL HTAnchor_isISMAPScript(HTAnchor * me)
{
return ((me && me->parent->info)
? (BOOL) me->parent->info->isISMAPScript
: NO);
return (BOOL) ((me && me->parent->info)
? me->parent->info->isISMAPScript
: NO);
}
#if defined(USE_COLOR_STYLE)
......@@ -1259,6 +1268,9 @@ LYUCcharset *HTAnchor_getUCInfoStage(HTParentAnchor *me,
if (stages == NULL)
outofmem(__FILE__, "HTAnchor_getUCInfoStage");
assert(stages != NULL);
for (i = 0; i < UCT_STAGEMAX; i++) {
stages->s[i].C.MIMEname = "";
stages->s[i].LYhndl = -1;
......
/*
* $LynxId: HTAnchor.h,v 1.33 2009/01/01 16:47:33 tom Exp $
* $LynxId: HTAnchor.h,v 1.34 2010/06/17 00:13:37 tom Exp $
*
* Hypertext "Anchor" Object HTAnchor.h
* ==========================
......@@ -35,6 +35,8 @@ extern "C" {
HTParentAnchor0 *parent; /* Parent of this anchor (self for adults) */
};
#define HASH_TYPE unsigned short
struct _HTParentAnchor0 { /* One for adult_table,
* generally not used outside HTAnchor.c */
/* Common part from the generic anchor structure */
......@@ -48,7 +50,7 @@ extern "C" {
HTList sources; /* List of anchors pointing to this, if any */
HTList _add_adult; /* - just a memory for list entry:) */
short adult_hash; /* adult list number */
HASH_TYPE adult_hash; /* adult list number */
BOOL underway; /* Document about to be attached to it */
};
......
/*
* $LynxId: HTAssoc.c,v 1.9 2009/01/03 01:59:16 tom Exp $
* $LynxId: HTAssoc.c,v 1.10 2010/04/29 09:34:03 tom Exp $
*
* MODULE HTAssoc.c
* ASSOCIATION LIST FOR STORING NAME-VALUE PAIRS.
......@@ -55,6 +55,8 @@ void HTAssocList_add(HTAssocList *alist,
if (!(assoc = (HTAssoc *) malloc(sizeof(HTAssoc))))
outofmem(__FILE__, "HTAssoc_add");
assert(assoc != NULL);
assoc->name = NULL;
assoc->value = NULL;
......
......@@ -78,9 +78,15 @@ HTAtom *HTAtom_for(const char *string)
a = (HTAtom *) malloc(sizeof(*a));
if (a == NULL)
outofmem(__FILE__, "HTAtom_for");
assert(a != NULL);
a->name = (char *) malloc(strlen(string) + 1);
if (a->name == NULL)
outofmem(__FILE__, "HTAtom_for");
assert(a->name != NULL);
strcpy(a->name, string);
a->next = hash_table[hash]; /* Put onto the head of list */
hash_table[hash] = a;
......
......@@ -24,6 +24,8 @@ HTBTree *HTBTree_new(HTComparer comp)
if (tree == NULL)
outofmem(__FILE__, "HTBTree_new");
assert(tree != NULL);
tree->compare = comp;
tree->top = NULL;
......@@ -143,6 +145,9 @@ void HTBTree_add(HTBTree *tree,
if (tree->top == NULL)
outofmem(__FILE__, "HTBTree_add");
assert(tree->top != NULL);
tree->top->up = NULL;
tree->top->object = object;
tree->top->left = NULL;
......@@ -167,6 +172,9 @@ void HTBTree_add(HTBTree *tree,
if (father_of_element->left == NULL)
outofmem(__FILE__, "HTBTree_add");
assert(father_of_element->left != NULL);
added_element = father_of_element->left;
added_element->up = father_of_element;
added_element->object = object;
......@@ -176,14 +184,16 @@ void HTBTree_add(HTBTree *tree,
added_element->right_depth = 0;
}
} else { /* res >= 0 */
if (father_of_element->right != NULL)
if (father_of_element->right != NULL) {
father_of_element = father_of_element->right;
else {
} else {
father_found = NO;
father_of_element->right = typeMalloc(HTBTElement);
if (father_of_element->right == NULL)
outofmem(__FILE__, "HTBTree_add");
assert(father_of_element->right != NULL);
added_element = father_of_element->right;
added_element->up = father_of_element;
added_element->object = object;
......@@ -246,19 +256,26 @@ void HTBTree_add(HTBTree *tree,
* with the two following conditions (4 March 94 - AS)
*/
if ((father_of_element->left == NULL)
&& (father_of_element->right->right == NULL)
&& (father_of_element->right->left->left == NULL)
&& (father_of_element->right->left->right == NULL))
corrections = 7;
if ((father_of_element->right == NULL)
&& (father_of_element->left->left == NULL)
&& (father_of_element->left->right->right == NULL)
&& (father_of_element->left->right->left == NULL))
corrections = 7;
if (father_of_element->left == NULL) {
if ((father_of_element->right != NULL)
&& (father_of_element->right->right == NULL)
&& (father_of_element->right->left != NULL)
&& (father_of_element->right->left->left == NULL)
&& (father_of_element->right->left->right == NULL)) {
corrections = 7;
}
} else {
if ((father_of_element->right == NULL)
&& (father_of_element->left->left == NULL)
&& (father_of_element->left->right != NULL)
&& (father_of_element->left->right->right == NULL)
&& (father_of_element->left->right->left == NULL)) {
corrections = 7;
}
}
if (father_of_element->left_depth > father_of_element->right_depth) {
if ((father_of_element->left != NULL)
&& (father_of_element->left_depth > father_of_element->right_depth)) {
added_element = father_of_element->left;
father_of_element->left_depth = added_element->right_depth;
added_element->right_depth = 1
......@@ -349,7 +366,7 @@ void HTBTree_add(HTBTree *tree,
father_of_element->up = added_element;
if (father_of_element->left != NULL)
father_of_element->left->up = father_of_element;
} else {
} else if (father_of_element->right != NULL) {
added_element = father_of_element->right;
father_of_element->right_depth = added_element->left_depth;
added_element->left_depth = 1 +
......
/*
* $LynxId: HTChunk.c,v 1.21 2009/02/01 12:49:24 tom Exp $
* $LynxId: HTChunk.c,v 1.24 2010/06/16 23:32:22 tom Exp $
*
* Chunk handling: Flexible arrays
* ===============================
......@@ -47,6 +47,9 @@ HTChunk *HTChunkCreateMayFail(int grow, int failok)
return ch;
}
}
assert(ch != NULL);
HTChunkInit(ch, grow);
ch->failok = failok;
return ch;
......@@ -62,10 +65,12 @@ HTChunk *HTChunkCreate2(int grow, size_t needed)
if (ch == NULL)
outofmem(__FILE__, "HTChunkCreate2");
assert(ch != NULL);
HTChunkInit(ch, grow);
if (needed > 0) {
if (needed-- > 0) {
/* Round up */
ch->allocated = (int) (needed - 1 - ((needed - 1) % ch->growby)
ch->allocated = (int) (needed - (needed % (size_t) ch->growby)
+ (unsigned) ch->growby);
CTRACE((tfp, "HTChunkCreate2: requested %d, allocate %u\n",
(int) needed, (unsigned) ch->allocated));
......@@ -129,13 +134,13 @@ BOOL HTChunkRealloc(HTChunk *ch, int growby)
/* Append a character
* ------------------
*/
void HTChunkPutc(HTChunk *ch, char c)
void HTChunkPutc(HTChunk *ch, unsigned char c)
{
if (ch->size >= ch->allocated) {
if (!HTChunkRealloc(ch, ch->growby))
return;
}
ch->data[ch->size++] = c;
ch->data[ch->size++] = (char) c;
}
/* like above but no realloc: extend to another chunk if necessary */
......@@ -145,7 +150,7 @@ HTChunk *HTChunkPutc2(HTChunk *ch, char c)
HTChunk *chunk = HTChunkCreateMayFail(ch->growby, ch->failok);
ch->next = chunk;
HTChunkPutc(chunk, c);
HTChunkPutc(chunk, UCH(c));
return chunk;
}
ch->data[ch->size++] = c;
......
/* HTChunk: Flexible array handling for libwww
/*
* $LynxId: HTChunk.h,v 1.19 2010/06/16 23:24:56 tom Exp $
*
* HTChunk: Flexible array handling for libwww
* CHUNK HANDLING:
* FLEXIBLE ARRAYS
*
......@@ -151,7 +154,7 @@ extern "C" {
* *ch Is one character bigger
*
*/
extern void HTChunkPutc(HTChunk *ch, char c);
extern void HTChunkPutc(HTChunk *ch, unsigned char c);