X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a5d46b7362198fd94a5fd3b751df86287f2187bc..a63d48fa138e9eaa3079172ace9a804ba5b0415e:/src/common/ftp.cpp diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index 5b11e509a0..83f419d546 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -10,14 +10,14 @@ // Created: 07/07/1997 // RCS-ID: $Id$ // Copyright: (c) 1997, 1998 Guilhem Lavaux -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ // declarations // ============================================================================ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "ftp.h" #endif @@ -507,7 +507,7 @@ public: { delete m_i_socket; - if ( LastError() == wxStream_NOERROR ) + if ( IsOk() ) { // wait for "226 transfer completed" m_ftp->CheckResult('2'); @@ -524,6 +524,8 @@ public: wxFTP *m_ftp; size_t m_ftpsize; + + DECLARE_NO_COPY_CLASS(wxInputFTPStream) }; class wxOutputFTPStream : public wxSocketOutputStream @@ -558,6 +560,8 @@ public: } wxFTP *m_ftp; + + DECLARE_NO_COPY_CLASS(wxOutputFTPStream) }; wxSocketClient *wxFTP::GetPort() @@ -672,7 +676,7 @@ wxOutputStream *wxFTP::GetOutputStream(const wxString& path) wxString tmp_str = wxT("STOR ") + path; if ( !CheckCommand(tmp_str, '1') ) - return FALSE; + return NULL; m_streaming = TRUE; @@ -800,7 +804,9 @@ int wxFTP::GetFileSize(const wxString& fileName) SetTransferMode(oldTransfermode); } - if ( !ok ) // this is not a direct else clause.. The size command might return an invalid "2yz" reply + // this is not a direct else clause.. The size command might return an + // invalid "2yz" reply + if ( !ok ) { // The server didn't understand the "SIZE"-command or it // returned an invalid reply. @@ -845,12 +851,7 @@ int wxFTP::GetFileSize(const wxString& fileName) if ( wxSscanf(fileList[i].c_str(), _T("%*s %*s %*s %*s %i %*s %*s %*s %*s"), - &filesize) == 9 ) - { - // We've gotten a good response - ok = TRUE; - } - else + &filesize) != 9 ) { // Hmm... Invalid response wxLogTrace(FTP_TRACE_MASK, @@ -861,12 +862,7 @@ int wxFTP::GetFileSize(const wxString& fileName) { if ( wxSscanf(fileList[i].c_str(), _T("%*s %*s %i %*s"), - &filesize) == 4 ) - { - // valid response - ok = TRUE; - } - else + &filesize) != 4 ) { // something bad happened..? wxLogTrace(FTP_TRACE_MASK, @@ -883,47 +879,5 @@ int wxFTP::GetFileSize(const wxString& fileName) return filesize; } - -#if WXWIN_COMPATIBILITY_2 -// deprecated -wxList *wxFTP::GetList(const wxString& wildcard, bool details) -{ - wxSocketBase *sock = GetPort(); - if (!sock) - return FALSE; - wxList *file_list = new wxList; - wxString line; - // NLST : List of Filenames (including Directory's !) - // LIST : depending on BS of FTP-Server - // - Unix : result like "ls" command - // - Windows : like "dir" command - // - others : ? - if (!details) - line = _T("NLST"); // Default - else - line = _T("LIST"); - if (!wildcard.IsNull()) - line += wildcard; - if (!CheckCommand(line, '1')) - { - delete sock; - delete file_list; - return NULL; - } - while (GetLine(sock, line) == wxPROTO_NOERR) - { - file_list->Append((wxObject *)(new wxString(line))); - } - if (!CheckResult('2')) - { - delete sock; - file_list->DeleteContents(TRUE); - delete file_list; - return NULL; - } - return file_list; -} -#endif // WXWIN_COMPATIBILITY_2 - #endif // wxUSE_PROTOCOL_FTP