Commit 7571780c authored by Axel Beckert's avatar Axel Beckert

Imported Upstream version 2.8.7dev13

parent 5e0cf9b4
// $LynxId: lynx_cfg.h,v 1.1 2007/06/29 22:47:53 tom Exp $
// $LynxId: lynx_cfg.h,v 1.2 2009/02/01 23:08:47 tom Exp $
// definitions abstracted from makefile.msc
#ifndef LYNX_CFG_H
......@@ -18,6 +18,7 @@
#define EXP_JUSTIFY_ELTS 1
#define EXP_NESTED_TABLES 1
#define HAVE_KEYPAD 1
#define HAVE_PUTENV 1
#define LONG_LIST 1
#define NDEBUG 1
#define NO_CONFIG_INFO 1
......
-- $LynxId: CHANGES,v 1.352 2008/12/31 23:27:54 tom Exp $
-- $LynxId: CHANGES,v 1.373 2009/02/01 23:51:04 tom Exp $
===============================================================================
Changes since Lynx 2.8 release
===============================================================================
2009-02-01 (2.8.7dev.13)
* modify definitions in LYStructs.h for union to cast to a void* rather than
a long, to help with 64-bit ports -TD
* modify CF_SSL configure macro to check for -ldl needed for recent OpenSSL
versions -TD
* modify CF_SSL configure macro to build with msys for mingw configuration -TD
* modify scanning of floats from lynx.cfg to allow Lynx to read POSIX values
in non-POSIX locales -TD
* modify configure script to check for msginit, needed to generate "en" po
file, and omit that target if msginit is not available, letting lynx build
with older gettext versions -TD
* improve drawing of menus for multibyte characters by changing the way the
number of fill-characters is computed in LYpaddstr -TD
* fix some uses of gettext in options menu and info page where a translated
string might contain angle-brackets or ampersand -TD
* modify AM_WITH_NLS configure macro to add the iconv library dependency for
intl library when checking for the latter -DK
* fix breakage of display of UTF-8 in UCTransUniChar() from cleanup in dev.12
(report by TG) -TD
* rename variable defined by CF_PATHSP to PATH_SEPARATOR, use this consistently
to ease use in later autoconf versions (prompted by patch by DK) -TD
* fix a typo in CF_ADD_LIBDIR which broke check for libintl (report by
Jose H Espinosa) -TD
* modify configure script to append to CFLAGS or CPPFLAGS rather than prepend,
to better match the user's intent -DK, TD
* modify UCSetBoxChars() to let line-drawing work with PDCurses, as well as
any fancy-curses implementation that is running in ASCII or Latin-1 -TD
* add a configure check for curses type "chtype" -TD
* fix for an ASCII dependency in LYKeymap.c -PG
* update fr.po, id.po, nl.pl, sv.po, tr.po, vi.po from
http://translationproject.org/latest/lynx/
* change configure script to check for "ar" archiver options, from tin bug
report for FreeBSD 8.0 which requires a "-" before the options -TD
* update config.guess (2008-12-19), config.sub (2008-12-11)
* use putenv() in preference to unsetenv() in LYReadCFG.c, noting that it is
a deprecated BSD interface -TD
* miscellaneous fixes for gcc type-conversion warnings -TD
* remove trailing comma from enumeration UCStatus which causes strict-compiler
warning -TD
2008-12-31 (2.8.7dev.12)
* add configure option --enable-ascii-ctypes to enable EXP_ASCII_CTYPES -TD
* move EBCDIC tables to separate file LYebcdic.c to simplify building test
......
; version used for Inno Setup files.
; $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$
#define LYNX_VERSION "2.8.7dev.12"
#define LYNX_VERSION "2.8.7dev.13"
#define MyAppName "Lynx"
#define MyAppPublisher "Thomas E Dickey"
......
/* MODULE HTAABrow.c
/*
* $LynxId: HTAABrow.c,v 1.29 2009/01/03 00:55:16 tom Exp $
*
* MODULE HTAABrow.c
* BROWSER SIDE ACCESS AUTHORIZATION MODULE
*
* Contains the code for keeping track on server hostnames,
......@@ -140,8 +142,9 @@ static int proxy_portnumber = 80;
void HTAAForwardAuth_set(const char *scheme_name,
const char *scheme_specifics)
{
int len = 20 + (scheme_name ? strlen(scheme_name) : 0)
+ (scheme_specifics ? strlen(scheme_specifics) : 0);
unsigned len = (20
+ (scheme_name ? strlen(scheme_name) : 0)
+ (scheme_specifics ? strlen(scheme_specifics) : 0));
FREE(HTAAForwardAuth);
if ((HTAAForwardAuth = typecallocn(char, len)) == 0)
......@@ -556,7 +559,7 @@ static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, BOOL IsPr
{
char *cleartext = NULL; /* Cleartext presentation */
char *ciphertext = NULL; /* Encrypted presentation */
int len;
unsigned len;
char *msg = NULL;
char *username = NULL;
char *password = NULL;
......@@ -620,9 +623,9 @@ 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;
len = (strlen(realm->realmname) +
strlen(theHost ?
theHost : "??") + 50);
HTSprintf0(&msg, gettext("Username for '%s' at %s '%s%s':"),
realm->realmname,
(IsProxy ? "proxy" : "server"),
......@@ -654,8 +657,8 @@ static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, BOOL IsPr
}
}
len = strlen(NonNull(realm->username)) +
strlen(NonNull(realm->password)) + 3;
len = (strlen(NonNull(realm->username)) +
strlen(NonNull(realm->password)) + 3);
if (scheme == HTAA_PUBKEY) {
#ifdef PUBKEY
......@@ -811,7 +814,7 @@ char *HTAA_composeAuth(const char *hostname,
char *auth_string;
BOOL retry;
HTAAScheme scheme;
int len;
unsigned len;
/*
* Setup atexit() freeing if not done already. - FM
......
/* MODULE HTAAProt.c
/*
* $LynxId: HTAAProt.c,v 1.30 2009/02/01 21:19:48 tom Exp $
*
* MODULE HTAAProt.c
* PROTECTION FILE PARSING MODULE
*
* AUTHORS:
......@@ -646,7 +648,7 @@ static void save_uid_info(const char *name, int user)
* ON EXIT:
* returns the user name, or an empty string if not found.
*/
const char *HTAA_UidToName(int uid)
const char *HTAA_UidToName(int uid GCC_UNUSED)
{
#ifndef NOUSERS
struct passwd *pw;
......@@ -659,7 +661,7 @@ const char *HTAA_UidToName(int uid)
return data->name;
}
if ((pw = getpwuid(uid)) != 0
if ((pw = getpwuid((uid_t) uid)) != 0
&& pw->pw_name != 0) {
CTRACE((tfp, "%s(%d) returned (%s:%d:...)\n",
"HTAA_UidToName: getpwuid",
......@@ -680,7 +682,7 @@ const char *HTAA_UidToName(int uid)
* ON EXIT:
* returns the user id, or NONESUCH if not found.
*/
int HTAA_NameToUid(const char *name)
int HTAA_NameToUid(const char *name GCC_UNUSED)
{
#ifndef NOUSERS
struct passwd *pw;
......@@ -713,7 +715,7 @@ int HTAA_NameToUid(const char *name)
* ON EXIT:
* returns the group name, or an empty string if not found.
*/
const char *HTAA_GidToName(int gid)
const char *HTAA_GidToName(int gid GCC_UNUSED)
{
#ifndef NOUSERS
struct group *gr;
......@@ -726,7 +728,7 @@ const char *HTAA_GidToName(int gid)
return data->name;
}
if ((gr = getgrgid(gid)) != 0
if ((gr = getgrgid((gid_t) gid)) != 0
&& gr->gr_name != 0) {
CTRACE((tfp, "%s(%d) returned (%s:%d:...)\n",
"HTAA_GidToName: getgrgid",
......@@ -747,7 +749,7 @@ const char *HTAA_GidToName(int gid)
* ON EXIT:
* returns the group id, or NONESUCH if not found.
*/
int HTAA_NameToGid(const char *name)
int HTAA_NameToGid(const char *name GCC_UNUSED)
{
#ifndef NOUSERS
struct group *gr;
......
/*
* $LynxId: HTAccess.c,v 1.67 2008/09/06 14:44:37 tom Exp $
* $LynxId: HTAccess.c,v 1.68 2009/01/03 01:31:41 tom Exp $
*
* Access Manager HTAccess.c
* ==============
......@@ -322,7 +322,7 @@ BOOL override_proxy(const char *addr)
}
if (!port)
port = 80; /* Default */
h_len = strlen(Host);
h_len = (int) strlen(Host);
while (*no_proxy) {
const char *end;
......@@ -356,7 +356,8 @@ BOOL override_proxy(const char *addr)
#ifdef CJK_EX /* ASATAKU PROXY HACK */
if ((!templ_port || templ_port == port) &&
(t_len > 0 && t_len <= h_len &&
isdigit(UCH(*no_proxy)) && !strncmp(host, no_proxy, t_len))) {
isdigit(UCH(*no_proxy)) &&
!strncmp(host, no_proxy, (unsigned) t_len))) {
FREE(host);
return YES;
}
......
/*
* $LynxId: HTAnchor.c,v 1.61 2008/12/31 22:02:20 tom Exp $
* $LynxId: HTAnchor.c,v 1.62 2009/01/01 16:56:15 tom Exp $
*
* Hypertext "Anchor" Object HTAnchor.c
* ==========================
......@@ -1365,6 +1365,8 @@ LYUCcharset *HTAnchor_resetUCInfoStage(HTParentAnchor *me,
/* Allow a switch to a more suitable display charset */
if (LYhndl >= 0 && LYhndl != ohandle && which_stage == UCT_STAGE_PARSER)
setup_switch_display_charset(me, LYhndl);
#else
(void) ohandle;
#endif
return (&me->UCStages->s[which_stage].C);
}
......
/*
* $LynxId: HTAnchor.h,v 1.32 2008/12/31 01:35:49 tom Exp $
* $LynxId: HTAnchor.h,v 1.33 2009/01/01 16:47:33 tom Exp $
*
* Hypertext "Anchor" Object HTAnchor.h
* ==========================
......@@ -112,7 +112,7 @@ extern "C" {
char *content_md5; /* Content-MD5 */
char *message_id; /* Message-ID */
char *subject; /* Subject */
int content_length; /* Content-Length */
long content_length; /* Content-Length */
char *date; /* Date */
char *expires; /* Expires */
char *last_modified; /* Last-Modified */
......
/* MODULE HTAssoc.c
/*
* $LynxId: HTAssoc.c,v 1.9 2009/01/03 01:59:16 tom Exp $
*
* MODULE HTAssoc.c
* ASSOCIATION LIST FOR STORING NAME-VALUE PAIRS.
* NAMES NOT CASE SENSITIVE, AND ONLY COMMON LENGTH
* IS CHECKED (allows abbreviations; well, length is
......@@ -73,7 +75,7 @@ char *HTAssocList_lookup(HTAssocList *alist,
HTAssoc *assoc;
while (NULL != (assoc = (HTAssoc *) HTList_nextObject(cur))) {
if (!strncasecomp(assoc->name, name, strlen(name)))
if (!strncasecomp(assoc->name, name, (int) strlen(name)))
return assoc->value;
}
return NULL;
......
/* Chunk handling: Flexible arrays
/*
* $LynxId: HTChunk.c,v 1.21 2009/02/01 12:49:24 tom Exp $
*
* Chunk handling: Flexible arrays
* ===============================
*
*/
......@@ -61,11 +64,12 @@ HTChunk *HTChunkCreate2(int grow, size_t needed)
HTChunkInit(ch, grow);
if (needed > 0) {
ch->allocated = needed - 1 - ((needed - 1) % ch->growby)
+ ch->growby; /* Round up */
CTRACE((tfp, "HTChunkCreate2: requested %d, allocate %d\n",
(int) needed, ch->allocated));
ch->data = typecallocn(char, ch->allocated);
/* Round up */
ch->allocated = (int) (needed - 1 - ((needed - 1) % ch->growby)
+ (unsigned) ch->growby);
CTRACE((tfp, "HTChunkCreate2: requested %d, allocate %u\n",
(int) needed, (unsigned) ch->allocated));
ch->data = typecallocn(char, (unsigned) ch->allocated);
if (!ch->data)
outofmem(__FILE__, "HTChunkCreate2 data");
......@@ -108,8 +112,8 @@ BOOL HTChunkRealloc(HTChunk *ch, int growby)
ch->allocated = ch->allocated + growby;
data = (ch->data
? (char *) realloc(ch->data, ch->allocated)
: typecallocn(char, ch->allocated));
? (char *) realloc(ch->data, (unsigned) ch->allocated)
: typecallocn(char, (unsigned) ch->allocated));
if (data) {
ch->data = data;
......@@ -158,8 +162,8 @@ void HTChunkEnsure(HTChunk *ch, int needed)
ch->allocated = needed - 1 - ((needed - 1) % ch->growby)
+ ch->growby; /* Round up */
ch->data = (ch->data
? (char *) realloc(ch->data, ch->allocated)
: typecallocn(char, ch->allocated));
? (char *) realloc(ch->data, (unsigned) ch->allocated)
: typecallocn(char, (unsigned) ch->allocated));
if (ch->data == NULL)
outofmem(__FILE__, "HTChunkEnsure");
......@@ -178,7 +182,7 @@ void HTChunkPutb(HTChunk *ch, const char *b, int l)
if (!HTChunkRealloc(ch, growby))
return;
}
memcpy(ch->data + ch->size, b, l);
memcpy(ch->data + ch->size, b, (unsigned) l);
ch->size += l;
}
......@@ -191,7 +195,7 @@ HTChunk *HTChunkPutb2(HTChunk *ch, const char *b, int l)
HTChunk *chunk;
int m = ch->allocated - ch->size;
memcpy(ch->data + ch->size, b, m);
memcpy(ch->data + ch->size, b, (unsigned) m);
ch->size += m;
chunk = HTChunkCreateMayFail(ch->growby, ch->failok);
......@@ -199,7 +203,7 @@ HTChunk *HTChunkPutb2(HTChunk *ch, const char *b, int l)
HTChunkPutb(chunk, b + m, l - m);
return chunk;
}
memcpy(ch->data + ch->size, b, l);
memcpy(ch->data + ch->size, b, (unsigned) l);
ch->size += l;
return ch;
}
......
/*
* $LynxId: HTDOS.c,v 1.35 2008/12/26 18:07:02 tom Exp $
* $LynxId: HTDOS.c,v 1.36 2009/01/03 01:58:39 tom Exp $
* DOS specific routines
*/
......@@ -20,7 +20,7 @@
*/
static char *copy_plus(char **result, const char *source)
{
int length = strlen(source);
int length = (int) strlen(source);
int extra = 10;
int n;
......@@ -69,7 +69,7 @@ const char *HTDOS_wwwName(const char *dosname)
}
*cp_url = '\0';
wwwname_len = strlen(wwwname);
wwwname_len = (int) strlen(wwwname);
if (wwwname_len > 1)
cp_url--; /* point last char */
......
This diff is collapsed.
/*
* $LynxId: HTFile.c,v 1.116 2008/12/31 01:47:53 tom Exp $
* $LynxId: HTFile.c,v 1.119 2009/02/01 21:17:39 tom Exp $
*
* File Access HTFile.c
* ===========
......@@ -252,7 +252,7 @@ static void LYListFmtParse(const char *fmtstr,
#define PBIT(a, n, s) (s) ? psbits[((a) >> (n)) & 0x7] : \
pbits[((a) >> (n)) & 0x7]
#endif
#ifdef S_ISVTX
#if defined(S_ISVTX) && !defined(_WINDOWS)
static const char *ptbits[] =
{"--T", "--t", "-wT", "-wt",
"r-T", "r-t", "rwT", "rwt", 0};
......@@ -1390,7 +1390,7 @@ CompressFileType HTContentToCompressType(HTParentAnchor *anchor)
* 1. No code for non-unix systems.
* 2. Isn't there a quicker way?
*/
BOOL HTEditable(const char *filename)
BOOL HTEditable(const char *filename GCC_UNUSED)
{
#ifndef NO_GROUPS
GETGROUPS_T groups[NGROUPS];
......@@ -1791,9 +1791,6 @@ static void do_readme(HTStructured * target, const char *localname)
fp = fopen(readme_file_name, "r");
if (fp) {
HTStructuredClass targetClass;
targetClass = *target->isa; /* (Can't init agregate in K&R) */
START(HTML_PRE);
while ((ch = fgetc(fp)) != EOF) {
PUTC((char) ch);
......@@ -1881,12 +1878,10 @@ static int print_local_dir(DIR *dp, char *localname,
char *pathname = NULL;
char *tail = NULL;
char *p;
BOOL present[HTML_A_ATTRIBUTES];
char *tmpfilename = NULL;
BOOL need_parent_link = FALSE;
BOOL preformatted = FALSE;
int status;
int i;
struct stat *actual_info;
#ifdef DISP_PARTIAL
......@@ -1917,9 +1912,6 @@ static int print_local_dir(DIR *dp, char *localname,
target = HTML_new(anchor, format_out, sink);
targetClass = *target->isa; /* Copy routine entry points */
for (i = 0; i < HTML_A_ATTRIBUTES; i++)
present[i] = (BOOL) (i == HTML_A_HREF);
/*
* The need_parent_link flag will be set if an "Up to <parent>" link was
* not created for a readable parent in HTDirTitles() because LONG_LIST is
......@@ -2918,10 +2910,10 @@ int HTLoadFile(const char *addr,
}
/* end if localname is a directory */
if (S_ISREG(dir_info.st_mode)) {
#ifdef INT_MAX
if (dir_info.st_size <= INT_MAX)
#ifdef LONG_MAX
if (dir_info.st_size <= LONG_MAX)
#endif
anchor->content_length = dir_info.st_size;
anchor->content_length = (long) dir_info.st_size;
}
} /* end if file stat worked */
......
/* FINGER ACCESS HTFinger.c
/*
* $LynxId: HTFinger.c,v 1.25 2009/01/03 02:02:18 tom Exp $
*
* FINGER ACCESS HTFinger.c
* =============
* Authors:
* ARB Andrew Brooks
......@@ -110,7 +113,7 @@ static int response(char *command,
HTStream *sink)
{
int status;
int length = strlen(command);
int length = (int) strlen(command);
int ch, i;
char line[BIG], *l, *cmd = NULL;
char *p = line, *href = NULL;
......@@ -125,7 +128,7 @@ static int response(char *command,
/* Send the command.
*/
CTRACE((tfp, "HTFinger command to be sent: %s", command));
status = NETWRITE(finger_fd, (char *) command, length);
status = NETWRITE(finger_fd, (char *) command, (unsigned) length);
if (status < 0) {
CTRACE((tfp, "HTFinger: Unable to send command. Disconnecting.\n"));
NETCLOSE(finger_fd);
......@@ -165,7 +168,7 @@ static int response(char *command,
} else {
StrAllocCopy(cmd, "");
}
for (i = (strlen(cmd) - 1); i >= 0; i--) {
for (i = ((int) strlen(cmd) - 1); i >= 0; i--) {
if (cmd[i] == LF || cmd[i] == CR) {
cmd[i] = '\0';
} else {
......
/*
* $LynxId: HTMIME.c,v 1.67 2008/12/14 18:46:52 tom Exp $
* $LynxId: HTMIME.c,v 1.69 2009/01/02 23:04:02 tom Exp $
*
* MIME Message Parse HTMIME.c
* ==================
......@@ -791,7 +791,7 @@ static int dispatchField(HTStream *me)
me->anchor->content_length = atoi(me->value);
if (me->anchor->content_length < 0)
me->anchor->content_length = 0;
CTRACE((tfp, " Converted to integer: '%d'\n",
CTRACE((tfp, " Converted to integer: '%ld'\n",
me->anchor->content_length));
break;
case miCONTENT_LOCATION:
......@@ -2501,7 +2501,6 @@ int HTrjis(char **t,
*/
/*
* RJIS ( Recover JIS code from broken file )
* $Header: rjis.c,v 0.2 92/09/04 takahasi Exp $
* Copyright (C) 1992 1994
* Hironobu Takahashi (takahasi@tiny.or.jp)
*
......
/* HTML Generator
/*
* $LynxId: HTMLGen.c,v 1.28 2009/01/03 01:27:53 tom Exp $
*
* HTML Generator
* ==============
*
* This version of the HTML object sends HTML markup to the output stream.
......@@ -331,7 +334,7 @@ static int HTMLGen_start_element(HTStructured * me, int element_number,
HTSprintf(&Style_className, ";%s", HTML_dtd.tags[element_number].name);
strcpy(myHash, HTML_dtd.tags[element_number].name);
if (class_string[0]) {
int len = strlen(myHash);
int len = (int) strlen(myHash);
sprintf(myHash + len, ".%.*s", (int) sizeof(myHash) - len - 2, class_string);
HTSprintf(&Style_className, ".%s", class_string);
......@@ -464,7 +467,9 @@ static int HTMLGen_start_element(HTStructured * me, int element_number,
/*
* Make very specific HTML assumption that PRE can't be nested!
*/
me->preformatted = (element_number == HTML_PRE) ? YES : was_preformatted;
me->preformatted = (BOOL) ((element_number == HTML_PRE)
? YES
: was_preformatted);
/*
* Can break after element start.
......@@ -561,7 +566,7 @@ static int HTMLGen_end_element(HTStructured * me, int element_number,
*/
static int HTMLGen_put_entity(HTStructured * me, int entity_number)
{
int nent = HTML_dtd.number_of_entities;
int nent = (int) HTML_dtd.number_of_entities;
HTMLGen_put_character(me, '&');
if (entity_number < nent) {
......
/*
* $LynxId: HTNews.c,v 1.57 2007/07/03 00:13:21 tom Exp $
* $LynxId: HTNews.c,v 1.58 2009/01/01 17:00:01 tom Exp $
*
* NEWS ACCESS HTNews.c
* ===========
......@@ -99,7 +99,6 @@ static HTStructured *target; /* The output sink */
static HTStructuredClass targetClass; /* Copy of fn addresses */
static HTStream *rawtarget = NULL; /* The output sink for rawtext */
static HTStreamClass rawtargetClass; /* Copy of fn addresses */
static HTParentAnchor *node_anchor; /* Its anchor */
static int diagnostic; /* level: 0=none 2=source */
static BOOL rawtext = NO; /* Flag: HEAD or -mime_headers */
static HTList *NNTP_AuthInfo = NULL; /* AUTHINFO database */
......@@ -2537,7 +2536,6 @@ static int HTLoadNews(const char *arg,
rawtext = (BOOL) (head_wanted || keep_mime_headers);
}
if (rawtext) {
node_anchor = anAnchor;
rawtarget = HTStreamStack(WWW_PLAINTEXT,
format_out,
stream, anAnchor);
......@@ -2556,7 +2554,6 @@ static int HTLoadNews(const char *arg,
* Make a hypertext object with an anchor list.
*/
if (!(post_wanted || reply_wanted || spost_wanted || sreply_wanted)) {
node_anchor = anAnchor;
target = HTML_new(anAnchor, format_out, stream);
targetClass = *target->isa; /* Copy routine entry points */
}
......
/*
* $LynxId: HTParse.c,v 1.50 2008/12/14 15:38:54 tom Exp $
* $LynxId: HTParse.c,v 1.51 2009/01/03 01:11:14 tom Exp $
*
* Parse HyperText Document Address HTParse.c
* ================================
......@@ -426,7 +426,7 @@ char *HTParse(const char *aName,
*p2 = '\0'; /* It is the default: ignore it */
}
if (p2 == NULL) {
int len3 = strlen(tail);
int len3 = (int) strlen(tail);
if (len3 > 0) {
h = tail + len3 - 1; /* last char of hostname */
......@@ -666,14 +666,17 @@ const char *HTParseAnchor(const char *aName)
{
const char *p = aName;
for (; *p && *p != '#'; p++) ;
for (; *p && *p != '#'; p++) {
;
}
if (*p == '#') {
/* the safe way based on HTParse() -
* keeping in mind scan() peculiarities on schemes:
*/
struct struct_parts given;
char *name = (char *) LYalloca((p - aName) + strlen(p) + 1);
char *name = (char *) LYalloca((unsigned) ((p - aName)
+ (int) strlen(p) + 1));
if (name == NULL) {
outofmem(__FILE__, "HTParseAnchor");
......@@ -887,7 +890,7 @@ char *HTRelative(const char *aName,
} else if (slashes == 3) { /* Same node, different path */
StrAllocCopy(result, path);
} else { /* Some path in common */
int levels = 0;
unsigned levels = 0;
for (; *q && (*q != '#'); q++)
if (*q == '/')
......@@ -907,6 +910,9 @@ char *HTRelative(const char *aName,
return result;
}
#define AlloCopy(next,base,extra) \
typecallocn(char, (unsigned) ((next - base) + ((int) extra)))
/* Escape undesirable characters using % HTEscape()
* -------------------------------------
*
......@@ -948,12 +954,12 @@ char *HTEscape(const char *str,
for (p = str; *p; p++)
if (!ACCEPTABLE(UCH(TOASCII(*p))))
unacceptable++;
result = typecallocn(char, (p - str) + (unacceptable * 2) + 1);
result = AlloCopy(p, str, (unacceptable * 2) + 1);
if (result == NULL)
outofmem(__FILE__, "HTEscape");
for (q = result, p = str; *p; p++) {
unsigned char a = TOASCII(*p);
unsigned char a = UCH(TOASCII(*p));
if (!ACCEPTABLE(a)) {
*q++ = HEX_ESCAPE; /* Means hex coming */
......@@ -988,12 +994,12 @@ char *HTEscapeUnsafe(const char *str)
for (p = str; *p; p++)
if (UNSAFE(UCH(TOASCII(*p))))
unacceptable++;
result = typecallocn(char, (p - str) + (unacceptable * 2) + 1);
result = AlloCopy(p, str, (unacceptable * 2) + 1);
if (result == NULL)
outofmem(__FILE__, "HTEscapeUnsafe");
for (q = result, p = str; *p; p++) {
unsigned char a = TOASCII(*p);
unsigned char a = UCH(TOASCII(*p));
if (UNSAFE(a)) {
*q++ = HEX_ESCAPE; /* Means hex coming */
......@@ -1028,12 +1034,12 @@ char *HTEscapeSP(const char *str,
for (p = str; *p; p++)
if (!(*p == ' ' || ACCEPTABLE(UCH(TOASCII(*p)))))
unacceptable++;
result = typecallocn(char, (p - str) + (unacceptable * 2) + 1);
result = AlloCopy(p, str, (unacceptable * 2) + 1);
if (result == NULL)
outofmem(__FILE__, "HTEscape");
for (q = result, p = str; *p; p++) {
unsigned char a = TOASCII(*p);
unsigned char a = UCH(TOASCII(*p));
if (a == 32) {
*q++ = '+';
......@@ -1181,7 +1187,7 @@ void HTMake822Word(char **str,
return;
}
for (p = *str; *p; p++) {
a = TOASCII(*p); /* S/390 -- gil -- 0240 */
a = UCH(TOASCII(*p)); /* S/390 -- gil -- 0240 */
if (a < 32 || a >= 128 ||
((crfc[a - 32]) & 1)) {
if (!added)
......@@ -1196,7 +1202,7 @@ void HTMake822Word(char **str,
}
if (!added)
return;
result = typecallocn(char, p - (*str) + added + 1);
result = AlloCopy(p, *str, added + 1);
if (result == NULL)
outofmem(__FILE__, "HTMake822Word");
......@@ -1211,7 +1217,7 @@ void HTMake822Word(char **str,
*/
/* S/390 -- gil -- 0268 */
for (p = *str; *p; p++) {
a = TOASCII(*p);
a = UCH(TOASCII(*p));
if ((a != ASCII_TAB) &&
((a & 127) < ASCII_SPC ||
(a < 128 && ((crfc[a - 32]) & 2))))
......
/*
* $LynxId: HTPlain.c,v 1.42 2008/09/06 14:45:09 tom Exp $
* $LynxId: HTPlain.c,v 1.44 2009/01/03 01:23:21 tom Exp $
*
* Plain text object HTWrite.c
* =================
......@@ -159,13 +159,13 @@ static void HTPlain_put_character(HTStream *me, char c)
UCode_t value = (UCode_t) FROMASCII((TOASCII(UCH(c)) - 160));