about summary refs log tree commit diff stats
path: root/WWW
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2010-09-26 14:26:23 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2010-09-26 14:26:23 -0400
commitbf9ea0cbb0562934c45170f94ebfe2ac609a44a8 (patch)
treef4bde48763d66ed00b176397aee2b3fd6e9fc7f5 /WWW
parent69a1a751cb798556c786e3ef66d473bf8a88abdc (diff)
downloadlynx-snapshots-bf9ea0cbb0562934c45170f94ebfe2ac609a44a8.tar.gz
snapshot of project "lynx", label v2-8-8dev_5e
Diffstat (limited to 'WWW')
-rw-r--r--WWW/Library/Implementation/HTAABrow.c16
-rw-r--r--WWW/Library/Implementation/HTAABrow.h9
-rw-r--r--WWW/Library/Implementation/HTAAUtil.c14
-rw-r--r--WWW/Library/Implementation/HTAccess.c14
-rw-r--r--WWW/Library/Implementation/HTAnchor.c14
-rw-r--r--WWW/Library/Implementation/HTAtom.c5
-rw-r--r--WWW/Library/Implementation/HTCJK.h39
-rw-r--r--WWW/Library/Implementation/HTChunk.c22
-rw-r--r--WWW/Library/Implementation/HTChunk.h6
-rw-r--r--WWW/Library/Implementation/HTDOS.c4
-rw-r--r--WWW/Library/Implementation/HTFTP.c86
-rw-r--r--WWW/Library/Implementation/HTFile.c48
-rw-r--r--WWW/Library/Implementation/HTFile.h8
-rw-r--r--WWW/Library/Implementation/HTFinger.c38
-rw-r--r--WWW/Library/Implementation/HTFormat.c75
-rw-r--r--WWW/Library/Implementation/HTFormat.h32
-rw-r--r--WWW/Library/Implementation/HTGopher.c100
-rw-r--r--WWW/Library/Implementation/HTMIME.c15
-rw-r--r--WWW/Library/Implementation/HTMLDTD.c6
-rw-r--r--WWW/Library/Implementation/HTMLGen.c11
-rw-r--r--WWW/Library/Implementation/HTNews.c112
-rw-r--r--WWW/Library/Implementation/HTParse.c26
-rw-r--r--WWW/Library/Implementation/HTParse.h6
-rw-r--r--WWW/Library/Implementation/HTPlain.c19
-rw-r--r--WWW/Library/Implementation/HTStream.h7
-rw-r--r--WWW/Library/Implementation/HTString.c24
-rw-r--r--WWW/Library/Implementation/HTString.h11
-rw-r--r--WWW/Library/Implementation/HTTCP.c31
-rw-r--r--WWW/Library/Implementation/HTTP.c68
-rw-r--r--WWW/Library/Implementation/HTUU.h5
-rw-r--r--WWW/Library/Implementation/HTUtils.h12
-rw-r--r--WWW/Library/Implementation/HTVMSUtils.c30
-rw-r--r--WWW/Library/Implementation/HTVMS_WaisProt.c14
-rw-r--r--WWW/Library/Implementation/HTVMS_WaisUI.c44
-rw-r--r--WWW/Library/Implementation/HTWAIS.c6
-rw-r--r--WWW/Library/Implementation/HTWSRC.c16
-rw-r--r--WWW/Library/Implementation/HText.h21
-rw-r--r--WWW/Library/Implementation/SGML.c116
-rw-r--r--WWW/Library/Implementation/SGML.h4
-rw-r--r--WWW/Library/Implementation/UCAux.h4
-rw-r--r--WWW/Library/Implementation/UCMap.h10
-rw-r--r--WWW/Library/Implementation/dtd_util.c6
-rw-r--r--WWW/Library/Implementation/www_tcp.h23
43 files changed, 617 insertions, 560 deletions
diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c
index e67c58ab..3e25deaf 100644
--- a/WWW/Library/Implementation/HTAABrow.c
+++ b/WWW/Library/Implementation/HTAABrow.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAABrow.c,v 1.33 2010/09/22 00:54:01 tom Exp $
+ * $LynxId: HTAABrow.c,v 1.34 2010/09/24 08:27:42 tom Exp $
  *
  * MODULE							HTAABrow.c
  *		BROWSER SIDE ACCESS AUTHORIZATION MODULE
@@ -189,7 +189,7 @@ static void HTAASetup_delete(HTAASetup * killme);	/* Forward */
  */
 static HTAAServer *HTAAServer_new(const char *hostname,
 				  int portnumber,
-				  BOOL IsProxy)
+				  int IsProxy)
 {
     HTAAServer *server;
 
@@ -200,7 +200,7 @@ static HTAAServer *HTAAServer_new(const char *hostname,
 
     server->hostname = NULL;
     server->portnumber = (portnumber > 0 ? portnumber : 80);
-    server->IsProxy = IsProxy;
+    server->IsProxy = (BOOLEAN) IsProxy;
     server->setups = HTList_new();
     server->realms = HTList_new();
 
@@ -280,7 +280,7 @@ static void HTAAServer_delete(HTAAServer *killme)
  */
 static HTAAServer *HTAAServer_lookup(const char *hostname,
 				     int portnumber,
-				     BOOL IsProxy)
+				     int IsProxy)
 {
     if (hostname) {
 	HTList *cur = server_table;
@@ -326,7 +326,7 @@ static HTAAServer *HTAAServer_lookup(const char *hostname,
 static HTAASetup *HTAASetup_lookup(const char *hostname,
 				   int portnumber,
 				   const char *docname,
-				   BOOL IsProxy)
+				   int IsProxy)
 {
     HTAAServer *server;
     HTAASetup *setup;
@@ -563,7 +563,7 @@ static HTAARealm *HTAARealm_new(HTList *realm_table,
  *	returned by AA package needs to (or should) be freed.
  *
  */
-static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, BOOL IsProxy)
+static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, int IsProxy)
 {
     char *cleartext = NULL;	/* Cleartext presentation */
     char *ciphertext = NULL;	/* Encrypted presentation */
@@ -816,7 +816,7 @@ static void free_HTAAGlobals(void)
 char *HTAA_composeAuth(const char *hostname,
 		       const int portnumber,
 		       const char *docname,
-		       BOOL IsProxy)
+		       int IsProxy)
 {
     char *auth_string;
     BOOL retry;
@@ -1049,7 +1049,7 @@ char *HTAA_composeAuth(const char *hostname,
 BOOL HTAA_shouldRetryWithAuth(char *start_of_headers,
 			      size_t length,
 			      int soc,
-			      BOOL IsProxy)
+			      int IsProxy)
 {
     HTAAScheme scheme;
     char *line = NULL;
diff --git a/WWW/Library/Implementation/HTAABrow.h b/WWW/Library/Implementation/HTAABrow.h
index 353d11f9..94034254 100644
--- a/WWW/Library/Implementation/HTAABrow.h
+++ b/WWW/Library/Implementation/HTAABrow.h
@@ -1,4 +1,7 @@
-/*                          BROWSER SIDE ACCESS AUTHORIZATION MODULE
+/*
+ * $LynxId: HTAABrow.h,v 1.15 2010/09/25 11:42:32 tom Exp $
+ *
+ *                          BROWSER SIDE ACCESS AUTHORIZATION MODULE
 
    This module is the browser side interface to Access Authorization (AA) package.  It
    contains code only for browser.
@@ -72,7 +75,7 @@ Routines for Browser Side Recording of AA Info
  */ extern char *HTAA_composeAuth(const char *hostname,
 				  const int portnumber,
 				  const char *docname,
-				  BOOL IsProxy);
+				  int IsProxy);
 
 /* BROWSER PUBLIC                               HTAA_shouldRetryWithAuth()
  *
@@ -104,7 +107,7 @@ Routines for Browser Side Recording of AA Info
     extern BOOL HTAA_shouldRetryWithAuth(char *start_of_headers,
 					 size_t length,
 					 int soc,
-					 BOOL IsProxy);
+					 int IsProxy);
 
 /*
  *  Function to allow clearing of all Authorization info
diff --git a/WWW/Library/Implementation/HTAAUtil.c b/WWW/Library/Implementation/HTAAUtil.c
index aa04e349..8a6caab6 100644
--- a/WWW/Library/Implementation/HTAAUtil.c
+++ b/WWW/Library/Implementation/HTAAUtil.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAAUtil.c,v 1.29 2010/06/17 00:36:31 tom Exp $
+ * $LynxId: HTAAUtil.c,v 1.31 2010/09/24 23:51:22 tom Exp $
  *
  * MODULE							HTAAUtil.c
  *		COMMON PARTS OF ACCESS AUTHORIZATION MODULE
@@ -77,19 +77,19 @@ HTAAScheme HTAAScheme_enum(const char *name)
     StrAllocCopy(upcased, name);
     LYUpperCase(upcased);
 
-    if (!strncmp(upcased, "NONE", 4)) {
+    if (!StrNCmp(upcased, "NONE", 4)) {
 	FREE(upcased);
 	return HTAA_NONE;
-    } else if (!strncmp(upcased, "BASIC", 5)) {
+    } else if (!StrNCmp(upcased, "BASIC", 5)) {
 	FREE(upcased);
 	return HTAA_BASIC;
-    } else if (!strncmp(upcased, "PUBKEY", 6)) {
+    } else if (!StrNCmp(upcased, "PUBKEY", 6)) {
 	FREE(upcased);
 	return HTAA_PUBKEY;
-    } else if (!strncmp(upcased, "KERBEROSV4", 10)) {
+    } else if (!StrNCmp(upcased, "KERBEROSV4", 10)) {
 	FREE(upcased);
 	return HTAA_KERBEROS_V4;
-    } else if (!strncmp(upcased, "KERBEROSV5", 10)) {
+    } else if (!StrNCmp(upcased, "KERBEROSV5", 10)) {
 	FREE(upcased);
 	return HTAA_KERBEROS_V5;
     } else {
@@ -495,7 +495,7 @@ void HTAA_setupReader(char *start_of_headers,
 #endif
     start_pointer = buffer;
     if (start_of_headers) {
-	strncpy(buffer, start_of_headers, length);
+	StrNCpy(buffer, start_of_headers, length);
 	buffer[length] = '\0';
 	end_pointer = buffer + length;
     } else {
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index 3cc6ff03..de47c209 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAccess.c,v 1.70 2010/09/21 23:57:37 tom Exp $
+ * $LynxId: HTAccess.c,v 1.71 2010/09/24 08:51:18 tom Exp $
  *
  *		Access Manager					HTAccess.c
  *		==============
@@ -357,7 +357,7 @@ BOOL override_proxy(const char *addr)
 	if ((!templ_port || templ_port == port) &&
 	    (t_len > 0 && t_len <= h_len &&
 	     isdigit(UCH(*no_proxy)) &&
-	     !strncmp(host, no_proxy, (unsigned) t_len))) {
+	     !StrNCmp(host, no_proxy, t_len))) {
 	    FREE(host);
 	    return YES;
 	}
@@ -411,10 +411,10 @@ static int get_physical(const char *addr,
 	StrAllocCat(physical, "?0,0");
 	CTRACE((tfp, "HTAccess: Appending '?0,0' coordinate pair.\n"));
     }
-    if (!strncmp(physical, "Proxied=", 8)) {
+    if (!StrNCmp(physical, "Proxied=", 8)) {
 	HTAnchor_setPhysical(anchor, physical + 8);
 	using_proxy = YES;
-    } else if (!strncmp(physical, "NoProxy=", 8)) {
+    } else if (!StrNCmp(physical, "NoProxy=", 8)) {
 	HTAnchor_setPhysical(anchor, physical + 8);
 	override_flag = YES;
     } else {
@@ -523,7 +523,7 @@ static int get_physical(const char *addr,
 	    char *gatewayed = NULL;
 
 	    StrAllocCopy(gatewayed, proxy);
-	    if (!strncmp(gatewayed, "http", 4)) {
+	    if (!StrNCmp(gatewayed, "http", 4)) {
 		char *cp = strrchr(gatewayed, '/');
 
 		/* Append a slash to the proxy specification if it doesn't
@@ -535,7 +535,7 @@ static int get_physical(const char *addr,
 	    /*
 	     * Ensure that the proxy server uses ftp for file URLs. - FM
 	     */
-	    if (!strncmp(addr, "file", 4)) {
+	    if (!StrNCmp(addr, "file", 4)) {
 		StrAllocCat(gatewayed, "ftp");
 		StrAllocCat(gatewayed, (addr + 4));
 	    } else
@@ -795,7 +795,7 @@ static BOOL HTLoadDocument(const char *full_address,	/* may include #fragment */
      */
     if (!anchor->post_data) {
 	while ((cp = HTAnchor_physical(anchor)) != NULL &&
-	       !strncmp(cp, "Location=", 9)) {
+	       !StrNCmp(cp, "Location=", 9)) {
 	    DocAddress NewDoc;
 
 	    CTRACE((tfp, "HTAccess: '%s' is a redirection URL.\n",
diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c
index a1602e93..11a02ef1 100644
--- a/WWW/Library/Implementation/HTAnchor.c
+++ b/WWW/Library/Implementation/HTAnchor.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAnchor.c,v 1.67 2010/06/18 09:39:24 tom Exp $
+ * $LynxId: HTAnchor.c,v 1.69 2010/09/25 12:39:08 tom Exp $
  *
  *	Hypertext "Anchor" Object				HTAnchor.c
  *	==========================
@@ -79,7 +79,7 @@ static HTList adult_table[HASH_SIZE] =
  *	anchor you are creating : use newWithParent or newWithAddress.
  */
 static HTParentAnchor0 *HTParentAnchor0_new(const char *address,
-					    HASH_TYPE hash)
+					    unsigned hash)
 {
     HTParentAnchor0 *newAnchor = typecalloc(HTParentAnchor0);
 
@@ -90,7 +90,7 @@ static HTParentAnchor0 *HTParentAnchor0_new(const char *address,
 
     newAnchor->parent = newAnchor;	/* self */
     StrAllocCopy(newAnchor->address, address);
-    newAnchor->adult_hash = hash;
+    newAnchor->adult_hash = (HASH_TYPE) hash;
 
     return (newAnchor);
 }
@@ -133,7 +133,7 @@ static HTChildAnchor *HTChildAnchor_new(HTParentAnchor0 *parent)
 static HTChildAnchor *HText_pool_ChildAnchor_new(HTParentAnchor *parent)
 {
     HTChildAnchor *p = (HTChildAnchor *) HText_pool_calloc((HText *) (parent->document),
-							   sizeof(HTChildAnchor));
+							   (unsigned) sizeof(HTChildAnchor));
 
     if (p == NULL)
 	outofmem(__FILE__, "HText_pool_ChildAnchor_new");
@@ -1286,7 +1286,7 @@ LYUCcharset *HTAnchor_getUCInfoStage(HTParentAnchor *me,
 		 */
 		chndl = UCLYhndl_for_unspec;	/* always >= 0 */
 	}
-	memcpy(&stages->s[UCT_STAGE_MIME].C, &LYCharSet_UC[chndl],
+	MemCpy(&stages->s[UCT_STAGE_MIME].C, &LYCharSet_UC[chndl],
 	       sizeof(LYUCcharset));
 
 	stages->s[UCT_STAGE_MIME].lock = UCT_SETBY_DEFAULT;
@@ -1352,7 +1352,7 @@ LYUCcharset *HTAnchor_setUCInfoStage(HTParentAnchor *me,
 	    me->UCStages->s[which_stage].lock = set_by;
 	    me->UCStages->s[which_stage].LYhndl = LYhndl;
 	    if (LYhndl >= 0) {
-		memcpy(p, &LYCharSet_UC[LYhndl], sizeof(LYUCcharset));
+		MemCpy(p, &LYCharSet_UC[LYhndl], sizeof(LYUCcharset));
 
 #ifdef CAN_SWITCH_DISPLAY_CHARSET
 		/* Allow a switch to a more suitable display charset */
@@ -1428,7 +1428,7 @@ LYUCcharset *HTAnchor_copyUCInfoStage(HTParentAnchor *me,
 					     me->UCStages->s[to_stage].LYhndl);
 #endif
 	    if (p_to != p_from)
-		memcpy(p_to, p_from, sizeof(LYUCcharset));
+		MemCpy(p_to, p_from, sizeof(LYUCcharset));
 
 	    return (p_to);
 	}
diff --git a/WWW/Library/Implementation/HTAtom.c b/WWW/Library/Implementation/HTAtom.c
index 06775832..d01455ca 100644
--- a/WWW/Library/Implementation/HTAtom.c
+++ b/WWW/Library/Implementation/HTAtom.c
@@ -1,4 +1,7 @@
-/*			Atoms: Names to numbers			HTAtom.c
+/*
+ * $LynxId: HTAtom.c,v 1.18 2010/09/25 11:43:12 tom Exp $
+ *
+ *			Atoms: Names to numbers			HTAtom.c
  *			=======================
  *
  *	Atoms are names which are given representative pointer values
diff --git a/WWW/Library/Implementation/HTCJK.h b/WWW/Library/Implementation/HTCJK.h
index 5835a3c8..555cff1a 100644
--- a/WWW/Library/Implementation/HTCJK.h
+++ b/WWW/Library/Implementation/HTCJK.h
@@ -1,4 +1,7 @@
-/*			CJK character converter		HTCJK.h
+/*
+ * $LynxId: HTCJK.h,v 1.18 2010/09/25 11:41:29 tom Exp $
+ *
+ *			CJK character converter		HTCJK.h
  *			=======================
  *
  *	Added 11-Jun-96 by FM, based on jiscode.h for
@@ -56,29 +59,29 @@ extern "C" {
 /*
  *  Function prototypes.
  */
-    extern void JISx0201TO0208_EUC(register unsigned char IHI,
-				   register unsigned char ILO,
-				   register unsigned char *OHI,
-				   register unsigned char *OLO);
+    extern void JISx0201TO0208_EUC(unsigned IHI,
+				   unsigned ILO,
+				   unsigned char *OHI,
+				   unsigned char *OLO);
 
-    extern unsigned char *SJIS_TO_JIS1(register unsigned char HI,
-				       register unsigned char LO,
-				       register unsigned char *JCODE);
+    extern unsigned char *SJIS_TO_JIS1(unsigned HI,
+				       unsigned LO,
+				       unsigned char *JCODE);
 
-    extern unsigned char *JIS_TO_SJIS1(register unsigned char HI,
-				       register unsigned char LO,
-				       register unsigned char *SJCODE);
+    extern unsigned char *JIS_TO_SJIS1(unsigned HI,
+				       unsigned LO,
+				       unsigned char *SJCODE);
 
-    extern unsigned char *EUC_TO_SJIS1(unsigned char HI,
-				       unsigned char LO,
+    extern unsigned char *EUC_TO_SJIS1(unsigned HI,
+				       unsigned LO,
 				       register unsigned char *SJCODE);
 
-    extern void JISx0201TO0208_SJIS(register unsigned char I,
-				    register unsigned char *OHI,
-				    register unsigned char *OLO);
+    extern void JISx0201TO0208_SJIS(unsigned I,
+				    unsigned char *OHI,
+				    unsigned char *OLO);
 
-    extern unsigned char *SJIS_TO_EUC1(unsigned char HI,
-				       unsigned char LO,
+    extern unsigned char *SJIS_TO_EUC1(unsigned HI,
+				       unsigned LO,
 				       unsigned char *EUCp);
 
     extern unsigned char *SJIS_TO_EUC(unsigned char *src,
diff --git a/WWW/Library/Implementation/HTChunk.c b/WWW/Library/Implementation/HTChunk.c
index db8b2c02..402f32c6 100644
--- a/WWW/Library/Implementation/HTChunk.c
+++ b/WWW/Library/Implementation/HTChunk.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTChunk.c,v 1.24 2010/06/16 23:32:22 tom Exp $
+ * $LynxId: HTChunk.c,v 1.26 2010/09/25 00:32:33 tom Exp $
  *
  *		Chunk handling:	Flexible arrays
  *		===============================
@@ -117,8 +117,8 @@ BOOL HTChunkRealloc(HTChunk *ch, int growby)
     ch->allocated = ch->allocated + growby;
 
     data = (ch->data
-	    ? (char *) realloc(ch->data, (unsigned) ch->allocated)
-	    : typecallocn(char, (unsigned) ch->allocated));
+	    ? typeRealloc(char, ch->data, ch->allocated)
+	    : typecallocn(char, ch->allocated));
 
     if (data) {
 	ch->data = data;
@@ -134,7 +134,7 @@ BOOL HTChunkRealloc(HTChunk *ch, int growby)
 /*	Append a character
  *	------------------
  */
-void HTChunkPutc(HTChunk *ch, unsigned char c)
+void HTChunkPutc(HTChunk *ch, unsigned c)
 {
     if (ch->size >= ch->allocated) {
 	if (!HTChunkRealloc(ch, ch->growby))
@@ -144,7 +144,7 @@ void HTChunkPutc(HTChunk *ch, unsigned char c)
 }
 
 /* like above but no realloc: extend to another chunk if necessary */
-HTChunk *HTChunkPutc2(HTChunk *ch, char c)
+HTChunk *HTChunkPutc2(HTChunk *ch, int c)
 {
     if (ch->size >= ch->allocated) {
 	HTChunk *chunk = HTChunkCreateMayFail(ch->growby, ch->failok);
@@ -153,7 +153,7 @@ HTChunk *HTChunkPutc2(HTChunk *ch, char c)
 	HTChunkPutc(chunk, UCH(c));
 	return chunk;
     }
-    ch->data[ch->size++] = c;
+    ch->data[ch->size++] = (char) c;
     return ch;
 }
 
@@ -167,8 +167,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, (unsigned) ch->allocated)
-		: typecallocn(char, (unsigned) ch->allocated));
+		? typeRealloc(char, ch->data, ch->allocated)
+		: typecallocn(char, ch->allocated));
 
     if (ch->data == NULL)
 	outofmem(__FILE__, "HTChunkEnsure");
@@ -187,7 +187,7 @@ void HTChunkPutb(HTChunk *ch, const char *b, int l)
 	if (!HTChunkRealloc(ch, growby))
 	    return;
     }
-    memcpy(ch->data + ch->size, b, (unsigned) l);
+    MemCpy(ch->data + ch->size, b, l);
     ch->size += l;
 }
 
@@ -200,7 +200,7 @@ HTChunk *HTChunkPutb2(HTChunk *ch, const char *b, int l)
 	HTChunk *chunk;
 	int m = ch->allocated - ch->size;
 
-	memcpy(ch->data + ch->size, b, (unsigned) m);
+	MemCpy(ch->data + ch->size, b, (unsigned) m);
 	ch->size += m;
 
 	chunk = HTChunkCreateMayFail(ch->growby, ch->failok);
@@ -208,7 +208,7 @@ HTChunk *HTChunkPutb2(HTChunk *ch, const char *b, int l)
 	HTChunkPutb(chunk, b + m, l - m);
 	return chunk;
     }
-    memcpy(ch->data + ch->size, b, (unsigned) l);
+    MemCpy(ch->data + ch->size, b, (unsigned) l);
     ch->size += l;
     return ch;
 }
diff --git a/WWW/Library/Implementation/HTChunk.h b/WWW/Library/Implementation/HTChunk.h
index 7da23f5e..1a9dbbae 100644
--- a/WWW/Library/Implementation/HTChunk.h
+++ b/WWW/Library/Implementation/HTChunk.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTChunk.h,v 1.19 2010/06/16 23:24:56 tom Exp $
+ * $LynxId: HTChunk.h,v 1.20 2010/09/24 08:37:39 tom Exp $
  *
  *				     HTChunk: Flexible array handling for libwww
  *					CHUNK HANDLING:
@@ -154,7 +154,7 @@ extern "C" {
  *   *ch		Is one character bigger
  *
  */
-    extern void HTChunkPutc(HTChunk *ch, unsigned char c);
+    extern void HTChunkPutc(HTChunk *ch, unsigned c);
 
     extern void HTChunkPutb(HTChunk *ch, const char *b, int l);
 
@@ -215,7 +215,7 @@ extern "C" {
  *                     by the field 'next')
  *
  */
-    extern HTChunk *HTChunkPutc2(HTChunk *ch, char c);
+    extern HTChunk *HTChunkPutc2(HTChunk *ch, int c);
     extern HTChunk *HTChunkPuts2(HTChunk *ch, const char *str);
     extern HTChunk *HTChunkPutb2(HTChunk *ch, const char *b, int l);
 
diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c
index a8090235..1221bb55 100644
--- a/WWW/Library/Implementation/HTDOS.c
+++ b/WWW/Library/Implementation/HTDOS.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTDOS.c,v 1.37 2009/09/09 00:40:55 tom Exp $
+ * $LynxId: HTDOS.c,v 1.38 2010/09/25 00:42:02 tom Exp $
  *							DOS specific routines
  */
 
@@ -160,7 +160,7 @@ char *HTDOS_short_name(const char *path)
 	path = HTDOS_name(path);
     r = GetShortPathName(path, sbuf, sizeof sbuf);
     if (r >= sizeof(sbuf) || r == 0) {
-	ret = LYstrncpy(sbuf, path, sizeof(sbuf));
+	ret = LYStrNCpy(sbuf, path, sizeof(sbuf));
     } else {
 	ret = sbuf;
     }
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index e2ac69b9..0786d2f3 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFTP.c,v 1.96 2010/09/23 09:29:36 tom Exp $
+ * $LynxId: HTFTP.c,v 1.98 2010/09/25 00:05:51 tom Exp $
  *
  *			File Transfer Protocol (FTP) Client
  *			for a WorldWideWeb browser
@@ -296,7 +296,7 @@ char *HTVMS_name(const char *nn,
 
     strcpy(filename, fn);
     strcpy(nodename, "");	/* On same node?  Yes if node names match */
-    if (strncmp(nn, "localhost", 9)) {
+    if (StrNCmp(nn, "localhost", 9)) {
 	const char *p;
 	const char *q;
 
@@ -550,9 +550,9 @@ static int response(const char *cmd)
 		CTRACE((tfp, "    Rx: %s", response_text));
 
 		/* Check for login or help messages */
-		if (!strncmp(response_text, "230-", 4) ||
-		    !strncmp(response_text, "250-", 4) ||
-		    !strncmp(response_text, "220-", 4))
+		if (!StrNCmp(response_text, "230-", 4) ||
+		    !StrNCmp(response_text, "250-", 4) ||
+		    !StrNCmp(response_text, "220-", 4))
 		    help_message_cache_add(response_text + 4);
 
 		sscanf(response_text, "%d%c", &result, &continuation);
@@ -1016,7 +1016,7 @@ static int get_connection(const char *arg,
     use_list = FALSE;		/* reset */
     if (response("SYST\r\n") == 2) {
 	/* we got a line -- what kind of server are we talking to? */
-	if (strncmp(response_text + 4,
+	if (StrNCmp(response_text + 4,
 		    "UNIX Type: L8 MAC-OS MachTen", 28) == 0) {
 	    server_type = MACHTEN_SERVER;
 	    use_list = TRUE;
@@ -1034,7 +1034,7 @@ static int get_connection(const char *arg,
 	    use_list = TRUE;
 	    CTRACE((tfp, "HTFTP: Treating as MSDOS (Unix emulation) server.\n"));
 
-	} else if (strncmp(response_text + 4, "VMS", 3) == 0) {
+	} else if (StrNCmp(response_text + 4, "VMS", 3) == 0) {
 	    char *tilde = strstr(arg, "/~");
 
 	    use_list = TRUE;
@@ -1048,13 +1048,13 @@ static int get_connection(const char *arg,
 		CTRACE((tfp, "HTFTP: Treating as VMS server.\n"));
 	    }
 
-	} else if ((strncmp(response_text + 4, "VM/CMS", 6) == 0) ||
-		   (strncmp(response_text + 4, "VM ", 3) == 0)) {
+	} else if ((StrNCmp(response_text + 4, "VM/CMS", 6) == 0) ||
+		   (StrNCmp(response_text + 4, "VM ", 3) == 0)) {
 	    server_type = CMS_SERVER;
 	    use_list = TRUE;
 	    CTRACE((tfp, "HTFTP: Treating as CMS server.\n"));
 
-	} else if (strncmp(response_text + 4, "DCTS", 4) == 0) {
+	} else if (StrNCmp(response_text + 4, "DCTS", 4) == 0) {
 	    server_type = DCTS_SERVER;
 	    CTRACE((tfp, "HTFTP: Treating as DCTS server.\n"));
 
@@ -1069,28 +1069,28 @@ static int get_connection(const char *arg,
 	    set_mac_binary(server_type);
 	    CTRACE((tfp, "HTFTP: Treating as NetPresenz (MACOS) server.\n"));
 
-	} else if (strncmp(response_text + 4, "MACOS Peter's Server", 20) == 0) {
+	} else if (StrNCmp(response_text + 4, "MACOS Peter's Server", 20) == 0) {
 	    server_type = PETER_LEWIS_SERVER;
 	    use_list = TRUE;
 	    set_mac_binary(server_type);
 	    CTRACE((tfp, "HTFTP: Treating as Peter Lewis (MACOS) server.\n"));
 
-	} else if (strncmp(response_text + 4, "Windows_NT", 10) == 0) {
+	} else if (StrNCmp(response_text + 4, "Windows_NT", 10) == 0) {
 	    server_type = WINDOWS_NT_SERVER;
 	    CTRACE((tfp, "HTFTP: Treating as Window_NT server.\n"));
 	    set_unix_dirstyle(&server_type, &use_list);
 
-	} else if (strncmp(response_text + 4, "Windows2000", 11) == 0) {
+	} else if (StrNCmp(response_text + 4, "Windows2000", 11) == 0) {
 	    server_type = WINDOWS_2K_SERVER;
 	    CTRACE((tfp, "HTFTP: Treating as Window_2K server.\n"));
 	    set_unix_dirstyle(&server_type, &use_list);
 
-	} else if (strncmp(response_text + 4, "MS Windows", 10) == 0) {
+	} else if (StrNCmp(response_text + 4, "MS Windows", 10) == 0) {
 	    server_type = MS_WINDOWS_SERVER;
 	    use_list = TRUE;
 	    CTRACE((tfp, "HTFTP: Treating as MS Windows server.\n"));
 
-	} else if (strncmp(response_text + 4,
+	} else if (StrNCmp(response_text + 4,
 			   "MACOS AppleShare IP FTP Server", 30) == 0) {
 	    server_type = APPLESHARE_SERVER;
 	    use_list = TRUE;
@@ -1392,7 +1392,10 @@ static int get_listen_socket(void)
 
 	    getnameinfo((struct sockaddr *) &soc_address,
 			SOCKADDR_LEN(soc_address),
-			hostbuf, sizeof(hostbuf), portbuf, sizeof(portbuf),
+			hostbuf,
+			(socklen_t) sizeof(hostbuf),
+			portbuf,
+			(socklen_t) sizeof(portbuf),
 			NI_NUMERICHOST | NI_NUMERICSERV);
 	    sprintf(port_command, "EPRT |%d|%s|%s|%c%c", 2, hostbuf, portbuf,
 		    CR, LF);
@@ -1452,12 +1455,12 @@ static void set_years_and_date(void)
     int i;
 
     NowTime = time(NULL);
-    strncpy(day, (char *) ctime(&NowTime) + 8, 2);
+    StrNCpy(day, (char *) ctime(&NowTime) + 8, 2);
     day[2] = '\0';
     if (day[0] == ' ') {
 	day[0] = '0';
     }
-    strncpy(month, (char *) ctime(&NowTime) + 4, 3);
+    StrNCpy(month, (char *) ctime(&NowTime) + 4, 3);
     month[3] = '\0';
     for (i = 0; i < 12; i++) {
 	if (!strcasecomp(month, months[i])) {
@@ -1790,7 +1793,7 @@ static void parse_dls_line(char *line,
     entry_info->size = (unsigned long) size_num;
 
     cps = LYSkipBlanks(&line[23]);
-    if (!strncmp(cps, "-> ", 3) && cps[3] != '\0' && cps[3] != ' ') {
+    if (!StrNCmp(cps, "-> ", 3) && cps[3] != '\0' && cps[3] != ' ') {
 	StrAllocCopy(entry_info->type, ENTRY_IS_SYMBOLIC_LINK);
 	StrAllocCopy(entry_info->linkname, LYSkipBlanks(cps + 3));
 	entry_info->size = 0;	/* don't display size */
@@ -1853,12 +1856,12 @@ static void parse_vms_dir_entry(char *line,
 	i = (int) ((strstr(entry_info->filename, "READ")
 		    - entry_info->filename)
 		   + 4);
-	if (!strncmp(&entry_info->filename[i], "ME", 2)) {
+	if (!StrNCmp(&entry_info->filename[i], "ME", 2)) {
 	    i += 2;
 	    while (entry_info->filename[i] && entry_info->filename[i] != '.') {
 		i++;
 	    }
-	} else if (!strncmp(&entry_info->filename[i], ".ME", 3)) {
+	} else if (!StrNCmp(&entry_info->filename[i], ".ME", 3)) {
 	    i = (int) strlen(entry_info->filename);
 	} else {
 	    i = 0;
@@ -1912,7 +1915,7 @@ static void parse_vms_dir_entry(char *line,
 	    sprintf(date + 4, "%c%.1s ", HT_NON_BREAK_SPACE, cpd - 1);
 
 	/* Time or Year */
-	if (!strncmp(ThisYear, cpd + 5, 4) &&
+	if (!StrNCmp(ThisYear, cpd + 5, 4) &&
 	    strlen(cpd) > 15 && *(cpd + 12) == ':') {
 	    sprintf(date + 7, "%.5s", cpd + 10);
 	} else {
@@ -2382,7 +2385,7 @@ static EntryInfo *parse_dir_entry(char *entry,
 		return (entry_info);
 	    }
 	    *first = FALSE;
-	    if (!strncmp(entry, "total ", 6) ||
+	    if (!StrNCmp(entry, "total ", 6) ||
 		strstr(entry, "not available") != NULL) {
 		entry_info->display = FALSE;
 		return (entry_info);
@@ -2595,9 +2598,9 @@ static EntryInfo *parse_dir_entry(char *entry,
 	format = HTFileFormat(entry_info->filename, &encoding, &cp2);
 
 	if (cp2 == NULL) {
-	    if (!strncmp(HTAtom_name(format), "application", 11)) {
+	    if (!StrNCmp(HTAtom_name(format), "application", 11)) {
 		cp2 = HTAtom_name(format) + 12;
-		if (!strncmp(cp2, "x-", 2))
+		if (!StrNCmp(cp2, "x-", 2))
 		    cp2 += 2;
 	    } else {
 		cp2 = HTAtom_name(format);
@@ -2663,7 +2666,7 @@ static int compare_EntryInfo_structs(EntryInfo *entry1, EntryInfo *entry2)
 		strcpy(date1, &entry1->date[8]);
 		strcpy(time1, "00:00");
 	    }
-	    strncpy(month, entry1->date, 3);
+	    StrNCpy(month, entry1->date, 3);
 	    month[3] = '\0';
 	    for (i = 0; i < 12; i++) {
 		if (!strcasecomp(month, months[i])) {
@@ -2673,7 +2676,7 @@ static int compare_EntryInfo_structs(EntryInfo *entry1, EntryInfo *entry2)
 	    i++;
 	    sprintf(month, "%02d", i);
 	    strcat(date1, month);
-	    strncat(date1, &entry1->date[4], 2);
+	    StrNCat(date1, &entry1->date[4], 2);
 	    date1[8] = '\0';
 	    if (date1[6] == ' ' || date1[6] == HT_NON_BREAK_SPACE) {
 		date1[6] = '0';
@@ -2698,7 +2701,7 @@ static int compare_EntryInfo_structs(EntryInfo *entry1, EntryInfo *entry2)
 		strcpy(date2, &entry2->date[8]);
 		strcpy(time2, "00:00");
 	    }
-	    strncpy(month, entry2->date, 3);
+	    StrNCpy(month, entry2->date, 3);
 	    month[3] = '\0';
 	    for (i = 0; i < 12; i++) {
 		if (!strcasecomp(month, months[i])) {
@@ -2708,7 +2711,7 @@ static int compare_EntryInfo_structs(EntryInfo *entry1, EntryInfo *entry2)
 	    i++;
 	    sprintf(month, "%02d", i);
 	    strcat(date2, month);
-	    strncat(date2, &entry2->date[4], 2);
+	    StrNCat(date2, &entry2->date[4], 2);
 	    date2[8] = '\0';
 	    if (date2[6] == ' ' || date2[6] == HT_NON_BREAK_SPACE) {
 		date2[6] = '0';
@@ -2867,10 +2870,10 @@ static void LYListFmtParse(const char *fmtstr,
 
 		if (c != 'T') {
 		    if (cp2 == NULL) {
-			if (!strncmp(HTAtom_name(format),
+			if (!StrNCmp(HTAtom_name(format),
 				     "application", 11)) {
 			    cp2 = HTAtom_name(format) + 12;
-			    if (!strncmp(cp2, "x-", 2))
+			    if (!StrNCmp(cp2, "x-", 2))
 				cp2 += 2;
 			} else {
 			    cp2 = HTAtom_name(format);
@@ -3424,8 +3427,11 @@ static int setup_connection(const char *name,
 		    status = HT_NO_CONNECTION;
 		    break;
 		}
-		if (getnameinfo((struct sockaddr *) &ss, sslen, dst,
-				sizeof(dst), NULL, 0, NI_NUMERICHOST)) {
+		if (getnameinfo((struct sockaddr *) &ss,
+				sslen,
+				dst,
+				(socklen_t) sizeof(dst),
+				NULL, 0, NI_NUMERICHOST)) {
 		    fprintf(tfp, "HTFTP: getnameinfo failed\n");
 		    status = HT_NO_CONNECTION;
 		    break;
@@ -3515,7 +3521,7 @@ int HTFTPLoad(const char *name,
 	     ? "passive"
 	     : "normal")));
 
-    HTReadProgress(0, 0);
+    HTReadProgress((off_t) 0, (off_t) 0);
 
     status = setup_connection(name, anchor);
     if (status < 0)
@@ -3704,7 +3710,7 @@ int HTFTPLoad(const char *name,
 		    return -1;
 		}
 		/* Handle any unescaped "/%2F" path */
-		if (!strncmp(filename, "//", 2)) {
+		if (!StrNCmp(filename, "//", 2)) {
 		    int i;
 
 		    included_device = TRUE;
@@ -3859,7 +3865,7 @@ int HTFTPLoad(const char *name,
 		    goto listen;
 		}
 		/* Otherwise, go to appropriate directory and doctor filename */
-		if (!strncmp(filename, "/~", 2)) {
+		if (!StrNCmp(filename, "/~", 2)) {
 		    filename += 2;
 		    found_tilde = TRUE;
 		}
@@ -3967,7 +3973,7 @@ int HTFTPLoad(const char *name,
 	    }
 	default:
 	    /* Shift for any unescaped "/%2F" path */
-	    if (!strncmp(filename, "//", 2))
+	    if (!StrNCmp(filename, "//", 2))
 		filename++;
 	    break;
 	}
@@ -4066,7 +4072,7 @@ int HTFTPLoad(const char *name,
 		if (outstanding-- > 0) {
 		    status = response(0);
 		    if (status < 0 ||
-			(status == 2 && !strncmp(response_text, "221", 3)))
+			(status == 2 && !StrNCmp(response_text, "221", 3)))
 			outstanding = 0;
 		}
 	} else {		/* HT_INTERRUPTED */
@@ -4169,7 +4175,7 @@ int HTFTPLoad(const char *name,
 		    return HTLoadError(sink, 500, response_text);
 		} else if (status <= 0) {
 		    outstanding = 0;
-		} else if (status == 2 && !strncmp(response_text, "221", 3))
+		} else if (status == 2 && !StrNCmp(response_text, "221", 3))
 		    outstanding = 0;
 	    }
 	}
@@ -4178,7 +4184,7 @@ int HTFTPLoad(const char *name,
     while (outstanding-- > 0 &&
 	   (status > 0)) {
 	status = response(0);
-	if (status == 2 && !strncmp(response_text, "221", 3))
+	if (status == 2 && !StrNCmp(response_text, "221", 3))
 	    break;
     }
     data_soc = -1;		/* invalidate it */
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 0fdc6e95..f8ea537f 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFile.c,v 1.125 2010/09/23 10:43:48 tom Exp $
+ * $LynxId: HTFile.c,v 1.126 2010/09/24 08:52:55 tom Exp $
  *
  *			File Access				HTFile.c
  *			===========
@@ -331,10 +331,10 @@ static void LYListFmtParse(const char *fmtstr,
 
 		if (c != 'T') {
 		    if (cp2 == NULL) {
-			if (!strncmp(HTAtom_name(format),
+			if (!StrNCmp(HTAtom_name(format),
 				     "application", 11)) {
 			    cp2 = HTAtom_name(format) + 12;
-			    if (!strncmp(cp2, "x-", 2))
+			    if (!StrNCmp(cp2, "x-", 2))
 				cp2 += 2;
 			} else {
 			    cp2 = HTAtom_name(format);
@@ -637,8 +637,8 @@ static int HTCreatePath(const char *path)
  *	Returns a malloc'ed string which must be freed by the caller.
  */
 char *HTURLPath_toFile(const char *name,
-		       BOOL expand_all,
-		       BOOL is_remote GCC_UNUSED)
+		       int expand_all,
+		       int is_remote GCC_UNUSED)
 {
     char *path = NULL;
     char *result = NULL;
@@ -676,8 +676,8 @@ char *HTURLPath_toFile(const char *name,
 	 paths (like ones containing "//", possibly escaped). - kw
 */
 char *HTnameOfFile_WWW(const char *name,
-		       BOOL WWW_prefix,
-		       BOOL expand_all)
+		       int WWW_prefix,
+		       int expand_all)
 {
     char *acc_method = HTParse(name, "", PARSE_ACCESS);
     char *host = HTParse(name, "", PARSE_HOST);
@@ -745,11 +745,11 @@ char *WWW_nameOfFile(const char *name)
     char *result = NULL;
 
 #ifdef NeXT
-    if (0 == strncmp("/private/Net/", name, 13)) {
+    if (0 == StrNCmp("/private/Net/", name, 13)) {
 	HTSprintf0(&result, "%s//%s", STR_FILE_URL, name + 13);
     } else
 #endif /* NeXT */
-    if (0 == strncmp(HTMountRoot, name, 5)) {
+    if (0 == StrNCmp(HTMountRoot, name, 5)) {
 	HTSprintf0(&result, "%s//%s", STR_FILE_URL, name + 5);
     } else {
 	HTSprintf0(&result, "%s//%s%s", STR_FILE_URL, HTHostName(), name);
@@ -1049,12 +1049,12 @@ HTFormat HTCharsetFormat(HTFormat format,
 	     * charset and the current display character both are likely to be
 	     * like ISO-8859 in structure, pretend we have some kind of match.
 	     */
-	    BOOL given_is_8859 = (BOOL) (!strncmp(cp4, "iso-8859-", 9) &&
+	    BOOL given_is_8859 = (BOOL) (!StrNCmp(cp4, "iso-8859-", 9) &&
 					 isdigit(UCH(cp4[9])));
 	    BOOL given_is_8859like = (BOOL) (given_is_8859 ||
-					     !strncmp(cp4, "windows-", 8) ||
-					     !strncmp(cp4, "cp12", 4) ||
-					     !strncmp(cp4, "cp-12", 5));
+					     !StrNCmp(cp4, "windows-", 8) ||
+					     !StrNCmp(cp4, "cp12", 4) ||
+					     !StrNCmp(cp4, "cp-12", 5));
 	    BOOL given_and_display_8859like = (BOOL) (given_is_8859like &&
 						      (strstr(LYchar_set_names[current_char_set],
 							      "ISO-8859") ||
@@ -1547,7 +1547,7 @@ void HTStructured_meta(HTStructured * target, HTFormat format_out)
  */
 BOOL HTDirTitles(HTStructured * target, HTParentAnchor *anchor,
 		 HTFormat format_out,
-		 BOOL tildeIsTop)
+		 int tildeIsTop)
 {
     const char *logical = anchor->address;
     char *path = HTParse(logical, "", PARSE_PATH + PARSE_PUNCTUATION);
@@ -1570,7 +1570,7 @@ BOOL HTDirTitles(HTStructured * target, HTParentAnchor *anchor,
      * Check tildeIsTop for treating home directory as Welcome (assume the
      * tilde is not followed by a username).  - FM
      */
-    if (tildeIsTop && !strncmp(path, "/~", 2)) {
+    if (tildeIsTop && !StrNCmp(path, "/~", 2)) {
 	if (path[2] == '\0') {
 	    path[1] = '\0';
 	} else {
@@ -2287,7 +2287,7 @@ static BOOL isGzipStream(FILE *fp)
     BOOL result;
 
     if (sniffStream(fp, buffer, sizeof(buffer))
-	&& !memcmp(buffer, "\037\213", sizeof(buffer) - 1)) {
+	&& !MemCmp(buffer, "\037\213", sizeof(buffer) - 1)) {
 	result = TRUE;
     } else {
 	CTRACE((tfp, "not a gzip-stream\n"));
@@ -2302,7 +2302,7 @@ static BOOL isDeflateStream(FILE *fp)
     BOOL result;
 
     if (sniffStream(fp, buffer, sizeof(buffer))
-	&& !memcmp(buffer, "\170\234", sizeof(buffer) - 1)) {
+	&& !MemCmp(buffer, "\170\234", sizeof(buffer) - 1)) {
 	result = TRUE;
     } else {
 	CTRACE((tfp, "not a deflate-stream\n"));
@@ -2319,7 +2319,7 @@ static BOOL isBzip2Stream(FILE *fp)
     BOOL result;
 
     if (sniffStream(fp, buffer, sizeof(buffer))
-	&& !memcmp(buffer, "BZh", 3)
+	&& !MemCmp(buffer, "BZh", 3)
 	&& isdigit(UCH(buffer[3]))
 	&& isdigit(UCH(buffer[4]))) {
 	result = TRUE;
@@ -2828,7 +2828,7 @@ int HTLoadFile(const char *addr,
 		    continue;	/* if the entry is not being used, skip it */
 #endif
 		if (strlen(dirbuf->d_name) > baselen &&		/* Match? */
-		    !strncmp(dirbuf->d_name, base, baselen)) {
+		    !StrNCmp(dirbuf->d_name, base, baselen)) {
 		    HTAtom *enc;
 		    HTFormat rep = HTFileFormat(dirbuf->d_name, &enc, NULL);
 		    float filevalue = HTFileValue(dirbuf->d_name);
@@ -2850,7 +2850,7 @@ int HTLoadFile(const char *addr,
 			    format = HTFileFormat(cp, NULL, NULL);
 			    FREE(cp);
 			    value = HTStackValue(format, format_out,
-						 filevalue, 0);
+						 filevalue, 0L);
 			    switch (cft) {
 			    case cftCompress:
 				atomname = "application/x-compressed";
@@ -2871,16 +2871,16 @@ int HTLoadFile(const char *addr,
 
 			if (atomname != NULL) {
 			    value = HTStackValue(format, format_out,
-						 filevalue, 0);
+						 filevalue, 0L);
 			    if (value <= 0.0) {
 				format = HTAtom_for(atomname);
 				value = HTStackValue(format, format_out,
-						     filevalue, 0);
+						     filevalue, 0L);
 			    }
 			    if (value <= 0.0) {
 				format = HTAtom_for("www/compressed");
 				value = HTStackValue(format, format_out,
-						     filevalue, 0);
+						     filevalue, 0L);
 			    }
 			}
 		    }
@@ -3032,7 +3032,7 @@ int HTLoadFile(const char *addr,
 	{
 	    status = -1;
 	    FREE(nodename);
-	    if (strncmp(addr, "file://localhost", 16)) {
+	    if (StrNCmp(addr, "file://localhost", 16)) {
 		/* never go to ftp site when URL
 		 * is file://localhost
 		 */
diff --git a/WWW/Library/Implementation/HTFile.h b/WWW/Library/Implementation/HTFile.h
index b7a514d6..2a548060 100644
--- a/WWW/Library/Implementation/HTFile.h
+++ b/WWW/Library/Implementation/HTFile.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFile.h,v 1.31 2008/12/07 18:49:53 tom Exp $
+ * $LynxId: HTFile.h,v 1.32 2010/09/24 00:32:16 tom Exp $
  *							File access in libwww
  *				FILE ACCESS
  *
@@ -49,8 +49,8 @@ extern "C" {
 /*
  *  Convert filenames between local and WWW formats
  */
-    extern char *HTURLPath_toFile(const char *name, BOOL expand_all, BOOL is_remote);
-    extern char *HTnameOfFile_WWW(const char *name, BOOL WWW_prefix, BOOL expand_all);
+    extern char *HTURLPath_toFile(const char *name, int expand_all, int is_remote);
+    extern char *HTnameOfFile_WWW(const char *name, int WWW_prefix, int expand_all);
 
 #define HTLocalName(name)      HTnameOfFile_WWW(name,TRUE,TRUE)
 #define HTfullURL_toFile(name) HTnameOfFile_WWW(name,FALSE,TRUE)
@@ -83,7 +83,7 @@ extern "C" {
  */
     extern BOOL HTDirTitles(HTStructured * target, HTParentAnchor *anchor,
 			    HTFormat format_out,
-			    BOOL tildeIsTop);
+			    int tildeIsTop);
 
 /*
  *	Check existence.
diff --git a/WWW/Library/Implementation/HTFinger.c b/WWW/Library/Implementation/HTFinger.c
index ed5a6b20..b7911309 100644
--- a/WWW/Library/Implementation/HTFinger.c
+++ b/WWW/Library/Implementation/HTFinger.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFinger.c,v 1.26 2010/09/22 00:46:26 tom Exp $
+ * $LynxId: HTFinger.c,v 1.27 2010/09/24 08:30:28 tom Exp $
  *
  *			FINGER ACCESS				HTFinger.c
  *			=============
@@ -203,22 +203,22 @@ static int response(char *command,
 	     */
 	    p = l = line;
 	    while (*l) {
-		if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
-		    strncmp(l, "snews://", 8) &&
-		    strncmp(l, "nntp://", 7) &&
-		    strncmp(l, "snewspost:", 10) &&
-		    strncmp(l, "snewsreply:", 11) &&
-		    strncmp(l, "newspost:", 9) &&
-		    strncmp(l, "newsreply:", 10) &&
-		    strncmp(l, "ftp://", 6) &&
-		    strncmp(l, "file:/", 6) &&
-		    strncmp(l, "finger://", 9) &&
-		    strncmp(l, "http://", 7) &&
-		    strncmp(l, "https://", 8) &&
-		    strncmp(l, "wais://", 7) &&
-		    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
-		    strncmp(l, "cso://", 6) &&
-		    strncmp(l, "gopher://", 9))
+		if (StrNCmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
+		    StrNCmp(l, "snews://", 8) &&
+		    StrNCmp(l, "nntp://", 7) &&
+		    StrNCmp(l, "snewspost:", 10) &&
+		    StrNCmp(l, "snewsreply:", 11) &&
+		    StrNCmp(l, "newspost:", 9) &&
+		    StrNCmp(l, "newsreply:", 10) &&
+		    StrNCmp(l, "ftp://", 6) &&
+		    StrNCmp(l, "file:/", 6) &&
+		    StrNCmp(l, "finger://", 9) &&
+		    StrNCmp(l, "http://", 7) &&
+		    StrNCmp(l, "https://", 8) &&
+		    StrNCmp(l, "wais://", 7) &&
+		    StrNCmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
+		    StrNCmp(l, "cso://", 6) &&
+		    StrNCmp(l, "gopher://", 9))
 		    PUTC(*l++);
 		else {
 		    StrAllocCopy(href, l);
@@ -254,6 +254,8 @@ int HTLoadFinger(const char *arg,
 		 HTFormat format_out,
 		 HTStream *stream)
 {
+    static char empty[1];
+
     char *username, *sitename, *colon;	/* Fields extracted from URL */
     char *slash, *at_sign;	/* Fields extracted from URL */
     char *command, *str, *param;	/* Buffers */
@@ -316,7 +318,7 @@ int HTLoadFinger(const char *arg,
     } else if (slash) {
 	username = slash;
     } else {
-	username = "";
+	username = empty;
     }
 
     if (*sitename == '\0') {
diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c
index 367ddd4f..798dbec7 100644
--- a/WWW/Library/Implementation/HTFormat.c
+++ b/WWW/Library/Implementation/HTFormat.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFormat.c,v 1.71 2010/09/22 00:46:54 tom Exp $
+ * $LynxId: HTFormat.c,v 1.72 2010/09/24 09:11:25 tom Exp $
  *
  *		Manage different file formats			HTFormat.c
  *		=============================
@@ -153,9 +153,9 @@ void HTSetPresentation(const char *representation,
 void HTSetConversion(const char *representation_in,
 		     const char *representation_out,
 		     HTConverter *converter,
-		     float quality,
-		     float secs,
-		     float secs_per_byte,
+		     double quality,
+		     double secs,
+		     double secs_per_byte,
 		     long int maxbytes,
 		     AcceptMedia media)
 {
@@ -178,9 +178,9 @@ void HTSetConversion(const char *representation_in,
     pres->converter = converter;
     pres->command = NULL;
     pres->testcommand = NULL;
-    pres->quality = quality;
-    pres->secs = secs;
-    pres->secs_per_byte = secs_per_byte;
+    pres->quality = (float) quality;
+    pres->secs = (float) secs;
+    pres->secs_per_byte = (float) secs_per_byte;
     pres->maxbytes = maxbytes;
     pres->get_accept = TRUE;
     pres->accept_opt = media;
@@ -343,7 +343,7 @@ static int half_match(char *trial_type, char *target)
 	    trial_type, target));
 
     /* main type matches */
-    if (!strncmp(trial_type, target, (size_t) ((cp - trial_type) - 1)))
+    if (!StrNCmp(trial_type, target, ((cp - trial_type) - 1)))
 	return 1;
 
     return 0;
@@ -611,7 +611,7 @@ void HTFilterPresentations(void)
  */
 float HTStackValue(HTFormat rep_in,
 		   HTFormat rep_out,
-		   float initial_value,
+		   double initial_value,
 		   long int length)
 {
     HTAtom *wildcard = WWW_WILDCARD_REP_OUT;
@@ -631,7 +631,7 @@ float HTStackValue(HTFormat rep_in,
 	    pres = (HTPresentation *) HTList_objectAt(HTPresentations, i);
 	    if (pres->rep == rep_in &&
 		(pres->rep_out == rep_out || pres->rep_out == wildcard)) {
-		float value = initial_value * pres->quality;
+		float value = (float) (initial_value * pres->quality);
 
 		if (HTMaxSecs > 0.0)
 		    value = (value
@@ -747,7 +747,7 @@ int HTCopy(HTParentAnchor *anchor,
 {
     HTStreamClass targetClass;
     BOOL suppress_readprogress = NO;
-    int bytes;
+    off_t bytes;
     int rv = 0;
 
     /*  Push the data down the stream
@@ -759,7 +759,7 @@ int HTCopy(HTParentAnchor *anchor,
      *
      * This operation could be put into a main event loop
      */
-    HTReadProgress(bytes = 0, 0);
+    HTReadProgress(bytes = 0, (off_t) 0);
     for (;;) {
 	int status;
 
@@ -883,7 +883,7 @@ int HTCopy(HTParentAnchor *anchor,
 	(*targetClass.put_block) (sink, input_buffer, status);
 	bytes += status;
 	if (!suppress_readprogress)
-	    HTReadProgress(bytes, anchor ? anchor->content_length : 0);
+	    HTReadProgress(bytes, (off_t) (anchor ? anchor->content_length : 0));
 	HTDisplayPartial();
 
     }				/* next bufferload */
@@ -920,7 +920,8 @@ int HTCopy(HTParentAnchor *anchor,
 int HTFileCopy(FILE *fp, HTStream *sink)
 {
     HTStreamClass targetClass;
-    int status, bytes;
+    int status;
+    off_t bytes;
     int rv = HT_OK;
 
     /*  Push the data down the stream
@@ -929,9 +930,11 @@ int HTFileCopy(FILE *fp, HTStream *sink)
 
     /*  Push binary from socket down sink
      */
-    HTReadProgress(bytes = 0, 0);
+    HTReadProgress(bytes = 0, (off_t) 0);
     for (;;) {
-	status = (int) fread(input_buffer, 1, INPUT_BUFFER_SIZE, fp);
+	status = (int) fread(input_buffer,
+			     (size_t) 1,
+			     (size_t) INPUT_BUFFER_SIZE, fp);
 	if (status == 0) {	/* EOF or error */
 	    if (ferror(fp) == 0) {
 		rv = HT_LOADED;
@@ -949,7 +952,7 @@ int HTFileCopy(FILE *fp, HTStream *sink)
 
 	(*targetClass.put_block) (sink, input_buffer, status);
 	bytes += status;
-	HTReadProgress(bytes, 0);
+	HTReadProgress(bytes, (off_t) 0);
 	/* Suppress last screen update in partial mode - a regular update under
 	 * control of mainloop() should follow anyway.  - kw
 	 */
@@ -993,11 +996,11 @@ int HTFileCopy(FILE *fp, HTStream *sink)
 int HTMemCopy(HTChunk *chunk, HTStream *sink)
 {
     HTStreamClass targetClass;
-    int bytes = 0;
+    off_t bytes;
     int rv = HT_OK;
 
     targetClass = *(sink->isa);
-    HTReadProgress(0, 0);
+    HTReadProgress(bytes = 0, (off_t) 0);
     for (; chunk != NULL; chunk = chunk->next) {
 
 	/* Push the data down the stream a piece at a time, in case we're
@@ -1006,7 +1009,7 @@ int HTMemCopy(HTChunk *chunk, HTStream *sink)
 	(*targetClass.put_block) (sink, chunk->data, chunk->size);
 	bytes += chunk->size;
 
-	HTReadProgress(bytes, 0);
+	HTReadProgress(bytes, (off_t) 0);
 	HTDisplayPartial();
 
 	if (HTCheckForInterrupt()) {
@@ -1049,7 +1052,8 @@ int HTMemCopy(HTChunk *chunk, HTStream *sink)
 static int HTGzFileCopy(gzFile gzfp, HTStream *sink)
 {
     HTStreamClass targetClass;
-    int status, bytes;
+    int status;
+    off_t bytes;
     int gzerrnum;
     int rv = HT_OK;
 
@@ -1059,7 +1063,7 @@ static int HTGzFileCopy(gzFile gzfp, HTStream *sink)
 
     /*  read and inflate gzip'd file, and push binary down sink
      */
-    HTReadProgress(bytes = 0, 0);
+    HTReadProgress(bytes = 0, (off_t) 0);
     for (;;) {
 	status = gzread(gzfp, input_buffer, INPUT_BUFFER_SIZE);
 	if (status <= 0) {	/* EOF or error */
@@ -1085,7 +1089,7 @@ static int HTGzFileCopy(gzFile gzfp, HTStream *sink)
 
 	(*targetClass.put_block) (sink, input_buffer, status);
 	bytes += status;
-	HTReadProgress(bytes, -1);
+	HTReadProgress(bytes, (off_t) - 1);
 	HTDisplayPartial();
 
 	if (HTCheckForInterrupt()) {
@@ -1145,7 +1149,7 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink)
 
     z_stream s;
     HTStreamClass targetClass;
-    int bytes;
+    off_t bytes;
     int rv = HT_OK;
     char output_buffer[INPUT_BUFFER_SIZE];
     int status;
@@ -1172,11 +1176,13 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink)
 
     /*  read and inflate deflate'd file, and push binary down sink
      */
-    HTReadProgress(bytes = 0, 0);
+    HTReadProgress(bytes = 0, (off_t) 0);
     for (;;) {
 	if (s.avail_in == 0) {
 	    s.next_in = (Bytef *) input_buffer;
-	    s.avail_in = (uInt) fread(input_buffer, 1, INPUT_BUFFER_SIZE, zzfp);
+	    s.avail_in = (uInt) fread(input_buffer,
+				      (size_t) 1,
+				      (size_t) INPUT_BUFFER_SIZE, zzfp);
 	    len = (int) s.avail_in;
 	}
 	status = inflate(&s, flush);
@@ -1185,7 +1191,7 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink)
 	    if (len > 0) {
 		(*targetClass.put_block) (sink, output_buffer, len);
 		bytes += len;
-		HTReadProgress(bytes, -1);
+		HTReadProgress(bytes, (off_t) - 1);
 		HTDisplayPartial();
 	    }
 	    rv = HT_LOADED;
@@ -1214,7 +1220,7 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink)
 
 	    (*targetClass.put_block) (sink, output_buffer, len);
 	    bytes += len;
-	    HTReadProgress(bytes, -1);
+	    HTReadProgress(bytes, (off_t) - 1);
 	    HTDisplayPartial();
 
 	    if (HTCheckForInterrupt()) {
@@ -1256,7 +1262,8 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink)
 static int HTBzFileCopy(BZFILE * bzfp, HTStream *sink)
 {
     HTStreamClass targetClass;
-    int status, bytes;
+    int status;
+    off_t bytes;
     int bzerrnum;
     int rv = HT_OK;
 
@@ -1266,7 +1273,7 @@ static int HTBzFileCopy(BZFILE * bzfp, HTStream *sink)
 
     /*  read and inflate bzip'd file, and push binary down sink
      */
-    HTReadProgress(bytes = 0, 0);
+    HTReadProgress(bytes = 0, (off_t) 0);
     for (;;) {
 	status = BZ2_bzread(bzfp, input_buffer, INPUT_BUFFER_SIZE);
 	if (status <= 0) {	/* EOF or error */
@@ -1288,7 +1295,7 @@ static int HTBzFileCopy(BZFILE * bzfp, HTStream *sink)
 
 	(*targetClass.put_block) (sink, input_buffer, status);
 	bytes += status;
-	HTReadProgress(bytes, -1);
+	HTReadProgress(bytes, (off_t) - 1);
 	HTDisplayPartial();
 
 	if (HTCheckForInterrupt()) {
@@ -1780,9 +1787,9 @@ int HTParseBzFile(HTFormat rep_in,
  *	C representation of a new line.
  */
 
-static void NetToText_put_character(HTStream *me, char net_char)
+static void NetToText_put_character(HTStream *me, int net_char)
 {
-    char c = FROMASCII(net_char);
+    char c = (char) FROMASCII(net_char);
 
     if (me->had_cr) {
 	if (c == LF) {
@@ -1864,7 +1871,7 @@ static HTStream HTBaseStreamInstance;	/* Made static */
  *	There is only one error stream shared by anyone who wants a
  *	generic error returned from all stream methods.
  */
-static void HTErrorStream_put_character(HTStream *me GCC_UNUSED, char c GCC_UNUSED)
+static void HTErrorStream_put_character(HTStream *me GCC_UNUSED, int c GCC_UNUSED)
 {
     LYCancelDownload = TRUE;
 }
diff --git a/WWW/Library/Implementation/HTFormat.h b/WWW/Library/Implementation/HTFormat.h
index c4bc9587..a2c15902 100644
--- a/WWW/Library/Implementation/HTFormat.h
+++ b/WWW/Library/Implementation/HTFormat.h
@@ -1,15 +1,15 @@
-/*                                            HTFormat: The format manager in the WWW Library
-                            MANAGE DIFFERENT DOCUMENT FORMATS
-
-   Here we describe the functions of the HTFormat module which handles conversion between
-   different data representations.  (In MIME parlance, a representation is known as a
-   content-type.  In WWW the term "format" is often used as it is shorter).
-
-   This module is implemented by HTFormat.c.  This hypertext document is used to generate
-   the HTFormat.h include file.  Part of the WWW library.
-
-Preamble
-
+/*
+ * $LynxId: HTFormat.h,v 1.32 2010/09/25 11:42:03 tom Exp $
+ *
+ *                                            HTFormat: The format manager in the WWW Library
+ *                          MANAGE DIFFERENT DOCUMENT FORMATS
+ *
+ * Here we describe the functions of the HTFormat module which handles conversion between
+ * different data representations.  (In MIME parlance, a representation is known as a
+ * content-type.  In WWW the term "format" is often used as it is shorter).
+ *
+ * This module is implemented by HTFormat.c.  This hypertext document is used to generate
+ * the HTFormat.h include file.  Part of the WWW library.
  */
 #ifndef HTFORMAT_H
 #define HTFORMAT_H
@@ -266,9 +266,9 @@ HTSetConversion:   Register a converstion routine
     extern void HTSetConversion(const char *rep_in,
 				const char *rep_out,
 				HTConverter *converter,
-				float quality,
-				float secs,
-				float secs_per_byte,
+				double quality,
+				double secs,
+				double secs_per_byte,
 				long int maxbytes,
 				AcceptMedia media
     );
@@ -326,7 +326,7 @@ HTStackValue: Find the cost of a filter stack
  */
     extern float HTStackValue(HTFormat format_in,
 			      HTFormat rep_out,
-			      float initial_value,
+			      double initial_value,
 			      long int length);
 
 #define NO_VALUE_FOUND  -1e20	/* returned if none found */
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index 993251a4..920263ba 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTGopher.c,v 1.48 2010/09/23 08:32:43 tom Exp $
+ * $LynxId: HTGopher.c,v 1.50 2010/09/25 00:43:55 tom Exp $
  *
  *			GOPHER ACCESS				HTGopher.c
  *			=============
@@ -157,7 +157,7 @@ static void init_acceptable(void)
  */
 static const char hex[17] = "0123456789abcdef";
 
-static char from_hex(char c)
+static char from_hex(int c)
 {
     return (char) ((c >= '0') && (c <= '9') ? c - '0'
 		   : (c >= 'A') && (c <= 'F') ? c - 'A' + 10
@@ -751,19 +751,19 @@ static void interpret_cso_key(const char *key,
 	 */
 	int error = 0;
 
-	if (0 == strncmp(key, "$(FID)", 6)) {
+	if (0 == StrNCmp(key, "$(FID)", 6)) {
 	    sprintf(buf, "%d", fld->id);
-	} else if (0 == strncmp(key, "$(FDESC)", 8)) {
+	} else if (0 == StrNCmp(key, "$(FDESC)", 8)) {
 	    sprintf(buf, "%.2046s", fld->description);
-	} else if (0 == strncmp(key, "$(FDEF)", 7)) {
+	} else if (0 == StrNCmp(key, "$(FDEF)", 7)) {
 	    strcpy(buf, fld->defreturn ? " checked" : "");
-	} else if (0 == strncmp(key, "$(FNDX)", 7)) {
+	} else if (0 == StrNCmp(key, "$(FNDX)", 7)) {
 	    strcpy(buf, fld->indexed ? "*" : "");
-	} else if (0 == strncmp(key, "$(FSIZE)", 8)) {
+	} else if (0 == StrNCmp(key, "$(FSIZE)", 8)) {
 	    sprintf(buf, " size=%d maxlength=%d",
 		    fld->max_size > 55 ? 55 : fld->max_size,
 		    fld->max_size);
-	} else if (0 == strncmp(key, "$(FSIZE2)", 9)) {
+	} else if (0 == StrNCmp(key, "$(FSIZE2)", 9)) {
 	    sprintf(buf, " maxlength=%d", fld->max_size);
 	} else {
 	    error = 1;
@@ -774,7 +774,7 @@ static void interpret_cso_key(const char *key,
 	}
     }
     buf[0] = '\0';
-    if (0 == strncmp(key, "$(NEXTFLD)", 10)) {
+    if (0 == StrNCmp(key, "$(NEXTFLD)", 10)) {
 	if (!ctx->fld)
 	    fld = CSOfields;
 	else
@@ -816,8 +816,8 @@ static void interpret_cso_key(const char *key,
 	}
 	ctx->fld = fld;
 
-    } else if ((0 == strncmp(key, "$(QFIELDS)", 10)) ||
-	       (0 == strncmp(key, "$(RFIELDS)", 10))) {
+    } else if ((0 == StrNCmp(key, "$(QFIELDS)", 10)) ||
+	       (0 == StrNCmp(key, "$(RFIELDS)", 10))) {
 	/*
 	 * Begin iteration sequence.
 	 */
@@ -829,7 +829,7 @@ static void interpret_cso_key(const char *key,
 	if (ctx->public_override)
 	    ctx->field_select++;
 
-    } else if (0 == strncmp(key, "$(NAMEFLD)", 10)) {
+    } else if (0 == StrNCmp(key, "$(NAMEFLD)", 10)) {
 	/*
 	 * Special, locate name field.  Flag lookup so QFIELDS will skip it.
 	 */
@@ -841,9 +841,9 @@ static void interpret_cso_key(const char *key,
 		break;
 	    }
 	ctx->fld = fld;
-    } else if (0 == strncmp(key, "$(HOST)", 7)) {
+    } else if (0 == StrNCmp(key, "$(HOST)", 7)) {
 	strcpy(buf, ctx->host);
-    } else if (0 == strncmp(key, "$(PORT)", 7)) {
+    } else if (0 == StrNCmp(key, "$(PORT)", 7)) {
 	sprintf(buf, "%d", ctx->port);
     } else {
 	/*
@@ -911,7 +911,7 @@ static int parse_cso_field_info(CSOfield_info *blk)
  *	================================================
  */
 static int parse_cso_fields(char *buf,
-			    int size)
+			    size_t size)
 {
     int ich;
     char *p = buf;
@@ -1172,7 +1172,7 @@ static int generate_cso_form(char *host,
 		    for (; ctemplate[i]; i++) {
 			for (line = ctemplate[i]; line[j]; j++) {
 			    if (line[j] == '$')
-				if (0 == strncmp(ctx.seek, &line[j], slen)) {
+				if (0 == StrNCmp(ctx.seek, &line[j], slen)) {
 				    if (j == 0)
 					j = (int) strlen(ctemplate[--i]) - 1;
 				    else
@@ -1340,23 +1340,23 @@ static int generate_cso_report(HTStream *Target)
 			    } else if (*l == '>') {
 				StrAllocCat(buf, "&gt;");
 				l++;
-			    } else if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
-				       strncmp(l, "snews://", 8) &&
-				       strncmp(l, "nntp://", 7) &&
-				       strncmp(l, "snewspost:", 10) &&
-				       strncmp(l, "snewsreply:", 11) &&
-				       strncmp(l, "newspost:", 9) &&
-				       strncmp(l, "newsreply:", 10) &&
-				       strncmp(l, "ftp://", 6) &&
-				       strncmp(l, "file:/", 6) &&
-				       strncmp(l, "finger://", 9) &&
-				       strncmp(l, "http://", 7) &&
-				       strncmp(l, "https://", 8) &&
-				       strncmp(l, "wais://", 7) &&
-				       strncmp(l, STR_MAILTO_URL,
+			    } else if (StrNCmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
+				       StrNCmp(l, "snews://", 8) &&
+				       StrNCmp(l, "nntp://", 7) &&
+				       StrNCmp(l, "snewspost:", 10) &&
+				       StrNCmp(l, "snewsreply:", 11) &&
+				       StrNCmp(l, "newspost:", 9) &&
+				       StrNCmp(l, "newsreply:", 10) &&
+				       StrNCmp(l, "ftp://", 6) &&
+				       StrNCmp(l, "file:/", 6) &&
+				       StrNCmp(l, "finger://", 9) &&
+				       StrNCmp(l, "http://", 7) &&
+				       StrNCmp(l, "https://", 8) &&
+				       StrNCmp(l, "wais://", 7) &&
+				       StrNCmp(l, STR_MAILTO_URL,
 					       LEN_MAILTO_URL) &&
-				       strncmp(l, "cso://", 6) &&
-				       strncmp(l, "gopher://", 9)) {
+				       StrNCmp(l, "cso://", 6) &&
+				       StrNCmp(l, "gopher://", 9)) {
 				HTSprintf(&buf, "%c", *l++);
 			    } else {
 				StrAllocCat(buf, "<a href=\"");
@@ -1385,22 +1385,22 @@ static int generate_cso_report(HTStream *Target)
 			} else if (*l == '>') {
 			    StrAllocCat(buf, "&gt;");
 			    l++;
-			} else if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
-				   strncmp(l, "snews://", 8) &&
-				   strncmp(l, "nntp://", 7) &&
-				   strncmp(l, "snewspost:", 10) &&
-				   strncmp(l, "snewsreply:", 11) &&
-				   strncmp(l, "newspost:", 9) &&
-				   strncmp(l, "newsreply:", 10) &&
-				   strncmp(l, "ftp://", 6) &&
-				   strncmp(l, "file:/", 6) &&
-				   strncmp(l, "finger://", 9) &&
-				   strncmp(l, "http://", 7) &&
-				   strncmp(l, "https://", 8) &&
-				   strncmp(l, "wais://", 7) &&
-				   strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
-				   strncmp(l, "cso://", 6) &&
-				   strncmp(l, "gopher://", 9)) {
+			} else if (StrNCmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
+				   StrNCmp(l, "snews://", 8) &&
+				   StrNCmp(l, "nntp://", 7) &&
+				   StrNCmp(l, "snewspost:", 10) &&
+				   StrNCmp(l, "snewsreply:", 11) &&
+				   StrNCmp(l, "newspost:", 9) &&
+				   StrNCmp(l, "newsreply:", 10) &&
+				   StrNCmp(l, "ftp://", 6) &&
+				   StrNCmp(l, "file:/", 6) &&
+				   StrNCmp(l, "finger://", 9) &&
+				   StrNCmp(l, "http://", 7) &&
+				   StrNCmp(l, "https://", 8) &&
+				   StrNCmp(l, "wais://", 7) &&
+				   StrNCmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
+				   StrNCmp(l, "cso://", 6) &&
+				   StrNCmp(l, "gopher://", 9)) {
 			    HTSprintf(&buf, "%c", *l++);
 			} else {
 			    StrAllocCat(buf, "<a href=\"");
@@ -1626,7 +1626,7 @@ static int HTLoadCSO(const char *arg,
 				break;
 			    }
 			}
-		    } else if (!strncmp(&data[start], "return=", 7)) {
+		    } else if (!StrNCmp(&data[start], "return=", 7)) {
 			if (!strcmp(&data[start + 7], "all")) {
 			    return_type = 1;
 			} else if (!strcmp(&data[start + 7], "selected")) {
@@ -1683,7 +1683,7 @@ static int HTLoadCSO(const char *arg,
     }
     generate_cso_report(Target);
     NETCLOSE(s);
-    (*Target->isa->put_block) (Target, end_form, sizeof(end_form) - 1);
+    (*Target->isa->put_block) (Target, end_form, (int) sizeof(end_form) - 1);
     (*Target->isa->_free) (Target);
     FREE(host);
     free_CSOfields();
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index bbc7e2a6..f55a6cc6 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTMIME.c,v 1.74 2010/09/22 00:42:30 tom Exp $
+ * $LynxId: HTMIME.c,v 1.75 2010/09/24 08:29:24 tom Exp $
  *
  *			MIME Message Parse			HTMIME.c
  *			==================
@@ -405,13 +405,13 @@ static int pumpData(HTStream *me)
 		     * some kind of match.
 		     */
 		    BOOL given_is_8859 =
-		    (BOOL) (!strncmp(cp4, "iso-8859-", 9) &&
+		    (BOOL) (!StrNCmp(cp4, "iso-8859-", 9) &&
 			    isdigit(UCH(cp4[9])));
 		    BOOL given_is_8859like =
 		    (BOOL) (given_is_8859 ||
-			    !strncmp(cp4, "windows-", 8) ||
-			    !strncmp(cp4, "cp12", 4) ||
-			    !strncmp(cp4, "cp-12", 5));
+			    !StrNCmp(cp4, "windows-", 8) ||
+			    !StrNCmp(cp4, "cp12", 4) ||
+			    !StrNCmp(cp4, "cp-12", 5));
 		    BOOL given_and_display_8859like =
 		    (BOOL) (given_is_8859like &&
 			    (strstr(LYchar_set_names[current_char_set],
@@ -1066,8 +1066,7 @@ static int dispatchField(HTStream *me)
  *	the beginning (that are not folded continuation lines) are ignored
  *	as unknown field names.  Fields with empty values are not picked up.
  */
-static void HTMIME_put_character(HTStream *me,
-				 char c)
+static void HTMIME_put_character(HTStream *me, int c)
 {
     /* MUST BE FAST */
     switch (me->state) {
@@ -2016,7 +2015,7 @@ static void HTMIME_put_character(HTStream *me,
       GET_VALUE:
 	if (c != '\n') {	/* Not end of line */
 	    if (me->value_pointer < me->value + VALUE_SIZE - 1) {
-		*me->value_pointer++ = c;
+		*me->value_pointer++ = (char) c;
 		break;
 	    } else {
 		goto value_too_long;
diff --git a/WWW/Library/Implementation/HTMLDTD.c b/WWW/Library/Implementation/HTMLDTD.c
index 78b29c25..833077f2 100644
--- a/WWW/Library/Implementation/HTMLDTD.c
+++ b/WWW/Library/Implementation/HTMLDTD.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTMLDTD.c,v 1.56 2008/09/18 22:29:24 tom Exp $
+ * $LynxId: HTMLDTD.c,v 1.57 2010/09/25 00:30:56 tom Exp $
  *
  *		Our Static DTD for HTML
  *		-----------------------
@@ -236,9 +236,9 @@ void HTSwitchDTD(int new_flag)
 		HTML_ALL_ELEMENTS,
 		(int) sizeof(HTTag)));
     if (new_flag)
-	memcpy(tags, tags_table1, HTML_ALL_ELEMENTS * sizeof(HTTag));
+	MemCpy(tags, tags_table1, HTML_ALL_ELEMENTS * sizeof(HTTag));
     else
-	memcpy(tags, tags_table0, HTML_ALL_ELEMENTS * sizeof(HTTag));
+	MemCpy(tags, tags_table0, HTML_ALL_ELEMENTS * sizeof(HTTag));
 }
 
 HTTag HTTag_unrecognized =
diff --git a/WWW/Library/Implementation/HTMLGen.c b/WWW/Library/Implementation/HTMLGen.c
index 45f8eeef..9fab6f52 100644
--- a/WWW/Library/Implementation/HTMLGen.c
+++ b/WWW/Library/Implementation/HTMLGen.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTMLGen.c,v 1.31 2010/09/22 00:43:23 tom Exp $
+ * $LynxId: HTMLGen.c,v 1.34 2010/09/25 12:38:36 tom Exp $
  *
  *		HTML Generator
  *		==============
@@ -146,15 +146,14 @@ static void do_cstyle_flush(HTStructured * me)
  *	We keep track of all the breaks for when we chop the line
  */
 
-static void allow_break(HTStructured * me, int new_cleanness,
-			BOOL dlbc)
+static void allow_break(HTStructured * me, int new_cleanness, int dlbc)
 {
     if (dlbc && me->write_pointer == me->buffer)
 	dlbc = NO;
     me->line_break[new_cleanness] =
 	dlbc ? me->write_pointer - 1	/* Point to space */
 	: me->write_pointer;	/* point to gap */
-    me->delete_line_break_char[new_cleanness] = dlbc;
+    me->delete_line_break_char[new_cleanness] = (BOOLEAN) dlbc;
     if (new_cleanness >= me->cleanness &&
 	(me->overflowed || me->line_break[new_cleanness] > me->buffer))
 	me->cleanness = new_cleanness;
@@ -173,7 +172,7 @@ static void allow_break(HTStructured * me, int new_cleanness,
  *	   This should make the source files easier to read and modify
  *	by hand, too, though this is not a primary design consideration. TBL
  */
-static void HTMLGen_put_character(HTStructured * me, char c)
+static void HTMLGen_put_character(HTStructured * me, int c)
 {
     if (me->escape_specials && UCH(c) < 32) {
 	if (c == HT_NON_BREAK_SPACE || c == HT_EN_SPACE ||
@@ -201,7 +200,7 @@ static void HTMLGen_put_character(HTStructured * me, char c)
 	}
     }
 
-    *me->write_pointer++ = c;
+    *me->write_pointer++ = (char) c;
 
     if (c == '\n') {
 	HTMLGen_flush(me);
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index c12196c0..ab4a6cb5 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTNews.c,v 1.64 2010/09/22 00:51:25 tom Exp $
+ * $LynxId: HTNews.c,v 1.66 2010/09/25 00:42:40 tom Exp $
  *
  *			NEWS ACCESS				HTNews.c
  *			===========
@@ -173,7 +173,7 @@ static void load_NNTP_AuthInfo(void)
     LYAddPathToHome(fname, sizeof(fname), NEWS_AUTH_FILE);
 
     if ((fp = fopen(fname, "r")) != 0) {
-	while (fgets(buffer, sizeof(buffer), fp) != 0) {
+	while (fgets(buffer, (int) sizeof(buffer), fp) != 0) {
 	    char the_host[LINE_LENGTH + 1];
 	    char the_pass[LINE_LENGTH + 1];
 	    char the_user[LINE_LENGTH + 1];
@@ -256,7 +256,7 @@ static BOOL initialize(void)
 	if (fp) {
 	    char server_name[MAXHOSTNAMELEN + 1];
 
-	    if (fgets(server_name, sizeof server_name, fp) != NULL) {
+	    if (fgets(server_name, (int) sizeof server_name, fp) != NULL) {
 		char *p = strchr(server_name, '\n');
 
 		if (p != NULL)
@@ -774,7 +774,7 @@ static void write_anchor(const char *text, const char *addr)
 	q = href;
 	strcpy(q, NewsHREF);
 	/* Make complete hypertext reference */
-	strncat(q, addr, (size_t) (p - addr));
+	StrNCat(q, addr, (size_t) (p - addr));
     } else {
 	q = NULL;
 	HTSprintf0(&q, "%s%.*s", NewsHREF, (int) (p - addr), addr);
@@ -905,7 +905,7 @@ static void post_article(char *postfile)
      */
     buf[0] = '\0';
     sprintf(crlf, "%c%c", CR, LF);
-    while (fgets(line, sizeof(line) - 2, fd) != NULL) {
+    while (fgets(line, (int) sizeof(line) - 2, fd) != NULL) {
 	if ((cp = strchr(line, '\n')) != NULL)
 	    *cp = '\0';
 	if (line[0] == '.') {
@@ -1458,22 +1458,22 @@ static int read_article(HTParentAnchor *thisanchor)
 			    p2 += 7;
 			    *p2 = 0;
 			    while (*l) {
-				if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
-				    strncmp(l, "snews://", 8) &&
-				    strncmp(l, "nntp://", 7) &&
-				    strncmp(l, "snewspost:", 10) &&
-				    strncmp(l, "snewsreply:", 11) &&
-				    strncmp(l, "newspost:", 9) &&
-				    strncmp(l, "newsreply:", 10) &&
-				    strncmp(l, "ftp://", 6) &&
-				    strncmp(l, "file:/", 6) &&
-				    strncmp(l, "finger://", 9) &&
-				    strncmp(l, "http://", 7) &&
-				    strncmp(l, "https://", 8) &&
-				    strncmp(l, "wais://", 7) &&
-				    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
-				    strncmp(l, "cso://", 6) &&
-				    strncmp(l, "gopher://", 9)) {
+				if (StrNCmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
+				    StrNCmp(l, "snews://", 8) &&
+				    StrNCmp(l, "nntp://", 7) &&
+				    StrNCmp(l, "snewspost:", 10) &&
+				    StrNCmp(l, "snewsreply:", 11) &&
+				    StrNCmp(l, "newspost:", 9) &&
+				    StrNCmp(l, "newsreply:", 10) &&
+				    StrNCmp(l, "ftp://", 6) &&
+				    StrNCmp(l, "file:/", 6) &&
+				    StrNCmp(l, "finger://", 9) &&
+				    StrNCmp(l, "http://", 7) &&
+				    StrNCmp(l, "https://", 8) &&
+				    StrNCmp(l, "wais://", 7) &&
+				    StrNCmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
+				    StrNCmp(l, "cso://", 6) &&
+				    StrNCmp(l, "gopher://", 9)) {
 				    PUTC(*l++);
 				} else {
 				    StrAllocCopy(href, l);
@@ -1497,22 +1497,22 @@ static int read_article(HTParentAnchor *thisanchor)
 			}
 		    }
 		    while (*l) {	/* Last bit of the line */
-			if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
-			    strncmp(l, "snews://", 8) &&
-			    strncmp(l, "nntp://", 7) &&
-			    strncmp(l, "snewspost:", 10) &&
-			    strncmp(l, "snewsreply:", 11) &&
-			    strncmp(l, "newspost:", 9) &&
-			    strncmp(l, "newsreply:", 10) &&
-			    strncmp(l, "ftp://", 6) &&
-			    strncmp(l, "file:/", 6) &&
-			    strncmp(l, "finger://", 9) &&
-			    strncmp(l, "http://", 7) &&
-			    strncmp(l, "https://", 8) &&
-			    strncmp(l, "wais://", 7) &&
-			    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
-			    strncmp(l, "cso://", 6) &&
-			    strncmp(l, "gopher://", 9))
+			if (StrNCmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
+			    StrNCmp(l, "snews://", 8) &&
+			    StrNCmp(l, "nntp://", 7) &&
+			    StrNCmp(l, "snewspost:", 10) &&
+			    StrNCmp(l, "snewsreply:", 11) &&
+			    StrNCmp(l, "newspost:", 9) &&
+			    StrNCmp(l, "newsreply:", 10) &&
+			    StrNCmp(l, "ftp://", 6) &&
+			    StrNCmp(l, "file:/", 6) &&
+			    StrNCmp(l, "finger://", 9) &&
+			    StrNCmp(l, "http://", 7) &&
+			    StrNCmp(l, "https://", 8) &&
+			    StrNCmp(l, "wais://", 7) &&
+			    StrNCmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
+			    StrNCmp(l, "cso://", 6) &&
+			    StrNCmp(l, "gopher://", 9))
 			    PUTC(*l++);
 			else {
 			    StrAllocCopy(href, l);
@@ -2060,7 +2060,7 @@ static int read_group(const char *groupName,
 		START(HTML_LI);
 		START(HTML_I);
 		if (LYListNewsNumbers)
-		    LYstrncpy(buffer, "Status:", sizeof(buffer) - 1);
+		    LYStrNCpy(buffer, "Status:", sizeof(buffer) - 1);
 		else
 		    sprintf(buffer, "Status (ARTICLE %d):", art);
 		PUTS(buffer);
@@ -2191,8 +2191,8 @@ static int HTLoadNews(const char *arg,
 	 * xxxxx                   News group (no "@")
 	 * group/n1-n2             Articles n1 to n2 in group
 	 */
-	normal_url = (BOOL) (!strncmp(arg, STR_NEWS_URL, LEN_NEWS_URL) ||
-			     !strncmp(arg, "nntp:", 5));
+	normal_url = (BOOL) (!StrNCmp(arg, STR_NEWS_URL, LEN_NEWS_URL) ||
+			     !StrNCmp(arg, "nntp:", 5));
 	spost_wanted = (BOOL) (!normal_url && strstr(arg, "snewspost:") != NULL);
 	sreply_wanted = (BOOL) (!(normal_url || spost_wanted) &&
 				strstr(arg, "snewsreply:") != NULL);
@@ -2276,7 +2276,7 @@ static int HTLoadNews(const char *arg,
 		 (!strcmp((arg + 5), "/") ||
 		  !strcmp((arg + 5), "//") ||
 		  !strcmp((arg + 5), "///"))) ||
-		((!strncmp((arg + 5), "//", 2)) &&
+		((!StrNCmp((arg + 5), "//", 2)) &&
 		 (!(cp = strchr((arg + 7), '/')) || *(cp + 1) == '\0'))) {
 		p1 = "*";
 		group_wanted = FALSE;
@@ -2310,7 +2310,7 @@ static int HTLoadNews(const char *arg,
 		 (!strcmp((arg + 6), "/") ||
 		  !strcmp((arg + 6), "//") ||
 		  !strcmp((arg + 6), "///"))) ||
-		((!strncmp((arg + 6), "//", 2)) &&
+		((!StrNCmp((arg + 6), "//", 2)) &&
 		 (!(cp = strchr((arg + 8), '/')) || *(cp + 1) == '\0'))) {
 		p1 = "*";
 		group_wanted = FALSE;
@@ -2462,7 +2462,7 @@ static int HTLoadNews(const char *arg,
 		    HTAlert(URL_TOO_LONG);
 		    return -400;
 		}
-		LYstrncpy(groupName, p1, sizeof(groupName) - 1);
+		LYStrNCpy(groupName, p1, sizeof(groupName) - 1);
 		*slash = '/';
 		(void) sscanf(slash + 1, "%d-%d", &first, &last);
 		if ((first > 0) && (isdigit(UCH(*(slash + 1)))) &&
@@ -2483,7 +2483,7 @@ static int HTLoadNews(const char *arg,
 		    HTAlert(URL_TOO_LONG);
 		    return -400;
 		}
-		LYstrncpy(groupName, p1, sizeof(groupName) - 1);
+		LYStrNCpy(groupName, p1, sizeof(groupName) - 1);
 	    }
 	    SnipIn(command, "GROUP %.*s", 9, groupName);
 	} else {
@@ -2527,7 +2527,7 @@ static int HTLoadNews(const char *arg,
     if (!(post_wanted || reply_wanted || spost_wanted || sreply_wanted ||
 	  (group_wanted && last != -1) || list_wanted)) {
 	head_wanted = anAnchor->isHEAD;
-	if (head_wanted && !strncmp(command, "ARTICLE ", 8)) {
+	if (head_wanted && !StrNCmp(command, "ARTICLE ", 8)) {
 	    /* overwrite "ARTICLE" - hack... */
 	    strcpy(command, "HEAD ");
 	    for (cp = command + 5;; cp++)
@@ -2580,9 +2580,9 @@ static int HTLoadNews(const char *arg,
 
 #ifdef USE_SSL
 	    if (!using_proxy &&
-		(!strncmp(arg, STR_SNEWS_URL, 6) ||
-		 !strncmp(arg, "snewspost:", 10) ||
-		 !strncmp(arg, "snewsreply:", 11)))
+		(!StrNCmp(arg, STR_SNEWS_URL, 6) ||
+		 !StrNCmp(arg, "snewspost:", 10) ||
+		 !StrNCmp(arg, "snewsreply:", 11)))
 		status = HTDoConnect(url, "NNTPS", SNEWS_PORT, &s);
 	    else
 		status = HTDoConnect(url, "NNTP", NEWS_PORT, &s);
@@ -2647,9 +2647,9 @@ static int HTLoadNews(const char *arg,
 		 * If this is an snews url, then do the SSL stuff here
 		 */
 		if (!using_proxy &&
-		    (!strncmp(url, "snews", 5) ||
-		     !strncmp(url, "snewspost:", 10) ||
-		     !strncmp(url, "snewsreply:", 11))) {
+		    (!StrNCmp(url, "snews", 5) ||
+		     !StrNCmp(url, "snewspost:", 10) ||
+		     !StrNCmp(url, "snewsreply:", 11))) {
 		    Handle = HTGetSSLHandle();
 		    SSL_set_fd(Handle, s);
 		    HTSSLInitPRNG();
@@ -2786,7 +2786,7 @@ static int HTLoadNews(const char *arg,
 	    }
 	    if (postfile == NULL) {
 		postfile = LYNewsPost(ListArg,
-				      (BOOLEAN) (reply_wanted || sreply_wanted));
+				      (reply_wanted || sreply_wanted));
 	    }
 	    if (postfile == NULL) {
 		HTProgress(CANCELLED);
@@ -2860,14 +2860,14 @@ static int HTLoadNews(const char *arg,
 	 * anything else when automatically retried.  - kw
 	 */
 	if (status == 411 && group_wanted &&
-	    !strncmp(command, "GROUP ", 6) &&
+	    !StrNCmp(command, "GROUP ", 6) &&
 	    !strncasecomp(response_text + 3, " No such group ", 15) &&
 	    !strcmp(response_text + 18, groupName)) {
 
 	    HTAlert(response_text);
 	    break;
 	} else if (status == 430 && !group_wanted && !list_wanted &&
-		   !strncmp(command, "ARTICLE <", 9) &&
+		   !StrNCmp(command, "ARTICLE <", 9) &&
 		   !strcasecomp(response_text + 3, " No such article")) {
 
 	    HTAlert(response_text);
@@ -2877,7 +2877,7 @@ static int HTLoadNews(const char *arg,
 	    status != 340 &&
 	    status != 480) {
 	    if (retries) {
-		if (list_wanted && !strncmp(command, "XGTITLE", 7)) {
+		if (list_wanted && !StrNCmp(command, "XGTITLE", 7)) {
 		    sprintf(command, "LIST NEWSGROUPS%c%c", CR, LF);
 		    goto Send_NNTP_command;
 		}
@@ -2903,7 +2903,7 @@ static int HTLoadNews(const char *arg,
 	    /*
 	     * Some servers return 480 for a failed XGTITLE.  - FM
 	     */
-	    if (list_wanted && !strncmp(command, "XGTITLE", 7) &&
+	    if (list_wanted && !StrNCmp(command, "XGTITLE", 7) &&
 		strstr(response_text, "uthenticat") == NULL &&
 		strstr(response_text, "uthor") == NULL) {
 		sprintf(command, "LIST NEWSGROUPS%c%c", CR, LF);
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c
index 60a9ec19..402a9b79 100644
--- a/WWW/Library/Implementation/HTParse.c
+++ b/WWW/Library/Implementation/HTParse.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTParse.c,v 1.63 2010/09/22 00:50:56 tom Exp $
+ * $LynxId: HTParse.c,v 1.67 2010/09/25 13:55:42 tom Exp $
  *
  *		Parse HyperText Document Address		HTParse.c
  *		================================
@@ -386,7 +386,7 @@ char *HTParse(const char *aName,
     /*
      * Make working copy of the input string to cut up.
      */
-    memcpy(name, aName, len1);
+    MemCpy(name, aName, len1);
 
     /*
      * Cut up the string into URL fields.
@@ -408,7 +408,7 @@ char *HTParse(const char *aName,
 	related.search = NULL;
 	related.anchor = NULL;
     } else {
-	memcpy(rel, relatedName, len2);
+	MemCpy(rel, relatedName, len2);
 	scan(rel, &related);
     }
     SHOW_PARTS(related);
@@ -851,8 +851,8 @@ void HTSimplify(char *filename)
 			 */
 			;
 		    if ((q[0] == '/') &&
-			(strncmp(q, "/../", 4) &&
-			 strncmp(q, "/..?", 4)) &&
+			(StrNCmp(q, "/../", 4) &&
+			 StrNCmp(q, "/..?", 4)) &&
 			!((q - 1) > filename && q[-1] == '/')) {
 			/*
 			 * Not at beginning of string or in a host field, so
@@ -924,7 +924,7 @@ void HTSimplify(char *filename)
 			return;
 		    q++;
 		}
-		if (strncmp(q, "../", 3) && strncmp(q, "./", 2)) {
+		if (StrNCmp(q, "../", 3) && StrNCmp(q, "./", 2)) {
 		    /*
 		     * Not after "//" at beginning of string or after "://",
 		     * and xxx is not ".." or ".", so remove the "xxx/..".
@@ -1014,7 +1014,7 @@ char *HTRelative(const char *aName,
 }
 
 #define AlloCopy(next,base,extra) \
-	typecallocn(char, (unsigned) ((next - base) + ((int) extra)))
+	typecallocn(char, ((next - base) + ((int) extra)))
 
 /*	Escape undesirable characters using %			HTEscape()
  *	-------------------------------------
@@ -1047,12 +1047,12 @@ static const char *hex = "0123456789ABCDEF";
 #define ACCEPTABLE(a)	( a>=32 && a<128 && ((isAcceptable[a-32]) & mask))
 
 char *HTEscape(const char *str,
-	       unsigned char mask)
+	       unsigned mask)
 {
     const char *p;
     char *q;
     char *result;
-    unsigned unacceptable = 0;
+    size_t unacceptable = 0;
 
     for (p = str; *p; p++)
 	if (!ACCEPTABLE(UCH(TOASCII(*p))))
@@ -1095,7 +1095,7 @@ char *HTEscapeUnsafe(const char *str)
     const char *p;
     char *q;
     char *result;
-    unsigned unacceptable = 0;
+    size_t unacceptable = 0;
 
     for (p = str; *p; p++)
 	if (UNSAFE(UCH(TOASCII(*p))))
@@ -1133,12 +1133,12 @@ char *HTEscapeUnsafe(const char *str)
  *	Unlike HTUnEscape(), this routine returns a calloced string.
  */
 char *HTEscapeSP(const char *str,
-		 unsigned char mask)
+		 unsigned mask)
 {
     const char *p;
     char *q;
     char *result;
-    unsigned unacceptable = 0;
+    size_t unacceptable = 0;
 
     for (p = str; *p; p++)
 	if (!(*p == ' ' || ACCEPTABLE(UCH(TOASCII(*p)))))
@@ -1175,7 +1175,7 @@ char *HTEscapeSP(const char *str,
  *	the ASCII hex code for character 16x+y.
  *	The string is converted in place, as it will never grow.
  */
-static char from_hex(char c)
+static char from_hex(int c)
 {
     return (char) (c >= '0' && c <= '9' ? c - '0'
 		   : c >= 'A' && c <= 'F' ? c - 'A' + 10
diff --git a/WWW/Library/Implementation/HTParse.h b/WWW/Library/Implementation/HTParse.h
index b6c368fe..3f427c41 100644
--- a/WWW/Library/Implementation/HTParse.h
+++ b/WWW/Library/Implementation/HTParse.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTParse.h,v 1.19 2008/12/14 15:31:47 tom Exp $
+ * $LynxId: HTParse.h,v 1.21 2010/09/24 22:45:23 tom Exp $
  *				HTParse:  URL parsing in the WWW Library
  *				HTPARSE
  *
@@ -139,7 +139,7 @@ extern "C" {
  *	Unlike HTUnEscape(), this routine returns a malloc'd string.
  */
     extern char *HTEscape(const char *str,
-			  unsigned char mask);
+			  unsigned mask);
 
 /*		Escape unsafe characters using %		HTEscapeUnsafe()
  *		--------------------------------
@@ -165,7 +165,7 @@ extern "C" {
  *	Unlike HTUnEscape(), this routine returns a malloc'd string.
  */
     extern char *HTEscapeSP(const char *str,
-			    unsigned char mask);
+			    unsigned mask);
 
 /*	Decode %xx escaped characters.				HTUnEscape()
  *	------------------------------
diff --git a/WWW/Library/Implementation/HTPlain.c b/WWW/Library/Implementation/HTPlain.c
index ef79695a..ff8b2bfb 100644
--- a/WWW/Library/Implementation/HTPlain.c
+++ b/WWW/Library/Implementation/HTPlain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTPlain.c,v 1.46 2010/04/30 08:28:48 tom Exp $
+ * $LynxId: HTPlain.c,v 1.48 2010/09/25 12:38:08 tom Exp $
  *
  *		Plain text object		HTWrite.c
  *		=================
@@ -106,7 +106,7 @@ static void HTPlain_write(HTStream *me, const char *s,
 /*	Character handling
  *	------------------
  */
-static void HTPlain_put_character(HTStream *me, char c)
+static void HTPlain_put_character(HTStream *me, int c)
 {
 #ifdef REMOVE_CR_ONLY
     /*
@@ -127,17 +127,23 @@ static void HTPlain_put_character(HTStream *me, char c)
 	return;
     }
     if (c == '\b' || c == '_' || HTPlain_bs_pending) {
-	HTPlain_write(me, &c, 1);
+	char temp[1];
+
+	temp[0] = (char) c;
+	HTPlain_write(me, temp, 1);
 	return;
     }
     HTPlain_lastraw = UCH(c);
     if (c == '\r') {
 	HText_appendCharacter(me->text, '\n');
     } else if (TOASCII(UCH(c)) >= 127) {	/* S/390 -- gil -- 0305 */
+	char temp[1];
+
+	temp[0] = (char) c;
 	/*
 	 * For now, don't repeat everything here that has been done below - KW
 	 */
-	HTPlain_write(me, &c, 1);
+	HTPlain_write(me, temp, 1);
     } else if (IS_CJK_TTY) {
 	HText_appendCharacter(me->text, c);
     } else if (TOASCII(UCH(c)) >= 127 && TOASCII(UCH(c)) < 161 &&
@@ -536,8 +542,9 @@ static void HTPlain_write(HTStream *me, const char *s, int l)
 		   (uck = UCTransUniChar(code,
 					 me->outUCLYhndl)) >= ' ' &&	/* S/390 -- gil -- 0464 */
 		   uck < 256) {
-	    CTRACE((tfp, "UCTransUniChar returned 0x%.2lX:'%c'.\n",
-		    uck, FROMASCII((char) uck)));
+	    CTRACE((tfp, "UCTransUniChar returned 0x%.2" PRI_UCode_t
+		    ":'%c'.\n",
+		    uck, FROMASCII(UCH(uck))));
 	    HText_appendCharacter(me->text, ((char) (uck & 0xff)));
 	} else if (chk &&
 		   (uck == -4 ||
diff --git a/WWW/Library/Implementation/HTStream.h b/WWW/Library/Implementation/HTStream.h
index 7a6d79ff..9aca42e0 100644
--- a/WWW/Library/Implementation/HTStream.h
+++ b/WWW/Library/Implementation/HTStream.h
@@ -1,4 +1,7 @@
-/*                                                      The Stream class definition -- libwww
+/*
+ * $LynxId: HTStream.h,v 1.15 2010/09/25 11:42:48 tom Exp $
+ *
+ *                                                      The Stream class definition -- libwww
                                  STREAM OBJECT DEFINITION
 
    A Stream object is something which accepts a stream of text.
@@ -36,7 +39,7 @@ extern "C" {
 
 	void (*_abort) (HTStream *me, HTError e);
 
-	void (*put_character) (HTStream *me, char ch);
+	void (*put_character) (HTStream *me, int ch);
 
 	void (*put_string) (HTStream *me, const char *str);
 
diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c
index 426608bb..c3ee43c2 100644
--- a/WWW/Library/Implementation/HTString.c
+++ b/WWW/Library/Implementation/HTString.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTString.c,v 1.62 2010/06/17 21:33:51 tom Exp $
+ * $LynxId: HTString.c,v 1.64 2010/09/25 11:32:30 tom Exp $
  *
  *	Case-independent string comparison		HTString.c
  *
@@ -307,7 +307,7 @@ char *HTSACopy(char **dest,
 	    if (*dest == NULL)
 		outofmem(__FILE__, "HTSACopy");
 	    assert(*dest != NULL);
-	    memcpy(*dest, src, size);
+	    MemCpy(*dest, src, size);
 	}
     } else {
 	FREE(*dest);
@@ -371,7 +371,7 @@ char *HTSACopy_extra(char **dest,
 	    *(EXTRA_TYPE *) (*dest) = size;
 	    *dest += EXTRA_SIZE;
 	}
-	memcpy(*dest, src, srcsize);
+	MemCpy(*dest, src, srcsize);
     } else {
 	Clear_extra(*dest);
     }
@@ -936,7 +936,7 @@ char *HTSprintf0(char **pstr, const char *fmt,...)
 
     LYva_start(ap, fmt);
     {
-	result = StrAllocVsprintf(pstr, 0, fmt, &ap);
+	result = StrAllocVsprintf(pstr, (size_t) 0, fmt, &ap);
     }
     va_end(ap);
 
@@ -1210,12 +1210,12 @@ void HTSABCopy(bstring **dest, const char *src,
 
 	assert(t != NULL);
 
-	if ((t->str = (char *) malloc(need)) == NULL)
-	    outofmem(__FILE__, "HTSABCopy");
+	if ((t->str = typeMallocn(char, need)) == NULL)
+	      outofmem(__FILE__, "HTSABCopy");
 
 	assert(t->str != NULL);
 
-	memcpy(t->str, src, (size_t) len);
+	MemCpy(t->str, src, len);
 	t->len = len;
 	t->str[t->len] = '\0';
 	*dest = t;
@@ -1257,21 +1257,21 @@ void HTSABCat(bstring **dest, const char *src,
 	if (t) {
 	    unsigned length = (unsigned) t->len + need;
 
-	    t->str = (char *) realloc(t->str, length);
+	    t->str = typeRealloc(char, t->str, length);
 	} else {
 	    if ((t = typecalloc(bstring)) == NULL)
 		  outofmem(__FILE__, "HTSACat");
 
 	    assert(t != NULL);
 
-	    t->str = (char *) malloc(need);
+	    t->str = typeMallocn(char, need);
 	}
 	if (t->str == NULL)
 	    outofmem(__FILE__, "HTSACat");
 
 	assert(t->str != NULL);
 
-	memcpy(t->str + t->len, src, (size_t) len);
+	MemCpy(t->str + t->len, src, len);
 	t->len += len;
 	t->str[t->len] = '\0';
 	*dest = t;
@@ -1301,7 +1301,7 @@ BOOL HTSABEql(bstring *a, bstring *b)
 
     if (len_a == len_b) {
 	if (len_a == 0
-	    || memcmp(a->str, b->str, (size_t) a->len) == 0)
+	    || MemCmp(a->str, b->str, a->len) == 0)
 	    return TRUE;
     }
     return FALSE;
@@ -1331,7 +1331,7 @@ bstring *HTBprintf(bstring **pstr, const char *fmt,...)
 
     LYva_start(ap, fmt);
     {
-	temp = StrAllocVsprintf(&temp, 0, fmt, &ap);
+	temp = StrAllocVsprintf(&temp, (size_t) 0, fmt, &ap);
 	if (non_empty(temp)) {
 	    HTSABCat(pstr, temp, (int) strlen(temp));
 	}
diff --git a/WWW/Library/Implementation/HTString.h b/WWW/Library/Implementation/HTString.h
index 09dfdbc4..37c668f6 100644
--- a/WWW/Library/Implementation/HTString.h
+++ b/WWW/Library/Implementation/HTString.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTString.h,v 1.31 2009/03/17 22:25:50 tom Exp $
+ * $LynxId: HTString.h,v 1.34 2010/09/25 00:32:47 tom Exp $
  *						String handling for libwww
  *                                         STRINGS
  *                                            
@@ -28,11 +28,18 @@ extern "C" {
 
 #else
 #define AS_casecomp( a, b ) ( strcasecomp( ( a ), ( b ) ) )
-#define AS_ncmp( a, b, c )  ( strncmp( ( a ), ( b ), ( c ) ) )
+#define AS_ncmp( a, b, c )  ( StrNCmp( ( a ), ( b ), ( c ) ) )
 #define AS_cmp strcmp
 
 #endif				/* NOT_ASCII */
 
+#define StrNCat(a,b,c) strncat((a),(b),(size_t)(c))
+#define StrNCpy(a,b,c) strncpy((a),(b),(size_t)(c))
+#define StrNCmp(a,b,c) strncmp((a),(b),(size_t)(c))
+
+#define MemCpy(a,b,c)  memcpy((a),(b),(size_t)(c))
+#define MemCmp(a,b,c)  memcmp((a),(b),(size_t)(c))
+
     /*
      * Case-insensitive string comparison
      *
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index a8f5611d..ec456175 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTCP.c,v 1.102 2010/09/22 00:40:25 tom Exp $
+ * $LynxId: HTTCP.c,v 1.104 2010/09/25 11:32:53 tom Exp $
  *
  *			Generic Communication Code		HTTCP.c
  *			==========================
@@ -285,7 +285,9 @@ const char *HTInetString(SockA * soc_in)
 
     getnameinfo((struct sockaddr *) soc_in,
 		SOCKADDR_LEN(soc_in),
-		hostbuf, sizeof(hostbuf), NULL, 0, NI_NUMERICHOST);
+		hostbuf, (socklen_t) sizeof(hostbuf),
+		NULL, 0,
+		NI_NUMERICHOST);
     return hostbuf;
 #else
     static char string[20];
@@ -526,7 +528,7 @@ static size_t fill_rehostent(char *rehostent,
 	for (pcnt = phost->h_addr_list, i_addr = 0;
 	     i_addr < num_addrs;
 	     pcnt++, i_addr++) {
-	    memcpy(p_next_char, *pcnt, sizeof(phost->h_addr_list[0]));
+	    MemCpy(p_next_char, *pcnt, sizeof(phost->h_addr_list[0]));
 	    *p_next_charptr++ = p_next_char;
 	    p_next_char += sizeof(phost->h_addr_list[0]);
 	}
@@ -601,7 +603,9 @@ static unsigned long __stdcall _fork_func(void *arg)
 #endif
 
     if (gbl_phost) {
-	rehostentlen = fill_rehostent(rehostent, REHOSTENT_SIZE, gbl_phost);
+	rehostentlen = fill_rehostent(rehostent,
+				      (size_t) REHOSTENT_SIZE,
+				      gbl_phost);
 	if (rehostentlen == 0) {
 	    gbl_phost = (LYNX_HOSTENT *) NULL;
 	} else {
@@ -896,7 +900,9 @@ LYNX_HOSTENT *LYGetHostByName(char *str)
 	    dump_hostent("CHILD gethostbyname", phost);
 #endif
 	    if (OK_HOST(phost)) {
-		rehostentlen = fill_rehostent(rehostent, REHOSTENT_SIZE, phost);
+		rehostentlen = fill_rehostent(rehostent,
+					      (size_t) REHOSTENT_SIZE,
+					      phost);
 #ifdef DEBUG_HOSTENT_CHILD
 		dump_hostent("CHILD fill_rehostent", (LYNX_HOSTENT *) rehostent);
 #endif
@@ -1290,7 +1296,7 @@ static int HTParseInet(SockA * soc_in, const char *str)
      * probably worth waiting until the Phase transition from IV to V.
      */
     soc_in->sdn_nam.n_len = min(DN_MAXNAML, strlen(host));	/* <=6 in phase 4 */
-    strncpy(soc_in->sdn_nam.n_name, host, soc_in->sdn_nam.n_len + 1);
+    StrNCpy(soc_in->sdn_nam.n_name, host, soc_in->sdn_nam.n_len + 1);
     CTRACE((tfp,
 	    "DECnet: Parsed address as object number %d on host %.6s...\n",
 	    soc_in->sdn_objnum, host));
@@ -1344,7 +1350,7 @@ static int HTParseInet(SockA * soc_in, const char *str)
 	gbl_phost = LYGetHostByName(host);	/* See above */
 	if (!gbl_phost)
 	    goto failed;
-	memcpy((void *) &soc_in->sin_addr, gbl_phost->h_addr_list[0], gbl_phost->h_length);
+	MemCpy((void *) &soc_in->sin_addr, gbl_phost->h_addr_list[0], gbl_phost->h_length);
 #else /* !_WINDOWS_NSL */
 	{
 	    LYNX_HOSTENT *phost;
@@ -1358,7 +1364,7 @@ static int HTParseInet(SockA * soc_in, const char *str)
 	    if (phost->h_length != sizeof soc_in->sin_addr) {
 		HTAlwaysAlert(host, gettext("Address length looks invalid"));
 	    }
-	    memcpy((void *) &soc_in->sin_addr, phost->h_addr_list[0], phost->h_length);
+	    MemCpy((void *) &soc_in->sin_addr, phost->h_addr_list[0], phost->h_length);
 	}
 #endif /* _WINDOWS_NSL */
 
@@ -1505,7 +1511,7 @@ static void get_host_details(void)
 	return;			/* Fail! */
     }
     StrAllocCopy(hostname, res->ai_canonname);
-    memcpy(&HTHostAddress, res->ai_addr, res->ai_addrlen);
+    MemCpy(&HTHostAddress, res->ai_addr, res->ai_addrlen);
     freeaddrinfo(res);
 #else
     phost = gethostbyname(name);	/* See netdb.h */
@@ -1516,7 +1522,7 @@ static void get_host_details(void)
 	return;			/* Fail! */
     }
     StrAllocCopy(hostname, phost->h_name);
-    memcpy(&HTHostAddress, &phost->h_addr_list[0], phost->h_length);
+    MemCpy(&HTHostAddress, &phost->h_addr_list[0], phost->h_length);
 #endif /* INET6 */
     CTRACE((tfp, "     Name server says that I am `%s' = %s\n",
 	    hostname, HTInetString(&HTHostAddress)));
@@ -1666,7 +1672,8 @@ int HTDoConnect(const char *url,
 	    char hostbuf[1024], portbuf[1024];
 
 	    getnameinfo(res->ai_addr, res->ai_addrlen,
-			hostbuf, sizeof(hostbuf), portbuf, sizeof(portbuf),
+			hostbuf, (socklen_t) sizeof(hostbuf),
+			portbuf, (socklen_t) sizeof(portbuf),
 			NI_NUMERICHOST | NI_NUMERICSERV);
 	    HTSprintf0(&line,
 		       gettext("socket failed: family %d addr %s port %s."),
@@ -2026,7 +2033,7 @@ int HTDoRead(int fildes,
 	    otries = tries;
 	    if (t - otime >= 5) {
 		otime = t;
-		HTReadProgress(-1, 0);	/* Put "stalled" message */
+		HTReadProgress((off_t) (-1), (off_t) 0);	/* Put "stalled" message */
 	    }
 	}
 #endif
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 35545fd6..ff898adb 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTP.c,v 1.118 2010/09/22 00:35:50 tom Exp $
+ * $LynxId: HTTP.c,v 1.120 2010/09/25 11:31:46 tom Exp $
  *
  * HyperText Tranfer Protocol	- Client implementation		HTTP.c
  * ==========================
@@ -83,7 +83,7 @@ static int HTSSLCallback(int preverify_ok, X509_STORE_CTX * x509_ctx GCC_UNUSED)
 #ifdef USE_X509_SUPPORT
     HTSprintf0(&msg,
 	       gettext("SSL callback:%s, preverify_ok=%d, ssl_okay=%d"),
-	       X509_verify_cert_error_string(X509_STORE_CTX_get_error(x509_ctx)),
+	       X509_verify_cert_error_string((long) X509_STORE_CTX_get_error(x509_ctx)),
 	       preverify_ok, ssl_okay);
     _HTProgress(msg);
     FREE(msg);
@@ -93,7 +93,8 @@ static int HTSSLCallback(int preverify_ok, X509_STORE_CTX * x509_ctx GCC_UNUSED)
     if (!(preverify_ok || ssl_okay || ssl_noprompt)) {
 #ifdef USE_X509_SUPPORT
 	HTSprintf0(&msg, SSL_FORCED_PROMPT,
-		   X509_verify_cert_error_string(X509_STORE_CTX_get_error(x509_ctx)));
+		   X509_verify_cert_error_string((long)
+						 X509_STORE_CTX_get_error(x509_ctx)));
 	if (HTForcedPrompt(ssl_noprompt, msg, YES))
 	    ssl_okay = 1;
 	else
@@ -161,24 +162,24 @@ void HTSSLInitPRNG(void)
 
 	t = time(NULL);
 	pid = getpid();
-	RAND_file_name(rand_file, 256);
+	RAND_file_name(rand_file, 256L);
 	CTRACE((tfp, "HTTP: Seeding PRNG\n"));
 	if (rand_file != NULL) {
 	    /* Seed as much as 1024 bytes from RAND_file_name */
-	    RAND_load_file(rand_file, 1024);
+	    RAND_load_file(rand_file, 1024L);
 	}
 	/* Seed in time (mod_ssl does this) */
-	RAND_seed((unsigned char *) &t, sizeof(time_t));
+	RAND_seed((unsigned char *) &t, (int) sizeof(time_t));
 	/* Seed in pid (mod_ssl does this) */
-	RAND_seed((unsigned char *) &pid, sizeof(pid));
+	RAND_seed((unsigned char *) &pid, (int) sizeof(pid));
 	/* Initialize system's random number generator */
-	RAND_bytes((unsigned char *) &seed, sizeof(long));
+	RAND_bytes((unsigned char *) &seed, (int) sizeof(long));
 
 	lynx_srand((unsigned) seed);
 	while (RAND_status() == 0) {
 	    /* Repeatedly seed the PRNG using the system's random number generator until it has been seeded with enough data */
 	    l = lynx_rand();
-	    RAND_seed((unsigned char *) &l, sizeof(long));
+	    RAND_seed((unsigned char *) &l, (int) sizeof(long));
 	}
 	if (rand_file != NULL) {
 	    /* Write a rand_file */
@@ -450,7 +451,7 @@ static void show_cert_issuer(X509 * peer_cert GCC_UNUSED)
     char ssl_dn[1024];
     char *msg = NULL;
 
-    X509_NAME_oneline(X509_get_issuer_name(peer_cert), ssl_dn, sizeof(ssl_dn));
+    X509_NAME_oneline(X509_get_issuer_name(peer_cert), ssl_dn, (int) sizeof(ssl_dn));
     HTSprintf0(&msg, gettext("Certificate issued by: %s"), ssl_dn);
     _HTProgress(msg);
     FREE(msg);
@@ -512,7 +513,7 @@ static int HTLoadHTTP(const char *arg,
     char *eol;			/* End of line if found */
     char *start_of_data;	/* Start of body of reply */
     int status;			/* tcp return */
-    int bytes_already_read;
+    off_t bytes_already_read;
     char crlf[3];		/* A CR LF equivalent string */
     HTStream *target;		/* Unconverted data */
     HTFormat format_in;		/* Format arriving in the message */
@@ -585,7 +586,7 @@ static int HTLoadHTTP(const char *arg,
 	goto done;
     }
 #ifdef USE_SSL
-    if (using_proxy && !strncmp(url, "http://", 7)) {
+    if (using_proxy && !StrNCmp(url, "http://", 7)) {
 	int portnumber;
 
 	if ((connect_url = strstr((url + 7), "https://"))) {
@@ -632,12 +633,12 @@ static int HTLoadHTTP(const char *arg,
     line_kept_clean = NULL;
 
 #ifdef USE_SSL
-    if (!strncmp(url, "https", 5))
+    if (!StrNCmp(url, "https", 5))
 	status = HTDoConnect(url, "HTTPS", HTTPS_PORT, &s);
     else
 	status = HTDoConnect(url, "HTTP", HTTP_PORT, &s);
 #else
-    if (!strncmp(url, "https", 5)) {
+    if (!StrNCmp(url, "https", 5)) {
 	HTAlert(gettext("This client does not contain support for HTTPS URLs."));
 	status = HT_NOT_LOADED;
 	goto done;
@@ -672,7 +673,7 @@ static int HTLoadHTTP(const char *arg,
     /*
      * If this is an https document, then do the SSL stuff here.
      */
-    if (did_connect || !strncmp(url, "https", 5)) {
+    if (did_connect || !StrNCmp(url, "https", 5)) {
 	SSL_handle = handle = HTGetSSLHandle();
 	SSL_set_fd(handle, s);
 	/* get host we're connecting to */
@@ -769,10 +770,10 @@ static int HTLoadHTTP(const char *arg,
 	peer_cert = SSL_get_peer_certificate(handle);
 #if defined(USE_OPENSSL_INCL) || defined(USE_GNUTLS_FUNCS)
 	X509_NAME_oneline(X509_get_subject_name(peer_cert),
-			  ssl_dn, sizeof(ssl_dn));
+			  ssl_dn, (int) sizeof(ssl_dn));
 #elif defined(USE_GNUTLS_INCL)
 	X509_NAME_oneline(X509_get_subject_name(peer_cert),
-			  ssl_dn + 1, sizeof(ssl_dn) - 1);
+			  ssl_dn + 1, (int) sizeof(ssl_dn) - 1);
 
 	/* Iterate over DN in incompatible GnuTLS format to bring it into OpenSSL format */
 	ssl_dn[0] = '/';
@@ -899,7 +900,7 @@ static int HTLoadHTTP(const char *arg,
 			size_t j = (size_t) ASN1_STRING_length(gn->d.ia5);
 
 			cert_host = (char *) malloc(j + 1);
-			memcpy(cert_host, ASN1_STRING_data(gn->d.ia5), j);
+			MemCpy(cert_host, ASN1_STRING_data(gn->d.ia5), j);
 			cert_host[j] = '\0';
 		    } else
 			continue;
@@ -1213,8 +1214,9 @@ static int HTLoadHTTP(const char *arg,
 	    char *colon;
 	    int portnumber;
 	    char *auth, *cookie = NULL;
-	    BOOL secure = (BOOL) (strncmp(anAnchor->address, "https", 5) ?
-				  FALSE : TRUE);
+	    BOOL secure = (BOOL) (StrNCmp(anAnchor->address, "https", 5)
+				  ? FALSE
+				  : TRUE);
 
 	    abspath = HTParse(arg, "", PARSE_PATH | PARSE_PUNCTUATION);
 	    docname = HTParse(arg, "", PARSE_PATH);
@@ -1222,7 +1224,7 @@ static int HTLoadHTTP(const char *arg,
 	    if (hostname &&
 		NULL != (colon = HTParsePort(hostname, &portnumber))) {
 		*colon = '\0';	/* Chop off port number */
-	    } else if (!strncmp(arg, "https", 5)) {
+	    } else if (!StrNCmp(arg, "https", 5)) {
 		portnumber = HTTPS_PORT;
 	    } else {
 		portnumber = HTTP_PORT;
@@ -1239,7 +1241,7 @@ static int HTLoadHTTP(const char *arg,
 		 * ultimate target of this request.  - FM & AJL
 		 */
 		char *host2 = NULL, *path2 = NULL;
-		int port2 = (strncmp(docname, "https", 5) ?
+		int port2 = (StrNCmp(docname, "https", 5) ?
 			     HTTP_PORT : HTTPS_PORT);
 
 		host2 = HTParse(docname, "", PARSE_HOST);
@@ -1296,7 +1298,7 @@ static int HTLoadHTTP(const char *arg,
 		 * Add 'Cookie:' header, if it's HTTP or HTTPS document being
 		 * proxied.
 		 */
-		if (!strncmp(docname, "http", 4)) {
+		if (!StrNCmp(docname, "http", 4)) {
 		    cookie = LYAddCookieHeader(host2, path2, port2, secure);
 		}
 		FREE(host2);
@@ -1489,12 +1491,12 @@ static int HTLoadHTTP(const char *arg,
 	BOOL end_of_file = NO;
 	int buffer_length = INIT_LINE_SIZE;
 
-	line_buffer = typecallocn(char, (unsigned) buffer_length);
+	line_buffer = typecallocn(char, (size_t) buffer_length);
 
 	if (line_buffer == NULL)
 	    outofmem(__FILE__, "HTLoadHTTP");
 
-	HTReadProgress(bytes_already_read = 0, 0);
+	HTReadProgress(bytes_already_read = 0, (off_t) 0);
 	do {			/* Loop to read in the first line */
 	    /*
 	     * Extend line buffer if necessary for those crazy WAIS URLs ;-)
@@ -1580,7 +1582,7 @@ static int HTLoadHTTP(const char *arg,
 #endif /* NOT_ASCII */
 
 	    bytes_already_read += status;
-	    HTReadProgress(bytes_already_read, 0);
+	    HTReadProgress(bytes_already_read, (off_t) 0);
 
 #ifdef UCX			/* UCX returns -1 on EOF */
 	    if (status == 0 || status == -1)
@@ -1599,7 +1601,7 @@ static int HTLoadHTTP(const char *arg,
 
 		if (line_kept_clean == NULL)
 		    outofmem(__FILE__, "HTLoadHTTP");
-		memcpy(line_kept_clean, line_buffer, (unsigned) buffer_length);
+		MemCpy(line_kept_clean, line_buffer, buffer_length);
 #ifdef SH_EX			/* FIX BUG by kaz@maczuka.hitachi.ibaraki.jp */
 		real_length_of_line = length + status;
 #endif
@@ -1639,9 +1641,9 @@ static int HTLoadHTTP(const char *arg,
      * can't handle the third word, so we try again without it.
      */
     if (extensions &&		/* Old buggy server or Help gateway? */
-	(0 == strncmp(line_buffer, "<TITLE>Bad File Request</TITLE>", 31) ||
-	 0 == strncmp(line_buffer, "Address should begin with", 25) ||
-	 0 == strncmp(line_buffer, "<TITLE>Help ", 12) ||
+	(0 == StrNCmp(line_buffer, "<TITLE>Bad File Request</TITLE>", 31) ||
+	 0 == StrNCmp(line_buffer, "Address should begin with", 25) ||
+	 0 == StrNCmp(line_buffer, "<TITLE>Help ", 12) ||
 	 0 == strcmp(line_buffer,
 		     "Document address invalid or access not authorised"))) {
 	FREE(line_buffer);
@@ -1703,7 +1705,7 @@ static int HTLoadHTTP(const char *arg,
 	     * Treat all plain text as HTML.  This sucks but its the only
 	     * solution without without looking at content.
 	     */
-	    if (!strncmp(HTAtom_name(format_in), "text/plain", 10)) {
+	    if (!StrNCmp(HTAtom_name(format_in), "text/plain", 10)) {
 		CTRACE((tfp, "HTTP: format_in being changed to text/HTML\n"));
 		format_in = WWW_HTML;
 	    }
@@ -1832,7 +1834,7 @@ static int HTLoadHTTP(const char *arg,
 			url = connect_url;
 			FREE(line_buffer);
 			FREE(line_kept_clean);
-			if (!strncmp(connect_url, "snews", 5)) {
+			if (!StrNCmp(connect_url, "snews", 5)) {
 			    CTRACE((tfp,
 				    "      Will attempt handshake and snews connection.\n"));
 			    status = HTNewsProxyConnect(s, url, anAnchor,
@@ -2039,7 +2041,7 @@ static int HTLoadHTTP(const char *arg,
 			FREE(line_buffer);
 			FREE(line_kept_clean);
 #ifdef USE_SSL
-			if (using_proxy && !strncmp(url, "https://", 8)) {
+			if (using_proxy && !StrNCmp(url, "https://", 8)) {
 			    url = arg;
 			    do_connect = TRUE;
 			    did_connect = FALSE;
diff --git a/WWW/Library/Implementation/HTUU.h b/WWW/Library/Implementation/HTUU.h
index 925d1f74..93ba4357 100644
--- a/WWW/Library/Implementation/HTUU.h
+++ b/WWW/Library/Implementation/HTUU.h
@@ -1,4 +1,7 @@
-/*                              ENCODING TO PRINTABLE CHARACTERS
+/*
+ * $LynxId: HTUU.h,v 1.11 2010/09/25 11:43:27 tom Exp $
+ *
+ *                              ENCODING TO PRINTABLE CHARACTERS
 
    File module provides functions HTUU_encode() and HTUU_decode() which convert
    a buffer of bytes to/from RFC 1113 printable encoding format.  This
diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h
index dd562964..ba10b1b3 100644
--- a/WWW/Library/Implementation/HTUtils.h
+++ b/WWW/Library/Implementation/HTUtils.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTUtils.h,v 1.99 2010/09/23 20:34:05 tom Exp $
+ * $LynxId: HTUtils.h,v 1.102 2010/09/25 15:32:56 tom Exp $
  *
  * Utility macros for the W3 code library
  * MACROS FOR GENERAL USE
@@ -329,13 +329,13 @@ Standard C library for malloc() etc
 /* array/table size */
 #define	TABLESIZE(v)	(sizeof(v)/sizeof(v[0]))
 
-#define	typecalloc(cast)		(cast *)calloc(1,sizeof(cast))
-#define	typecallocn(cast,ntypes)	(cast *)calloc(ntypes,sizeof(cast))
+#define	typecalloc(cast)		(cast *)calloc((size_t)1, sizeof(cast))
+#define	typecallocn(cast,ntypes)	(cast *)calloc((size_t)(ntypes),sizeof(cast))
 
-#define typeRealloc(cast,ptr,ntypes)    (cast *)realloc(ptr, (ntypes)*sizeof(cast))
+#define typeRealloc(cast,ptr,ntypes)    (cast *)realloc(ptr, (size_t)(ntypes)*sizeof(cast))
 
 #define typeMalloc(cast)                (cast *)malloc(sizeof(cast))
-#define typeMallocn(cast,ntypes)        (cast *)malloc((ntypes)*sizeof(cast))
+#define typeMallocn(cast,ntypes)        (cast *)malloc((size_t)(ntypes)*sizeof(cast))
 
 /*
 
@@ -618,7 +618,7 @@ extern int WWW_TraceMask;
 /*
  * Printing-format for "UCode_t".
  */
-#define PRI_UCode_t	"ld"
+#define PRI_UCode_t	"lX"
 
 /*
  * Verbose-tracing.
diff --git a/WWW/Library/Implementation/HTVMSUtils.c b/WWW/Library/Implementation/HTVMSUtils.c
index a4657760..85ca863a 100644
--- a/WWW/Library/Implementation/HTVMSUtils.c
+++ b/WWW/Library/Implementation/HTVMSUtils.c
@@ -1,5 +1,7 @@
-
-/* MODULE							HTVMSUtil.c
+/*
+ * $LynxId: HTVMSUtils.c,v 1.37 2010/09/25 11:39:49 tom Exp $
+ *
+ * MODULE							HTVMSUtil.c
  *		VMS Utility Routines
  *
  * AUTHORS:
@@ -350,7 +352,7 @@ int HTStat(const char *filename,
 	if ((Ptr2 == NULL) && (Name[0] == '/')) {
 	    char End[256];
 
-	    LYstrncpy(End, Ptr, sizeof(End) - 1);
+	    LYStrNCpy(End, Ptr, sizeof(End) - 1);
 	    *(Ptr + 1) = '\0';
 	    StrAllocCat(Name, "000000");
 	    StrAllocCat(Name, End);
@@ -465,7 +467,7 @@ static DIR *HTVMSopendir(char *dirname)
 	StrAllocCat(DirEntry, ".dir");
     }
     /* lib$find_file needs a fixed-size buffer */
-    LYstrncpy(Actual, DirEntry, sizeof(Actual) - 1);
+    LYStrNCpy(Actual, DirEntry, sizeof(Actual) - 1);
 
     dir.context = 0;
     dirname_desc.dsc$w_length = strlen(Actual);
@@ -643,7 +645,7 @@ int compare_VMSEntryInfo_structs(VMSEntryInfo * entry1, VMSEntryInfo * entry2)
 		strcpy(date1, (char *) &entry1->date[8]);
 		strcpy(time1, "00:00");
 	    }
-	    strncpy(month, entry1->date, 3);
+	    StrNCpy(month, entry1->date, 3);
 	    month[3] = '\0';
 	    for (i = 0; i < 12; i++) {
 		if (!strcasecomp(month, months[i])) {
@@ -653,7 +655,7 @@ int compare_VMSEntryInfo_structs(VMSEntryInfo * entry1, VMSEntryInfo * entry2)
 	    i++;
 	    sprintf(month, "%02d", i);
 	    strcat(date1, month);
-	    strncat(date1, (char *) &entry1->date[4], 2);
+	    StrNCat(date1, (char *) &entry1->date[4], 2);
 	    date1[8] = '\0';
 	    if (date1[6] == ' ') {
 		date1[6] = '0';
@@ -666,7 +668,7 @@ int compare_VMSEntryInfo_structs(VMSEntryInfo * entry1, VMSEntryInfo * entry2)
 		strcpy(date2, (char *) &entry2->date[8]);
 		strcpy(time2, "00:00");
 	    }
-	    strncpy(month, entry2->date, 3);
+	    StrNCpy(month, entry2->date, 3);
 	    month[3] = '\0';
 	    for (i = 0; i < 12; i++) {
 		if (!strcasecomp(month, months[i])) {
@@ -676,7 +678,7 @@ int compare_VMSEntryInfo_structs(VMSEntryInfo * entry1, VMSEntryInfo * entry2)
 	    i++;
 	    sprintf(month, "%02d", i);
 	    strcat(date2, month);
-	    strncat(date2, (char *) &entry2->date[4], 2);
+	    StrNCat(date2, (char *) &entry2->date[4], 2);
 	    date2[8] = '\0';
 	    if (date2[6] == ' ') {
 		date2[6] = '0';
@@ -749,7 +751,7 @@ int HTVMSBrowseDir(const char *address,
     if (((*pathname != '/') ||
 	 (cp = strchr(pathname + 1, '/')) == NULL ||
 	 *(cp + 1) == '\0' ||
-	 0 == strncmp((cp + 1), "000000", 6)) ||
+	 0 == StrNCmp((cp + 1), "000000", 6)) ||
 	(dp = HTVMSopendir(pathname)) == NULL) {
 	FREE(pathname);
 	return HTLoadError(sink, 403, COULD_NOT_ACCESS_DIR);
@@ -779,7 +781,7 @@ int HTVMSBrowseDir(const char *address,
 	*cp = '\0';
 	if ((cp1 = strrchr(pathname, '/')) != NULL &&
 	    cp1 != pathname &&
-	    strncmp((cp1 + 1), "000000", 6))
+	    StrNCmp((cp1 + 1), "000000", 6))
 	    StrAllocCopy(parent, (cp1 + 1));
 	*cp = '/';
     } else {
@@ -938,9 +940,9 @@ int HTVMSBrowseDir(const char *address,
 	    format = HTFileFormat(dirbuf->d_name, &encoding,
 				  (const char **) &cp);
 	    if (!cp) {
-		if (!strncmp(HTAtom_name(format), "application", 11)) {
+		if (!StrNCmp(HTAtom_name(format), "application", 11)) {
 		    cp = HTAtom_name(format) + 12;
-		    if (!strncmp(cp, "x-", 2))
+		    if (!StrNCmp(cp, "x-", 2))
 			cp += 2;
 		} else
 		    cp = HTAtom_name(format);
@@ -962,12 +964,12 @@ int HTVMSBrowseDir(const char *address,
 		    cp = entry_info->filename;
 		} else {
 		    cp += 4;
-		    if (!strncmp(cp, "ME", 2)) {
+		    if (!StrNCmp(cp, "ME", 2)) {
 			cp += 2;
 			while (cp && *cp && *cp != '.') {
 			    cp++;
 			}
-		    } else if (!strncmp(cp, ".ME", 3)) {
+		    } else if (!StrNCmp(cp, ".ME", 3)) {
 			cp = (entry_info->filename +
 			      strlen(entry_info->filename));
 		    } else {
diff --git a/WWW/Library/Implementation/HTVMS_WaisProt.c b/WWW/Library/Implementation/HTVMS_WaisProt.c
index 23b4a4f8..30feae62 100644
--- a/WWW/Library/Implementation/HTVMS_WaisProt.c
+++ b/WWW/Library/Implementation/HTVMS_WaisProt.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTVMS_WaisProt.c,v 1.8 2010/04/29 23:56:46 tom Exp $
+ * $LynxId: HTVMS_WaisProt.c,v 1.9 2010/09/24 23:51:22 tom Exp $
  *
  *							  HTVMS_WAISProt.c
  *
@@ -2114,8 +2114,8 @@ static query_term **makeWAISQueryTerms(DocObj **docs)
 		    char start[20], end[20];
 
 		    (doc->ChunkCode == CT_byte) ?
-			strncpy(chunk_att, BYTE, ATTRIBUTE_SIZE) :
-			strncpy(chunk_att, LINE, ATTRIBUTE_SIZE);
+			StrNCpy(chunk_att, BYTE, ATTRIBUTE_SIZE) :
+			StrNCpy(chunk_att, LINE, ATTRIBUTE_SIZE);
 		    sprintf(start, "%ld", doc->ChunkStart.Pos);
 		    startChunk = stringToAny(start);
 		    sprintf(end, "%ld", doc->ChunkEnd.Pos);
@@ -2123,7 +2123,7 @@ static query_term **makeWAISQueryTerms(DocObj **docs)
 		}
 		break;
 	    case CT_paragraph:
-		strncpy(chunk_att, PARAGRAPH, ATTRIBUTE_SIZE);
+		StrNCpy(chunk_att, PARAGRAPH, ATTRIBUTE_SIZE);
 		startChunk = doc->ChunkStart.ID;
 		endChunk = doc->ChunkEnd.ID;
 		break;
@@ -2453,13 +2453,13 @@ void writeWAISPacketHeader(char *header,
 	serverLen = 10;
 
     sprintf(lengthBuf, "%010ld", dataLen);
-    strncpy(header, lengthBuf, 10);
+    StrNCpy(header, lengthBuf, 10);
 
     header[10] = type & 0xFF;
     header[11] = version & 0xFF;
 
-    strncpy(serverBuf, server, serverLen);
-    strncpy((char *) (header + 12), serverBuf, serverLen);
+    StrNCpy(serverBuf, server, serverLen);
+    StrNCpy((char *) (header + 12), serverBuf, serverLen);
 
     header[22] = compression & 0xFF;
     header[23] = encoding & 0xFF;
diff --git a/WWW/Library/Implementation/HTVMS_WaisUI.c b/WWW/Library/Implementation/HTVMS_WaisUI.c
index f46b4372..45a38a60 100644
--- a/WWW/Library/Implementation/HTVMS_WaisUI.c
+++ b/WWW/Library/Implementation/HTVMS_WaisUI.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTVMS_WaisUI.c,v 1.15 2008/12/14 18:06:19 tom Exp $
+ * $LynxId: HTVMS_WaisUI.c,v 1.16 2010/09/25 00:32:18 tom Exp $
  *								HTVMS_WAISUI.c
  *
  *	Adaptation for Lynx by F.Macrides (macrides@sci.wfeb.edu)
@@ -243,7 +243,7 @@ static long transport_message(long connection,
     {
 	char length_array[11];
 
-	strncpy(length_array, header.msg_len, 10);
+	StrNCpy(length_array, header.msg_len, 10);
 	length_array[10] = '\0';
 	response_length = atol(length_array);
 	/*
@@ -787,7 +787,7 @@ char *writeSearchAPDU(SearchAPDU *query, char *buffer, long *len)
 		if (query->ElementSetNames[i + 1] == NULL)	/* there is a single element set name */
 		{
 		    scratch = (char *) s_malloc((size_t) strlen(ptr) + 2);
-		    strncpy(scratch, ES_DELIMITER_1, 2);
+		    StrNCpy(scratch, ES_DELIMITER_1, 2);
 		    s_strncat(scratch, ptr, strlen(ptr) + 1, strlen(ptr) + 2);
 		} else {	/* this is the first of a series of element set names */
 		    size_t newScratchSize = (size_t) (strlen(ptr) +
@@ -1023,7 +1023,7 @@ diagnosticRecord *makeDiag(boolean surrogate, char *code, char *addInfo)
     (diagnosticRecord *) s_malloc((size_t) sizeof(diagnosticRecord));
 
     diag->SURROGATE = surrogate;
-    memcpy(diag->DIAG, code, DIAGNOSTIC_CODE_SIZE);
+    MemCpy(diag->DIAG, code, DIAGNOSTIC_CODE_SIZE);
     diag->ADDINFO = s_strdup(addInfo);
 
     return (diag);
@@ -1080,7 +1080,7 @@ char *writeDiag(diagnosticRecord * diag, char *buffer, long *len)
 
     if (length > 3) {
 	CHECK_FOR_SPACE_LEFT(3, len);
-	memcpy(buf, diag->ADDINFO, (size_t) length - 3);
+	MemCpy(buf, diag->ADDINFO, length - 3);
 	buf += length - 3;
     }
 
@@ -1114,7 +1114,7 @@ char *readDiag(diagnosticRecord ** diag, char *buffer)
 
     if (len > 3) {
 	d->ADDINFO = (char *) s_malloc((size_t) (len - 3 + 1));
-	memcpy(d->ADDINFO, (char *) (buf + 2), (size_t) (len - 3));
+	MemCpy(d->ADDINFO, (char *) (buf + 2), len - 3);
 	d->ADDINFO[len - 3] = '\0';
     } else
 	d->ADDINFO = NULL;
@@ -1301,7 +1301,7 @@ any *duplicateAny(any *a)
 	copy->bytes = NULL;
     else {
 	copy->bytes = (char *) s_malloc((size_t) copy->size);
-	memcpy(copy->bytes, a->bytes, (size_t) copy->size);
+	MemCpy(copy->bytes, a->bytes, copy->size);
     }
     return (copy);
 }
@@ -1322,7 +1322,7 @@ char *writeAny(any *a, data_tag tag, char *buffer, long *len)
 
     /* write the bytes */
     CHECK_FOR_SPACE_LEFT(a->size, len);
-    memcpy(buf, a->bytes, (size_t) a->size);
+    MemCpy(buf, a->bytes, a->size);
 
     return (buf + a->size);
 }
@@ -1346,7 +1346,7 @@ char *readAny(any **anAny, char *buffer)
 
     /* now simply copy the bytes */
     a->bytes = (char *) s_malloc((size_t) a->size);
-    memcpy(a->bytes, buf, (size_t) a->size);
+    MemCpy(a->bytes, buf, a->size);
     *anAny = a;
 
     return (buf + a->size);
@@ -1380,7 +1380,7 @@ any *stringToAny(char *s)
 
     a->size = strlen(s);
     a->bytes = (char *) s_malloc((size_t) a->size);
-    memcpy(a->bytes, s, (size_t) a->size);
+    MemCpy(a->bytes, s, a->size);
     return (a);
 }
 
@@ -1394,7 +1394,7 @@ char *anyToString(any *a)
 	return (NULL);
 
     s = s_malloc((size_t) (a->size + 1));
-    memcpy(s, a->bytes, (size_t) a->size);
+    MemCpy(s, a->bytes, a->size);
     s[a->size] = '\0';
     return (s);
 }
@@ -1833,12 +1833,12 @@ query_term *makeAttributeTerm(char *use,
     qt->TermType = TT_Attribute;
 
     /* copy in the attributes */
-    strncpy(qt->Use, use, ATTRIBUTE_SIZE);
-    strncpy(qt->Relation, relation, ATTRIBUTE_SIZE);
-    strncpy(qt->Position, position, ATTRIBUTE_SIZE);
-    strncpy(qt->Structure, structure, ATTRIBUTE_SIZE);
-    strncpy(qt->Truncation, truncation, ATTRIBUTE_SIZE);
-    strncpy(qt->Completeness, completeness, ATTRIBUTE_SIZE);
+    StrNCpy(qt->Use, use, ATTRIBUTE_SIZE);
+    StrNCpy(qt->Relation, relation, ATTRIBUTE_SIZE);
+    StrNCpy(qt->Position, position, ATTRIBUTE_SIZE);
+    StrNCpy(qt->Structure, structure, ATTRIBUTE_SIZE);
+    StrNCpy(qt->Truncation, truncation, ATTRIBUTE_SIZE);
+    StrNCpy(qt->Completeness, completeness, ATTRIBUTE_SIZE);
 
     qt->Term = duplicateAny(term);
 
@@ -1870,7 +1870,7 @@ query_term *makeOperatorTerm(char *operatorCode)
 
     qt->TermType = TT_Operator;
 
-    strncpy(qt->Operator, operatorCode, OPERATOR_SIZE);
+    StrNCpy(qt->Operator, operatorCode, OPERATOR_SIZE);
 
     qt->Term = NULL;
     qt->ResultSetID = NULL;
@@ -1914,7 +1914,7 @@ char *writeQueryTerm(query_term *qt, char *buffer, long *len)
 
     switch (qt->TermType) {
     case TT_Attribute:
-	strncpy(attributes, qt->Use, ATTRIBUTE_LIST_SIZE);
+	StrNCpy(attributes, qt->Use, ATTRIBUTE_LIST_SIZE);
 	s_strncat(attributes, AT_DELIMITER, sizeof(AT_DELIMITER) + 1, ATTRIBUTE_LIST_SIZE);
 	s_strncat(attributes, qt->Relation, ATTRIBUTE_SIZE, ATTRIBUTE_LIST_SIZE);
 	s_strncat(attributes, AT_DELIMITER, sizeof(AT_DELIMITER) + 1, ATTRIBUTE_LIST_SIZE);
@@ -2226,7 +2226,7 @@ char *s_strdup(char *s)
     len = strlen(s);		/* length of string - terminator */
     copy = (char *) s_malloc((size_t) (sizeof(char) * (len + 1)));
 
-    strncpy(copy, s, len + 1);
+    StrNCpy(copy, s, len + 1);
     return (copy);
 }
 
@@ -2242,14 +2242,14 @@ char *fs_strncat(char *dst, char *src, size_t maxToAdd, size_t maxTotal)
     size_t srcSize = strlen(src);
 
     if (dstSize + srcSize < maxTotal)	/* use regular old strncat */
-	return (strncat(dst, src, maxToAdd));
+	return (StrNCat(dst, src, maxToAdd));
     else {
 	size_t truncateTo = maxTotal - dstSize - 1;
 	char saveChar = src[truncateTo];
 	char *result = NULL;
 
 	src[truncateTo] = '\0';
-	result = strncat(dst, src, maxToAdd);
+	result = StrNCat(dst, src, maxToAdd);
 	src[truncateTo] = saveChar;
 	return (result);
     }
diff --git a/WWW/Library/Implementation/HTWAIS.c b/WWW/Library/Implementation/HTWAIS.c
index b04d380f..34e0dea7 100644
--- a/WWW/Library/Implementation/HTWAIS.c
+++ b/WWW/Library/Implementation/HTWAIS.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTWAIS.c,v 1.34 2010/06/19 17:43:32 tom Exp $
+ * $LynxId: HTWAIS.c,v 1.35 2010/09/25 00:04:53 tom Exp $
  *
  *	WorldWideWeb - Wide Area Informaion Server Access	HTWAIS.c
  *	==================================================
@@ -243,7 +243,7 @@ static char *WWW_from_archie(char *file)
     if (!result)
 	return result;		/* Malloc error */
     strcpy(result, "file://");
-    strncat(result, file, end - file);
+    StrNCat(result, file, end - file);
     colon = strchr(result + 7, ':');	/* Expect colon after host */
     if (colon) {
 	for (; colon[0]; colon[0] = colon[1], colon++) ;	/* move down */
@@ -823,7 +823,7 @@ int HTLoadWAIS(const char *arg,
 	char *p;
 	HTStructured *target;
 
-	strncpy(keywords, key, MAX_KEYWORDS_LENGTH);
+	StrNCpy(keywords, key, MAX_KEYWORDS_LENGTH);
 	while ((p = strchr(keywords, '+')) != 0)
 	    *p = ' ';
 
diff --git a/WWW/Library/Implementation/HTWSRC.c b/WWW/Library/Implementation/HTWSRC.c
index 22fd5c7c..803034b1 100644
--- a/WWW/Library/Implementation/HTWSRC.c
+++ b/WWW/Library/Implementation/HTWSRC.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTWSRC.c,v 1.25 2010/04/30 08:29:00 tom Exp $
+ * $LynxId: HTWSRC.c,v 1.27 2010/09/25 00:35:26 tom Exp $
  *
  *			Parse WAIS Source file			HTWSRC.c
  *			======================
@@ -133,7 +133,7 @@ char from_hex(char c)
 /*		Treat One Character
  *		-------------------
  */
-static void WSRCParser_put_character(HTStream *me, char c)
+static void WSRCParser_put_character(HTStream *me, int c)
 {
     switch (me->state) {
     case beginning:
@@ -171,7 +171,7 @@ static void WSRCParser_put_character(HTStream *me, char c)
 	    me->state = before_value;
 	} else {
 	    if (me->param_count < PARAM_MAX)
-		me->param[me->param_count++] = c;
+		me->param[me->param_count++] = (char) c;
 	}
 	break;
 
@@ -189,7 +189,7 @@ static void WSRCParser_put_character(HTStream *me, char c)
 	}
 	me->state = (c == '"') ? quoted_value :
 	    (c == '(') ? bracketed_value : value;
-	me->param[me->param_count++] = c;	/* Don't miss first character */
+	me->param[me->param_count++] = (char) c;	/* Don't miss first character */
 	break;
 
     case value:
@@ -199,7 +199,7 @@ static void WSRCParser_put_character(HTStream *me, char c)
 	    me->state = before_tag;
 	} else {
 	    if (me->param_count < PARAM_MAX)
-		me->param[me->param_count++] = c;
+		me->param[me->param_count++] = (char) c;
 	}
 	break;
 
@@ -211,7 +211,7 @@ static void WSRCParser_put_character(HTStream *me, char c)
 	    break;
 	}
 	if (me->param_count < PARAM_MAX)
-	    me->param[me->param_count++] = c;
+	    me->param[me->param_count++] = (char) c;
 	break;
 
     case quoted_value:
@@ -230,7 +230,7 @@ static void WSRCParser_put_character(HTStream *me, char c)
 
     case escape_in_quoted:
 	if (me->param_count < PARAM_MAX)
-	    me->param[me->param_count++] = c;
+	    me->param[me->param_count++] = (char) c;
 	me->state = quoted_value;
 	break;
 
@@ -303,7 +303,7 @@ static void give_parameter(HTStream *me, int p)
 /*			Generate Outout
  *			===============
  */
-static void WSRC_gen_html(HTStream *me, BOOL source_file)
+static void WSRC_gen_html(HTStream *me, int source_file)
 {
     if (me->par_value[PAR_DATABASE_NAME]) {
 	char *shortname = 0;
diff --git a/WWW/Library/Implementation/HText.h b/WWW/Library/Implementation/HText.h
index f0b44e52..84ec87c7 100644
--- a/WWW/Library/Implementation/HText.h
+++ b/WWW/Library/Implementation/HText.h
@@ -1,14 +1,11 @@
-/*                                                           Rich Hypertext object for libWWW
-                                  RICH HYPERTEXT OBJECT
-
- */
-
 /*
-
-   This is the C interface to the Objective-C (or whatever) Style-oriented
-   HyperText class.  It is used when a style-oriented text object is available
-   or craeted in order to display hypertext.
-
+ * $LynxId: HText.h,v 1.16 2010/09/25 11:41:08 tom Exp $
+ *                                                           Rich Hypertext object for libWWW
+ *                                RICH HYPERTEXT OBJECT
+ *
+ * This is the C interface to the Objective-C (or whatever) Style-oriented
+ * HyperText class.  It is used when a style-oriented text object is available
+ * or craeted in order to display hypertext.
  */
 #ifndef HTEXT_H
 #define HTEXT_H
@@ -127,7 +124,7 @@ Object Building methods
    Anchors may not be nested.
 
  */
-    extern int HText_beginAnchor(HText *text, BOOL underline,
+    extern int HText_beginAnchor(HText *text, int underline,
 				 HTChildAnchor *anc);
     extern void HText_endAnchor(HText *text, int number);
     extern BOOL HText_isAnchorBlank(HText *text, int number);
@@ -148,7 +145,7 @@ Object Building methods
     extern void HText_appendImage(HText *text, HTChildAnchor *anc,
 				  const char *alternative_text,
 				  int alignment,
-				  BOOL isMap);
+				  int isMap);
 
 /*
 
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index 22132597..d00b5be3 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: SGML.c,v 1.136 2010/09/22 00:53:49 tom Exp $
+ * $LynxId: SGML.c,v 1.139 2010/09/25 15:40:04 tom Exp $
  *
  *			General SGML Parser code		SGML.c
  *			========================
@@ -312,7 +312,7 @@ static void pool_free(HTElement * e)
 
 static void HTMLSRC_apply_markup(HTStream *context,
 				 HTlexeme lexeme,
-				 BOOL start)
+				 int start)
 {
     HT_tagspec *ts = *((start ? lexeme_start : lexeme_end) + lexeme);
 
@@ -328,14 +328,14 @@ static void HTMLSRC_apply_markup(HTStream *context,
 	CTRACE((tfp, ts->start ? "SRCSTART %d\n" : "SRCSTOP %d\n", (int) lexeme));
 	if (ts->start)
 	    (*context->actions->start_element) (context->target,
-						ts->element,
+						(int) ts->element,
 						ts->present,
 						(const char **) ts->value,
 						context->current_tag_charset,
 						&context->include);
 	else
 	    (*context->actions->end_element) (context->target,
-					      ts->element,
+					      (int) ts->element,
 					      &context->include);
 	ts = ts->next;
     }
@@ -528,7 +528,7 @@ static void handle_attribute_value(HTStream *context, const char *s)
 	StrAllocCopy_extra(context->value[context->current_attribute_number], s);
 #ifdef USE_COLOR_STYLE
 	if (current_is_class) {
-	    strncpy(class_string, s, TEMPSTRINGSIZE);
+	    StrNCpy(class_string, s, TEMPSTRINGSIZE);
 	    CTRACE((tfp, "SGML: class is '%s'\n", s));
 	} else {
 	    CTRACE((tfp, "SGML: attribute value is '%s'\n", s));
@@ -656,7 +656,7 @@ static void put_pretty_number(HTStream *context)
 static char replace_buf[64];	/* buffer for replacement strings */
 static BOOL FoundEntity = FALSE;
 
-static void handle_entity(HTStream *context, char term)
+static void handle_entity(HTStream *context, int term)
 {
     UCode_t code;
     long uck = -1;
@@ -810,7 +810,7 @@ static void handle_comment(HTStream *context)
     CTRACE((tfp, "SGML Comment:\n<%s>\n", s));
 
     if (context->csi == NULL &&
-	strncmp(s, "!--#", 4) == 0 &&
+	StrNCmp(s, "!--#", 4) == 0 &&
 	LYCheckForCSI(context->node_anchor, &context->url) == TRUE) {
 	LYDoCSI(context->url, s, &context->csi);
     } else {
@@ -857,14 +857,14 @@ static void handle_marked(HTStream *context)
 
     CTRACE((tfp, "SGML Marked Section:\n<%s>\n", s));
 
-    if (!strncmp(context->string->data, "![INCLUDE[", 10)) {
+    if (!StrNCmp(context->string->data, "![INCLUDE[", 10)) {
 	context->string->data[context->string->size - 3] = '\0';
 	StrAllocCat(context->include, context->string->data + 10);
 	/* @@@ This needs to take charset into account! @@@
 	   the wrong assumptions will be made about the data's
 	   charset once it is in include - kw */
 
-    } else if (!strncmp(context->string->data, "![CDATA[", 8)) {
+    } else if (!StrNCmp(context->string->data, "![CDATA[", 8)) {
 	(*context->actions->put_block) (context->target,
 					context->string->data + 8,
 					context->string->size - 11);
@@ -882,7 +882,7 @@ static void handle_processing_instruction(HTStream *context)
 
     CTRACE((tfp, "SGML Processing instruction:\n<%s>\n", s));
 
-    if (!strncmp(s, "?xml ", 5)) {
+    if (!StrNCmp(s, "?xml ", 5)) {
 	int flag = context->T.decode_utf8;
 
 	context->strict_xml = TRUE;
@@ -896,7 +896,7 @@ static void handle_processing_instruction(HTStream *context)
 		t += 9;
 		if (*t == '"')
 		    ++t;
-		flag = !strncmp(t, "utf-8", 5);
+		flag = !StrNCmp(t, "utf-8", 5);
 	    }
 	    if (flag) {
 		CTRACE((tfp, "...Use UTF-8 for XML\n"));
@@ -972,7 +972,7 @@ static void handle_sgmlatt(HTStream *context)
 #define ALT_TAGP(t) ALT_TAGP_OF_TAGNUM(TAGNUM_OF_TAGP(t))
 #define NORMAL_TAGP(t) NORMAL_TAGP_OF_TAGNUM(TAGNUM_OF_TAGP(t))
 
-static BOOL element_valid_within(HTTag * new_tag, HTTag * stacked_tag, BOOL direct)
+static BOOL element_valid_within(HTTag * new_tag, HTTag * stacked_tag, int direct)
 {
     BOOL result = YES;
     TagClass usecontains, usecontained;
@@ -1032,7 +1032,7 @@ static void do_close_stacked(HTStream *context)
     if (!psrc_view)		/* Don't actually pass call on if viewing psrc - kw */
 #endif
 	(*context->actions->end_element) (context->target,
-					  e,
+					  (int) e,
 					  &context->include);
     context->element_stack = stacked->next;
     pool_free(stacked);
@@ -1164,11 +1164,12 @@ static void end_element(HTStream *context, HTTag * old_tag)
 	if (!psrc_view)		/* Don't actually pass call on if viewing psrc - kw */
 #endif
 	    status = (*context->actions->end_element) (context->target,
-						       e, &context->include);
+						       (int) e,
+						       &context->include);
 	if (status == HT_PARSER_REOPEN_ELT) {
 	    CTRACE((tfp, "SGML: Restart <%s>\n", t->name));
 	    (*context->actions->start_element) (context->target,
-						e,
+						(int) e,
 						NULL,
 						NULL,
 						context->current_tag_charset,
@@ -1347,7 +1348,7 @@ static void start_element(HTStream *context)
      */
     CTRACE((tfp, "SGML: Start <%s>\n", new_tag->name));
     status = (*context->actions->start_element) (context->target,
-						 TAGNUM_OF_TAGP(new_tag),
+						 (int) TAGNUM_OF_TAGP(new_tag),
 						 context->present,
 						 (const char **) context->value,	/* coerce type for think c */
 						 context->current_tag_charset,
@@ -1591,7 +1592,7 @@ static void discard_empty(HTStream *context)
 }
 
 #ifdef USE_PRETTYSRC
-static BOOL end_if_prettysrc(HTStream *context, HTChunk *string, char end_ch)
+static BOOL end_if_prettysrc(HTStream *context, HTChunk *string, int end_ch)
 {
     BOOL result = psrc_view;
 
@@ -1620,7 +1621,7 @@ static BOOL end_if_prettysrc(HTStream *context, HTChunk *string, char end_ch)
 }
 #endif
 
-static void SGML_character(HTStream *context, char c_in)
+static void SGML_character(HTStream *context, int c_in)
 {
     const SGML_dtd *dtd = context->dtd;
     HTChunk *string = context->string;
@@ -1911,7 +1912,7 @@ static void SGML_character(HTStream *context, char c_in)
 	 */
 	if (context->inUCLYhndl == LATIN1
 	    || context->inUCLYhndl == US_ASCII) {
-	    clong = LYcp1252ToUnicode(c);
+	    clong = LYcp1252ToUnicode((UCode_t) c);
 	    goto top1;
 	}
 	goto after_switch;
@@ -2100,7 +2101,7 @@ static void SGML_character(HTStream *context, char c_in)
 			   HTPassEightBitRaw &&
 			   saved_char_in >=
 			   LYlowest_eightbit[context->outUCLYhndl]) {
-		    PUTUTF8((0xf000 | saved_char_in));
+		    PUTUTF8((UCode_t) (0xf000 | saved_char_in));
 		} else {
 		    PUTUTF8(clong);
 		}
@@ -2146,7 +2147,8 @@ static void SGML_character(HTStream *context, char c_in)
 		   (uck = UCTransUniChar(unsign_c,
 					 context->outUCLYhndl)) >= ' ' &&
 		   uck < 256) {
-	    CTRACE((tfp, "UCTransUniChar returned 0x%.2lX:'%c'.\n",
+	    CTRACE((tfp, "UCTransUniChar returned 0x%.2" PRI_UCode_t
+		    ":'%c'.\n",
 		    uck, FROMASCII((char) uck)));
 	    /*
 	     * We got one octet from the conversions, so use it.  - FM
@@ -2195,7 +2197,7 @@ static void SGML_character(HTStream *context, char c_in)
 #endif
 
 	    string->size = 0;
-	    EntityName = HTMLGetEntityName((int) (unsign_c - 160));
+	    EntityName = HTMLGetEntityName((UCode_t) (unsign_c - 160));
 	    HTChunkPuts(string, EntityName);
 	    HTChunkTerminate(string);
 #ifdef USE_PRETTYSRC
@@ -2746,7 +2748,7 @@ static void SGML_character(HTStream *context, char c_in)
 			   code == 8207) {
 		    if (TRACE) {
 			string->size--;
-			LYstrncpy(replace_buf,
+			LYStrNCpy(replace_buf,
 				  string->data,
 				  (string->size < 64 ? string->size : 63));
 			fprintf(tfp,
@@ -3307,7 +3309,7 @@ static void SGML_character(HTStream *context, char c_in)
 		saved_char_in >=
 		LYlowest_eightbit[context->outUCLYhndl]) {
 		HTChunkPutUtf8Char(string,
-				   (0xf000 | saved_char_in));
+				   (UCode_t) (0xf000 | saved_char_in));
 	    } else {
 		HTChunkPutUtf8Char(string, clong);
 	    }
@@ -3717,7 +3719,7 @@ static void SGML_character(HTStream *context, char c_in)
 		saved_char_in >=
 		LYlowest_eightbit[context->outUCLYhndl]) {
 		HTChunkPutUtf8Char(string,
-				   (0xf000 | saved_char_in));
+				   (UCode_t) (0xf000 | saved_char_in));
 	    } else {
 		HTChunkPutUtf8Char(string, clong);
 	    }
@@ -3757,7 +3759,7 @@ static void SGML_character(HTStream *context, char c_in)
 		saved_char_in >=
 		LYlowest_eightbit[context->outUCLYhndl]) {
 		HTChunkPutUtf8Char(string,
-				   (0xf000 | saved_char_in));
+				   (UCode_t) (0xf000 | saved_char_in));
 	    } else {
 		HTChunkPutUtf8Char(string, clong);
 	    }
@@ -3801,7 +3803,7 @@ static void SGML_character(HTStream *context, char c_in)
 		saved_char_in >=
 		LYlowest_eightbit[context->outUCLYhndl]) {
 		HTChunkPutUtf8Char(string,
-				   (0xf000 | saved_char_in));
+				   (UCode_t) (0xf000 | saved_char_in));
 	    } else {
 		HTChunkPutUtf8Char(string, clong);
 	    }
@@ -3955,7 +3957,7 @@ static void SGML_character(HTStream *context, char c_in)
 #endif
 				(*context->actions->end_element)
 				    (context->target,
-				     TAGNUM_OF_TAGP(context->current_tag),
+				     (int) TAGNUM_OF_TAGP(context->current_tag),
 				     &context->include);
 			}
 		    } else if (!strcasecomp(string->data, "P")) {
@@ -3985,7 +3987,7 @@ static void SGML_character(HTStream *context, char c_in)
 #endif
 			    (*context->actions->end_element)
 				(context->target,
-				 TAGNUM_OF_TAGP(context->current_tag),
+				 (int) TAGNUM_OF_TAGP(context->current_tag),
 				 &context->include);
 		    }
 		    string->size = 0;
@@ -4325,10 +4327,10 @@ static void InferUtfFromBom(HTStream *context, int chndl)
  * Avoid rewrite of SGML_character() to handle hypothetical case of UTF-16
  * webpages, by pretending that the data is UTF-8.
  */
-static void SGML_widechar(HTStream *context, long ch)
+static void SGML_widechar(HTStream *context, int ch)
 {
-    if (!UCPutUtf8_charstring(context, SGML_character, ch)) {
-	SGML_character(context, (char) ch);
+    if (!UCPutUtf8_charstring(context, SGML_character, (UCode_t) ch)) {
+	SGML_character(context, ch);
     }
 }
 
@@ -4339,17 +4341,17 @@ static void SGML_write(HTStream *context, const char *str, int l)
 
     if (sgml_offset == 0) {
 	if (l > 3
-	    && !memcmp(str, "\357\273\277", 3)) {
+	    && !MemCmp(str, "\357\273\277", 3)) {
 	    CTRACE((tfp, "SGML_write found UTF-8 BOM\n"));
 	    InferUtfFromBom(context, UTF8_handle);
 	    str += 3;
 	} else if (l > 2) {
-	    if (!memcmp(str, "\377\376", 2)) {
+	    if (!MemCmp(str, "\377\376", 2)) {
 		CTRACE((tfp, "SGML_write found UCS-2 LE BOM\n"));
 		InferUtfFromBom(context, UTF8_handle);
 		str += 2;
 		context->T.ucs_mode = -1;
-	    } else if (!memcmp(str, "\376\377", 2)) {
+	    } else if (!MemCmp(str, "\376\377", 2)) {
 		CTRACE((tfp, "SGML_write found UCS-2 BE BOM\n"));
 		InferUtfFromBom(context, UTF8_handle);
 		str += 2;
@@ -4526,8 +4528,8 @@ History:
 
 static int TREAT_SJIS = 1;
 
-void JISx0201TO0208_EUC(unsigned char IHI,
-			unsigned char ILO,
+void JISx0201TO0208_EUC(unsigned IHI,
+			unsigned ILO,
 			unsigned char *OHI,
 			unsigned char *OLO)
 {
@@ -4602,8 +4604,8 @@ void JISx0201TO0208_EUC(unsigned char IHI,
 	*OHI = UCH(table[ILO - 0xA1][0]);
 	*OLO = UCH(table[ILO - 0xA1][1]);
     } else {
-	*OHI = IHI;
-	*OLO = ILO;
+	*OHI = UCH(IHI);
+	*OLO = UCH(ILO);
     }
 }
 
@@ -4622,8 +4624,8 @@ static int IS_SJIS_STR(const unsigned char *str)
     return 0;
 }
 
-unsigned char *SJIS_TO_JIS1(unsigned char HI,
-			    unsigned char LO,
+unsigned char *SJIS_TO_JIS1(unsigned HI,
+			    unsigned LO,
 			    unsigned char *JCODE)
 {
     HI = UCH(HI - UCH((HI <= 0x9F) ? 0x71 : 0xB1));
@@ -4636,13 +4638,13 @@ unsigned char *SJIS_TO_JIS1(unsigned char HI,
     } else {
 	LO = UCH(LO - UCH(0x1F));
     }
-    JCODE[0] = HI;
-    JCODE[1] = LO;
+    JCODE[0] = UCH(HI);
+    JCODE[1] = UCH(LO);
     return JCODE;
 }
 
-unsigned char *JIS_TO_SJIS1(unsigned char HI,
-			    unsigned char LO,
+unsigned char *JIS_TO_SJIS1(unsigned HI,
+			    unsigned LO,
 			    unsigned char *SJCODE)
 {
     if (HI & 1)
@@ -4655,22 +4657,28 @@ unsigned char *JIS_TO_SJIS1(unsigned char HI,
     HI = UCH(((HI - 0x21) >> 1) + 0x81);
     if (0x9F < HI)
 	HI = UCH(HI + UCH(0x40));
-    SJCODE[0] = HI;
-    SJCODE[1] = LO;
+    SJCODE[0] = UCH(HI);
+    SJCODE[1] = UCH(LO);
     return SJCODE;
 }
 
-unsigned char *EUC_TO_SJIS1(unsigned char HI,
-			    unsigned char LO,
+unsigned char *EUC_TO_SJIS1(unsigned HI,
+			    unsigned LO,
 			    unsigned char *SJCODE)
 {
-    if (HI == 0x8E)
-	JISx0201TO0208_EUC(HI, LO, &HI, &LO);
+    if (HI == 0x8E) {
+	unsigned char HI_data[2];
+	unsigned char LO_data[2];
+
+	HI_data[0] = UCH(HI);
+	LO_data[0] = UCH(LO);
+	JISx0201TO0208_EUC(HI, LO, HI_data, LO_data);
+    }
     JIS_TO_SJIS1(UCH(HI & 0x7F), UCH(LO & 0x7F), SJCODE);
     return SJCODE;
 }
 
-void JISx0201TO0208_SJIS(unsigned char I,
+void JISx0201TO0208_SJIS(unsigned I,
 			 unsigned char *OHI,
 			 unsigned char *OLO)
 {
@@ -4682,8 +4690,8 @@ void JISx0201TO0208_SJIS(unsigned char I,
     *OLO = SJCODE[1];
 }
 
-unsigned char *SJIS_TO_EUC1(unsigned char HI,
-			    unsigned char LO,
+unsigned char *SJIS_TO_EUC1(unsigned HI,
+			    unsigned LO,
 			    unsigned char *data)
 {
     SJIS_TO_JIS1(HI, LO, data);
diff --git a/WWW/Library/Implementation/SGML.h b/WWW/Library/Implementation/SGML.h
index 7868317d..499e1d0c 100644
--- a/WWW/Library/Implementation/SGML.h
+++ b/WWW/Library/Implementation/SGML.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: SGML.h,v 1.44 2009/11/21 15:24:48 tom Exp $
+ * $LynxId: SGML.h,v 1.45 2010/09/24 00:12:09 tom Exp $
  *			       SGML parse and stream definition for libwww
  *                             SGML AND STRUCTURED STREAMS
  *
@@ -216,7 +216,7 @@ Structured Object definition
 
 	void (*_abort) (HTStructured * me, HTError e);
 
-	void (*put_character) (HTStructured * me, char ch);
+	void (*put_character) (HTStructured * me, int ch);
 
 	void (*put_string) (HTStructured * me, const char *str);
 
diff --git a/WWW/Library/Implementation/UCAux.h b/WWW/Library/Implementation/UCAux.h
index 4d4bd84e..f89609be 100644
--- a/WWW/Library/Implementation/UCAux.h
+++ b/WWW/Library/Implementation/UCAux.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: UCAux.h,v 1.16 2009/03/10 21:17:21 tom Exp $
+ * $LynxId: UCAux.h,v 1.17 2010/09/24 00:14:04 tom Exp $
  */
 #ifndef UCAUX_H
 #define UCAUX_H
@@ -60,7 +60,7 @@ extern "C" {
 			      int hori_in);
 
     typedef void putc_func_t(HTStream *me,
-			     char ch);
+			     int ch);
 
     extern BOOL UCPutUtf8_charstring(HTStream *target,
 				     putc_func_t * actions,
diff --git a/WWW/Library/Implementation/UCMap.h b/WWW/Library/Implementation/UCMap.h
index e1a802cc..6f9e74bc 100644
--- a/WWW/Library/Implementation/UCMap.h
+++ b/WWW/Library/Implementation/UCMap.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: UCMap.h,v 1.23 2009/01/01 02:03:25 tom Exp $
+ * $LynxId: UCMap.h,v 1.26 2010/09/25 15:18:32 tom Exp $
  */
 #ifndef UCMAP_H
 #define UCMAP_H
@@ -32,15 +32,15 @@ extern "C" {
 				 UCode_t unicode,
 				 int charset_out,
 				 int chk_single_flag);
-    extern int UCTransChar(char ch_in,
+    extern int UCTransChar(int ch_in,
 			   int charset_in,
 			   int charset_out);
-    extern int UCReverseTransChar(char ch_out,
+    extern int UCReverseTransChar(int ch_out,
 				  int charset_in,
 				  int charset_out);
     extern int UCTransCharStr(char *outbuf,
 			      int buflen,
-			      char ch_in,
+			      int ch_in,
 			      int charset_in,
 			      int charset_out,
 			      int chk_single_flag);
@@ -49,7 +49,7 @@ extern "C" {
 				  int buflen,
 				  int charset_in);
 #endif
-    extern UCode_t UCTransToUni(char ch_in,
+    extern UCode_t UCTransToUni(int ch_in,
 				int charset_in);
     extern int UCGetRawUniMode_byLYhndl(int i);
     extern int UCGetLYhndl_byMIME(const char *p);	/* returns -1 if name not recognized */
diff --git a/WWW/Library/Implementation/dtd_util.c b/WWW/Library/Implementation/dtd_util.c
index 497b9d02..4e18fdf7 100644
--- a/WWW/Library/Implementation/dtd_util.c
+++ b/WWW/Library/Implementation/dtd_util.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: dtd_util.c,v 1.74 2010/04/29 09:31:08 tom Exp $
+ * $LynxId: dtd_util.c,v 1.76 2010/09/25 00:30:23 tom Exp $
  *
  * Given a SGML_dtd structure, write a corresponding flat file, or "C" source.
  * Given the flat-file, write the "C" source.
@@ -335,7 +335,7 @@ static AttrType *sorted_AttrTypes(const AttrType * source)
     if (number != 0) {
 	result = typecallocn(AttrType, number + 1);
 	if (result != 0) {
-	    memcpy(result, source, number * sizeof(*result));
+	    MemCpy(result, source, number * sizeof(*result));
 	    qsort(result, number, sizeof(*result), compare_attr_types);
 	}
     }
@@ -1035,7 +1035,7 @@ static char *get_line(FILE *input)
     char temp[1024];
     char *result = 0;
 
-    if (fgets(temp, sizeof(temp), input) != 0) {
+    if (fgets(temp, (int) sizeof(temp), input) != 0) {
 	result = strdup(temp);
     }
     return result;
diff --git a/WWW/Library/Implementation/www_tcp.h b/WWW/Library/Implementation/www_tcp.h
index 705c41ba..4e47d788 100644
--- a/WWW/Library/Implementation/www_tcp.h
+++ b/WWW/Library/Implementation/www_tcp.h
@@ -1,5 +1,5 @@
 /*                System dependencies in the W3 library
- * $LynxId: www_tcp.h,v 1.43 2010/09/22 00:35:17 tom Exp $
+ * $LynxId: www_tcp.h,v 1.45 2010/09/25 16:24:45 tom Exp $
  *
                                    SYSTEM DEPENDENCIES
 
@@ -46,10 +46,9 @@ Default values
 #define NETREAD(s,p,n) \
 	HTDoRead(s, p, (unsigned)(n))
 	/* Routine to write to a TCP-IP socket      */
-#define NETWRITE(s,p,n) \
-	write(s, p, (size_t)(n))
-#define SOCKET_READ read	/* normal socket read routine */
-#define IOCTL ioctl		/* normal ioctl routine for sockets */
+#define NETWRITE(s,p,n)		write(s, p, (size_t)(n))
+#define SOCKET_READ(s,b,l)	read(s,b,(size_t)(l))
+#define IOCTL(s,cmd,arg)	ioctl(s,(long)(cmd),arg)
 #define SOCKET_ERRNO errno	/* normal socket errno */
 
 /* Unless stated otherwise, */
@@ -216,7 +215,7 @@ extern int ws_netread(int fd, char *buf, int len);
 #define NETREAD(s,b,l)  ws_netread((s),(b),(l))		/* 1997/11/06 (Thu) */
 #define NETWRITE(s,b,l) send((s),(b),(l),0)
 #define NETCLOSE(s)     closesocket(s)
-#define IOCTL				ioctlsocket
+#define IOCTL(s,cmd,arg)	ioctlsocket(s,cmd,arg)
 #include <io.h>
 #include <string.h>
 #include <process.h>
@@ -327,7 +326,7 @@ VAX/VMS
 
 #ifdef UCX
 #undef IOCTL
-#define IOCTL HTioctl
+#define IOCTL(s,cmd,arg)	HTioctl(s,cmd,arg)
 #endif /* UCX */
 
 #ifdef WIN_TCP
@@ -375,7 +374,7 @@ extern int socket_ioctl();
 #define NETWRITE(s,b,l)     ((s)>10 ? socket_write((s),(b),(l)) : \
                                 write((s),(b),(l)))
 #define NETCLOSE(s)         ((s)>10 ? socket_close(s) : close(s))
-#define IOCTL socket_ioctl
+#define IOCTL(s,cmd,arg)	socket_ioctl(s,cmd,arg)
 #define SOCKET_ERRNO socket_errno
 #endif /* MULTINET */
 
@@ -392,7 +391,7 @@ extern int socket_ioctl();
 #define NETWRITE(s,b,l)     (si_get_sdc((s)) != 0 ? si_write((s),(b),(l)) : \
                                 write((s),(b),(l)))
 #define NETCLOSE(s)         (si_get_sdc((s)) != 0 ? si_close((s)) : close((s)))
-#define IOCTL si_ioctl
+#define IOCTL(s,cmd,arg)	si_ioctl(s,cmd,arg)
 #endif /* SOCKETSHR_TCP */
 
 #ifdef TCPIP_SERVICES
@@ -629,7 +628,7 @@ extern int errno;
 #undef SELECT
 #define TCP_INCLUDES_DONE
 #undef  IOCTL
-#define IOCTL(s,cmd,arg) ioctlsocket(s,cmd,(char*)(arg))
+#define IOCTL(s,cmd,arg)	ioctlsocket(s,cmd,(char*)(arg))
 #define DECL_ERRNO
 #include <errno.h>
 #include <sys/types.h>
@@ -937,7 +936,7 @@ typedef TYPE_FD_SET fd_set;
 typedef struct sockaddr_storage SockA;
 
 #ifdef SIN6_LEN
-#define SOCKADDR_LEN(soc_address) ((struct sockaddr *)&soc_address)->sa_len
+#define SOCKADDR_LEN(soc_address) (((struct sockaddr *)&soc_address)->sa_len)
 #else
 #ifndef SA_LEN
 #define SA_LEN(x) (((x)->sa_family == AF_INET6) \
@@ -946,7 +945,7 @@ typedef struct sockaddr_storage SockA;
 		      ? sizeof(struct sockaddr_in) \
 		      : sizeof(struct sockaddr)))	/* AF_UNSPEC? */
 #endif
-#define SOCKADDR_LEN(soc_address) SA_LEN((struct sockaddr *)&soc_address)
+#define SOCKADDR_LEN(soc_address) (socklen_t) (SA_LEN((struct sockaddr *)&soc_address))
 #endif /* SIN6_LEN */
 #else
 typedef struct sockaddr_in SockA;