Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
Silence compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
direc85 committed Jun 14, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 2cca466 commit a66bcdb
Showing 9 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion rpm/harbour-ytplayer.changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
* Thu Jun 11 2020 Matti Viljanen <[email protected]> 0.6.16-1
* Update youtube-dl-lite to 2020.05.08
- Update youtube-dl-lite to 2020.05.08

* Mon Jun 1 2020 Matti Viljanen <[email protected]> 0.6.15-1
- Revert "Recommened" videos change
2 changes: 1 addition & 1 deletion src/YTLocalVideoData.cpp
Original file line number Diff line number Diff line change
@@ -273,7 +273,7 @@ YTLocalVideoData::videoDownloadFinished()
Q_ASSERT(_videoFile->size() > 0);

Q_ASSERT(_videoPath.endsWith(kPartialContentSuffix));
_videoPath = _videoPath.left(_videoPath.size() - strlen(kPartialContentSuffix));
_videoPath = _videoPath.left(_videoPath.size() - static_cast<int>(strlen(kPartialContentSuffix)));

if (QFile(_videoPath).exists())
QFile(_videoPath).remove();
34 changes: 17 additions & 17 deletions src/YTLocalVideoManager.cpp
Original file line number Diff line number Diff line change
@@ -39,13 +39,13 @@ class YTDownloadInfo : public QObject {
Q_OBJECT
public:
explicit YTDownloadInfo(QSharedPointer<YTLocalVideoData> data,
QNetworkAccessManager& nam, QObject *parent = 0)
QNetworkAccessManager& nam, QObject *parent = nullptr)
: QObject(parent)
, _downloadData(data)
, _streamRequest(NULL)
, _snippetRequest(NULL)
, _thumbnailReply(NULL)
, _videoReply(NULL)
, _streamRequest(nullptr)
, _snippetRequest(nullptr)
, _thumbnailReply(nullptr)
, _videoReply(nullptr)
, _initialVideoOffset(0)
, _networkAccessManager(nam)
{
@@ -120,7 +120,7 @@ private slots:
}
_thumbnailReply->disconnect();
_thumbnailReply->deleteLater();
_thumbnailReply = NULL;
_thumbnailReply = nullptr;
}

void onVideoDownloadFinished()
@@ -138,7 +138,7 @@ private slots:
QNetworkRequest::RedirectionTargetAttribute).toUrl();
_videoReply->disconnect();
_videoReply->deleteLater();
_videoReply = NULL;
_videoReply = nullptr;
startVideoDataDownload();
return;
} else {
@@ -152,16 +152,16 @@ private slots:
}
_videoReply->disconnect();
_videoReply->deleteLater();
_videoReply = NULL;
_videoReply = nullptr;
}

void onVideoDownloadProgress(qint64 bytesReceived, qint64 bytesTotal)
{
Q_ASSERT(_videoReply);
if (bytesTotal != 0) {
double p = (double)(_initialVideoOffset + bytesReceived) /
(_initialVideoOffset + bytesTotal);
_downloadData->reportVideoDownloadProgress(p * 100);
double p = (_initialVideoOffset + static_cast<double>(bytesReceived)) /
(_initialVideoOffset + static_cast<double>(bytesTotal));
_downloadData->reportVideoDownloadProgress(static_cast<unsigned int>(p * 100.0));
}
_downloadData->videoDataFetched(_videoReply->readAll());
}
@@ -210,7 +210,7 @@ private slots:
_downloadData->setQuality(quality);

_streamRequest->deleteLater();
_streamRequest = NULL;
_streamRequest = nullptr;
beginDataDownloadsIfPossible();
}

@@ -253,7 +253,7 @@ private slots:
_downloadData->setDuration(contentDetails["duration"].toString());

_snippetRequest->deleteLater();
_snippetRequest = NULL;
_snippetRequest = nullptr;
beginDataDownloadsIfPossible();
}

