[tin 1.9.x] int -> size_t

Urs Janßen <[email protected]> Tue, 27 Nov 2007 18:00:31 +0100
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
the following should be safe (but I may have overlooked something), it
eleminates a few casts (and fixes a warning in post.c (where I used size_t
instead of int)).

-----------------------------------------------------------------------------
 include/proto.h |   10 +++++-----
 src/charset.c   |    2 +-
 src/cook.c      |    8 ++++----
 src/help.c      |    2 +-
 src/mail.c      |    2 +-
 src/misc.c      |    8 ++++----
 src/rfc2045.c   |   10 +++++-----
 src/rfc2047.c   |    2 +-
 8 files changed, 22 insertions(+), 22 deletions(-)
-----------------------------------------------------------------------------
diff -Nurp tin-1.9.3/include/proto.h tin-1.9.3.x/include/proto.h
--- tin-1.9.3/include/proto.h	2007-10-05 00:45:32.000000000 +0200
+++ tin-1.9.3.x/include/proto.h	2007-11-27 17:28:21.000000000 +0100
@@ -86,7 +86,7 @@ extern void write_attributes_file(const 
 /* charset.c */
 extern char *convert_to_printable(char *buf);
 extern t_bool is_art_tex_encoded(FILE *fp);
-extern void convert_iso2asc(char *iso, char **asc_buffer, int *max_line_len, int t);
+extern void convert_iso2asc(char *iso, char **asc_buffer, size_t *max_line_len, int t);
 extern void convert_tex2iso(char *from, char *to);
 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
 	extern wchar_t *wconvert_to_printable(wchar_t *wbuf);
@@ -116,7 +116,7 @@ extern void write_config_file(char *file
 /* cook.c */
 extern const char *get_filename(t_param *ptr);
 extern t_bool cook_article(t_bool wrap_lines, t_openartinfo *artinfo, int tabs, int hide_uue);
-extern t_bool expand_ctrl_chars(char **line, int *length, size_t cook_width);
+extern t_bool expand_ctrl_chars(char **line, size_t *length, size_t cook_width);
 
 /* curses.c */
 extern OUTC_RETTYPE outchar(OUTC_ARGS);
@@ -358,7 +358,7 @@ extern void get_author(t_bool thread, st
 extern void get_cwd(char *buf);
 extern void make_base_group_path(const char *base_dir, const char *group_name, char *group_path);
 extern void make_group_path(const char *name, char *path);
-extern void process_charsets(char **line, int *max_line_len, const char *network_charset, const char *local_charset, t_bool conv_tex2iso);
+extern void process_charsets(char **line, size_t *max_line_len, const char *network_charset, const char *local_charset, t_bool conv_tex2iso);
 extern void read_input_history_file(void);
 extern void rename_file(const char *old_filename, const char *new_filename);
 extern void show_inverse_video_status(void);
@@ -527,8 +527,8 @@ extern t_mailcap *get_mailcap_entry(t_pa
 extern void free_mailcap(t_mailcap *tmailcap);
 
 /* rfc2045.c */
-extern int read_decoded_base64_line(FILE *file, char **line, int *max_line_len, const int max_lines_to_read, char **rest);
-extern int read_decoded_qp_line(FILE *file, char **line, int *max_line_len, const int max_lines_to_read);
+extern int read_decoded_base64_line(FILE *file, char **line, size_t *max_line_len, const int max_lines_to_read, char **rest);
+extern int read_decoded_qp_line(FILE *file, char **line, size_t *max_line_len, const int max_lines_to_read);
 extern void rfc1521_encode(char *line, FILE *f, int e);
 
 /* rfc2046.c */
diff -Nurp tin-1.9.3/src/charset.c tin-1.9.3.x/src/charset.c
--- tin-1.9.3/src/charset.c	2007-10-05 00:22:30.000000000 +0200
+++ tin-1.9.3.x/src/charset.c	2007-11-27 17:28:54.000000000 +0100
@@ -153,7 +153,7 @@ void
 convert_iso2asc(
 	char *iso,
 	char **asc_buffer,
-	int *max_line_len,
+	size_t *max_line_len,
 	int t)
 {
 	constext *p;
diff -Nurp tin-1.9.3/src/cook.c tin-1.9.3.x/src/cook.c
--- tin-1.9.3/src/cook.c	2007-10-05 00:46:45.000000000 +0200
+++ tin-1.9.3.x/src/cook.c	2007-11-27 17:44:27.000000000 +0100
@@ -82,7 +82,7 @@ static t_openartinfo *art;
 t_bool
 expand_ctrl_chars(
 	char **line,
-	int *length,
+	size_t *length,
 	size_t lcook_width)
 {
 	t_bool ctrl_L = FALSE;
@@ -401,7 +401,7 @@ process_text_body_part(
 {
 	char *rest = NULL;
 	char *line = NULL, *buf;
-	int max_line_len = 0;
+	size_t max_line_len = 0;
 	int flags, len, lines_left;
 	int offsets[6];
 	int size_offsets = ARRAY_SIZE(offsets);
@@ -444,7 +444,7 @@ process_text_body_part(
 				 * especially if we must resize it.
 				 * So copy buf to line (and resize line if necessary).
 				 */
-				if (max_line_len < (int) strlen(buf) + 2) {
+				if (max_line_len < strlen(buf) + 2) {
 					max_line_len = strlen(buf) + 2;
 					line = my_realloc(line, max_line_len);
 				};
@@ -736,7 +736,7 @@ cook_article(
 		}
 
 		if (header_wanted(line)) {	/* Put cooked data */
-			int i = LEN;
+			size_t i = LEN;
 			char *l = my_strdup(rfc1522_decode(line));	/* FIXME: don't decode addr-part of From:/Cc:/ etc.pp. */
 
 			header_put = TRUE;
diff -Nurp tin-1.9.3/src/help.c tin-1.9.3.x/src/help.c
--- tin-1.9.3/src/help.c	2007-10-13 23:58:26.000000000 +0200
+++ tin-1.9.3.x/src/help.c	2007-11-27 17:25:22.000000000 +0100
@@ -446,7 +446,7 @@ make_help_page(
 	 * length is only needed to pass it to expand_ctrl_chars()
 	 * we have no need for the value
 	 */
-	int length;
+	size_t length;
 	size_t i;
 
 	if (!helppage)
diff -Nurp tin-1.9.3/src/mail.c tin-1.9.3.x/src/mail.c
--- tin-1.9.3/src/mail.c	2007-10-05 00:48:12.000000000 +0200
+++ tin-1.9.3.x/src/mail.c	2007-11-27 17:26:09.000000000 +0100
@@ -388,7 +388,7 @@ read_groups_descriptions(
 
 		if (group != NULL && group->description == NULL) {
 			char *r;
-			int r_len;
+			size_t r_len;
 
 			q = p;
 			while ((q = strchr(q, '\t')) != NULL)
diff -Nurp tin-1.9.3/src/misc.c tin-1.9.3.x/src/misc.c
--- tin-1.9.3/src/misc.c	2007-10-05 00:48:35.000000000 +0200
+++ tin-1.9.3.x/src/misc.c	2007-11-27 17:47:57.000000000 +0100
@@ -80,7 +80,7 @@ static int gnksa_dequote_plainphrase(cha
 static int strfeditor(char *editor, int linenum, const char *filename, char *s, size_t maxsize, char *format);
 static void write_input_history_file(void);
 #ifdef CHARSET_CONVERSION
-	static t_bool buffer_to_local(char **line, int *max_line_len, const char *network_charset, const char *local_charset);
+	static t_bool buffer_to_local(char **line, size_t *max_line_len, const char *network_charset, const char *local_charset);
 #endif /* CHARSET_CONVERSION */
 #if 0 /* currently unused */
 	static t_bool stat_article(long art, const char *group_path);
@@ -2287,7 +2287,7 @@ strip_name(
 static t_bool
 buffer_to_local(
 	char **line,
-	int *max_line_len,
+	size_t *max_line_len,
 	const char *network_charset,
 	const char *local_charset)
 {
@@ -2426,7 +2426,7 @@ buffer_to_local(
 				} while (inbytesleft > 0);
 
 				**&outbuf = '\0';
-				if (*max_line_len < (int) strlen(obuf) + 1) {
+				if (*max_line_len < strlen(obuf) + 1) {
 					*max_line_len = strlen(obuf) + 1;
 					*line = my_realloc(*line, *max_line_len);
 				}
@@ -2536,7 +2536,7 @@ buffer_to_ascii(
 void
 process_charsets(
 	char **line,
-	int *max_line_len,
+	size_t *max_line_len,
 	const char *network_charset,
 	const char *local_charset,
 	t_bool conv_tex2iso)
diff -Nurp tin-1.9.3/src/rfc2045.c tin-1.9.3.x/src/rfc2045.c
--- tin-1.9.3/src/rfc2045.c	2007-10-05 00:22:30.000000000 +0200
+++ tin-1.9.3.x/src/rfc2045.c	2007-11-27 17:52:55.000000000 +0100
@@ -42,7 +42,7 @@
 /*
  * local prototypes
  */
-static int put_rest(char **rest, char **line, int *max_line_len, const int offset);
+static int put_rest(char **rest, char **line, size_t *max_line_len, const int offset);
 static unsigned char bin2hex(unsigned int x);
 static void set_rest(char **rest, const char *ptr);
 
@@ -251,7 +251,7 @@ static int
 put_rest(
 	char **rest,
 	char **line,
-	int *max_line_len,
+	size_t *max_line_len,
 	const int offset)
 {
 	char *my_rest = *rest;
@@ -317,7 +317,7 @@ int
 read_decoded_base64_line(
 	FILE *file,
 	char **line,
-	int *max_line_len,
+	size_t *max_line_len,
 	const int max_lines_to_read,
 	char **rest)
 {
@@ -430,7 +430,7 @@ int
 read_decoded_qp_line(
 	FILE *file,
 	char **line,					/* where to copy the decoded line */
-	int *max_line_len,				/* (maximum) line length */
+	size_t *max_line_len,				/* (maximum) line length */
 	const int max_lines_to_read)	/* don't read more physical lines than told here */
 {
 	char *buf, *buf2;
@@ -512,7 +512,7 @@ read_decoded_qp_line(
 	} else	/* error in encoding: copy raw line */
 		ptr = buf;
 
-	if (*max_line_len < (int) strlen(ptr) + 1) {
+	if (*max_line_len < strlen(ptr) + 1) {
 		*max_line_len = strlen(ptr) + 1;
 		*line = my_realloc(*line, *max_line_len);
 	}
diff -Nurp tin-1.9.3/src/rfc2047.c tin-1.9.3.x/src/rfc2047.c
--- tin-1.9.3/src/rfc2047.c	2007-10-10 11:55:41.000000000 +0200
+++ tin-1.9.3.x/src/rfc2047.c	2007-11-27 17:32:35.000000000 +0100
@@ -224,7 +224,7 @@ rfc1522_decode(
 	char *t;
 #define BUFFER_LEN 2048
 	static char buffer[BUFFER_LEN];
-	int max_len;
+	size_t max_len;
 	char charset[1024];
 	char encoding;
 	t_bool adjacentflag = FALSE;