patch for win64 build

Moderator: Project members

Post Reply
Message
Author
twu2
425 Can't open data connection
Posts: 45
Joined: 2005-02-26 16:54

patch for win64 build

#1 Post by twu2 » 2011-04-06 09:36

http://trac.filezilla-project.org/ticket/7271

this include patch for filezilla 3.4.0, wxWidgets 2.8.12, gnutls 2.10.5.
after patched, you can build win64 version using mingw64.

it work for FTP and SFTP.
but still not work for FTPS and FTPES, it will crash during handshake. I'm still trying to find the reason for this.

twu2
425 Can't open data connection
Posts: 45
Joined: 2005-02-26 16:54

Re: patch for win64 build

#2 Post by twu2 » 2011-04-06 11:36

the crash caused by the asm code in libgcrypt, it's not work when use mingw64.
after add --disable-asm for libgcrypt, then rebuild libgcrypt, gnutls, filezilla.
now the win64 filezilla work fine also for FTPS/FTPES.

twu2
425 Can't open data connection
Posts: 45
Joined: 2005-02-26 16:54

Re: patch for win64 build

#3 Post by twu2 » 2011-04-06 11:58

if you want to test this, you can download the binary file build by me, just replace the win32 file in filezilla folder.

here is the file:
http://sourceforge.net/projects/filezil ... z/download

edit: update the new binary file created using the new wxwidgets patch.
Last edited by twu2 on 2011-04-07 06:39, edited 1 time in total.

User avatar
botg
Site Admin
Posts: 31874
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse
Contact:

Re: patch for win64 build

#4 Post by botg » 2011-04-06 22:19

I fail to see how this is supposed to work, considering that wxWidgets 2.x does not compile as 64bit Windows application.

In particular, your patch for wx is flawed in that you cast 64bit pointers to 32bit integers.

tateu
450 Internal Error
Posts: 38
Joined: 2004-11-13 01:19

Re: patch for win64 build

#5 Post by tateu » 2011-04-07 04:35

botg wrote:wxWidgets 2.x does not compile as 64bit Windows application.
Not true. I am using a 64bit static build of wxWidgets v2.8.10 with my 64 bit app and Visual Studio 2008.

twu2
425 Can't open data connection
Posts: 45
Joined: 2005-02-26 16:54

Re: patch for win64 build

#6 Post by twu2 » 2011-04-07 06:08

I just update the patch for wxWidgets, remove some un-necessary cast from int64 to int32.

some type I change in this patch, the size in win64 are:

Code: Select all

sizeof int = 4
sizeof size_t = 8
sizeof ssize_t = 8
sizeof intptr_t = 8
sizeof HANDLE = 8
sizeof HGLOBAL = 8
sizeof HINSTANCE = 8
sizeof LPDEVMODE = 8
sizeof UINT_PTR = 8
sizeof ULONG_PTR = 8
sizeof LPARAM = 8
and in win32, all above (except intptr_t, it's not define in win32) size are 4.

the only cast from int64 to int32 in this new patch is the return value of thread.

Code: Select all

diff --strip-trailing-cr -Nur wxWidgets-2.8.12/src/msw/thread.cpp wxWidgets-2.8.12.patched/src/msw/thread.cpp
--- wxWidgets-2.8.12/src/msw/thread.cpp	2011-03-22 20:00:54 +0800
+++ wxWidgets-2.8.12.patched/src/msw/thread.cpp	2011-04-07 13:32:55 +0800
@@ -522,7 +522,7 @@
             return (THREAD_RETVAL)-1;
         }
 
-        rc = (THREAD_RETVAL)thread->Entry();
+        rc = (THREAD_RETVAL)(intptr_t)thread->Entry();
     }
     wxCATCH_ALL( wxTheApp->OnUnhandledException(); )
 
@@ -842,7 +842,7 @@
             break;
         }
 
-        if ( (DWORD)rc != STILL_ACTIVE )
+        if ( (intptr_t)rc != STILL_ACTIVE )
             break;
 
         // give the other thread some time to terminate, otherwise we may be
@@ -1000,7 +1000,7 @@
     // could we set all bits?
     if ( level != 0 )
     {
-        wxLogDebug(_T("bad level %u in wxThread::SetConcurrency()"), level);
+        wxLogDebug(_T("bad level %Iu in wxThread::SetConcurrency()"), level);
 
         return false;
     }
@@ -1162,7 +1162,7 @@
     }
 
 #ifdef wxUSE_BEGIN_THREAD
-    _endthreadex((unsigned)status);
+    _endthreadex((unsigned)(intptr_t)status);
 #else // !VC++
     ::ExitThread((DWORD)status);
 #endif // VC++/!VC++
in wxWidgets 2.9.x trunk, it's doing the same cast here. the return value for thread is a 32bits integer, it can't hold win64 pointer also.
and the _endthreadex() parameter is a unsigned int also in win64. so I think the cast for this won't cause any bad result.

Post Reply