Cone doesn't like fileno() macro (was: GCC flaw in FreeBSD5? Cone 0.58 does not compile)

Matthias Andree <[email protected]>
Newsgroups gmane.mail.cone
Message-ID <[email protected]>
Sam Varshavchik <[email protected]> writes:

>> The code looks fine and compiles fine on SuSE Linux 8.2 with an updated
>> vanilla GCC 3.3.3. Given that mail::file has an operator FILE *() that
>> returns the FILE* pointer, I don't see what the compiler wants to tell
>> me. Cc:'ing FreeBSD-current.
>
> Perhaps fileno() is a macro?

Yes, see Jaques' reply.

> Try inserting an explicit cast to FILE *.

This patch will be used for the FreeBSD port:

--- libmail/mbox.C~	Tue Apr  6 04:06:36 2004
+++ libmail/mbox.C	Sat Apr 17 22:05:27 2004
@@ -1243,7 +1243,7 @@
 				// Remember how big the saveFile was,
 				// originally.
 
-				if (fstat(fileno(*saveFile), &stat_buf) < 0)
+				if (fstat(fileno(static_cast<FILE *>(*saveFile)), &stat_buf) < 0)
 				{
 					return false;
 				}
@@ -1280,7 +1280,7 @@
 			{
 				// Potential short cut.
 
-				if (fstat(fileno(scanFile), &stat_buf) < 0)
+				if (fstat(fileno(static_cast<FILE *>(scanFile)), &stat_buf) < 0)
 				{
 					return false;
 				}
--- libmail/mboxadd.C~	Wed Aug 27 04:37:22 2003
+++ libmail/mboxadd.C	Sat Apr 17 22:06:10 2004
@@ -99,13 +99,13 @@
 {
 	struct stat st;
 
-	mail::mbox::sighandler updating(fileno(file));
+	mail::mbox::sighandler updating(fileno(static_cast<FILE *>(file)));
 
 	try {
 
 		// Make sure the mboxAccount file ends with a trailing newline
 
-		if (fstat(fileno(file), &st) < 0)
+		if (fstat(fileno(static_cast<FILE *>(file)), &st) < 0)
 		{
 			fail(strerror(errno));
 			return;
--- libmail/mboxgetmessage.C~	Wed Aug 27 04:37:22 2003
+++ libmail/mboxgetmessage.C	Sat Apr 17 22:06:42 2004
@@ -81,7 +81,7 @@
 	{
 		struct stat stat_buf;
 
-		if (fstat(fileno(file), &stat_buf) < 0)
+		if (fstat(fileno(static_cast<FILE *>(file)), &stat_buf) < 0)
 			endingPos=stat_buf.st_size;
 	}
 	else


-- 
Matthias Andree

Encrypt your mail: my GnuPG key ID is 0x052E7D95


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Courier-cone mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-cone
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.