SOURCES: elinks-bug899.patch (NEW) - new

adamg adamg at pld-linux.org
Fri Dec 15 23:50:59 CET 2006


Author: adamg                        Date: Fri Dec 15 22:50:59 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- new

---- Files affected:
SOURCES:
   elinks-bug899.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/elinks-bug899.patch
diff -u /dev/null SOURCES/elinks-bug899.patch:1.1
--- /dev/null	Fri Dec 15 23:50:59 2006
+++ SOURCES/elinks-bug899.patch	Fri Dec 15 23:50:54 2006
@@ -0,0 +1,113 @@
+diff --git a/src/osdep/types.h b/src/osdep/types.h
+index 9d0f282..2404ac0 100644
+--- a/src/osdep/types.h
++++ b/src/osdep/types.h
+@@ -53,6 +53,28 @@
+ #endif
+ #endif
+ 
++#if defined(HAVE_LONG_LONG) && !defined(LLONG_MAX)
++#ifdef MAXLLONG
++#define LLONG_MAX MAXLLONG
++#elif SIZEOF_LONG_LONG == 8
++#define LLONG_MAX 9223372036854775807LL
++#elif SIZEOF_LONG_LONG == 4
++#define LLONG_MAX LONG_MAX
++#endif
++#endif
++
++#ifndef OFFT_MAX
++#if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T == SIZEOF_LONG_LONG
++#define OFFT_MAX LLONG_MAX
++#elif SIZEOF_OFF_T == SIZEOF_LONG
++#define OFFT_MAX LONG_MAX
++#elif SIZEOF_OFF_T == SIZEOF_INT
++#define OFFT_MAX INT_MAX
++#elif SIZEOF_OFF_T == SIZEOF_SHORT
++#define OFFT_MAX SHRT_MAX
++#endif
++#endif
++
+ #ifndef HAVE_UINT16_T
+ #if SIZEOF_CHAR == 2
+ typedef unsigned char uint16_t;
+diff --git a/src/protocol/ftp/ftp.c b/src/protocol/ftp/ftp.c
+index 87ec444..01e301b 100644
+--- a/src/protocol/ftp/ftp.c
++++ b/src/protocol/ftp/ftp.c
+@@ -1091,7 +1091,7 @@ display_dir_entry(struct cache_entry *cached, off_t *pos, int *tries,
+ 	add_to_string(&string, "   1 ftp      ftp ");
+ 
+ 	if (ftp_info->size != FTP_SIZE_UNKNOWN) {
+-		add_format_to_string(&string, "%12lu ", ftp_info->size);
++		add_format_to_string(&string, "%12" OFF_T_FORMAT " ", ftp_info->size);
+ 	} else {
+ 		add_to_string(&string, "           - ");
+ 	}
+diff --git a/src/protocol/ftp/parse.c b/src/protocol/ftp/parse.c
+index b5caeba..be4326e 100644
+--- a/src/protocol/ftp/parse.c
++++ b/src/protocol/ftp/parse.c
+@@ -41,10 +41,10 @@
+ #define skip_nonspace_end(src, end) \
+ 	do { while ((src) < (end) && *(src) != ' ') (src)++; } while (0)
+ 
+-static long
+-parse_ftp_number(unsigned char **src, unsigned char *end, long from, long to)
++static off_t
++parse_ftp_number(unsigned char **src, unsigned char *end, off_t from, off_t to)
+ {
+-	long number = 0;
++	off_t number = 0;
+ 	unsigned char *pos = *src;
+ 
+ 	for (; pos < end && isdigit(*pos); pos++)
+@@ -104,7 +104,7 @@ parse_ftp_eplf_response(struct ftp_file_info *info, unsigned char *src, int len)
+ 
+ 		case FTP_EPLF_SIZE:
+ 			if (src >= pos) break;
+-			info->size = parse_ftp_number(&src, pos, 0, LONG_MAX);
++			info->size = parse_ftp_number(&src, pos, 0, OFFT_MAX);
+ 			break;
+ 
+ 		case FTP_EPLF_MTIME:
+@@ -278,7 +278,7 @@ parse_ftp_unix_response(struct ftp_file_info *info, unsigned char *src, int len)
+ 				break;
+ 			}
+ 
+-			info->size = parse_ftp_number(&src, pos, 0, LONG_MAX);
++			info->size = parse_ftp_number(&src, pos, 0, OFFT_MAX);
+ 			break;
+ 
+ 		case FTP_UNIX_DAY:
+@@ -543,7 +543,7 @@ parse_ftp_winnt_response(struct ftp_file_info *info, unsigned char *src, int len
+ 	memset(&mtime, 0, sizeof(mtime));
+ 	mtime.tm_isdst = -1;
+ 
+-	mtime.tm_mon = parse_ftp_number(&src, end, 1, 12);
++	mtime.tm_mon = (int) parse_ftp_number(&src, end, 1, 12);
+ 	if (src + 2 >= end || *src != '-')
+ 		return NULL;
+ 
+@@ -587,7 +587,7 @@ parse_ftp_winnt_response(struct ftp_file_info *info, unsigned char *src, int len
+ 
+ 	} else if (isdigit(*src)) {
+ 		info->type = FTP_FILE_PLAINFILE;
+-		info->size = parse_ftp_number(&src, end, 0, LONG_MAX);
++		info->size = parse_ftp_number(&src, end, 0, OFFT_MAX);
+ 		info->permissions = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
+ 
+ 	} else {
+diff --git a/src/protocol/ftp/parse.h b/src/protocol/ftp/parse.h
+index e777398..18cfacd 100644
+--- a/src/protocol/ftp/parse.h
++++ b/src/protocol/ftp/parse.h
+@@ -19,7 +19,7 @@ struct ftp_file_info {
+ 	enum ftp_file_type type;	/* File type */
+ 	struct string name;		/* File name */
+ 	struct string symlink;		/* Link to which file points */
+-	long size;			/* File size. -1 if unknown. */
++	off_t size;			/* File size. -1 if unknown. */
+ 	time_t mtime;			/* Modification time */
+ 	unsigned int local_time_zone:1;	/* What format the mtime is in */
+ 	mode_t permissions;		/* File permissions */
================================================================


More information about the pld-cvs-commit mailing list