@@ -272,31 +272,31 @@ private slots:
if (_snippetRequest->isRunning())
_snippetRequest->abort();
_snippetRequest->deleteLater();
_snippetRequest = NULL;
_snippetRequest = nullptr;
qDebug() << "Cleaning up snippet request";
}
if (_streamRequest) {
_streamRequest->disconnect();
if (_streamRequest->isRunning())
_streamRequest->abort();
_streamRequest->deleteLater();
_streamRequest = NULL;
_streamRequest = nullptr;
qDebug() << "Cleaning up stream request";
}
if (_videoReply) {
_videoReply->disconnect();
if (_videoReply->isRunning())
_videoReply->abort();
_videoReply->deleteLater();
_videoReply = NULL;
_videoReply = nullptr;
qDebug() << "Cleaning up video reply";
}
if (_thumbnailReply) {
_thumbnailReply->disconnect();
if (_thumbnailReply->isRunning())
_thumbnailReply->abort();
_thumbnailReply->deleteLater();
_thumbnailReply = NULL;
_thumbnailReply = nullptr;
qDebug() << "Cleaning up thumbnail reply";
}
}
2 changes: 1 addition & 1 deletion src/YTLogger.cpp
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ static QString _log_str_arr[] = {
QString("[INFO] ")
};

QtMessageHandler YTLogger::_original_handler = NULL;
QtMessageHandler YTLogger::_original_handler = nullptr;
QContiguousCache<QVariantMap> YTLogger::_log_cache =
QContiguousCache<QVariantMap>(kLogCacheSize);

2 changes: 1 addition & 1 deletion src/YTNetworkManager.cpp
Original file line number Diff line number Diff line change
@@ -209,7 +209,7 @@ YTNetworkManager::closeNetworkSession()

_session->close();
delete _session;
_session = NULL;
_session = nullptr;
}

