Small bug in tFtp class

Small bug in tFtp class

Postby StefanHaupt » Mon Jan 28, 2013 11:17 am

Antonio,

I found a small bug in the method ::Driectory() of tFtp class. If cMask contains a filename that is not found on the ftp server, oWin32FindData:cFileName is not empty and seems to contain dummy value. So checking ::hFtpDir is the correct way.

Code: Select all  Expand view
if ::hFTP != nil
      cBuffer = oWin32FindData:cBuffer
      hFTPDir = FtpFindFirstFile( ::hFTP, cMask, @cBuffer, 0, 0 )
      oWin32FindData:cBuffer = cBuffer
      //if ! Empty( oWin32FindData:cFileName )
      if hFtpDir != 0                                               // changed !!
         AAdd( aFiles, { oWin32FindData:cFileName,;
                         oWin32FindData:nSizeLow,;
                         FileTimeToDate( oWin32FindData:nLastWriteAccess ),;
                         FileTimeToTime( oWin32FindData:nLastWriteAccess ) } )
         while InternetFindNextFile( hFTPDir, @cBuffer )
            oWin32FindData:cBuffer = cBuffer
            AAdd( aFiles, { oWin32FindData:cFileName,;
                            oWin32FindData:nSizeLow,;
                            FileTimeToDate( oWin32FindData:nLastWriteAccess ),;
                            FileTimeToTime( oWin32FindData:nLastWriteAccess ) } )
         end
      endif
      InternetCloseHandle( hFTPDir )
   endif
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Small bug in tFtp class

Postby StefanHaupt » Tue Jan 29, 2013 7:34 am

Antonio, can you confirm this ?
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 117 guests