]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/ftp.cpp
fixed pasting of Unicode strings
[wxWidgets.git] / src / common / ftp.cpp
index c85d7adbe3d20e6f7b6abc94d3cb4a94cb7d264e..5edc4b2e8bc775ec19be6c3b8d5407bc60baa29f 100644 (file)
@@ -596,10 +596,10 @@ wxSocketClient *wxFTP::GetPort()
     wxSscanf(straddr, wxT("%d,%d,%d,%d,%d,%d"),
              &a[2],&a[3],&a[4],&a[5],&a[0],&a[1]);
 
-    wxUint32 hostaddr = (wxUint16)a[5] << 24 |
-                        (wxUint16)a[4] << 16 |
-                        (wxUint16)a[3] << 8 |
-                        a[2];
+    wxUint32 hostaddr = (wxUint16)a[2] << 24 |
+                        (wxUint16)a[3] << 16 |
+                        (wxUint16)a[4] << 8 |
+                        a[5];
     wxUint16 port = (wxUint16)a[0] << 8 | a[1];
 
     wxIPV4address addr;
@@ -804,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.
@@ -849,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,
@@ -865,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,
@@ -887,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 NULL;
- 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