diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/protocols/jabber/libiris/cutestuff/util/base64.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/jabber/libiris/cutestuff/util/base64.cpp')
-rw-r--r-- | kopete/protocols/jabber/libiris/cutestuff/util/base64.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/kopete/protocols/jabber/libiris/cutestuff/util/base64.cpp b/kopete/protocols/jabber/libiris/cutestuff/util/base64.cpp index c1483196..06df3f73 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/util/base64.cpp +++ b/kopete/protocols/jabber/libiris/cutestuff/util/base64.cpp @@ -33,21 +33,21 @@ //! ... //! //! // encode a block of data into base64 -//! QByteArray block(1024); -//! QByteArray enc = Base64::encode(block); +//! TQByteArray block(1024); +//! TQByteArray enc = Base64::encode(block); //! //! \endcode //! //! Encodes array \a s and returns the result. -QByteArray Base64::encode(const QByteArray &s) +TQByteArray Base64::encode(const TQByteArray &s) { int i; int len = s.size(); char tbl[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; int a, b, c; - QByteArray p((len+2)/3*4); + TQByteArray p((len+2)/3*4); int at = 0; for( i = 0; i < len; i += 3 ) { a = ((unsigned char)s[i] & 3) << 4; @@ -74,10 +74,10 @@ QByteArray Base64::encode(const QByteArray &s) //! //! Decodes array \a s and returns the result. -QByteArray Base64::decode(const QByteArray &s) +TQByteArray Base64::decode(const TQByteArray &s) { // return value - QByteArray p; + TQByteArray p; // -1 specifies invalid // 64 specifies eof @@ -140,41 +140,41 @@ QByteArray Base64::decode(const QByteArray &s) //! //! Encodes array \a a and returns the result as a string. -QString Base64::arrayToString(const QByteArray &a) +TQString Base64::arrayToString(const TQByteArray &a) { - QByteArray b = encode(a); - QCString c; + TQByteArray b = encode(a); + TQCString c; c.resize(b.size()+1); memcpy(c.data(), b.data(), b.size()); - return QString::fromLatin1(c); + return TQString::fromLatin1(c); } //! //! Decodes string \a s and returns the result as an array. -QByteArray Base64::stringToArray(const QString &s) +TQByteArray Base64::stringToArray(const TQString &s) { if(s.isEmpty()) - return QByteArray(); + return TQByteArray(); // Unfold data - QString us(s); + TQString us(s); us.remove('\n'); const char *c = us.latin1(); int len = strlen(c); - QByteArray b(len); + TQByteArray b(len); memcpy(b.data(), c, len); - QByteArray a = decode(b); + TQByteArray a = decode(b); return a; } //! //! Encodes string \a s and returns the result as a string. -QString Base64::encodeString(const QString &s) +TQString Base64::encodeString(const TQString &s) { - QCString c = s.utf8(); + TQCString c = s.utf8(); int len = c.length(); - QByteArray b(len); + TQByteArray b(len); memcpy(b.data(), c.data(), len); return arrayToString(b); } |