about summary refs log tree commit diff stats
path: root/WWW
diff options
context:
space:
mode:
Diffstat (limited to 'WWW')
-rw-r--r--WWW/Library/Implementation/HTAABrow.c25
-rw-r--r--WWW/Library/Implementation/HTAAProt.c10
-rw-r--r--WWW/Library/Implementation/HTAccess.c7
-rw-r--r--WWW/Library/Implementation/HTAssoc.c8
-rw-r--r--WWW/Library/Implementation/HTChunk.c28
-rw-r--r--WWW/Library/Implementation/HTDOS.c6
-rw-r--r--WWW/Library/Implementation/HTFTP.c79
-rw-r--r--WWW/Library/Implementation/HTFile.c3
-rw-r--r--WWW/Library/Implementation/HTFinger.c11
-rw-r--r--WWW/Library/Implementation/HTMIME.c4
-rw-r--r--WWW/Library/Implementation/HTMLGen.c13
-rw-r--r--WWW/Library/Implementation/HTParse.c34
-rw-r--r--WWW/Library/Implementation/HTPlain.c10
-rw-r--r--WWW/Library/Implementation/HTTP.c28
-rw-r--r--WWW/Library/Implementation/HTWSRC.c7
-rw-r--r--WWW/Library/Implementation/SGML.c4
16 files changed, 155 insertions, 122 deletions
diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c
index 9d7efab5..1b859e24 100644
--- a/WWW/Library/Implementation/HTAABrow.c
+++ b/WWW/Library/Implementation/HTAABrow.c
@@ -1,5 +1,7 @@
-
-/* MODULE							HTAABrow.c
+/*
+ * $LynxId: HTAABrow.c,v 1.29 2009/01/03 00:55:16 tom Exp $
+ *
+ * MODULE							HTAABrow.c
  *		BROWSER SIDE ACCESS AUTHORIZATION MODULE
  *
  *	Contains the code for keeping track on server hostnames,
@@ -140,8 +142,9 @@ static int proxy_portnumber = 80;
 void HTAAForwardAuth_set(const char *scheme_name,
 			 const char *scheme_specifics)
 {
-    int len = 20 + (scheme_name ? strlen(scheme_name) : 0)
-    + (scheme_specifics ? strlen(scheme_specifics) : 0);
+    unsigned len = (20
+		    + (scheme_name ? strlen(scheme_name) : 0)
+		    + (scheme_specifics ? strlen(scheme_specifics) : 0));
 
     FREE(HTAAForwardAuth);
     if ((HTAAForwardAuth = typecallocn(char, len)) == 0)
@@ -556,7 +559,7 @@ static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, BOOL IsPr
 {
     char *cleartext = NULL;	/* Cleartext presentation */
     char *ciphertext = NULL;	/* Encrypted presentation */
-    int len;
+    unsigned len;
     char *msg = NULL;
     char *username = NULL;
     char *password = NULL;
@@ -620,9 +623,9 @@ static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, BOOL IsPr
 	 * prompting function, but the password is NULL-ed and always replaced. 
 	 * - FM
 	 */
-	len = strlen(realm->realmname) +
-	    strlen(theHost ?
-		   theHost : "??") + 50;
+	len = (strlen(realm->realmname) +
+	       strlen(theHost ?
+		      theHost : "??") + 50);
 	HTSprintf0(&msg, gettext("Username for '%s' at %s '%s%s':"),
 		   realm->realmname,
 		   (IsProxy ? "proxy" : "server"),
@@ -654,8 +657,8 @@ static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, BOOL IsPr
 	}
     }
 
-    len = strlen(NonNull(realm->username)) +
-	strlen(NonNull(realm->password)) + 3;
+    len = (strlen(NonNull(realm->username)) +
+	   strlen(NonNull(realm->password)) + 3);
 
     if (scheme == HTAA_PUBKEY) {
 #ifdef PUBKEY
@@ -811,7 +814,7 @@ char *HTAA_composeAuth(const char *hostname,
     char *auth_string;
     BOOL retry;
     HTAAScheme scheme;
-    int len;
+    unsigned len;
 
     /*
      * Setup atexit() freeing if not done already.  - FM
diff --git a/WWW/Library/Implementation/HTAAProt.c b/WWW/Library/Implementation/HTAAProt.c
index 9e8a06d5..2f0ca7ca 100644
--- a/WWW/Library/Implementation/HTAAProt.c
+++ b/WWW/Library/Implementation/HTAAProt.c
@@ -1,5 +1,7 @@
-
-/* MODULE							HTAAProt.c
+/*
+ * $LynxId: HTAAProt.c,v 1.29 2009/01/03 02:00:14 tom Exp $
+ *
+ * MODULE							HTAAProt.c
  *		PROTECTION FILE PARSING MODULE
  *
  * AUTHORS:
@@ -659,7 +661,7 @@ const char *HTAA_UidToName(int uid)
 	    return data->name;
     }
 
-    if ((pw = getpwuid(uid)) != 0
+    if ((pw = getpwuid((uid_t) uid)) != 0
 	&& pw->pw_name != 0) {
 	CTRACE((tfp, "%s(%d) returned (%s:%d:...)\n",
 		"HTAA_UidToName: getpwuid",
@@ -726,7 +728,7 @@ const char *HTAA_GidToName(int gid)
 	    return data->name;
     }
 
-    if ((gr = getgrgid(gid)) != 0
+    if ((gr = getgrgid((gid_t) gid)) != 0
 	&& gr->gr_name != 0) {
 	CTRACE((tfp, "%s(%d) returned (%s:%d:...)\n",
 		"HTAA_GidToName: getgrgid",
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index f92df3a0..93902cd8 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAccess.c,v 1.67 2008/09/06 14:44:37 tom Exp $
+ * $LynxId: HTAccess.c,v 1.68 2009/01/03 01:31:41 tom Exp $
  *
  *		Access Manager					HTAccess.c
  *		==============
@@ -322,7 +322,7 @@ BOOL override_proxy(const char *addr)
     }
     if (!port)
 	port = 80;		/* Default */
-    h_len = strlen(Host);
+    h_len = (int) strlen(Host);
 
     while (*no_proxy) {
 	const char *end;
@@ -356,7 +356,8 @@ BOOL override_proxy(const char *addr)
 #ifdef CJK_EX			/* ASATAKU PROXY HACK */
 	if ((!templ_port || templ_port == port) &&
 	    (t_len > 0 && t_len <= h_len &&
-	     isdigit(UCH(*no_proxy)) && !strncmp(host, no_proxy, t_len))) {
+	     isdigit(UCH(*no_proxy)) &&
+	     !strncmp(host, no_proxy, (unsigned) t_len))) {
 	    FREE(host);
 	    return YES;
 	}
diff --git a/WWW/Library/Implementation/HTAssoc.c b/WWW/Library/Implementation/HTAssoc.c
index 112f70a9..64a7d1aa 100644
--- a/WWW/Library/Implementation/HTAssoc.c
+++ b/WWW/Library/Implementation/HTAssoc.c
@@ -1,5 +1,7 @@
-
-/* MODULE							HTAssoc.c
+/*
+ * $LynxId: HTAssoc.c,v 1.9 2009/01/03 01:59:16 tom Exp $
+ *
+ * MODULE							HTAssoc.c
  *	    ASSOCIATION LIST FOR STORING NAME-VALUE PAIRS.
  *	    NAMES NOT CASE SENSITIVE, AND ONLY COMMON LENGTH
  *	    IS CHECKED (allows abbreviations; well, length is
@@ -73,7 +75,7 @@ char *HTAssocList_lookup(HTAssocList *alist,
     HTAssoc *assoc;
 
     while (NULL != (assoc = (HTAssoc *) HTList_nextObject(cur))) {
-	if (!strncasecomp(assoc->name, name, strlen(name)))
+	if (!strncasecomp(assoc->name, name, (int) strlen(name)))
 	    return assoc->value;
     }
     return NULL;
diff --git a/WWW/Library/Implementation/HTChunk.c b/WWW/Library/Implementation/HTChunk.c
index 7f41c687..8c8ed8cc 100644
--- a/WWW/Library/Implementation/HTChunk.c
+++ b/WWW/Library/Implementation/HTChunk.c
@@ -1,4 +1,7 @@
-/*		Chunk handling:	Flexible arrays
+/*
+ * $LynxId: HTChunk.c,v 1.20 2009/01/03 01:21:34 tom Exp $
+ *
+ *		Chunk handling:	Flexible arrays
  *		===============================
  *
  */
@@ -61,11 +64,12 @@ HTChunk *HTChunkCreate2(int grow, size_t needed)
 
     HTChunkInit(ch, grow);
     if (needed > 0) {
-	ch->allocated = needed - 1 - ((needed - 1) % ch->growby)
-	    + ch->growby;	/* Round up */
+	/* Round up */
+	ch->allocated = (int) (needed - 1 - ((needed - 1) % ch->growby)
+			       + (unsigned) ch->growby);
 	CTRACE((tfp, "HTChunkCreate2: requested %d, allocate %d\n",
-		(int) needed, ch->allocated));
-	ch->data = typecallocn(char, ch->allocated);
+		(int) needed, (unsigned) ch->allocated));
+	ch->data = typecallocn(char, (unsigned) ch->allocated);
 
 	if (!ch->data)
 	    outofmem(__FILE__, "HTChunkCreate2 data");
@@ -108,8 +112,8 @@ BOOL HTChunkRealloc(HTChunk *ch, int growby)
     ch->allocated = ch->allocated + growby;
 
     data = (ch->data
-	    ? (char *) realloc(ch->data, ch->allocated)
-	    : typecallocn(char, ch->allocated));
+	    ? (char *) realloc(ch->data, (unsigned) ch->allocated)
+	    : typecallocn(char, (unsigned) ch->allocated));
 
     if (data) {
 	ch->data = data;
@@ -158,8 +162,8 @@ void HTChunkEnsure(HTChunk *ch, int needed)
     ch->allocated = needed - 1 - ((needed - 1) % ch->growby)
 	+ ch->growby;		/* Round up */
     ch->data = (ch->data
-		? (char *) realloc(ch->data, ch->allocated)
-		: typecallocn(char, ch->allocated));
+		? (char *) realloc(ch->data, (unsigned) ch->allocated)
+		: typecallocn(char, (unsigned) ch->allocated));
 
     if (ch->data == NULL)
 	outofmem(__FILE__, "HTChunkEnsure");
@@ -178,7 +182,7 @@ void HTChunkPutb(HTChunk *ch, const char *b, int l)
 	if (!HTChunkRealloc(ch, growby))
 	    return;
     }
-    memcpy(ch->data + ch->size, b, l);
+    memcpy(ch->data + ch->size, b, (unsigned) l);
     ch->size += l;
 }
 
@@ -191,7 +195,7 @@ HTChunk *HTChunkPutb2(HTChunk *ch, const char *b, int l)
 	HTChunk *chunk;
 	int m = ch->allocated - ch->size;
 
-	memcpy(ch->data + ch->size, b, m);
+	memcpy(ch->data + ch->size, b, (unsigned) m);
 	ch->size += m;
 
 	chunk = HTChunkCreateMayFail(ch->growby, ch->failok);
@@ -199,7 +203,7 @@ HTChunk *HTChunkPutb2(HTChunk *ch, const char *b, int l)
 	HTChunkPutb(chunk, b + m, l - m);
 	return chunk;
     }
-    memcpy(ch->data + ch->size, b, l);
+    memcpy(ch->data + ch->size, b, (unsigned) l);
     ch->size += l;
     return ch;
 }
diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c
index abf24dfb..69772043 100644
--- a/WWW/Library/Implementation/HTDOS.c
+++ b/WWW/Library/Implementation/HTDOS.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTDOS.c,v 1.35 2008/12/26 18:07:02 tom Exp $
+ * $LynxId: HTDOS.c,v 1.36 2009/01/03 01:58:39 tom Exp $
  *							DOS specific routines
  */
 
@@ -20,7 +20,7 @@
  */
 static char *copy_plus(char **result, const char *source)
 {
-    int length = strlen(source);
+    int length = (int) strlen(source);
     int extra = 10;
     int n;
 
@@ -69,7 +69,7 @@ const char *HTDOS_wwwName(const char *dosname)
     }
     *cp_url = '\0';
 
-    wwwname_len = strlen(wwwname);
+    wwwname_len = (int) strlen(wwwname);
     if (wwwname_len > 1)
 	cp_url--;		/* point last char */
 
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index 5f508efc..e1d53c59 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFTP.c,v 1.87 2009/01/01 16:53:31 tom Exp $
+ * $LynxId: HTFTP.c,v 1.88 2009/01/03 01:57:47 tom Exp $
  *
  *			File Transfer Protocol (FTP) Client
  *			for a WorldWideWeb browser
@@ -462,7 +462,7 @@ static int write_cmd(const char *cmd)
 	    }
 	}
 #endif /* NOT_ASCII */
