Fix uninitialized variables

This commit is contained in:
Jonas Kvinge
2021-03-26 21:30:13 +01:00
parent 8a39a43ad5
commit 14fb647647
27 changed files with 64 additions and 65 deletions

View File

@@ -33,11 +33,11 @@ FileSystemWatcherInterface::FileSystemWatcherInterface(QObject *parent)
: QObject(parent) {}
FileSystemWatcherInterface *FileSystemWatcherInterface::Create(QObject *parent) {
FileSystemWatcherInterface *ret;
#ifdef Q_OS_MACOS
ret = new MacFSListener(parent);
FileSystemWatcherInterface *ret = new MacFSListener(parent);
#else
ret = new QtFSListener(parent);
FileSystemWatcherInterface *ret = new QtFSListener(parent);
#endif
ret->Init();

View File

@@ -282,7 +282,7 @@ QModelIndex MergedProxyModel::mapFromSource(const QModelIndex &source_index) con
// Add a mapping if we don't have one already
const auto &it = p_->mappings_.get<tag_by_source>().find(source_index);
Mapping *mapping;
Mapping *mapping = nullptr;
if (it != p_->mappings_.get<tag_by_source>().end()) {
mapping = *it;
}

View File

@@ -566,8 +566,8 @@ void SongLoader::ErrorMessageReceived(GstMessage *msg) {
if (state_ == Finished) return;
GError *error;
gchar *debugs;
GError *error = nullptr;
gchar *debugs = nullptr;
gst_message_parse_error(msg, &error, &debugs);
qLog(Error) << __PRETTY_FUNCTION__ << error->message;

View File

@@ -315,7 +315,7 @@ bool Copy(QIODevice *source, QIODevice *destination) {
std::unique_ptr<char[]> data(new char[bytes]);
qint64 pos = 0;
qint64 bytes_read;
qint64 bytes_read = 0;
do {
bytes_read = source->read(data.get() + pos, bytes - pos);
if (bytes_read == -1) return false;
@@ -324,7 +324,7 @@ bool Copy(QIODevice *source, QIODevice *destination) {
} while (bytes_read > 0 && pos != bytes);
pos = 0;
qint64 bytes_written;
qint64 bytes_written = 0;
do {
bytes_written = destination->write(data.get() + pos, bytes - pos);
if (bytes_written == -1) return false;