[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sylpheed
Subject:    [sylpheed:24136] PATCH: size_t fixes in procheader.c
From:       Alfons Hoogervorst <alfons () proteus ! demon ! nl>
Date:       2005-02-26 10:44:26
Message-ID: 20050226114426.4b998e1d.alfons () proteus ! demon ! nl
[Download RAW message or body]

Lo Hiro,

Please apply the attached patch.

procheader.c uses int where it should use size_t for portability reasons
(size_t is either a unsigned int and unsigned long). 

Besides that it makes the code portable in plain sylpheed, it would be a
starting point for a fix for a bug in claws, which happens to cast the
address of fgets() to "char * (*) (char *, int, void *) ".

Bye.

-- 
Ecuación algebraico sin solución posible,
a menos de poseer profundos conocimientos
en matemática - Revueltas (Ocho Por Radio)


["procheader.c.patch" (text/plain)]

--- sylpheed-old/trunk/src/procheader.c	2005-02-11 00:49:10.000000000 +0100
+++ sylpheed-new/trunk/src/procheader.c	2005-02-26 11:33:27.000000000 +0100
@@ -37,7 +37,7 @@
 
 #define BUFFSIZE	8192
 
-gint procheader_get_one_field(gchar *buf, gint len, FILE *fp,
+gint procheader_get_one_field(gchar *buf, size_t len, FILE *fp,
 			      HeaderEntry hentry[])
 {
 	gint nexthead;
@@ -147,7 +147,7 @@
 	return hnum;
 }
 
-gchar *procheader_get_unfolded_line(gchar *buf, gint len, FILE *fp)
+gchar *procheader_get_unfolded_line(gchar *buf, size_t len, FILE *fp)
 {
 	gboolean folded = FALSE;
 	gint nexthead;

--- sylpheed-old/trunk/src/procheader.h	2005-02-04 21:52:49.000000000 +0100
+++ sylpheed-new/trunk/src/procheader.h	2005-02-26 11:33:15.000000000 +0100
@@ -43,11 +43,11 @@
 };
 
 gint procheader_get_one_field		(gchar		*buf,
-					 gint		 len,
+					 size_t		 len,
 					 FILE		*fp,
 					 HeaderEntry	 hentry[]);
 gchar *procheader_get_unfolded_line	(gchar		*buf,
-					 gint		 len,
+					 size_t		 len,
 					 FILE		*fp);
 
 GSList *procheader_get_header_list_from_file	(const gchar	*file);




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic