1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-02-07 15:28:47 +01:00

Replace NULL with nullptr

This commit is contained in:
Jonas Kvinge 2019-09-08 21:18:26 +02:00
parent 795f95d855
commit 57d9c87de6
6 changed files with 21 additions and 21 deletions

View File

@ -447,12 +447,12 @@ SongLoader::Result SongLoader::LoadRemote() {
// Connect callbacks // Connect callbacks
GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline.get())); GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline.get()));
CHECKED_GCONNECT(typefind, "have-type", &TypeFound, this); CHECKED_GCONNECT(typefind, "have-type", &TypeFound, this);
gst_bus_set_sync_handler(bus, BusCallbackSync, this, NULL); gst_bus_set_sync_handler(bus, BusCallbackSync, this, nullptr);
gst_bus_add_watch(bus, BusCallback, this); gst_bus_add_watch(bus, BusCallback, this);
// Add a probe to the sink so we can capture the data if it's a playlist // Add a probe to the sink so we can capture the data if it's a playlist
GstPad *pad = gst_element_get_static_pad(fakesink, "sink"); GstPad *pad = gst_element_get_static_pad(fakesink, "sink");
gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, &DataReady, this, NULL); gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, &DataReady, this, nullptr);
gst_object_unref(pad); gst_object_unref(pad);
QEventLoop loop; QEventLoop loop;

View File

