[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/runtime/kioslave
From:       David Faure <faure () kde ! org>
Date:       2009-02-18 22:39:17
Message-ID: 1234996757.785571.11282.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 928122 by dfaure:

Catch more error(foo, QByteArray) errors, and port KDE_foo to KDE::foo in kio_sftp \
while I was at it


 M  +1 -1      cgi/cgi.cpp  
 M  +3 -3      filter/filter.cc  
 M  +0 -16     remote/tests/testremote.cpp  
 M  +15 -15    sftp/kio_sftp.cpp  


--- trunk/KDE/kdebase/runtime/kioslave/cgi/cgi.cpp #928121:928122
@@ -108,7 +108,7 @@
 
     if ( !fd ) {
       kDebug(7124) << "Error opening '" << filepath << "'";
-      error( KIO::ERR_CANNOT_OPEN_FOR_READING, filepath );
+      error(KIO::ERR_CANNOT_OPEN_FOR_READING, path);
       return;
     }
   } else {
--- trunk/KDE/kdebase/runtime/kioslave/filter/filter.cc #928121:928122
@@ -69,19 +69,19 @@
     subURL.setProtocol("file");
 
     if (subURL.isEmpty()) {
-        error( KIO::ERR_NO_SOURCE_PROTOCOL, mProtocol );
+        error(KIO::ERR_NO_SOURCE_PROTOCOL, QString::fromLatin1(mProtocol));
         return;
     }
 
     QFile localFile(url.path());
     if (!localFile.open(QIODevice::ReadOnly)) {
-        error( KIO::ERR_COULD_NOT_READ, mProtocol );
+        error(KIO::ERR_COULD_NOT_READ, QString::fromLatin1(mProtocol));
         return;
     }
 
     if (!filter) {
         // TODO better error message
-        error( KIO::ERR_INTERNAL, mProtocol );
+        error(KIO::ERR_INTERNAL, QString::fromLatin1(mProtocol));
         return;
     }
 
--- trunk/KDE/kdebase/runtime/kioslave/remote/tests/testremote.cpp #928121:928122
@@ -26,22 +26,6 @@
 
 #include <stdlib.h>
 
-static bool check(const QString& txt, QString a, QString b)
-{
-    if (a.isEmpty())
-        a.clear();
-    if (b.isEmpty())
-        b.clear();
-    if (a == b) {
-        kDebug() << txt << " : checking '" << a << "' against expected value '" << b \
                << "'... " << "ok";
-    }
-    else {
-        kDebug() << txt << " : checking '" << a << "' against expected value '" << b \
                << "'... " << "KO !";
-        exit(1);
-    }
-    return true;
-}
-
 int main(int argc, char *argv[])
 {
     //KApplication::disableAutoDcopRegistration();
--- trunk/KDE/kdebase/runtime/kioslave/sftp/kio_sftp.cpp #928121:928122
@@ -218,8 +218,8 @@
         return;
 
     KDE_struct_stat buff_orig;
-    QByteArray dest_orig ( QFile::encodeName(dest.path()) );
-    bool origExists = (KDE_lstat( dest_orig.data(), &buff_orig ) != -1);
+    const QString dest_orig = dest.path();
+    bool origExists = (KDE::lstat( dest_orig, &buff_orig ) != -1);
 
     if (origExists)
     {
@@ -237,7 +237,7 @@
     }
 
     KIO::filesize_t offset = 0;
-    QByteArray dest_part ( dest_orig + ".part" );
+    QString dest_part(dest_orig + ".part");
 
     int fd = -1;
     bool partExists = false;
@@ -246,7 +246,7 @@
     if (markPartial)
     {
         KDE_struct_stat buff_part;
-        partExists = (KDE_stat( dest_part.data(), &buff_part ) != -1);
+        partExists = (KDE::stat(dest_part, &buff_part ) != -1);
 
         if (partExists && buff_part.st_size > 0 && S_ISREG(buff_part.st_mode))
         {
@@ -259,7 +259,7 @@
 
         if (offset > 0)
         {
-            fd = KDE_open(dest_part.data(), O_RDWR);
+            fd = KDE::open(dest_part, O_RDWR);
             offset = KDE_lseek(fd, 0, SEEK_END);
             if (offset == 0)
             {
@@ -272,7 +272,7 @@
             // Set up permissions properly, based on what is done in file io-slave
             int openFlags = (O_CREAT | O_TRUNC | O_WRONLY);
             int initialMode = (mode == -1) ? 0666 : (mode | S_IWUSR);
-            fd = KDE_open(dest_part.data(), openFlags, initialMode);
+            fd = KDE::open(dest_part, openFlags, initialMode);
         }
     }
     else
@@ -280,7 +280,7 @@
         // Set up permissions properly, based on what is done in file io-slave
         int openFlags = (O_CREAT | O_TRUNC | O_WRONLY);
         int initialMode = (mode == -1) ? 0666 : (mode | S_IWUSR);
-        fd = KDE_open(dest_orig.data(), openFlags, initialMode);
+        fd = KDE::open(dest_orig, openFlags, initialMode);
     }
 
     if(fd == -1)
@@ -299,7 +299,7 @@
       // Should we keep the partially downloaded file ??
       KIO::filesize_t size = config()->readEntry("MinimumKeepSize", \
DEFAULT_MINIMUM_KEEP_SIZE);  if (info.size < size)
-        ::remove(dest_part.data());
+        QFile::remove(dest_part);
 
       error(info.code, info.text);
       return;
@@ -314,7 +314,7 @@
     //
     if (markPartial)
     {
-      if (::rename(dest_part.data(), dest_orig.data()) != 0)
+      if (KDE::rename(dest_part, dest_orig) != 0)
       {
         error (ERR_CANNOT_RENAME_PARTIAL, dest_part);
         return;
@@ -1386,15 +1386,15 @@
 
     r >> type >> id;
     if( id != expectedId ) {
-        kError(KIO_SFTP_DB) << "mkdir: sftp packet id mismatch" << endl;
-        error(ERR_COULD_NOT_MKDIR, path);
+        kError(KIO_SFTP_DB) << "mkdir: sftp packet id mismatch";
+        error(ERR_COULD_NOT_MKDIR, url.path());
         finished();
         return;
     }
 
     if( type != SSH2_FXP_STATUS ) {
-        kError(KIO_SFTP_DB) << "mkdir(): unexpected packet type of " << type << \
                endl;
-        error(ERR_COULD_NOT_MKDIR, path);
+        kError(KIO_SFTP_DB) << "mkdir(): unexpected packet type of" << type;
+        error(ERR_COULD_NOT_MKDIR, url.path());
         finished();
         return;
     }
@@ -1402,7 +1402,7 @@
     int code;
     r >> code;
     if( code != SSH2_FX_OK ) {
-        kError(KIO_SFTP_DB) << "mkdir(): failed with code " << code << endl;
+        kError(KIO_SFTP_DB) << "mkdir(): failed with code " << code;
 
         // Check if mkdir failed because the directory already exists so that
         // we can return the appropriate message...
@@ -1413,7 +1413,7 @@
           return;
         }
 
-        error(ERR_COULD_NOT_MKDIR, path);
+        error(ERR_COULD_NOT_MKDIR, url.path());
     }
 
     finished();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic