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

List:       kde-commits
Subject:    KDE_3_1_BRANCH: kdebase/kioslave/sftp
From:       Lucas Fisher <ljfisher () iastate ! edu>
Date:       2003-05-26 23:05:42
[Download RAW message or body]

CVS commit by fisher: 

Decode filename strings from sftp server as UTF-8 instead of ASCII. This
should make us compatible with unicode servers.


  M +6 -10     sftpfileattr.cpp   1.7.4.1
  M +3 -3      sftpfileattr.h   1.6.4.1


--- kdebase/kioslave/sftp/sftpfileattr.h  #1.6:1.6.4.1
@@ -36,5 +36,5 @@ class sftpFileAttr {
 private: // Private attributes
     /** Name of file. */
-    QCString mFilename;
+    QString mFilename;
 
     /** Specifies which fields of the file attribute are available. */
@@ -201,8 +201,8 @@ public:
     /** No descriptions */
     void setFilename(const QString& fn)
-        { mFilename = fn.latin1(); }
+        { mFilename = fn; }
 
     QString filename() const
-        { QString x = mFilename; return x; }
+        { return mFilename; }
 
     /** Returns a UDSEntry describing the file.

--- kdebase/kioslave/sftp/sftpfileattr.cpp  #1.7:1.7.4.1
@@ -148,14 +148,10 @@ QDataStream& operator>> (QDataStream& s,
     //     we get a bad sftp packet.
     fa.clear();
+        QByteArray fn;
     Q_UINT32 size;
     if( fa.mDirAttrs ) {
-        s >> fa.mFilename;
-        size = fa.mFilename.size();
-        fa.mFilename.resize(size+1);
-        fa.mFilename[size] = 0;
+        s >> fn; 
 
-        // for( int i = 0; i < fa.mFilename.size(); i++ ) {
-        //    kdDebug() << (int)fa.mFilename[i] << endl;
-        // }
+                fa.mFilename = QString::fromUtf8(fn.data(),fn.size());
 
         s >> fa.mLongname;
@@ -248,5 +244,5 @@ kdbgstream& operator<< (kdbgstream& s, s
 }
 /** Make sure it builds with NDEBUG */
-kndbgstream& operator<< (kndbgstream& s, sftpFileAttr& a) {
+kndbgstream& operator<< (kndbgstream& s, sftpFileAttr& ) {
     return s;
 }
@@ -260,5 +256,5 @@ void sftpFileAttr::clear(){
     clearPermissions();
     clearExtensions();
-    mFilename = "\0";
+    mFilename = QString::null;
     mGroupName =  QString::null;
     mUserName = QString::null;


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

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