[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kio/kio
From: Till Adam <adam () kde ! org>
Date: 2005-04-11 19:12:41
Message-ID: 20050411191241.55BF3633 () office ! kde ! org
[Download RAW message or body]
CVS commit by tilladam:
Forward port of:
CVS commit by tilladam:
Fix encoding of webdav documents by keeping the stream from the server
as a byte array internally, instead of a QString and auto-detecting
encoding in QDomDocument::setContent(). Keep if BC to be on the safe side.
M +11 -8 davjob.cpp 1.12
M +1 -1 davjob.h 1.8
--- kdelibs/kio/kio/davjob.cpp #1.11:1.12
@@ -47,4 +47,5 @@ class DavJob::DavJobPrivate
public:
QByteArray savedStaticData;
+ QByteArray str_response; // replaces the QString previously used in DavJob itself
};
@@ -67,12 +68,15 @@ DavJob::DavJob( const KURL& url, int met
void DavJob::slotData( const QByteArray& data )
{
- if(m_redirectionURL.isEmpty() || !m_redirectionURL.isValid() || m_error)
- m_str_response.append( QString( data ) );
+ if(m_redirectionURL.isEmpty() || !m_redirectionURL.isValid() || m_error) {
+ unsigned int oldSize = d->str_response.size();
+ d->str_response.resize( oldSize + data.size() );
+ memcpy( d->str_response.data() + oldSize, data.data(), data.size() );
+ }
}
void DavJob::slotFinished()
{
- // kdDebug() << "DavJob::slotFinished()" << endl;
- // kdDebug() << m_str_response << endl;
+ // kdDebug(7113) << "DavJob::slotFinished()" << endl;
+ // kdDebug(7113) << d->str_response << endl;
if (!m_redirectionURL.isEmpty() && m_redirectionURL.isValid() && (m_command == CMD_SPECIAL)) {
QDataStream istream( m_packedArgs, IO_ReadOnly );
@@ -88,5 +92,5 @@ void DavJob::slotFinished()
stream << (int)7 << m_redirectionURL << (int)KIO::DAV_PROPFIND;
}
- } else if ( ! m_response.setContent( m_str_response, true ) ) {
+ } else if ( ! m_response.setContent( d->str_response, true ) ) {
// An error occurred parsing the XML response
QDomElement root = m_response.createElementNS( "DAV:", "error-report" );
@@ -94,5 +98,5 @@ void DavJob::slotFinished()
QDomElement el = m_response.createElementNS( "DAV:", "offending-response" );
- QDomText textnode = m_response.createTextNode( m_str_response );
+ QDomText textnode = m_response.createTextNode( d->str_response );
el.appendChild( textnode );
root.appendChild( el );
@@ -103,6 +107,5 @@ void DavJob::slotFinished()
d = 0;
}
-
- // kdDebug() << m_response.toString() << endl;
+ // kdDebug(7113) << m_response.toString() << endl;
TransferJob::slotFinished();
if( d ) staticData = d->savedStaticData.copy(); // Need to send DAV request to this host too
--- kdelibs/kio/kio/davjob.h #1.7:1.8
@@ -81,5 +81,5 @@ namespace KIO {
class DavJobPrivate;
DavJobPrivate *d;
- QString m_str_response;
+ QString dummy; // kept around for BC reasons
QDomDocument m_response;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic