Skip to content

Commit

Permalink
MythCookieJar: fix loading/saving of cookies to a file
Browse files Browse the repository at this point in the history
I assume the intention here was to save to a file not to a QString!
  • Loading branch information
Paul Harrison committed May 5, 2013
1 parent f17a6fd commit b5e7db6
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions mythtv/libs/libmythbase/mythdownloadmanager.cpp
Expand Up @@ -1521,8 +1521,17 @@ MythCookieJar::MythCookieJar()
*/
void MythCookieJar::load(const QString &filename)
{
LOG(VB_GENERAL, LOG_DEBUG, QString("MythCookieJar: loading cookies from: %1").arg(filename));

QFile f(filename);
if (!f.open(QIODevice::ReadOnly))
{
LOG(VB_GENERAL, LOG_WARNING, QString("MythCookieJar::load() failed to open file for reading: %1").arg(filename));
return;
}

QList<QNetworkCookie> cookieList;
QTextStream stream((QString *)&filename, QIODevice::ReadOnly);
QTextStream stream(&f);
while (!stream.atEnd())
{
QString cookie = stream.readLine();
Expand All @@ -1537,8 +1546,17 @@ void MythCookieJar::load(const QString &filename)
*/
void MythCookieJar::save(const QString &filename)
{
LOG(VB_GENERAL, LOG_DEBUG, QString("MythCookieJar: saving cookies to: %1").arg(filename));

QFile f(filename);
if (!f.open(QIODevice::WriteOnly))
{
LOG(VB_GENERAL, LOG_ERR, QString("MythCookieJar::save() failed to open file for writing: %1").arg(filename));
return;
}

QList<QNetworkCookie> cookieList = allCookies();
QTextStream stream((QString *)&filename, QIODevice::WriteOnly);
QTextStream stream(&f);

for (QList<QNetworkCookie>::iterator it = cookieList.begin();
it != cookieList.end(); ++it)
Expand Down

0 comments on commit b5e7db6

Please sign in to comment.