qint64
12 changes: 6 additions & 6 deletions src/YTPlayer.cpp
Original file line number Diff line number Diff line change
@@ -72,8 +72,8 @@ InitApplicationDatabase()
QThread*
GetBackgroundTaskThread()
{
static QThread* thread = NULL;
if (thread == NULL) {
static QThread* thread = nullptr;
if (thread == nullptr) {
thread = new QThread();
thread->start();
thread->setPriority(QThread::LowPriority);
@@ -84,8 +84,8 @@ GetBackgroundTaskThread()
QNetworkDiskCache*
GetImageDiskCache()
{
static QNetworkDiskCache* cache = NULL;
if (cache == NULL) {
static QNetworkDiskCache* cache = nullptr;
if (cache == nullptr) {
cache = new QNetworkDiskCache();
QString datadir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
datadir += "/ImageCache";
@@ -101,8 +101,8 @@ GetImageDiskCache()
QNetworkDiskCache*
GetAPIResponseDiskCache()
{
static QNetworkDiskCache* cache = NULL;
if (cache == NULL) {
static QNetworkDiskCache* cache = nullptr;
if (cache == nullptr) {
cache = new QNetworkDiskCache();
QString datadir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
datadir += "/APIRequestCache";
34 changes: 17 additions & 17 deletions src/YTRequest.cpp
Original file line number Diff line number Diff line change
@@ -81,12 +81,11 @@ appendAuthHeader(QNetworkRequest& request)
static QString
methodToString(YTRequest::Method method)
{
switch (method) {
case YTRequest::List: return "list";
case YTRequest::Post: return "post";
case YTRequest::Delete: return "delete";
default: return "unknown";
}
if(method == YTRequest::List) return "list";
if(method == YTRequest::List) return "list";
if(method == YTRequest::Post) return "post";
if(method == YTRequest::Delete) return "delete";
return "unknown";
}

static QUrl
@@ -121,13 +120,13 @@ youtubeVideoInfoUrl(QVariantMap params)

YTRequest::YTRequest(QObject *parent, QNetworkAccessManager* nam)
: QObject(parent)
, _reply(NULL)
, _token_reply(NULL)
, _url_fetcher(NULL)
, _reply(nullptr)
, _token_reply(nullptr)
, _url_fetcher(nullptr)
, _network_access_manager(nam ? *nam : GetNetworkAccessManager())
, _loaded(false)
, _busy(false)
, _model(NULL)
, _model(nullptr)
, _retryCount(0)
{
Q_ASSERT(thread() == _network_access_manager.thread());
@@ -139,18 +138,18 @@ YTRequest::~YTRequest()
if (!_reply->isFinished())
_reply->abort();
_reply->deleteLater();
_reply = NULL;
_reply = nullptr;
}
if (_token_reply) {
if (!_token_reply->isFinished())
_token_reply->abort();
_reply->deleteLater();
_token_reply = NULL;
_token_reply = nullptr;
}
if (_url_fetcher) {
_url_fetcher->disconnect();
_url_fetcher->deleteLater();
_url_fetcher = NULL;
_url_fetcher = nullptr;
}
}

@@ -237,13 +236,13 @@ YTRequest::onTokenRequestFinished()
handleError(_token_reply);
if (_reply) {
delete _reply;
_reply = NULL;
_reply = nullptr;
}
break;
}

_token_reply->deleteLater();
_token_reply = NULL;
_token_reply = nullptr;
}

void
@@ -292,13 +291,14 @@ YTRequest::onFinished()
refreshToken();
break;
}
/* fall thru */
default:
handleError(_reply);
break;
}

_reply->deleteLater();
_reply = NULL;
_reply = nullptr;

setBusy(busy);
}
@@ -551,7 +551,7 @@ YTRequest::oAuth2Url() const
query.addQueryItem("response_type", "code");
query.addQueryItem("access_type=", "offline");

QUrl url(YOUTUBE_AUTH_URI);
QUrl url((YOUTUBE_AUTH_URI));
url.setQuery(query);
return url;
}
6 changes: 3 additions & 3 deletions src/YTSuggestionEngine.cpp
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ initDatabase()
YTSuggestionEngine::YTSuggestionEngine(QObject *parent)
: QObject(parent)
, _network_access_manager(YTRequest::GetNetworkAccessManager())
, _reply(NULL)
, _reply(nullptr)
{
static bool db_initialized = false;
if (!db_initialized) {
@@ -104,7 +104,7 @@ YTSuggestionEngine::~YTSuggestionEngine()
{
if (_reply) {
delete _reply;
_reply = NULL;
_reply = nullptr;
}
}

@@ -195,7 +195,7 @@ YTSuggestionEngine::onFinished()
}

_reply->deleteLater();
_reply = NULL;
_reply = nullptr;
}

int
12 changes: 6 additions & 6 deletions src/YTVIdeoUrlFetcher.cpp
Original file line number Diff line number Diff line change
@@ -50,8 +50,8 @@ QString YTVideoUrlFetcher::_version_str;
bool YTVideoUrlFetcher::_works = false;

YTVideoUrlFetcher::YTVideoUrlFetcher()
: QObject(0)
, _process(0)
: QObject(nullptr)
, _process(nullptr)
{
Q_ASSERT(QFile("/usr/share/harbour-ytplayer/youtube-dl-lite/youtube-dl").exists());

@@ -133,7 +133,7 @@ YTVideoUrlFetcher::onFetchUrlsFor(QString videoId)

qDebug() << "YouTubeDL subprocess:" << getYouTubeDLPath() << arguments;

_process = new QProcess(0);
_process = new QProcess(nullptr);
connect(_process, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(onProcessFinished(int, QProcess::ExitStatus)));
connect(_process, SIGNAL(error(QProcess::ProcessError)),
@@ -183,15 +183,15 @@ YTVideoUrlFetcher::onProcessFinished(int code, QProcess::ExitStatus status)
emit failure(map);
}
delete _process;
_process = NULL;
_process = nullptr;
}

void
YTVideoUrlFetcher::onProcessError(QProcess::ProcessError error)
{
qCritical() << "Process error:" << error;
delete _process;
_process = NULL;
_process = nullptr;
emit failure(QVariantMap());
}

@@ -202,7 +202,7 @@ YTVideoUrlFetcher::~YTVideoUrlFetcher()
_process->kill();
_process->waitForFinished();
_process->deleteLater();
_process = NULL;
_process = nullptr;
}
}

0 comments on commit a66bcdb

Please sign in to comment.