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/HTFTP.c27
-rw-r--r--WWW/Library/Implementation/HTFile.c5
-rw-r--r--WWW/Library/Implementation/HTMIME.c6
-rw-r--r--WWW/Library/Implementation/HTRules.c5
-rw-r--r--WWW/Library/Implementation/HTUtils.h23
-rw-r--r--WWW/Library/Implementation/SGML.c6
6 files changed, 50 insertions, 22 deletions
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index 03781a63..da6cc477 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFTP.c,v 1.128 2016/11/24 23:43:55 tom Exp $
+ * $LynxId: HTFTP.c,v 1.129 2017/07/02 20:42:32 tom Exp $
  *
  *			File Transfer Protocol (FTP) Client
  *			for a WorldWideWeb browser
@@ -2324,6 +2324,7 @@ static EntryInfo *parse_dir_entry(char *entry,
 	    break;
 	}
 	/* fall through if server_type changed for *first == TRUE ! */
+	/* FALLTHRU */
     case UNIX_SERVER:
     case PETER_LEWIS_SERVER:
     case MACHTEN_SERVER:
@@ -2706,7 +2707,8 @@ static char *FormatSize(char **bufp,
     char fmt[512];
 
     if (*start) {
-	sprintf(fmt, "%%%.*s" PRI_off_t, (int) sizeof(fmt) - 3, start);
+	sprintf(fmt, "%%%.*s" PRI_off_t,
+		  (int) sizeof(fmt) - DigitsOf(start) - 3, start);
 
 	HTSprintf(bufp, fmt, value);
     } else {
@@ -2724,7 +2726,8 @@ static char *FormatNum(char **bufp,
     char fmt[512];
 
     if (*start) {
-	sprintf(fmt, "%%%.*sld", (int) sizeof(fmt) - 3, start);
+	sprintf(fmt, "%%%.*sld",
+		(int) sizeof(fmt) - DigitsOf(start) - 3, start);
 	HTSprintf(bufp, fmt, value);
     } else {
 	sprintf(fmt, "%lu", value);
@@ -3951,12 +3954,22 @@ int HTFTPLoad(const char *name,
 	     */
 	    if (control->is_binary) {
 		int code;
-		off_t size;
 
 		status = send_cmd_2("SIZE", filename);
-		if (status == 2 &&
-		    sscanf(response_text, "%d %" PRI_off_t, &code, &size) == 2) {
-		    anchor->content_length = size;
+		if (status == 2) {
+#if !defined(HAVE_LONG_LONG) && defined(GUESS_PRI_off_t)
+		    long size;
+
+		    if (sscanf(response_text, "%d %ld", &code, &size) == 2) {
+			anchor->content_length = (off_t) size;
+		    }
+#else
+		    off_t size;
+		    if (sscanf(response_text, "%d %" SCN_off_t, &code, &size)
+			== 2) {
+			anchor->content_length = size;
+		    }
+#endif
 		}
 	    }
 	    status = send_cmd_2("RETR", filename);
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index ffb23324..77817a4f 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFile.c,v 1.146 2017/04/27 20:51:05 tom Exp $
+ * $LynxId: HTFile.c,v 1.147 2017/07/02 20:42:33 tom Exp $
  *
  *			File Access				HTFile.c
  *			===========
@@ -208,7 +208,8 @@ static char *FormatSize(char **bufp,
     char fmt[512];
 
     if (*start) {
-	sprintf(fmt, "%%%.*s" PRI_off_t, (int) sizeof(fmt) - 3, start);
+	sprintf(fmt, "%%%.*s" PRI_off_t,
+		  (int) sizeof(fmt) - DigitsOf(start) - 3, start);
 
 	HTSprintf0(bufp, fmt, entry);
     } else {
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index 2014e459..1644793a 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTMIME.c,v 1.94 2017/07/02 16:49:21 tom Exp $
+ * $LynxId: HTMIME.c,v 1.95 2017/07/02 19:40:06 tom Exp $
  *
  *			MIME Message Parse			HTMIME.c
  *			==================
@@ -2004,7 +2004,7 @@ static void HTMIME_put_character(HTStream *me, int c)
     case miWWW_AUTHENTICATE:
 	me->field = me->state;	/* remember it */
 	me->state = miSKIP_GET_VALUE;
-	/* Fall through! */
+	/* FALLTHRU */
 
     case miSKIP_GET_VALUE:
 	if (c == '\n') {
@@ -2021,6 +2021,7 @@ static void HTMIME_put_character(HTStream *me, int c)
 	me->value_pointer = me->value;
 	me->state = miGET_VALUE;
 	/* Fall through to store first character */
+	/* FALLTHRU */
 
     case miGET_VALUE:
       GET_VALUE:
@@ -2033,6 +2034,7 @@ static void HTMIME_put_character(HTStream *me, int c)
 	    }
 	}
 	/* Fall through (if end of line) */
+	/* FALLTHRU */
 
     case miJUNK_LINE:
 	if (c == '\n') {
diff --git a/WWW/Library/Implementation/HTRules.c b/WWW/Library/Implementation/HTRules.c
index b1e263bb..91ac93d5 100644
--- a/WWW/Library/Implementation/HTRules.c
+++ b/WWW/Library/Implementation/HTRules.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTRules.c,v 1.46 2016/11/24 15:29:50 tom Exp $
+ * $LynxId: HTRules.c,v 1.47 2017/07/02 19:45:22 tom Exp $
  *
  *	Configuration manager for Hypertext Daemon		HTRules.c
  *	==========================================
@@ -291,6 +291,7 @@ char *HTTranslate(const char *required)
 	case HT_Progress:
 	case HT_Alert:
 	    LYFixCursesOn("show rule message:");	/* and fall through */
+	    /* FALLTHRU */
 	case HT_AlwaysAlert:
 	    pMsg = r->equiv ? r->equiv :
 		(r->op == HT_AlwaysAlert) ? "%s" : "Rule: %s";
@@ -335,7 +336,7 @@ char *HTTranslate(const char *required)
 		CTRACE((tfp, "HTRule: Pass `%s'\n", current));
 		return current;
 	    }
-	    /* Else fall through ...to map and pass */
+	    /* FALLTHRU */
 
 	case HT_Map:
 	case HT_Redirect:
diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h
index 744557ab..bd6391bb 100644
--- a/WWW/Library/Implementation/HTUtils.h
+++ b/WWW/Library/Implementation/HTUtils.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTUtils.h,v 1.122 2016/11/23 22:16:51 tom Exp $
+ * $LynxId: HTUtils.h,v 1.124 2017/07/02 20:40:14 tom Exp $
  *
  * Utility macros for the W3 code library
  * MACROS FOR GENERAL USE
@@ -19,11 +19,11 @@
 
 /* see AC_FUNC_ALLOCA macro */
 #ifdef __GNUC__
-# define alloca __builtin_alloca
+# define alloca(size) __builtin_alloca(size)
 #else
 # ifdef _MSC_VER
 #  include <malloc.h>
-#  define alloca _alloca
+#  define alloca(size) _alloca(size)
 # else
 #  if HAVE_ALLOCA_H
 #   include <alloca.h>
@@ -191,7 +191,11 @@ extern int ignore_unused;
 #undef small			/* see <w32api/rpcndr.h> */
 #endif
 
-#ifdef HAVE_ATOLL
+#if defined(__DARWIN_NO_LONG_LONG)
+#undef HAVE_ATOLL
+#endif
+
+#if defined(HAVE_ATOLL)
 #define LYatoll(n) atoll(n)
 #else
 extern off_t LYatoll(const char *value);
@@ -575,6 +579,8 @@ extern int WWW_TraceMask;
 #include <inttypes.h>
 #endif
 
+#define DigitsOf(type)  (int)((sizeof(type)*8)/3)
+
 /*
  * Printing/scanning-formats for "off_t", as well as cast needed to fit.
  */
@@ -602,13 +608,18 @@ extern int WWW_TraceMask;
 #endif
 
 #ifndef PRI_off_t
-#if defined(HAVE_LONG_LONG) && (SIZEOF_OFF_T > SIZEOF_LONG)
+#define GUESS_PRI_off_t
+#if (SIZEOF_OFF_T == SIZEOF_LONG)
+#define PRI_off_t	"ld"
+#define SCN_off_t	"ld"
+#define CAST_off_t(n)	(long)(n)
+#elif defined(HAVE_LONG_LONG)
 #define PRI_off_t	"lld"
 #define SCN_off_t	"lld"
 #define CAST_off_t(n)	(long long)(n)
 #else
 #define PRI_off_t	"ld"
-#define SCN_off_t	"ld"
+/* SCN_off_t requires workaround */
 #define CAST_off_t(n)	(long)(n)
 #endif
 #endif
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index 138ce334..3087f0b7 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: SGML.c,v 1.160 2017/01/01 00:56:18 Takeshi.Hataguchi Exp $
+ * $LynxId: SGML.c,v 1.161 2017/07/02 19:45:00 tom Exp $
  *
  *			General SGML Parser code		SGML.c
  *			========================
@@ -1895,7 +1895,7 @@ static void SGML_character(HTStream *me, int c_in)
 	if (!(c == '>' && me->slashedtag && TOASCII(clong) < 127)) {
 	    me->state = S_text;
 	}
-	/* fall through in any case! */
+	/* FALLTHRU */
     case S_text:
 	if (IS_CJK_TTY && ((TOASCII(c) & 0200) != 0)
 #ifdef EXP_JAPANESEUTF8_SUPPORT
@@ -3567,7 +3567,7 @@ static void SGML_character(HTStream *me, int c_in)
 	    PSRCSTART(attrval);
 #endif
 	me->state = S_value;
-	/*  no break!  fall through to S_value and process current `c`   */
+	/* FALLTHRU */
 
     case S_value:
 	if (WHITE(c) || (c == '>')) {	/* End of word */