[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenetwork/librss
From:       Frerich Raabe <raabe () kde ! org>
Date:       2004-04-09 21:42:58
Message-ID: 20040409214258.7323E9A24 () office ! kde ! org
[Download RAW message or body]

CVS commit by raabe: 

- berkus' comment was right, this method is not only useless by now, it's
  also wrong (as his usecase involving KHTMLPart shows): librss should not
  do the job of replacing non-standard (usually HTML) entities, that should
  be left to the client.
CCMAIL:geiseri@kde.org,mcamen@mcamen.de


  M +8 -25     tools_p.cpp   1.8
  M +1 -2      tools_p.h   1.6


--- kdenetwork/librss/tools_p.cpp  #1.7:1.8
@@ -16,31 +16,14 @@
 #include <qdom.h>
 
-/* <berkus> frerich: please explain in what circumstances this function might be \
                needed
-            and if there are none, i think its safe to just remove it altogether.
-*/
-QString RSS::decodeEntities(const QString &s)
-{
-        QString result = s;
-        // btw: next line is wrong, all wrong (1st: &amp; not &amp 2nd: QDom does it \
                all for us)
-        result.replace(QString::fromLatin1("&amp"), QString::fromLatin1("&"));
-        for (int p = result.find(QString::fromLatin1("&")); p >= 0; p = \
                result.find(QString::fromLatin1("&"), p)) {
-                int q = result.find(QString::fromLatin1(";"), p++);
-                if (q != -1)
-                        result.replace(p - 1, q - p + 2, \
                KGlobal::charsets()->fromEntity(result.mid(p, q - p))); 
-        }
-        return result;
-}
-
-QString RSS::extractNode(const QDomNode &parent, const QString &elemName, bool \
entities) +QString RSS::extractNode(const QDomNode &parent, const QString &elemName)
 {
-        QString result;
         QDomNode node = parent.namedItem(elemName);
-        if (!node.isNull()) {
-                result = node.toElement().text().simplifyWhiteSpace();
-                if (entities)
-                        result = RSS::decodeEntities(result);
+        if (node.isNull())
+                return QString::null;
+
+        QString result = node.toElement().text().simplifyWhiteSpace();
                 if (result.isEmpty())
-                        result = QString::null;
-        }
+                return QString::null;
+
         return result;
 }

--- kdenetwork/librss/tools_p.h  #1.5:1.6
@@ -27,6 +27,5 @@ namespace RSS
         };
 
-        QString decodeEntities(const QString &s);
-        QString extractNode(const QDomNode &parent, const QString &elemName, bool \
entities = false); +        QString extractNode(const QDomNode &parent, const QString \
&elemName);  }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic