Uses single quotes and QString objects to improve efficiency.
From: Erik Hovland <erik@hovland.org>
---
mythtv/libs/libmythupnp/httprequest.cpp | 8 ++++----
mythtv/libs/libmythupnp/ssdp.cpp | 2 +-
mythtv/libs/libmythupnp/upnpcds.cpp | 10 +++++-----
mythtv/libs/libmythupnp/upnpdevice.cpp | 6 +++---
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/mythtv/libs/libmythupnp/httprequest.cpp b/mythtv/libs/libmythupnp/httprequest.cpp
index 37b4116..109e4cc 100644
a
|
b
|
RequestType HTTPRequest::SetRequestType( const QString &sType )
|
171 | 171 | if (sType == "UNSUBSCRIBE") return( m_eType = RequestTypeUnsubscribe ); |
172 | 172 | if (sType == "NOTIFY" ) return( m_eType = RequestTypeNotify ); |
173 | 173 | |
174 | | if (sType.startsWith( "HTTP/" )) return( m_eType = RequestTypeResponse ); |
| 174 | if (sType.startsWith( QString("HTTP/") )) return( m_eType = RequestTypeResponse ); |
175 | 175 | |
176 | 176 | VERBOSE( VB_UPNP, QString( "HTTPRequest::SentRequestType( %1 ) - returning Unknown." ) |
177 | 177 | .arg( sType ) ); |
… |
… |
void HTTPRequest::ProcessRequestLine( const QString &sLine )
|
995 | 995 | |
996 | 996 | // ---------------------------------------------------------------------- |
997 | 997 | |
998 | | if ( sLine.startsWith( "HTTP/" )) |
| 998 | if ( sLine.startsWith( QString("HTTP/") )) |
999 | 999 | m_eType = RequestTypeResponse; |
1000 | 1000 | else |
1001 | 1001 | m_eType = RequestTypeUnknown; |
… |
… |
bool HTTPRequest::ProcessSOAPPayload( const QString &sSOAPAction )
|
1196 | 1196 | // XML Document Loaded... now parse it |
1197 | 1197 | // -------------------------------------------------------------- |
1198 | 1198 | |
1199 | | m_sNameSpace = sSOAPAction.section( "#", 0, 0).remove( 0, 1); |
1200 | | m_sMethod = sSOAPAction.section( "#", 1 ); |
| 1199 | m_sNameSpace = sSOAPAction.section( '#', 0, 0).remove( 0, 1); |
| 1200 | m_sMethod = sSOAPAction.section( '#', 1 ); |
1201 | 1201 | m_sMethod.remove( m_sMethod.length()-1, 1 ); |
1202 | 1202 | |
1203 | 1203 | QDomNodeList oNodeList = doc.elementsByTagNameNS( m_sNameSpace, m_sMethod ); |
diff --git a/mythtv/libs/libmythupnp/ssdp.cpp b/mythtv/libs/libmythupnp/ssdp.cpp
index cb81199..ae3d134 100644
a
|
b
|
SSDPRequestType SSDP::ProcessRequestLine( const QString &sLine )
|
339 | 339 | // <method> <Resource URI> HTTP/m.n |
340 | 340 | // ---------------------------------------------------------------------- |
341 | 341 | |
342 | | if ( sLine.startsWith( "HTTP/" )) |
| 342 | if ( sLine.startsWith( QString("HTTP/") )) |
343 | 343 | return SSDP_MSearchResp; |
344 | 344 | else |
345 | 345 | { |
diff --git a/mythtv/libs/libmythupnp/upnpcds.cpp b/mythtv/libs/libmythupnp/upnpcds.cpp
index bd2f5b9..b63fc9b 100644
a
|
b
|
void UPnpCDS::HandleBrowse( HTTPRequest *pRequest )
|
232 | 232 | short nTotalMatches = 0; |
233 | 233 | short nUpdateID = 0; |
234 | 234 | QString sResultXML; |
235 | | FilterMap filter = (FilterMap) request.m_sFilter.split(","); |
| 235 | FilterMap filter = (FilterMap) request.m_sFilter.split(','); |
236 | 236 | |
237 | 237 | VERBOSE(VB_UPNP, QString("UPnpCDS::HandleBrowse ObjectID=%1, ContainerId=%2") |
238 | 238 | .arg(request.m_sObjectId) |
… |
… |
void UPnpCDS::HandleSearch( HTTPRequest *pRequest )
|
473 | 473 | |
474 | 474 | if (eErrorCode == UPnPResult_Success) |
475 | 475 | { |
476 | | FilterMap filter = (FilterMap) request.m_sFilter.split(","); |
| 476 | FilterMap filter = (FilterMap) request.m_sFilter.split(','); |
477 | 477 | nNumberReturned = pResult->m_List.count(); |
478 | 478 | nTotalMatches = pResult->m_nTotalMatches; |
479 | 479 | nUpdateID = pResult->m_nUpdateID; |
… |
… |
UPnpCDSExtensionResults *UPnpCDSExtension::Browse( UPnpCDSRequest *pRequest )
|
631 | 631 | " ", QString::SkipEmptyParts); |
632 | 632 | idPath = idPath[0].split('?', QString::SkipEmptyParts); |
633 | 633 | |
634 | | if (idPath[0].startsWith("Id")) |
| 634 | if (idPath[0].startsWith(QString("Id"))) |
635 | 635 | idPath[0] = QString("item=%1").arg(idPath[0].right(idPath[0].length() - 2)); |
636 | 636 | } |
637 | 637 | } |
… |
… |
UPnpCDSExtensionResults *UPnpCDSExtension::Browse( UPnpCDSRequest *pRequest )
|
643 | 643 | if (sLast == m_sExtensionId ) { return( ProcessRoot ( pRequest, pResults, idPath )); } |
644 | 644 | if (sLast == "0" ) { return( ProcessAll ( pRequest, pResults, idPath )); } |
645 | 645 | |
646 | | if (sLast.startsWith("key" , Qt::CaseSensitive)) |
| 646 | if (sLast.startsWith(QString("key") , Qt::CaseSensitive)) |
647 | 647 | return ProcessKey(pRequest, pResults, idPath); |
648 | 648 | |
649 | | if (sLast.startsWith("item", Qt::CaseSensitive)) |
| 649 | if (sLast.startsWith(QString("item"), Qt::CaseSensitive)) |
650 | 650 | return ProcessItem(pRequest, pResults, idPath); |
651 | 651 | |
652 | 652 | int nNodeIdx = sLast.toInt(); |
diff --git a/mythtv/libs/libmythupnp/upnpdevice.cpp b/mythtv/libs/libmythupnp/upnpdevice.cpp
index 58b5e55..1c2429a 100644
a
|
b
|
void UPnpDeviceDesc::OutputDevice( QTextStream &os,
|
377 | 377 | // ---------------------------------------------------------------------- |
378 | 378 | |
379 | 379 | bool bIsXbox360 = |
380 | | sUserAgent.startsWith("Xbox/2.0", Qt::CaseInsensitive) || |
381 | | sUserAgent.startsWith( "Mozilla/4.0", Qt::CaseInsensitive); |
| 380 | sUserAgent.startsWith(QString("Xbox/2.0"), Qt::CaseInsensitive) || |
| 381 | sUserAgent.startsWith( QString("Mozilla/4.0"), Qt::CaseInsensitive); |
382 | 382 | |
383 | 383 | os << FormatValue( "manufacturer" , pDevice->m_sManufacturer ); |
384 | 384 | os << FormatValue( "modelURL" , pDevice->m_sModelURL ); |
… |
… |
UPnpDeviceDesc *UPnpDeviceDesc::Retrieve( QString &sURL, bool bInQtThread )
|
625 | 625 | NULL, // login |
626 | 626 | bInQtThread ); |
627 | 627 | |
628 | | if (sXml.startsWith( "<?xml" )) |
| 628 | if (sXml.startsWith( QString("<?xml") )) |
629 | 629 | { |
630 | 630 | QString sErrorMsg; |
631 | 631 | |