about summary refs log tree commit diff stats
path: root/src/HTAlert.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/HTAlert.c')
-rw-r--r--src/HTAlert.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/HTAlert.c b/src/HTAlert.c
index ce237e54..12416ec7 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAlert.c,v 1.86 2009/11/21 16:32:23 tom Exp $
+ * $LynxId: HTAlert.c,v 1.89 2010/09/23 10:43:48 tom Exp $
  *
  *	Displaying messages and getting input for Lynx Browser
  *	==========================================================
@@ -40,7 +40,7 @@
 #ifdef HAVE_NAPMS
 #define LYSleep(n) napms(n)
 #else
-#define LYSleep(n) sleep(n)
+#define LYSleep(n) sleep((unsigned)n)
 #endif
 
 /*	Issue a message about a problem.		HTAlert()
@@ -180,7 +180,7 @@ static const char *sprint_bytes(char *s, off_t n, const char *was_units)
 	if (n >= 10 * kb_units) {
 	    sprintf(s, "%" PRI_off_t, CAST_off_t(n / kb_units));
 	} else if (n > 999) {	/* Avoid switching between 1016b/s and 1K/s */
-	    sprintf(s, "%.2g", ((double) n) / kb_units);
+	    sprintf(s, "%.2g", ((double) n) / (double) kb_units);
 	} else {
 	    sprintf(s, "%" PRI_off_t, CAST_off_t(n));
 	    u = HTProgressUnits(rateBYTES);
@@ -226,7 +226,7 @@ void HTReadProgress(off_t bytes, off_t total)
     static double first, last, last_active;
 
     gettimeofday(&tv, (struct timezone *) 0);
-    now = tv.tv_sec + tv.tv_usec / 1000000.;
+    now = (double) tv.tv_sec + (double) tv.tv_usec / 1000000.;
 #else
 #if defined(HAVE_FTIME) && defined(HAVE_SYS_TIMEB_H)
     static double now, first, last, last_active;
@@ -254,8 +254,10 @@ void HTReadProgress(off_t bytes, off_t total)
     /* 1 sec delay for transfer_rate calculation without g-t-o-d */
     if ((bytes > 0) &&
 	(now > first)) {
-	if (transfer_rate <= 0)	/* the very first time */
-	    transfer_rate = (off_t) ((bytes) / (now - first));	/* bytes/sec */
+	if (transfer_rate <= 0) {	/* the very first time */
+	    transfer_rate = (off_t) ((double) (bytes) / (now - first));
+	    /* bytes/sec */
+	}
 	total_last = total;
 
 	/*
@@ -281,7 +283,7 @@ void HTReadProgress(off_t bytes, off_t total)
 		if (bytes_last != bytes)
 		    last_active = now;
 		bytes_last = bytes;
-		transfer_rate = (off_t) (bytes / (now - first));	/* more accurate value */
+		transfer_rate = (off_t) ((double) bytes / (now - first));	/* more accurate value */
 	    }
 
 	    if (total > 0)
@@ -300,8 +302,8 @@ void HTReadProgress(off_t bytes, off_t total)
 		HTSprintf0(&line, gettext("Read %s of data"), bytesp);
 
 		if (total > 0) {
-		    float percent = bytes / (float) total;
-		    int meter = (LYcolLimit * percent) - 5;
+		    float percent = (float) bytes / (float) total;
+		    int meter = (int) (((float) LYcolLimit * percent) - 5);
 
 		    CTRACE((tfp, "rateBAR: bytes: %" PRI_off_t ", total: "
 			    "%" PRI_off_t "\n", bytes, total));
@@ -909,7 +911,7 @@ BOOL HTConfirmCookie(domain_entry * de, const char *server,
 		 * (O/N/Toujours/Jamais)           - French
 		 */
 		char *p = gettext("Y/N/A/V");	/* placeholder for comment */
-		char *s = "YNAV\007\003";	/* see ADVANCED_COOKIE_CONFIRMATION */
+		const char *s = "YNAV\007\003";		/* see ADVANCED_COOKIE_CONFIRMATION */
 
 		if (strchr(s, ch) == 0
 		    && isalpha(ch)