Rui .. the fix below only does part of the job.  Don't forget about the
IA64 (Itanium) architecture, which defines int/long as 64 bits, while
the other
Wintel chips make int 32bits.  Pointers are 32 or 64 bits depending on
the chipset.

So if you go down the path to make the code properly compile & run on
64-bit architectures, don't break it on Itanium, or O/S such as HP/UX on
Itanium architectures.

I'll be happy to compile your revised code with full warnings on one of
my itanium systems under IA64 versions of HP/UX, LINUX, and Win2003 and
let you know if I find any portability issues .. and I thank you for
that work. 

Also, did you see this in defs.h ?? It also mucks things up.

#ifdef NO_SOCKLEN_T
 typedef int socklen_t
#endif 

- David


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rui
Jorge Coelho
Sent: Monday, March 17, 2008 9:32 AM
To: [email protected]
Subject: [shttpd-general] FW: Porting to 64 bits

Reply-To: [EMAIL PROTECTED]

Hi all!

I'm interesting in porting shttpd to 64 bits (win/un*x). Under Windows
using -Wp64 we get a few warnings:
string.c(73) : warning C4267: '=' : conversion from 'size_t' to 'int',
possible loss of data
shttpd.c(106) : warning C4244: '=' : conversion from '__w64 int' to
'int', possible loss of data
shttpd.c(108) : warning C4267: '=' : conversion from 'size_t' to 'int',
possible loss of data
shttpd.c(150) : warning C4244: '=' : conversion from 'SOCKET' to 'int',
possible loss of data
...

Under Windows 64 bits sockets are 8 bytes, against the usual 4 bytes.
Sock variable declaration should abstract this.
#if defined WINDOWS
        typedef SOCKET sock_t;
#else
        typedef int sock_t;
#endif
...
sock_t sock = socket(PF_INET, SOCK_STREAM, 6);

The changes are trivial, but a patch will touch a lot of code. Do you
want me to go ahead and submit a patch ?

http://www.ibm.com/developerworks/library/l-port64.html
http://msdn2.microsoft.com/en-us/library/3b2e7499(VS.71).aspx
http://developers.sun.com/solaris/articles/ILP32toLP64Issues.html
http://en.wikipedia.org/wiki/64-bit

Best Regards,
Rui



------------------------------------------------------------------------
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
shttpd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shttpd-general



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
shttpd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shttpd-general

Reply via email to