@ -36,7 +36,7 @@
#include "imobiledeviceconnection.h" #include "imobiledeviceconnection.h"
AfcDevice::AfcDevice(const QUrl &url, DeviceLister* lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time) AfcDevice::AfcDevice(const QUrl &url, DeviceLister* lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
: GPodDevice(url, lister, unique_id, manager, app, database_id, first_time), transfer_(NULL) : GPodDevice(url, lister, unique_id, manager, app, database_id, first_time), transfer_(nullptr)
{ {
} }
@ -66,7 +66,7 @@ bool AfcDevice::Init() {
void AfcDevice::CopyFinished(bool success) { void AfcDevice::CopyFinished(bool success) {
transfer_->deleteLater(); transfer_->deleteLater();
transfer_ = NULL; transfer_ = nullptr;
if (!success) { if (!success) {
app_->AddError(tr("An error occurred copying the iTunes database from the device")); app_->AddError(tr("An error occurred copying the iTunes database from the device"));
@ -147,7 +147,7 @@ bool AfcDevice::CopyToStorage(const CopyJob &job) {
void AfcDevice::FinishCopy(bool success) { void AfcDevice::FinishCopy(bool success) {
// Temporarily unset the GUID so libgpod doesn't lock the device for syncing // Temporarily unset the GUID so libgpod doesn't lock the device for syncing
itdb_device_set_sysinfo(db_->device, "FirewireGuid", NULL); itdb_device_set_sysinfo(db_->device, "FirewireGuid", nullptr);
GPodDevice::FinishCopy(success); GPodDevice::FinishCopy(success);
@ -163,7 +163,7 @@ void AfcDevice::FinaliseDatabase() {
// Copy the files back to the iPod // Copy the files back to the iPod
// No need to start another thread since we're already in the organiser thread // No need to start another thread since we're already in the organiser thread
AfcTransfer transfer(url_.host(), local_path_, NULL, shared_from_this()); AfcTransfer transfer(url_.host(), local_path_, nullptr, shared_from_this());
itdb_start_sync(db_); itdb_start_sync(db_);
bool success = transfer.CopyToDevice(connection_.get()); bool success = transfer.CopyToDevice(connection_.get());

View File

@ -84,7 +84,7 @@ void CddaSongLoader::LoadSongs() {
g_object_set(cdda_, "device", g_strdup(url_.path().toLocal8Bit().constData()), nullptr); g_object_set(cdda_, "device", g_strdup(url_.path().toLocal8Bit().constData()), nullptr);
} }
if (g_object_class_find_property (G_OBJECT_GET_CLASS (cdda_), "paranoia-mode")) { if (g_object_class_find_property (G_OBJECT_GET_CLASS (cdda_), "paranoia-mode")) {
g_object_set (cdda_, "paranoia-mode", 0, NULL); g_object_set (cdda_, "paranoia-mode", 0, nullptr);
} }
// Change the element's state to ready and paused, to be able to query it // Change the element's state to ready and paused, to be able to query it
@ -123,8 +123,8 @@ void CddaSongLoader::LoadSongs() {
gst_tag_register_musicbrainz_tags(); gst_tag_register_musicbrainz_tags();
GstElement *pipeline = gst_pipeline_new("pipeline"); GstElement *pipeline = gst_pipeline_new("pipeline");
GstElement *sink = gst_element_factory_make ("fakesink", NULL); GstElement *sink = gst_element_factory_make ("fakesink", nullptr);
gst_bin_add_many (GST_BIN (pipeline), cdda_, sink, NULL); gst_bin_add_many (GST_BIN (pipeline), cdda_, sink, nullptr);
gst_element_link (cdda_, sink); gst_element_link (cdda_, sink);
gst_element_set_state(pipeline, GST_STATE_READY); gst_element_set_state(pipeline, GST_STATE_READY);
gst_element_set_state(pipeline, GST_STATE_PAUSED); gst_element_set_state(pipeline, GST_STATE_PAUSED);

View File

@ -104,10 +104,10 @@ QVariant iMobileDeviceConnection::GetProperty(const QString &property, const QSt
return QVariant(); return QVariant();
} }
plist_t node = NULL; plist_t node = nullptr;
QByteArray domain_ascii = domain.toUtf8(); QByteArray domain_ascii = domain.toUtf8();
const char *d = domain_ascii.isEmpty() ? NULL : domain_ascii.constData(); const char *d = domain_ascii.isEmpty() ? nullptr : domain_ascii.constData();
//const char *d = domain.isEmpty() ? NULL : "com.apple.disk_usage"; //const char *d = domain.isEmpty() ? nullptr : "com.apple.disk_usage";
lockdownd_get_value(lockdown, d, property.toUtf8().constData(), &node); lockdownd_get_value(lockdown, d, property.toUtf8().constData(), &node);
lockdownd_client_free(lockdown); lockdownd_client_free(lockdown);
@ -141,14 +141,14 @@ QStringList iMobileDeviceConnection::ReadDirectory(const QString &path, QDir::Fi
if (!afc_) return QStringList(); if (!afc_) return QStringList();
char **list = NULL; char **list = nullptr;
afc_error_t err = afc_read_directory(afc_, path.toUtf8().constData(), &list); afc_error_t err = afc_read_directory(afc_, path.toUtf8().constData(), &list);
if (err != AFC_E_SUCCESS || !list) { if (err != AFC_E_SUCCESS || !list) {
return QStringList(); return QStringList();
} }
QStringList ret; QStringList ret;
for (char **p = list ; *p != NULL ; ++p) { for (char **p = list ; *p != nullptr ; ++p) {
QString filename = QString::fromUtf8(*p); QString filename = QString::fromUtf8(*p);
free(*p); free(*p);
@ -184,14 +184,14 @@ QString iMobileDeviceConnection::GetFileInfo(const QString &path, const QString
if (!afc_) return QString(); if (!afc_) return QString();
QString ret; QString ret;
char **infolist = NULL; char **infolist = nullptr;
afc_error_t err = afc_get_file_info(afc_, path.toUtf8().constData(), &infolist); afc_error_t err = afc_get_file_info(afc_, path.toUtf8().constData(), &infolist);
if (err != AFC_E_SUCCESS || !infolist) { if (err != AFC_E_SUCCESS || !infolist) {
return ret; return ret;
} }
QString last_key; QString last_key;
for (char **p = infolist ; *p != NULL ; ++p) { for (char **p = infolist ; *p != nullptr ; ++p) {
if (last_key.isNull()) { if (last_key.isNull()) {
last_key = QString::fromUtf8(*p); last_key = QString::fromUtf8(*p);
} }

View File

@ -307,7 +307,7 @@ bool GstEnginePipeline::InitAudioBin() {
// Add a data probe on the src pad of the audioconvert element for our scope. // Add a data probe on the src pad of the audioconvert element for our scope.
// We do it here because we want pre-equalized and pre-volume samples so that our visualization are not be affected by them. // We do it here because we want pre-equalized and pre-volume samples so that our visualization are not be affected by them.
pad = gst_element_get_static_pad(event_probe, "src"); pad = gst_element_get_static_pad(event_probe, "src");
gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, &EventHandoffCallback, this, NULL); gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, &EventHandoffCallback, this, nullptr);
gst_object_unref(pad); gst_object_unref(pad);
// Configure the fakesink properly // Configure the fakesink properly
@ -449,7 +449,7 @@ bool GstEnginePipeline::InitFromUrl(const QByteArray &stream_url, const QUrl ori
CHECKED_GCONNECT(G_OBJECT(pipeline_), "notify::source", &SourceSetupCallback, this); CHECKED_GCONNECT(G_OBJECT(pipeline_), "notify::source", &SourceSetupCallback, this);
// Setting up a discoverer // Setting up a discoverer
discoverer_ = gst_discoverer_new(kDiscoveryTimeoutS * GST_SECOND, NULL); discoverer_ = gst_discoverer_new(kDiscoveryTimeoutS * GST_SECOND, nullptr);
if (discoverer_) { if (discoverer_) {
CHECKED_GCONNECT(G_OBJECT(discoverer_), "discovered", &StreamDiscovered, this); CHECKED_GCONNECT(G_OBJECT(discoverer_), "discovered", &StreamDiscovered, this);
CHECKED_GCONNECT(G_OBJECT(discoverer_), "finished", &StreamDiscoveryFinished, this); CHECKED_GCONNECT(G_OBJECT(discoverer_), "finished", &StreamDiscoveryFinished, this);
@ -459,7 +459,7 @@ bool GstEnginePipeline::InitFromUrl(const QByteArray &stream_url, const QUrl ori
if (!InitAudioBin()) return false; if (!InitAudioBin()) return false;
// Set playbin's sink to be our costum audio-sink. // Set playbin's sink to be our costum audio-sink.
g_object_set(GST_OBJECT(pipeline_), "audio-sink", audiobin_, NULL); g_object_set(GST_OBJECT(pipeline_), "audio-sink", audiobin_, nullptr);
pipeline_is_connected_ = true; pipeline_is_connected_ = true;
return true; return true;
@ -550,7 +550,7 @@ void GstEnginePipeline::StreamStatusMessageReceived(GstMessage *msg) {
const GValue *val = gst_message_get_stream_status_object(msg); const GValue *val = gst_message_get_stream_status_object(msg);
if (G_VALUE_TYPE(val) == GST_TYPE_TASK) { if (G_VALUE_TYPE(val) == GST_TYPE_TASK) {
GstTask *task = static_cast<GstTask*>(g_value_get_object(val)); GstTask *task = static_cast<GstTask*>(g_value_get_object(val));
gst_task_set_enter_callback(task, &TaskEnterCallback, this, NULL); gst_task_set_enter_callback(task, &TaskEnterCallback, this, nullptr);
} }
} }

View File

@ -101,7 +101,7 @@ QString Chromaprinter::CreateFingerprint() {
"format", G_TYPE_STRING, "S16LE", "format", G_TYPE_STRING, "S16LE",
"channels", G_TYPE_INT, kDecodeChannels, "channels", G_TYPE_INT, kDecodeChannels,
"rate", G_TYPE_INT, kDecodeRate, "rate", G_TYPE_INT, kDecodeRate,
NULL); nullptr);
gst_element_link_filtered(resample, sink, caps); gst_element_link_filtered(resample, sink, caps);
gst_caps_unref(caps); gst_caps_unref(caps);