Fix comparison between signed/unsigned

This commit is contained in:
Jonas Kvinge
2019-11-15 00:23:06 +01:00
parent bbad45f1e7
commit 1b65dcd7df
11 changed files with 19 additions and 25 deletions

View File

@@ -114,12 +114,9 @@ void SingleApplicationPrivate::genBlockServerName() {
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
QByteArray username; QByteArray username;
#if defined(HAVE_GETEUID) && defined(HAVE_GETPWUID) #if defined(HAVE_GETEUID) && defined(HAVE_GETPWUID)
uid_t uid = geteuid(); struct passwd *pw = getpwuid(geteuid());
if (uid != -1) { if (pw) {
struct passwd *pw = getpwuid(uid); username = pw->pw_name;
if (pw) {
username = pw->pw_name;
}
} }
#endif #endif
if (username.isEmpty()) username = qgetenv("USER"); if (username.isEmpty()) username = qgetenv("USER");

View File

@@ -114,12 +114,9 @@ void SingleCoreApplicationPrivate::genBlockServerName() {
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
QByteArray username; QByteArray username;
#if defined(HAVE_GETEUID) && defined(HAVE_GETPWUID) #if defined(HAVE_GETEUID) && defined(HAVE_GETPWUID)
uid_t uid = geteuid(); struct passwd *pw = getpwuid(geteuid());
if (uid != -1) { if (pw) {
struct passwd *pw = getpwuid(uid); username = pw->pw_name;
if (pw) {
username = pw->pw_name;
}
} }
#endif #endif
if (username.isEmpty()) username = qgetenv("USER"); if (username.isEmpty()) username = qgetenv("USER");

View File

@@ -290,7 +290,7 @@ void TagReader::ReadFile(const QString &filename, pb::tagreader::SongMetadata *s
if (!map["APIC"].isEmpty()) song->set_art_automatic(kEmbeddedCover); if (!map["APIC"].isEmpty()) song->set_art_automatic(kEmbeddedCover);
// Find a suitable comment tag. For now we ignore iTunNORM comments. // Find a suitable comment tag. For now we ignore iTunNORM comments.
for (int i = 0; i < map["COMM"].size(); ++i) { for (uint i = 0; i < map["COMM"].size(); ++i) {
const TagLib::ID3v2::CommentsFrame *frame = dynamic_cast<const TagLib::ID3v2::CommentsFrame*>(map["COMM"][i]); const TagLib::ID3v2::CommentsFrame *frame = dynamic_cast<const TagLib::ID3v2::CommentsFrame*>(map["COMM"][i]);
if (frame && TStringToQString(frame->description()) != "iTunNORM") { if (frame && TStringToQString(frame->description()) != "iTunNORM") {
@@ -300,7 +300,7 @@ void TagReader::ReadFile(const QString &filename, pb::tagreader::SongMetadata *s
} }
// Parse FMPS frames // Parse FMPS frames
for (int i = 0; i < map["TXXX"].size(); ++i) { for (uint i = 0; i < map["TXXX"].size(); ++i) {
const TagLib::ID3v2::UserTextIdentificationFrame *frame = dynamic_cast<const TagLib::ID3v2::UserTextIdentificationFrame*>(map["TXXX"][i]); const TagLib::ID3v2::UserTextIdentificationFrame *frame = dynamic_cast<const TagLib::ID3v2::UserTextIdentificationFrame*>(map["TXXX"][i]);
if (frame && frame->description().startsWith("FMPS_")) { if (frame && frame->description().startsWith("FMPS_")) {
@@ -836,7 +836,7 @@ QByteArray TagReader::LoadEmbeddedAPEArt(const TagLib::APE::ItemListMap &map) co
TagLib::ByteVector data = it->second.binaryData(); TagLib::ByteVector data = it->second.binaryData();
int pos = data.find('\0') + 1; int pos = data.find('\0') + 1;
if ((pos > 0) && (pos < data.size())) { if ((pos > 0) && ((uint)pos < data.size())) {
ret = QByteArray(data.data() + pos, data.size() - pos); ret = QByteArray(data.data() + pos, data.size() - pos);
} }
} }

View File

@@ -72,7 +72,7 @@ void Analyzer::Base::showEvent(QShowEvent*) { timer_.start(timeout(), this); }
void Analyzer::Base::transform(Scope& scope) { void Analyzer::Base::transform(Scope& scope) {
QVector<float> aux(fht_->size()); QVector<float> aux(fht_->size());
if (aux.size() >= scope.size()) { if ((long unsigned int)aux.size() >= scope.size()) {
std::copy(scope.begin(), scope.end(), aux.begin()); std::copy(scope.begin(), scope.end(), aux.begin());
} }
else { else {

View File

@@ -196,7 +196,7 @@ void BlockAnalyzer::analyze(QPainter &p, const Analyzer::Scope &s, bool new_fram
canvas_painter.drawPixmap(x * (kWidth + 1), y * (kHeight + 1) + y_, *bar(), 0, y * (kHeight + 1), bar()->width(), bar()->height()); canvas_painter.drawPixmap(x * (kWidth + 1), y * (kHeight + 1) + y_, *bar(), 0, y * (kHeight + 1), bar()->width(), bar()->height());
} }
for (uint x = 0; x < store_.size(); ++x) for (int x = 0; x < store_.size(); ++x)
canvas_painter.drawPixmap(x * (kWidth + 1), static_cast<int>(store_[x]) * (kHeight + 1) + y_, topbarpixmap_); canvas_painter.drawPixmap(x * (kWidth + 1), static_cast<int>(store_[x]) * (kHeight + 1) + y_, topbarpixmap_);
p.drawPixmap(0, 0, canvas_); p.drawPixmap(0, 0, canvas_);

View File

@@ -498,7 +498,7 @@ void ContextView::UpdateSong(const Song &song) {
void ContextView::UpdateLyrics(const quint64 id, const QString &provider, const QString &lyrics) { void ContextView::UpdateLyrics(const quint64 id, const QString &provider, const QString &lyrics) {
if (id != lyrics_id_) return; if ((qint64) id != lyrics_id_) return;
lyrics_ = lyrics + "\n\n(Lyrics from " + provider + ")\n"; lyrics_ = lyrics + "\n\n(Lyrics from " + provider + ")\n";
lyrics_id_ = -1; lyrics_id_ = -1;
if (action_show_lyrics_->isChecked()) { if (action_show_lyrics_->isChecked()) {

View File

@@ -55,7 +55,7 @@ inline void AddMetadata(const QString &key, const QDateTime &metadata, QVariantM
if (metadata.isValid()) (*map)[key] = metadata; if (metadata.isValid()) (*map)[key] = metadata;
} }
inline QString AsMPRISDateTimeType(uint time) { inline QString AsMPRISDateTimeType(const int time) {
return time != -1 ? QDateTime::fromTime_t(time).toString(Qt::ISODate) : ""; return time != -1 ? QDateTime::fromTime_t(time).toString(Qt::ISODate) : "";
} }

View File

@@ -149,7 +149,7 @@ void CddaSongLoader::LoadSongs() {
gst_message_parse_toc (msg_toc, &toc, nullptr); gst_message_parse_toc (msg_toc, &toc, nullptr);
if (toc) { if (toc) {
GList *entries = gst_toc_get_entries(toc); GList *entries = gst_toc_get_entries(toc);
if (entries && songs.size() <= g_list_length (entries)) { if (entries && (guint)songs.size() <= g_list_length(entries)) {
int i = 0; int i = 0;
for (GList *node = entries; node != nullptr; node = node->next) { for (GList *node = entries; node != nullptr; node = node->next) {
GstTocEntry *entry = static_cast<GstTocEntry*>(node->data); GstTocEntry *entry = static_cast<GstTocEntry*>(node->data);

View File

@@ -511,7 +511,7 @@ void GstEngine::EndOfStreamReached(const int pipeline_id, const bool has_next_tr
} }
void GstEngine::HandlePipelineError(int pipeline_id, const QString &message, int domain, int error_code) { void GstEngine::HandlePipelineError(const int pipeline_id, const QString &message, const int domain, const int error_code) {
if (!current_pipeline_.get() || current_pipeline_->id() != pipeline_id) return; if (!current_pipeline_.get() || current_pipeline_->id() != pipeline_id) return;
@@ -521,7 +521,7 @@ void GstEngine::HandlePipelineError(int pipeline_id, const QString &message, int
BufferingFinished(); BufferingFinished();
emit StateChanged(Engine::Error); emit StateChanged(Engine::Error);
if (domain == GST_RESOURCE_ERROR && (error_code == GST_RESOURCE_ERROR_NOT_FOUND || error_code == GST_RESOURCE_ERROR_NOT_AUTHORIZED)) { if (domain == (int)GST_RESOURCE_ERROR && (error_code == (int)GST_RESOURCE_ERROR_NOT_FOUND || error_code == (int)GST_RESOURCE_ERROR_NOT_AUTHORIZED)) {
emit InvalidSongRequested(stream_url_); emit InvalidSongRequested(stream_url_);
} }
else { else {

View File

@@ -617,7 +617,7 @@ GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad *pad, GstPadProbeInf
if (instance->end_offset_nanosec_ > 0) { if (instance->end_offset_nanosec_ > 0) {
quint64 start_time = GST_BUFFER_TIMESTAMP(buf) - instance->segment_start_; quint64 start_time = GST_BUFFER_TIMESTAMP(buf) - instance->segment_start_;
quint64 duration = GST_BUFFER_DURATION(buf); quint64 duration = GST_BUFFER_DURATION(buf);
quint64 end_time = start_time + duration; qint64 end_time = start_time + duration;
if (end_time > instance->end_offset_nanosec_) { if (end_time > instance->end_offset_nanosec_) {
if (instance->has_next_valid_url() && instance->next_stream_url_ == instance->stream_url_ && instance->next_beginning_offset_nanosec_ == instance->end_offset_nanosec_) { if (instance->has_next_valid_url() && instance->next_stream_url_ == instance->stream_url_ && instance->next_beginning_offset_nanosec_ == instance->end_offset_nanosec_) {
@@ -804,7 +804,7 @@ void GstEnginePipeline::ErrorMessageReceived(GstMessage *msg) {
g_error_free(error); g_error_free(error);
free(debugs); free(debugs);
if (state() == GST_STATE_PLAYING && pipeline_is_initialised_ && next_uri_set_ && (domain == GST_RESOURCE_ERROR || domain == GST_STREAM_ERROR)) { if (state() == GST_STATE_PLAYING && pipeline_is_initialised_ && next_uri_set_ && (domain == (int)GST_RESOURCE_ERROR || domain == (int)GST_STREAM_ERROR)) {
// A track is still playing and the next uri is not playable. We ignore the error here so it can play until the end. // A track is still playing and the next uri is not playable. We ignore the error here so it can play until the end.
// But there is no message send to the bus when the current track finishes, we have to add an EOS ourself. // But there is no message send to the bus when the current track finishes, we have to add an EOS ourself.
qLog(Debug) << "Ignoring error when loading next track"; qLog(Debug) << "Ignoring error when loading next track";

View File

@@ -575,7 +575,7 @@ void Transcoder::SetElementProperties(const QString &name, GObject *object) {
guint properties_count = 0; guint properties_count = 0;
GParamSpec **properties = g_object_class_list_properties(G_OBJECT_GET_CLASS(object), &properties_count); GParamSpec **properties = g_object_class_list_properties(G_OBJECT_GET_CLASS(object), &properties_count);
for (int i = 0; i < properties_count; ++i) { for (uint i = 0; i < properties_count; ++i) {
GParamSpec *property = properties[i]; GParamSpec *property = properties[i];
const QVariant value = s.value(property->name); const QVariant value = s.value(property->name);