summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/libiris/cutestuff/util/base64.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/protocols/jabber/libiris/cutestuff/util/base64.cpp')
-rw-r--r--kopete/protocols/jabber/libiris/cutestuff/util/base64.cpp36
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);
}