-	status = NETWRITE(control->socket, cmd, (int) strlen(cmd));
+	status = NETWRITE(control->socket, cmd, (unsigned) strlen(cmd));
 	if (status < 0) {
 	    CTRACE((tfp,
 		    "HTFTP: Error %d sending command: closing socket %d\n",
@@ -1126,9 +1126,9 @@ static void reset_master_socket(void)
 
 static void set_master_socket(int value)
 {
-    have_socket = (value >= 0);
+    have_socket = (BOOLEAN) (value >= 0);
     if (have_socket)
-	master_socket = value;
+	master_socket = (unsigned) value;
 }
 
 /*	Close Master (listening) socket
@@ -1143,7 +1143,7 @@ static int close_master_socket(void)
     if (have_socket)
 	FD_CLR(master_socket, &open_sockets);
 
-    status = NETCLOSE(master_socket);
+    status = NETCLOSE((int) master_socket);
     CTRACE((tfp, "HTFTP: Closed master socket %u\n", master_socket));
 
     reset_master_socket();
@@ -1405,10 +1405,10 @@ static int get_listen_socket(void)
 
 #ifdef SOCKS
 	if (socks_flag)
-	    status = Rlisten(master_socket, 1);
+	    status = Rlisten((int) master_socket, 1);
 	else
 #endif /* SOCKS */
-	    status = listen(master_socket, 1);
+	    status = listen((int) master_socket, 1);
 	if (status < 0) {
 	    reset_master_socket();
 	    return HTInetStatus("listen");
@@ -1419,7 +1419,7 @@ static int get_listen_socket(void)
     if ((master_socket + 1) > num_sockets)
 	num_sockets = master_socket + 1;
 
-    return master_socket;	/* Good */
+    return (int) master_socket;	/* Good */
 
 }				/* get_listen_socket */
 
@@ -1600,7 +1600,7 @@ static void parse_eplf_line(char *line,
 	case 's':
 	    size = 0;
 	    while (*(++cp) && (*cp != ','))
-		size = (size * 10) + (*cp - '0');
+		size = (size * 10) + (unsigned long) (*cp - '0');
 	    info->size = size;
 	    break;
 	case 'm':
@@ -1637,7 +1637,7 @@ static void parse_ls_line(char *line,
     unsigned long base = 1;
     unsigned long size_num = 0;
 
-    for (i = strlen(line) - 1;
+    for (i = (int) strlen(line) - 1;
 	 (i > 13) && (!isspace(UCH(line[i])) || !is_ls_date(&line[i - 12]));
 	 i--) {
 	;			/* null body */
@@ -1657,7 +1657,7 @@ static void parse_ls_line(char *line,
     }
     j = i - 14;
     while (isdigit(UCH(line[j]))) {
-	size_num += (line[j] - '0') * base;
+	size_num += ((unsigned long) (line[j] - '0') * base);
 	base *= 10;
 	j--;
     }
@@ -1681,7 +1681,7 @@ static void parse_ls_line(char *line,
      * Next is the link-count.
      */
     next = 0;
-    entry->file_links = strtol(cp, &next, 10);
+    entry->file_links = (unsigned long) strtol(cp, &next, 10);
     if (next == 0 || *next != ' ') {
 	entry->file_links = 0;
 	next = cp;
@@ -1738,7 +1738,7 @@ static void parse_dls_line(char *line,
        79215    \0
      */
 
-    len = strlen(line);
+    len = (int) strlen(line);
     if (len == 0) {
 	FREE(*pspilledname);
 	entry_info->display = FALSE;
@@ -1783,7 +1783,7 @@ static void parse_dls_line(char *line,
 	    j--;
 	}
     }
-    entry_info->size = size_num;
+    entry_info->size = (unsigned long) size_num;
 
     cps = LYSkipBlanks(&line[23]);
     if (!strncmp(cps, "-> ", 3) && cps[3] != '\0' && cps[3] != ' ') {
@@ -1797,10 +1797,10 @@ static void parse_dls_line(char *line,
 
     LYTrimTrailing(line);
 
-    len = strlen(line);
+    len = (int) strlen(line);
     if (len == 0 && *pspilledname && **pspilledname) {
 	line = *pspilledname;
-	len = strlen(*pspilledname);
+	len = (int) strlen(*pspilledname);
     }
     if (len > 0 && line[len - 1] == '/') {
 	/*
@@ -1844,7 +1844,7 @@ static void parse_vms_dir_entry(char *line,
     /* Cast VMS non-README file and directory names to lowercase. */
     if (strstr(entry_info->filename, "READ") == NULL) {
 	LYLowerCase(entry_info->filename);
-	i = strlen(entry_info->filename);
+	i = (int) strlen(entry_info->filename);
     } else {
 	i = ((strstr(entry_info->filename, "READ") - entry_info->filename) + 4);
 	if (!strncmp(&entry_info->filename[i], "ME", 2)) {
@@ -1853,7 +1853,7 @@ static void parse_vms_dir_entry(char *line,
 		i++;
 	    }
 	} else if (!strncmp(&entry_info->filename[i], ".ME", 3)) {
-	    i = strlen(entry_info->filename);
+	    i = (int) strlen(entry_info->filename);
 	} else {
 	    i = 0;
 	}
@@ -1924,12 +1924,12 @@ static void parse_vms_dir_entry(char *line,
 	    cps--;
 	if (cps < cpd)
 	    *cpd = '\0';
-	entry_info->size = atoi(cps);
+	entry_info->size = (unsigned long) atol(cps);
 	cps = cpd + 1;
 	while (isdigit(UCH(*cps)))
 	    cps++;
 	*cps = '\0';
-	ialloc = atoi(cpd + 1);
+	ialloc = (unsigned) atoi(cpd + 1);
 	/* Check if used is in blocks or bytes */
 	if (entry_info->size <= ialloc)
 	    entry_info->size *= 512;
@@ -1943,7 +1943,7 @@ static void parse_vms_dir_entry(char *line,
 		cpd++;
 	    if (*cpd == '\0') {
 		/* Assume it's blocks */
-		entry_info->size = atoi(cps) * 512;
+		entry_info->size = ((unsigned long) atol(cps) * 512);
 		break;
 	    }
 	}
@@ -1988,7 +1988,7 @@ static void parse_ms_windows_dir_entry(char *line,
 	cpd = LYSkipNonBlanks(cps);
 	*cpd++ = '\0';
 	if (isdigit(UCH(*cps))) {
-	    entry_info->size = atoi(cps);
+	    entry_info->size = (unsigned long) atol(cps);
 	} else {
 	    StrAllocCopy(entry_info->type, ENTRY_IS_DIRECTORY);
 	}
@@ -2121,7 +2121,7 @@ static void parse_windows_nt_dir_entry(char *line,
 	cpd = LYSkipNonBlanks(cps);
 	*cpd = '\0';
 	if (isdigit(*cps)) {
-	    entry_info->size = atoi(cps);
+	    entry_info->size = atol(cps);
 	} else {
 	    StrAllocCopy(entry_info->type, ENTRY_IS_DIRECTORY);
 	}
@@ -2219,7 +2219,7 @@ static void parse_cms_dir_entry(char *line,
 	}
 	if (Records > 0 && RecordLength > 0) {
 	    /* Compute an approximate size. */
-	    entry_info->size = (Records * RecordLength);
+	    entry_info->size = ((unsigned long) Records * (unsigned long) RecordLength);
 	}
     }
 
@@ -2310,7 +2310,7 @@ static EntryInfo *parse_dir_entry(char *entry,
 	 */
 
 	if (*first) {
-	    len = strlen(entry);
+	    len = (int) strlen(entry);
 	    if (!len || entry[0] == ' ' ||
 		(len >= 24 && entry[23] != ' ') ||
 		(len < 24 && strchr(entry, ' '))) {
@@ -2362,7 +2362,7 @@ static EntryInfo *parse_dir_entry(char *entry,
 	/*
 	 * Interpret and edit LIST output from Unix server.
 	 */
-	len = strlen(entry);
+	len = (int) strlen(entry);
 	if (*first) {
 	    /* don't gettext() this -- incoming text: */
 	    if (!strcmp(entry, "can not access directory .")) {
@@ -2443,7 +2443,7 @@ static EntryInfo *parse_dir_entry(char *entry,
 	/*
 	 * Trim off VMS directory extensions.
 	 */
-	len = strlen(entry_info->filename);
+	len = (int) strlen(entry_info->filename);
 	if ((len > 4) && !strcmp(&entry_info->filename[len - 4], ".dir")) {
 	    entry_info->filename[len - 4] = '\0';
 	    StrAllocCopy(entry_info->type, ENTRY_IS_DIRECTORY);
@@ -2527,7 +2527,7 @@ static EntryInfo *parse_dir_entry(char *entry,
 	 * Directories identified by trailing "/" characters.
 	 */
 	StrAllocCopy(entry_info->filename, entry);
-	len = strlen(entry);
+	len = (int) strlen(entry);
 	if (entry[len - 1] == '/') {
 	    /*
 	     * It's a dir, remove / and mark it as such.
@@ -2751,7 +2751,7 @@ static char *FormatStr(char **bufp,
 
 static char *FormatNum(char **bufp,
 		       char *start,
-		       long value)
+		       unsigned long value)
 {
     char fmt[512];
 
@@ -2784,11 +2784,11 @@ static void LYListFmtParse(const char *fmtstr,
     char *start;
     char *str = NULL;
     char *buf = NULL;
-    BOOL is_directory = (data->file_mode != 0 &&
-			 (TOUPPER(data->file_mode[0]) == 'D'));
-    BOOL is_symlinked = (data->file_mode != 0 &&
-			 (TOUPPER(data->file_mode[0]) == 'L'));
-    BOOL remove_size = (is_directory || is_symlinked);
+    BOOL is_directory = (BOOL) (data->file_mode != 0 &&
+				(TOUPPER(data->file_mode[0]) == 'D'));
+    BOOL is_symlinked = (BOOL) (data->file_mode != 0 &&
+				(TOUPPER(data->file_mode[0]) == 'L'));
+    BOOL remove_size = (BOOL) (is_directory || is_symlinked);
 
     StrAllocCopy(str, fmtstr);
     s = str;
@@ -3384,7 +3384,7 @@ static int setup_connection(const char *name,
 		    status = HT_NO_CONNECTION;
 		    break;
 		}
-		passive_port = (p0 << 8) + p1;
+		passive_port = (PortNumber) ((p0 << 8) + p1);
 		sprintf(dst, "%d.%d.%d.%d", h0, h1, h2, h3);
 	    } else if (strcmp(p, "EPSV") == 0) {
 		char c0, c1, c2, c3;
@@ -3399,15 +3399,16 @@ static int setup_connection(const char *name,
 		}
 		for ( /*nothing */ ;
 		     *p && *p && *p != '(';
-		     p++)	/*) */
+		     p++) {	/*) */
 		    ;		/* null body */
+		}
 		status = sscanf(p, "(%c%c%c%d%c)", &c0, &c1, &c2, &p0, &c3);
 		if (status != 5) {
 		    fprintf(tfp, "HTFTP: EPSV reply has invalid format!\n");
 		    status = HT_NO_CONNECTION;
 		    break;
 		}
-		passive_port = p0;
+		passive_port = (PortNumber) p0;
 
 		sslen = sizeof(ss);
 		if (getpeername(control->socket, (struct sockaddr *) &ss,
@@ -4024,12 +4025,12 @@ int HTFTPLoad(const char *name,
 
 #ifdef SOCKS
 	if (socks_flag)
-	    status = Raccept(master_socket,
+	    status = Raccept((int) master_socket,
 			     (struct sockaddr *) &soc_address,
 			     &soc_addrlen);
 	else
 #endif /* SOCKS */
-	    status = accept(master_socket,
+	    status = accept((int) master_socket,
 			    (struct sockaddr *) &soc_address,
 			    &soc_addrlen);
 	if (status < 0) {
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index e98077c3..53184d47 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFile.c,v 1.117 2009/01/01 16:47:58 tom Exp $
+ * $LynxId: HTFile.c,v 1.118 2009/01/02 23:03:34 tom Exp $
  *
  *			File Access				HTFile.c
  *			===========
@@ -1882,7 +1882,6 @@ static int print_local_dir(DIR *dp, char *localname,
     BOOL need_parent_link = FALSE;
     BOOL preformatted = FALSE;
     int status;
-    int i;
     struct stat *actual_info;
 
 #ifdef DISP_PARTIAL
diff --git a/WWW/Library/Implementation/HTFinger.c b/WWW/Library/Implementation/HTFinger.c
index 7afb64b9..5567ed1d 100644
--- a/WWW/Library/Implementation/HTFinger.c
+++ b/WWW/Library/Implementation/HTFinger.c
@@ -1,4 +1,7 @@
-/*			FINGER ACCESS				HTFinger.c
+/*
+ * $LynxId: HTFinger.c,v 1.25 2009/01/03 02:02:18 tom Exp $
+ *
+ *			FINGER ACCESS				HTFinger.c
  *			=============
  * Authors:
  *  ARB  Andrew Brooks
@@ -110,7 +113,7 @@ static int response(char *command,
 		    HTStream *sink)
 {
     int status;
-    int length = strlen(command);
+    int length = (int) strlen(command);
     int ch, i;
     char line[BIG], *l, *cmd = NULL;
     char *p = line, *href = NULL;
@@ -125,7 +128,7 @@ static int response(char *command,
     /* Send the command.
      */
     CTRACE((tfp, "HTFinger command to be sent: %s", command));
-    status = NETWRITE(finger_fd, (char *) command, length);
+    status = NETWRITE(finger_fd, (char *) command, (unsigned) length);
     if (status < 0) {
 	CTRACE((tfp, "HTFinger: Unable to send command. Disconnecting.\n"));
 	NETCLOSE(finger_fd);
@@ -165,7 +168,7 @@ static int response(char *command,
     } else {
 	StrAllocCopy(cmd, "");
     }
-    for (i = (strlen(cmd) - 1); i >= 0; i--) {
+    for (i = ((int) strlen(cmd) - 1); i >= 0; i--) {
 	if (cmd[i] == LF || cmd[i] == CR) {
 	    cmd[i] = '\0';
 	} else {
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index 844cf6e0..d6e8e883 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTMIME.c,v 1.68 2009/01/01 16:50:17 tom Exp $
+ * $LynxId: HTMIME.c,v 1.69 2009/01/02 23:04:02 tom Exp $
  *
  *			MIME Message Parse			HTMIME.c
  *			==================
@@ -791,7 +791,7 @@ static int dispatchField(HTStream *me)
 	me->anchor->content_length = atoi(me->value);
 	if (me->anchor->content_length < 0)
 	    me->anchor->content_length = 0;
-	CTRACE((tfp, "        Converted to integer: '%d'\n",
+	CTRACE((tfp, "        Converted to integer: '%ld'\n",
 		me->anchor->content_length));
 	break;
     case miCONTENT_LOCATION:
diff --git a/WWW/Library/Implementation/HTMLGen.c b/WWW/Library/Implementation/HTMLGen.c
index 00c79499..98882782 100644
--- a/WWW/Library/Implementation/HTMLGen.c
+++ b/WWW/Library/Implementation/HTMLGen.c
@@ -1,4 +1,7 @@
-/*		HTML Generator
+/*
+ * $LynxId: HTMLGen.c,v 1.28 2009/01/03 01:27:53 tom Exp $
+ *
+ *		HTML Generator
  *		==============
  *
  *	This version of the HTML object sends HTML markup to the output stream.
@@ -331,7 +334,7 @@ static int HTMLGen_start_element(HTStructured * me, int element_number,
 	HTSprintf(&Style_className, ";%s", HTML_dtd.tags[element_number].name);
 	strcpy(myHash, HTML_dtd.tags[element_number].name);
 	if (class_string[0]) {
-	    int len = strlen(myHash);
+	    int len = (int) strlen(myHash);
 
 	    sprintf(myHash + len, ".%.*s", (int) sizeof(myHash) - len - 2, class_string);
 	    HTSprintf(&Style_className, ".%s", class_string);
@@ -464,7 +467,9 @@ static int HTMLGen_start_element(HTStructured * me, int element_number,
     /*
      * Make very specific HTML assumption that PRE can't be nested!
      */
-    me->preformatted = (element_number == HTML_PRE) ? YES : was_preformatted;
+    me->preformatted = (BOOL) ((element_number == HTML_PRE)
+			       ? YES
+			       : was_preformatted);
 
     /*
      * Can break after element start.
@@ -561,7 +566,7 @@ static int HTMLGen_end_element(HTStructured * me, int element_number,
  */
 static int HTMLGen_put_entity(HTStructured * me, int entity_number)
 {
-    int nent = HTML_dtd.number_of_entities;
+    int nent = (int) HTML_dtd.number_of_entities;
 
     HTMLGen_put_character(me, '&');
     if (entity_number < nent) {
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c
index 33a4154a..c9bfbbf0 100644
--- a/WWW/Library/Implementation/HTParse.c
+++ b/WWW/Library/Implementation/HTParse.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTParse.c,v 1.50 2008/12/14 15:38:54 tom Exp $
+ * $LynxId: HTParse.c,v 1.51 2009/01/03 01:11:14 tom Exp $
  *
  *		Parse HyperText Document Address		HTParse.c
  *		================================
@@ -426,7 +426,7 @@ char *HTParse(const char *aName,
 			*p2 = '\0';	/* It is the default: ignore it */
 		}
 		if (p2 == NULL) {
-		    int len3 = strlen(tail);
+		    int len3 = (int) strlen(tail);
 
 		    if (len3 > 0) {
 			h = tail + len3 - 1;	/* last char of hostname */
@@ -666,14 +666,17 @@ const char *HTParseAnchor(const char *aName)
 {
     const char *p = aName;
 
-    for (; *p && *p != '#'; p++) ;
+    for (; *p && *p != '#'; p++) {
+	;
+    }
     if (*p == '#') {
 	/* the safe way based on HTParse() -
 	 * keeping in mind scan() peculiarities on schemes:
 	 */
 	struct struct_parts given;
 
-	char *name = (char *) LYalloca((p - aName) + strlen(p) + 1);
+	char *name = (char *) LYalloca((unsigned) ((p - aName)
+						   + (int) strlen(p) + 1));
 
 	if (name == NULL) {
 	    outofmem(__FILE__, "HTParseAnchor");
@@ -887,7 +890,7 @@ char *HTRelative(const char *aName,
     } else if (slashes == 3) {	/* Same node, different path */
 	StrAllocCopy(result, path);
     } else {			/* Some path in common */
-	int levels = 0;
+	unsigned levels = 0;
 
 	for (; *q && (*q != '#'); q++)
 	    if (*q == '/')
@@ -907,6 +910,9 @@ char *HTRelative(const char *aName,
     return result;
 }
 
+#define AlloCopy(next,base,extra) \
+	typecallocn(char, (unsigned) ((next - base) + ((int) extra)))
+
 /*	Escape undesirable characters using %			HTEscape()
  *	-------------------------------------
  *
@@ -948,12 +954,12 @@ char *HTEscape(const char *str,
     for (p = str; *p; p++)
 	if (!ACCEPTABLE(UCH(TOASCII(*p))))
 	    unacceptable++;
-    result = typecallocn(char, (p - str) + (unacceptable * 2) + 1);
+    result = AlloCopy(p, str, (unacceptable * 2) + 1);
 
     if (result == NULL)
 	outofmem(__FILE__, "HTEscape");
     for (q = result, p = str; *p; p++) {
-	unsigned char a = TOASCII(*p);
+	unsigned char a = UCH(TOASCII(*p));
 
 	if (!ACCEPTABLE(a)) {
 	    *q++ = HEX_ESCAPE;	/* Means hex coming */
@@ -988,12 +994,12 @@ char *HTEscapeUnsafe(const char *str)
     for (p = str; *p; p++)
 	if (UNSAFE(UCH(TOASCII(*p))))
 	    unacceptable++;
-    result = typecallocn(char, (p - str) + (unacceptable * 2) + 1);
+    result = AlloCopy(p, str, (unacceptable * 2) + 1);
 
     if (result == NULL)
 	outofmem(__FILE__, "HTEscapeUnsafe");
     for (q = result, p = str; *p; p++) {
-	unsigned char a = TOASCII(*p);
+	unsigned char a = UCH(TOASCII(*p));
 
 	if (UNSAFE(a)) {
 	    *q++ = HEX_ESCAPE;	/* Means hex coming */
@@ -1028,12 +1034,12 @@ char *HTEscapeSP(const char *str,
     for (p = str; *p; p++)
 	if (!(*p == ' ' || ACCEPTABLE(UCH(TOASCII(*p)))))
 	    unacceptable++;
-    result = typecallocn(char, (p - str) + (unacceptable * 2) + 1);
+    result = AlloCopy(p, str, (unacceptable * 2) + 1);
 
     if (result == NULL)
 	outofmem(__FILE__, "HTEscape");
     for (q = result, p = str; *p; p++) {
-	unsigned char a = TOASCII(*p);
+	unsigned char a = UCH(TOASCII(*p));
 
 	if (a == 32) {
 	    *q++ = '+';
@@ -1181,7 +1187,7 @@ void HTMake822Word(char **str,
 	return;
     }
     for (p = *str; *p; p++) {
-	a = TOASCII(*p);	/* S/390 -- gil -- 0240 */
+	a = UCH(TOASCII(*p));	/* S/390 -- gil -- 0240 */
 	if (a < 32 || a >= 128 ||
 	    ((crfc[a - 32]) & 1)) {
 	    if (!added)
@@ -1196,7 +1202,7 @@ void HTMake822Word(char **str,
     }
     if (!added)
 	return;
-    result = typecallocn(char, p - (*str) + added + 1);
+    result = AlloCopy(p, *str, added + 1);
     if (result == NULL)
 	outofmem(__FILE__, "HTMake822Word");
 
@@ -1211,7 +1217,7 @@ void HTMake822Word(char **str,
      */
     /* S/390 -- gil -- 0268 */
     for (p = *str; *p; p++) {
-	a = TOASCII(*p);
+	a = UCH(TOASCII(*p));
 	if ((a != ASCII_TAB) &&
 	    ((a & 127) < ASCII_SPC ||
 	     (a < 128 && ((crfc[a - 32]) & 2))))
diff --git a/WWW/Library/Implementation/HTPlain.c b/WWW/Library/Implementation/HTPlain.c
index 8dfa901e..c3b66861 100644
--- a/WWW/Library/Implementation/HTPlain.c
+++ b/WWW/Library/Implementation/HTPlain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTPlain.c,v 1.42 2008/09/06 14:45:09 tom Exp $
+ * $LynxId: HTPlain.c,v 1.44 2009/01/03 01:23:21 tom Exp $
  *
  *		Plain text object		HTWrite.c
  *		=================
@@ -159,13 +159,13 @@ static void HTPlain_put_character(HTStream *me, char c)
 	    UCode_t value = (UCode_t) FROMASCII((TOASCII(UCH(c)) - 160));
 
 	    name = HTMLGetEntityName(value);
-	    len = strlen(name);
-	    for (low = 0, high = HTML_dtd.number_of_entities;
+	    len = (int) strlen(name);
+	    for (low = 0, high = (int) HTML_dtd.number_of_entities;
 		 high > low;
 		 diff < 0 ? (low = i + 1) : (high = i)) {
 		/* Binary search */
 		i = (low + (high - low) / 2);
-		diff = AS_ncmp(HTML_dtd.entity_names[i], name, len);
+		diff = AS_ncmp(HTML_dtd.entity_names[i], name, (unsigned) len);
 		if (diff == 0) {
 		    HText_appendText(me->text,
 				     LYCharSets[me->outUCLYhndl][i]);
@@ -572,7 +572,7 @@ static void HTPlain_write(HTStream *me, const char *s, int l)
 		 * Out of luck, so use the UHHH notation (ugh).  - gil
 		 */
 		/* S/390 -- gil -- 0517 */
-		sprintf(replace_buf, "U%.2lX", TOASCII(code));
+		sprintf(replace_buf, "U%.2lX", (unsigned long) TOASCII(code));
 		HText_appendText(me->text, replace_buf);
 	    }
 #ifdef NOTDEFINED
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 47c8307a..c13d686d 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTP.c,v 1.103 2009/01/01 16:40:54 tom Exp $
+ * $LynxId: HTTP.c,v 1.104 2009/01/03 01:41:51 tom Exp $
  *
  * HyperText Tranfer Protocol	- Client implementation		HTTP.c
  * ==========================
@@ -173,7 +173,7 @@ void HTSSLInitPRNG(void)
 	/* Initialize system's random number generator */
 	RAND_bytes((unsigned char *) &seed, sizeof(long));
 
-	lynx_srand(seed);
+	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();
@@ -444,7 +444,7 @@ static BOOL acceptEncoding(int code)
 	 * FIXME:  if lynx did not rely upon external programs to decompress
 	 * files for external viewers, this check could be relaxed.
 	 */
-	result = (program != 0);
+	result = (BOOL) (program != 0);
     }
     return result;
 }
@@ -894,7 +894,7 @@ static int HTLoadHTTP(const char *arg,
 			cert_host = (char *) ASN1_STRING_data(gn->d.ia5);
 		    else if (gn->type == GEN_IPADD) {
 			/* XXX untested -TG */
-			size_t j = ASN1_STRING_length(gn->d.ia5);
+			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);
@@ -1059,13 +1059,13 @@ static int HTLoadHTTP(const char *arg,
 			    "Accept: " : ", "),
 			   HTAtom_name(pres->rep),
 			   temp);
-		len += strlen(linebuf);
+		len += (int) strlen(linebuf);
 		if (len > 252 && !first_Accept) {
 		    BStrCat0(command, crlf);
 		    HTSprintf0(&linebuf, "Accept: %s%s",
 			       HTAtom_name(pres->rep),
 			       temp);
-		    len = strlen(linebuf);
+		    len = (int) strlen(linebuf);
 		}
 		BStrCat0(command, linebuf);
 		first_Accept = FALSE;
@@ -1485,7 +1485,7 @@ static int HTLoadHTTP(const char *arg,
 	BOOL end_of_file = NO;
 	int buffer_length = INIT_LINE_SIZE;
 
-	line_buffer = typecallocn(char, buffer_length);
+	line_buffer = typecallocn(char, (unsigned) buffer_length);
 
 	if (line_buffer == NULL)
 	    outofmem(__FILE__, "HTLoadHTTP");
@@ -1498,14 +1498,17 @@ static int HTLoadHTTP(const char *arg,
 	    if (buffer_length - length < LINE_EXTEND_THRESH) {
 		buffer_length = buffer_length + buffer_length;
 		line_buffer =
-		    (char *) realloc(line_buffer, (buffer_length * sizeof(char)));
+		    (char *) realloc(line_buffer, ((unsigned) buffer_length *
+						   sizeof(char)));
 
 		if (line_buffer == NULL)
 		    outofmem(__FILE__, "HTLoadHTTP");
 	    }
 	    CTRACE((tfp, "HTTP: Trying to read %d\n", buffer_length - length - 1));
-	    status = HTTP_NETREAD(s, line_buffer + length,
-				  buffer_length - length - 1, handle);
+	    status = HTTP_NETREAD(s,
+				  line_buffer + length,
+				  (buffer_length - length - 1),
+				  handle);
 	    CTRACE((tfp, "HTTP: Read %d\n", status));
 	    if (status <= 0) {
 		/*
@@ -1576,11 +1579,12 @@ static int HTLoadHTTP(const char *arg,
 
 	    if (line_buffer) {
 		FREE(line_kept_clean);
-		line_kept_clean = (char *) malloc(buffer_length * sizeof(char));
+		line_kept_clean = (char *) malloc((unsigned) buffer_length *
+						  sizeof(char));
 
 		if (line_kept_clean == NULL)
 		    outofmem(__FILE__, "HTLoadHTTP");
-		memcpy(line_kept_clean, line_buffer, buffer_length);
+		memcpy(line_kept_clean, line_buffer, (unsigned) buffer_length);
 		real_length_of_line = length + status;
 	    }
 
diff --git a/WWW/Library/Implementation/HTWSRC.c b/WWW/Library/Implementation/HTWSRC.c
index 3916bd86..252627b3 100644
--- a/WWW/Library/Implementation/HTWSRC.c
+++ b/WWW/Library/Implementation/HTWSRC.c
@@ -1,4 +1,7 @@
-/*			Parse WAIS Source file			HTWSRC.c
+/*
+ * $LynxId: HTWSRC.c,v 1.24 2009/01/03 02:01:01 tom Exp $
+ *
+ *			Parse WAIS Source file			HTWSRC.c
  *			======================
  *
  *	This module parses a stream with WAIS source file
@@ -307,7 +310,7 @@ static void WSRC_gen_html(HTStream *me, BOOL source_file)
 	int l;
 
 	StrAllocCopy(shortname, me->par_value[PAR_DATABASE_NAME]);
-	l = strlen(shortname);
+	l = (int) strlen(shortname);
 	if (l > 4 && !strcasecomp(shortname + l - 4, ".src")) {
 	    shortname[l - 4] = 0;	/* Chop of .src -- boring! */
 	}
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index 1c851824..709586e5 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: SGML.c,v 1.119 2008/12/31 20:19:38 tom Exp $
+ * $LynxId: SGML.c,v 1.120 2009/01/03 01:12:28 tom Exp $
  *
  *			General SGML Parser code		SGML.c
  *			========================
@@ -80,7 +80,7 @@ static void fake_put_character(void *p GCC_UNUSED,
     }
 
 #define PUTS(str) ((*context->actions->put_string)(context->target, str))
-#define PUTC(ch)  ((*context->actions->put_character)(context->target, ch))
+#define PUTC(ch)  ((*context->actions->put_character)(context->target, (char) ch))
 #define PUTUTF8(code) (UCPutUtf8_charstring((HTStream *)context->target, \
 		      (putc_func_t*)(context->actions->put_character), code))