FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Small bug in tFtp class
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Small bug in tFtp class
Posted: 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 (fw): Select all Collapse
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
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: Small bug in tFtp class
Posted: Tue Jan 29, 2013 07:34 AM

Antonio, can you confirm this ?

kind regards

Stefan

Continue the discussion