Ticket #5773: libs_libmythdb-krazy2-QString-compare.patch

File libs_libmythdb-krazy2-QString-compare.patch, 4.6 KB (added by Erik Hovland <erik@…>, 12 years ago)

Uses clear() instead of null assignment and uses isEmpty() instead of == ""

  • mythtv/libs/libmythdb/httpcomms.cpp

    Use isEmpty() instead of == "".
    
    From: Erik Hovland <erik@hovland.org>
    
    
    ---
    
     mythtv/libs/libmythdb/httpcomms.cpp  |    6 +++---
     mythtv/libs/libmythdb/lcddevice.cpp  |    8 ++++----
     mythtv/libs/libmythdb/mythdb.cpp     |    7 ++++---
     mythtv/libs/libmythdb/mythsocket.cpp |    2 +-
     mythtv/libs/libmythdb/mythstorage.h  |    2 +-
     5 files changed, 13 insertions(+), 12 deletions(-)
    
    diff --git a/mythtv/libs/libmythdb/httpcomms.cpp b/mythtv/libs/libmythdb/httpcomms.cpp
    index 5901c3e..33debf7 100644
    a b QString HttpComms::getHttp(QString &url, 
    302302    while (1)
    303303    {
    304304        QUrl qurl(url);
    305         if (hostname == "")
     305        if (hostname.isEmpty())
    306306            hostname = qurl.host();  // hold onto original host
    307307        if (qurl.host().isEmpty())   // can occur on redirects to partial paths
    308308            qurl.setHost(hostname);
    bool HttpComms::getHttpFile(const QString& filename, QString& url, int timeoutMS 
    394394    while (1)
    395395    {
    396396        QUrl qurl(url);
    397         if (hostname == "")
     397        if (hostname.isEmpty())
    398398            hostname = qurl.host();  // hold onto original host
    399399       
    400400        if (qurl.host().isEmpty())   // can occur on redirects to partial paths
    QString HttpComms::postHttp(QUrl &url , 
    547547
    548548    while (1)
    549549    {
    550         if (hostname == "")
     550        if (hostname.isEmpty())
    551551            hostname = url.host();  // hold onto original host
    552552        if (url.host().isEmpty())   // can occur on redirects to partial paths
    553553            url.setHost(hostname);
  • mythtv/libs/libmythdb/lcddevice.cpp

    diff --git a/mythtv/libs/libmythdb/lcddevice.cpp b/mythtv/libs/libmythdb/lcddevice.cpp
    index 8b36602..31cd1f2 100644
    a b LCD::LCD() 
    3939
    4040      retryTimer(new QTimer(this)), LEDTimer(new QTimer(this)),
    4141
    42       send_buffer(""),              last_command(QString::null),
    43 
    4442      lcd_width(0),                 lcd_height(0),
    4543
    4644      lcd_ready(false),             lcd_showtime(false),
    LCD::LCD() 
    5149
    5250      lcd_popuptime(0),
    5351
    54       lcd_showmusic_items(QString::null),
    55       lcd_keystring(QString::null),
     52      lcd_showmusic_items(),
     53      lcd_keystring(),
    5654
    5755      GetLEDMask(NULL)
    5856{
     57    send_buffer.clear(); last_command.clear();
     58    lcd_showmusic_items.clear(); lcd_keystring.clear();
    5959
    6060    setObjectName("LCD");
    6161
  • mythtv/libs/libmythdb/mythdb.cpp

    diff --git a/mythtv/libs/libmythdb/mythdb.cpp b/mythtv/libs/libmythdb/mythdb.cpp
    index 8b9988d..d94dc79 100644
    a b class MythDBPrivate 
    6363};
    6464
    6565MythDBPrivate::MythDBPrivate()
    66     : m_localhostname(QString::null), m_settings(new Settings()),
     66    : m_settings(new Settings()),
    6767      ignoreDatabase(false), useSettingsCache(false)
    6868{
     69    m_localhostname.clear();
    6970}
    7071
    7172MythDBPrivate::~MythDBPrivate()
    void MythDB::GetResolutionSetting(const QString &type, 
    484485
    485486    QString res = GetSetting(sRes);
    486487
    487     if ("" != res)
     488    if (!res.isEmpty())
    488489    {
    489490        QStringList slist = res.split(QString("x"));
    490491        int w = width, h = height;
    void MythDB::OverrideSettingForSession(const QString &key, 
    543544void MythDB::ClearSettingsCache(QString myKey, QString newVal)
    544545{
    545546    d->settingsCacheLock.lock();
    546     if (myKey != "" && d->settingsCache.contains(myKey))
     547    if (!myKey.isEmpty() && d->settingsCache.contains(myKey))
    547548    {
    548549        VERBOSE(VB_DATABASE, QString("Clearing Settings Cache for '%1'.")
    549550                                    .arg(myKey));
  • mythtv/libs/libmythdb/mythsocket.cpp

    diff --git a/mythtv/libs/libmythdb/mythsocket.cpp b/mythtv/libs/libmythdb/mythsocket.cpp
    index c0d3ea0..bae58c7 100644
    a b bool MythSocket::writeStringList(QStringList &list) 
    265265    }
    266266
    267267    QString str = list.join("[]:[]");
    268     if (str == QString::null)
     268    if (str.isEmpty())
    269269    {
    270270        VERBOSE(VB_IMPORTANT, LOC +
    271271                "writeStringList: Error, joined null string.");
  • mythtv/libs/libmythdb/mythstorage.h

    diff --git a/mythtv/libs/libmythdb/mythstorage.h b/mythtv/libs/libmythdb/mythstorage.h
    index 11b920b..219cf6e 100644
    a b class MPUBLIC SimpleDBStorage : public DBStorage 
    5050  public:
    5151    SimpleDBStorage(StorageUser *_user,
    5252                    QString _table, QString _column) :
    53         DBStorage(_user, _table, _column), initval(QString::null) {}
     53        DBStorage(_user, _table, _column) { initval.clear(); }
    5454    virtual ~SimpleDBStorage() { }
    5555
    5656    virtual void Load(void);