Commit 3a499979 authored by Laurent Montel's avatar Laurent Montel 😁

Minor optimization. Remove unused variable. Don't duplicate method + variables

parent e7d21171
...@@ -120,6 +120,7 @@ NonMimeParser::~NonMimeParser() {} ...@@ -120,6 +120,7 @@ NonMimeParser::~NonMimeParser() {}
/** /**
* try to guess the mimetype from the file-extension * try to guess the mimetype from the file-extension
*/ */
QByteArray NonMimeParser::guessMimeType(const QByteArray &fileName) QByteArray NonMimeParser::guessMimeType(const QByteArray &fileName)
{ {
QByteArray tmp, mimeType; QByteArray tmp, mimeType;
...@@ -274,7 +275,7 @@ bool UUEncoded::parse() ...@@ -274,7 +275,7 @@ bool UUEncoded::parse()
// append trailing text part of the article // append trailing text part of the article
m_text.append(m_src.right(m_src.length() - currentPos)); m_text.append(m_src.right(m_src.length() - currentPos));
return ((m_bins.count() > 0) || isPartial()); return ((!m_bins.isEmpty()) || isPartial());
} }
//============================================================================== //==============================================================================
...@@ -320,11 +321,10 @@ bool YENCEncoded::parse() ...@@ -320,11 +321,10 @@ bool YENCEncoded::parse()
{ {
int currentPos = 0; int currentPos = 0;
bool success = true; bool success = true;
while (success) { while (success) {
int beginPos = currentPos, yencStart = currentPos; int beginPos = currentPos, yencStart = currentPos;
bool containsPart = false; bool containsPart = false;
QByteArray fileName, mimeType; QByteArray fileName;
if ((beginPos = m_src.indexOf("=ybegin ", currentPos)) > -1 && if ((beginPos = m_src.indexOf("=ybegin ", currentPos)) > -1 &&
(beginPos == 0 || m_src.at(beginPos - 1) == '\n')) { (beginPos == 0 || m_src.at(beginPos - 1) == '\n')) {
...@@ -499,7 +499,7 @@ bool YENCEncoded::parse() ...@@ -499,7 +499,7 @@ bool YENCEncoded::parse()
// append trailing text part of the article // append trailing text part of the article
m_text.append(m_src.right(m_src.length() - currentPos)); m_text.append(m_src.right(m_src.length() - currentPos));
return m_bins.count() > 0; return !m_bins.isEmpty();
} }
} // namespace Parser } // namespace Parser
......
...@@ -136,13 +136,8 @@ public: ...@@ -136,13 +136,8 @@ public:
explicit YENCEncoded(const QByteArray &src); explicit YENCEncoded(const QByteArray &src);
bool parse() Q_DECL_OVERRIDE; bool parse() Q_DECL_OVERRIDE;
QVector<QByteArray> binaryParts() const
{
return m_bins;
}
private: private:
QVector<QByteArray> m_bins;
static bool yencMeta(QByteArray &src, const QByteArray &name, int *value); static bool yencMeta(QByteArray &src, const QByteArray &name, int *value);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment