author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdecore/kmdcodec.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kdecore/kmdcodec.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdecore/kmdcodec.cpp | 139 |
1 files changed, 69 insertions, 70 deletions
diff --git a/microkde/kdecore/kmdcodec.cpp b/microkde/kdecore/kmdcodec.cpp index bc03569..db11e52 100644 --- a/microkde/kdecore/kmdcodec.cpp +++ b/microkde/kdecore/kmdcodec.cpp @@ -41,2 +41,4 @@ #include "kmdcodec.h" +//Added by qt3to4: +#include <Q3CString> @@ -149,3 +151,3 @@ static int rikFindChar(register const char * _s, const char c) -QCString KCodecs::quotedPrintableEncode(const QByteArray& in, bool useCRLF) +Q3CString KCodecs::quotedPrintableEncode(const QByteArray& in, bool useCRLF) { @@ -153,6 +155,6 @@ QCString KCodecs::quotedPrintableEncode(const QByteArray& in, bool useCRLF) quotedPrintableEncode (in, out, useCRLF); - return QCString (out.data(), out.size()+1); + return Q3CString (out.data(), out.size()+1); } -QCString KCodecs::quotedPrintableEncode(const QCString& str, bool useCRLF) +Q3CString KCodecs::quotedPrintableEncode(const Q3CString& str, bool useCRLF) { @@ -282,3 +284,3 @@ void KCodecs::quotedPrintableEncode(const QByteArray& in, QByteArray& out, bool -QCString KCodecs::quotedPrintableDecode(const QByteArray & in) +Q3CString KCodecs::quotedPrintableDecode(const QByteArray & in) { @@ -286,6 +288,6 @@ QCString KCodecs::quotedPrintableDecode(const QByteArray & in) quotedPrintableDecode (in, out); - return QCString (out.data(), out.size()+1); + return Q3CString (out.data(), out.size()+1); } -QCString KCodecs::quotedPrintableDecode(const QCString & str) +Q3CString KCodecs::quotedPrintableDecode(const Q3CString & str) { @@ -357,3 +359,3 @@ void KCodecs::quotedPrintableDecode(const QByteArray& in, QByteArray& out) -QCString KCodecs::base64Encode( const QCString& str, bool insertLFs ) +Q3CString KCodecs::base64Encode( const Q3CString& str, bool insertLFs ) { @@ -367,3 +369,3 @@ QCString KCodecs::base64Encode( const QCString& str, bool insertLFs ) -QCString KCodecs::base64Encode( const QByteArray& in, bool insertLFs ) +Q3CString KCodecs::base64Encode( const QByteArray& in, bool insertLFs ) { @@ -371,3 +373,3 @@ QCString KCodecs::base64Encode( const QByteArray& in, bool insertLFs ) base64Encode( in, out, insertLFs ); - return QCString( out.data(), out.size()+1 ); + return Q3CString( out.data(), out.size()+1 ); } @@ -407,11 +409,11 @@ void KCodecs::base64Encode( const QByteArray& in, QByteArray& out, if ( count && (count%76) == 0 ) - out.at(didx++) = '\n'; + out[didx++] = '\n'; count += 4; } - out.at(didx++) = Base64EncMap[(data[sidx] >> 2) & 077]; - out.at(didx++) = Base64EncMap[(data[sidx+1] >> 4) & 017 | + out[didx++] = Base64EncMap[(data[sidx] >> 2) & 077]; + out[didx++] = Base64EncMap[(data[sidx+1] >> 4) & 017 | (data[sidx] << 4) & 077]; - out.at(didx++) = Base64EncMap[(data[sidx+2] >> 6) & 003 | + out[didx++] = Base64EncMap[(data[sidx+2] >> 6) & 003 | (data[sidx+1] << 2) & 077]; - out.at(didx++) = Base64EncMap[data[sidx+2] & 077]; + out[didx++] = Base64EncMap[data[sidx+2] & 077]; sidx += 3; @@ -423,10 +425,10 @@ void KCodecs::base64Encode( const QByteArray& in, QByteArray& out, if ( insertLFs && (count > 0) && (count%76) == 0 ) - out.at(didx++) = '\n'; + out[didx++] = '\n'; - out.at(didx++) = Base64EncMap[(data[sidx] >> 2) & 077]; + out[didx++] = Base64EncMap[(data[sidx] >> 2) & 077]; if (sidx < len-1) { - out.at(didx++) = Base64EncMap[(data[sidx+1] >> 4) & 017 | + out[didx++] = Base64EncMap[(data[sidx+1] >> 4) & 017 | (data[sidx] << 4) & 077]; - out.at(didx++) = Base64EncMap[(data[sidx+1] << 2) & 077]; + out[didx++] = Base64EncMap[(data[sidx+1] << 2) & 077]; } @@ -434,3 +436,3 @@ void KCodecs::base64Encode( const QByteArray& in, QByteArray& out, { - out.at(didx++) = Base64EncMap[(data[sidx] << 4) & 077]; + out[didx++] = Base64EncMap[(data[sidx] << 4) & 077]; } @@ -440,9 +442,6 @@ void KCodecs::base64Encode( const QByteArray& in, QByteArray& out, while (didx < out.size()) - { - out.at(didx) = '='; - didx++; - } + out[didx++] = '='; } -QCString KCodecs::base64Decode( const QCString& str ) +Q3CString KCodecs::base64Decode( const Q3CString& str ) { @@ -456,3 +455,3 @@ QCString KCodecs::base64Decode( const QCString& str ) -QCString KCodecs::base64Decode( const QByteArray& in ) +Q3CString KCodecs::base64Decode( const QByteArray& in ) { @@ -460,3 +459,3 @@ QCString KCodecs::base64Decode( const QByteArray& in ) base64Decode( in, out ); - return QCString( out.data(), out.size()+1 ); + return Q3CString( out.data(), out.size()+1 ); } @@ -507,3 +506,3 @@ void KCodecs::base64Decode( const QByteArray& in, QByteArray& out ) { - out.at(outIdx++) = Base64DecMap[ch]; + out[outIdx++] = Base64DecMap[ch]; } @@ -525,5 +524,5 @@ void KCodecs::base64Decode( const QByteArray& in, QByteArray& out ) { - out.at(didx) = (((out.at(sidx) << 2) & 255) | ((out.at(sidx+1) >> 4) & 003)); - out.at(didx+1) = (((out.at(sidx+1) << 4) & 255) | ((out.at(sidx+2) >> 2) & 017)); - out.at(didx+2) = (((out.at(sidx+2) << 6) & 255) | (out.at(sidx+3) & 077)); + out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003)); + out[didx+1] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017)); + out[didx+2] = (((out[sidx+2] << 6) & 255) | (out[sidx+3] & 077)); sidx += 4; @@ -534,6 +533,6 @@ void KCodecs::base64Decode( const QByteArray& in, QByteArray& out ) if (didx < len) - out.at(didx) = (((out.at(sidx) << 2) & 255) | ((out.at(sidx+1) >> 4) & 003)); + out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003)); if (++didx < len ) - out.at(didx) = (((out.at(sidx+1) << 4) & 255) | ((out.at(sidx+2) >> 2) & 017)); + out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017)); @@ -544,3 +543,3 @@ void KCodecs::base64Decode( const QByteArray& in, QByteArray& out ) -QCString KCodecs::uuencode( const QCString& str ) +Q3CString KCodecs::uuencode( const Q3CString& str ) { @@ -555,3 +554,3 @@ QCString KCodecs::uuencode( const QCString& str ) -QCString KCodecs::uuencode( const QByteArray& in ) +Q3CString KCodecs::uuencode( const QByteArray& in ) { @@ -559,3 +558,3 @@ QCString KCodecs::uuencode( const QByteArray& in ) uuencode( in, out ); - return QCString( out.data(), out.size()+1 ); + return Q3CString( out.data(), out.size()+1 ); } @@ -582,3 +581,3 @@ void KCodecs::uuencode( const QByteArray& in, QByteArray& out ) // line length - out.at(didx++) = UUEncMap[line_len]; + out[didx++] = UUEncMap[line_len]; @@ -587,8 +586,8 @@ void KCodecs::uuencode( const QByteArray& in, QByteArray& out ) { - out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; - out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 | + out[didx++] = UUEncMap[(data[sidx] >> 2) & 077]; + out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 | (data[sidx] << 4) & 077]; - out.at(didx++) = UUEncMap[(data[sidx+2] >> 6) & 003 | + out[didx++] = UUEncMap[(data[sidx+2] >> 6) & 003 | (data[sidx+1] << 2) & 077]; - out.at(didx++) = UUEncMap[data[sidx+2] & 077]; + out[didx++] = UUEncMap[data[sidx+2] & 077]; } @@ -597,3 +596,3 @@ void KCodecs::uuencode( const QByteArray& in, QByteArray& out ) //for (unsigned int idx=0; idx < nl_len; idx++) - //out.at(didx++) = nl[idx]; + //out[didx++] = nl[idx]; memcpy(out.data()+didx, nl, nl_len); @@ -603,3 +602,3 @@ void KCodecs::uuencode( const QByteArray& in, QByteArray& out ) // line length - out.at(didx++) = UUEncMap[len-sidx]; + out[didx++] = UUEncMap[len-sidx]; // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion @@ -607,8 +606,8 @@ void KCodecs::uuencode( const QByteArray& in, QByteArray& out ) { - out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; - out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 | + out[didx++] = UUEncMap[(data[sidx] >> 2) & 077]; + out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 | (data[sidx] << 4) & 077]; - out.at(didx++) = UUEncMap[(data[sidx+2] >> 6) & 003 | + out[didx++] = UUEncMap[(data[sidx+2] >> 6) & 003 | (data[sidx+1] << 2) & 077]; - out.at(didx++) = UUEncMap[data[sidx+2] & 077]; + out[didx++] = UUEncMap[data[sidx+2] & 077]; sidx += 3; @@ -618,7 +617,7 @@ void KCodecs::uuencode( const QByteArray& in, QByteArray& out ) { - out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; - out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 | + out[didx++] = UUEncMap[(data[sidx] >> 2) & 077]; + out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 | (data[sidx] << 4) & 077]; - out.at(didx++) = UUEncMap[(data[sidx+1] << 2) & 077]; - out.at(didx++) = UUEncMap[0]; + out[didx++] = UUEncMap[(data[sidx+1] << 2) & 077]; + out[didx++] = UUEncMap[0]; } @@ -626,6 +625,6 @@ void KCodecs::uuencode( const QByteArray& in, QByteArray& out ) { - out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; - out.at(didx++) = UUEncMap[(data[sidx] << 4) & 077]; - out.at(didx++) = UUEncMap[0]; - out.at(didx++) = UUEncMap[0]; + out[didx++] = UUEncMap[(data[sidx] >> 2) & 077]; + out[didx++] = UUEncMap[(data[sidx] << 4) & 077]; + out[didx++] = UUEncMap[0]; + out[didx++] = UUEncMap[0]; } @@ -641,3 +640,3 @@ void KCodecs::uuencode( const QByteArray& in, QByteArray& out ) -QCString KCodecs::uudecode( const QCString& str ) +Q3CString KCodecs::uudecode( const Q3CString& str ) { @@ -652,3 +651,3 @@ QCString KCodecs::uudecode( const QCString& str ) -QCString KCodecs::uudecode( const QByteArray& in ) +Q3CString KCodecs::uudecode( const QByteArray& in ) { @@ -656,3 +655,3 @@ QCString KCodecs::uudecode( const QByteArray& in ) uudecode( in, out ); - return QCString( out.data(), out.size()+1 ); + return Q3CString( out.data(), out.size()+1 ); } @@ -707,5 +706,5 @@ void KCodecs::uudecode( const QByteArray& in, QByteArray& out ) D = UUDecMap[(unsigned char) data[sidx+3]]; - out.at(didx++) = ( ((A << 2) & 255) | ((B >> 4) & 003) ); - out.at(didx++) = ( ((B << 4) & 255) | ((C >> 2) & 017) ); - out.at(didx++) = ( ((C << 6) & 255) | (D & 077) ); + out[didx++] = ( ((A << 2) & 255) | ((B >> 4) & 003) ); + out[didx++] = ( ((B << 4) & 255) | ((C >> 2) & 017) ); + out[didx++] = ( ((C << 6) & 255) | (D & 077) ); sidx += 4; @@ -718,3 +717,3 @@ void KCodecs::uudecode( const QByteArray& in, QByteArray& out ) B = UUDecMap[(unsigned char) data[sidx+1]]; - out.at(didx++) = ( ((A << 2) & 255) | ((B >> 4) & 003) ); + out[didx++] = ( ((A << 2) & 255) | ((B >> 4) & 003) ); } @@ -725,3 +724,3 @@ void KCodecs::uudecode( const QByteArray& in, QByteArray& out ) C = UUDecMap[(unsigned char) data[sidx+2]]; - out.at(didx++) = ( ((B << 4) & 255) | ((C >> 2) & 017) ); + out[didx++] = ( ((B << 4) & 255) | ((C >> 2) & 017) ); } @@ -763,3 +762,3 @@ KMD5::KMD5(const QByteArray& in) -KMD5::KMD5(const QCString& in) +KMD5::KMD5(const Q3CString& in) { @@ -774,3 +773,3 @@ void KMD5::update(const QByteArray& in) -void KMD5::update(const QCString& in) +void KMD5::update(const Q3CString& in) { @@ -875,3 +874,3 @@ bool KMD5::verify( const KMD5::Digest& digest) -bool KMD5::verify( const QCString& hexdigest) +bool KMD5::verify( const Q3CString& hexdigest) { @@ -894,5 +893,5 @@ void KMD5::rawDigest( KMD5::Digest& bin ) -QCString KMD5::hexDigest() +Q3CString KMD5::hexDigest() { - QCString s(33); + Q3CString s(33); @@ -907,3 +906,3 @@ QCString KMD5::hexDigest() -void KMD5::hexDigest(QCString& s) +void KMD5::hexDigest(Q3CString& s) { @@ -917,3 +916,3 @@ void KMD5::hexDigest(QCString& s) -QCString KMD5::base64Digest() +Q3CString KMD5::base64Digest() { @@ -958,3 +957,3 @@ void KMD5::transform( const unsigned char block[64] ) //US Q_ASSERT(!m_finalized); // not just a user error, since the method is private - ASSERT(!m_finalized); // not just a user error, since the method is private + Q_ASSERT(!m_finalized); // not just a user error, since the method is private |