Fix some warnings

This commit is contained in:
Martchus 2018-01-31 21:02:24 +01:00
parent 5254e6cdf9
commit 7848b285b6
5 changed files with 25 additions and 22 deletions

View File

@ -181,13 +181,15 @@ void printNotifications(const MediaFileInfo &fileInfo, const char *head, bool be
void printProperty(const char *propName, const char *value, const char *suffix, Indentation indentation)
{
if(*value) {
cout << indentation << propName << Indentation(30 - strlen(propName)) << value;
if(suffix) {
cout << ' ' << suffix;
}
cout << '\n';
if(!*value) {
return;
}
const auto propLen(strlen(propName));
cout << indentation << propName << Indentation(static_cast<unsigned char>(propLen < 30 ? 30 - propLen : 1)) << value;
if(suffix) {
cout << ' ' << suffix;
}
cout << '\n';
}
void printProperty(const char *propName, ElementPosition elementPosition, const char *suffix, Indentation indentation)

View File

@ -903,6 +903,7 @@ void exportToJson(const ArgumentOccurrence &, const Argument &filesArg, const Ar
#else
VAR_UNUSED(filesArg);
VAR_UNUSED(prettyArg);
cerr << Phrases::Error << "JSON export has not been enabled when building the tag editor." << Phrases::EndFlush;
#endif
}

View File

@ -146,7 +146,7 @@ void addNotifications(Media::NotificationList *notifications, QStandardItem *par
}
template<class ElementType, bool isAdditional = false> void addElementNode(ElementType *element, QStandardItem *parent)
template<class ElementType, bool isAdditional = false> void addElementNode(const ElementType *element, QStandardItem *parent)
{
while(element) {
if(element->isParsed()) {
@ -335,7 +335,7 @@ void FileInfoModel::updateCache()
if(!tags.empty()) {
auto *tagsItem = defaultItem(tr("Tags"));
setItem(++currentRow, tagsItem);
setItem(currentRow, 1, defaultItem(tr("%1 tag(s) assigned", 0, tags.size()).arg(tags.size())));
setItem(currentRow, 1, defaultItem(tr("%1 tag(s) assigned", nullptr, static_cast<int>(tags.size())).arg(tags.size())));
for(const Tag *tag : tags) {
auto *tagItem = defaultItem(tag->typeName());
@ -357,9 +357,9 @@ void FileInfoModel::updateCache()
setItem(++currentRow, tracksItem);
const string summary(m_file->technicalSummary());
if(summary.empty()) {
setItem(currentRow, 1, defaultItem(tr("%1 track(s) contained", 0, tracks.size()).arg(tracks.size())));
setItem(currentRow, 1, defaultItem(tr("%1 track(s) contained", nullptr, static_cast<int>(tracks.size())).arg(tracks.size())));
} else {
setItem(currentRow, 1, defaultItem(tr("%1 track(s): ", 0, tracks.size()).arg(tracks.size()) + QString::fromUtf8(summary.data(), summary.size())));
setItem(currentRow, 1, defaultItem(tr("%1 track(s): ", nullptr, static_cast<int>(tracks.size())).arg(tracks.size()) + QString::fromUtf8(summary.data(), summary.size())));
}
size_t number = 0;
@ -375,7 +375,7 @@ void FileInfoModel::updateCache()
if(track->format() != GeneralMediaFormat::Unknown && strcmp(fmtName, fmtAbbr)) { // format name and abbreviation differ
trackHelper.appendRow(tr("Abbreviation"), fmtAbbr);
}
if(track->version()) {
if(track->version() > 0) {
switch(track->format().general) {
case GeneralMediaFormat::Mpeg4Video:
case GeneralMediaFormat::Avc:
@ -458,7 +458,7 @@ void FileInfoModel::updateCache()
if(!attachments.empty()) {
auto *attachmentsItem = defaultItem(tr("Attachments"));
setItem(++currentRow, attachmentsItem);
setItem(currentRow, 1, defaultItem(tr("%1 attachment(s) present", 0, attachments.size()).arg(attachments.size())));
setItem(currentRow, 1, defaultItem(tr("%1 attachment(s) present", nullptr, attachments.size()).arg(attachments.size())));
size_t number = 0;
for(const AbstractAttachment *attachment : attachments) {
@ -521,7 +521,7 @@ void FileInfoModel::updateCache()
if(!editionEntries.empty()) {
auto *editionsItem = defaultItem(tr("Editions"));
setItem(++currentRow, editionsItem);
setItem(currentRow, 1, defaultItem(tr("%1 edition(s) present", 0, editionEntries.size()).arg(editionEntries.size())));
setItem(currentRow, 1, defaultItem(tr("%1 edition(s) present", nullptr, editionEntries.size()).arg(editionEntries.size())));
size_t editionNumber = 0;
for(const auto &edition : editionEntries) {
auto *editionItem = defaultItem(tr("Edition #%1").arg(++editionNumber));
@ -551,7 +551,7 @@ void FileInfoModel::updateCache()
if(!chapters.empty()) {
auto *chaptersItem = defaultItem(tr("Chapters"));
setItem(++currentRow, chaptersItem);
setItem(currentRow, 1, defaultItem(tr("%1 chapter(s) present", 0, chapters.size()).arg(chapters.size())));
setItem(currentRow, 1, defaultItem(tr("%1 chapter(s) present", nullptr, chapters.size()).arg(chapters.size())));
for(const AbstractChapter *chapter : chapters) {
addChapter(chapter, chaptersItem);
}
@ -570,12 +570,12 @@ void FileInfoModel::updateCache()
switch(m_file->containerFormat()) {
case ContainerFormat::Mp4:
case ContainerFormat::QuickTime:
addElementNode(static_cast<Mp4Container *>(container)->firstElement(), structureItem);
addElementNode(static_cast<const Mp4Container *>(container)->firstElement(), structureItem);
break;
case ContainerFormat::Matroska:
case ContainerFormat::Webm:
case ContainerFormat::Ebml:
addElementNode(static_cast<MatroskaContainer *>(container)->firstElement(), structureItem);
addElementNode(static_cast<const MatroskaContainer *>(container)->firstElement(), structureItem);
break;
default:
;

View File

@ -933,7 +933,7 @@ public:
startTableSection();
const QString moreId(QStringLiteral("tagsMore"));
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Tags"));
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "%1 tag(s) assigned", 0, static_cast<int>(tags.size())).arg(tags.size()));
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "%1 tag(s) assigned", nullptr, static_cast<int>(tags.size())).arg(tags.size()));
mkSpace();
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
m_rowMaker.endRow();
@ -962,7 +962,7 @@ public:
startTableSection();
const QString moreId(QStringLiteral("tracksMore"));
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Tracks"));
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "file has %1 track(s)", 0, static_cast<int>(tracks.size())).arg(tracks.size()));
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "file has %1 track(s)", nullptr, static_cast<int>(tracks.size())).arg(tracks.size()));
const string summary(m_file.technicalSummary());
if(!summary.empty()) {
m_writer.writeCharacters(QStringLiteral(": "));
@ -989,7 +989,7 @@ public:
startTableSection();
const QString moreId(QStringLiteral("attachmentsMore"));
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Attachments"));
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "%1 attachment(s) assigned", 0, static_cast<int>(attachments.size())).arg(attachments.size()));
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "%1 attachment(s) assigned", nullptr, static_cast<int>(attachments.size())).arg(attachments.size()));
mkSpace();
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
m_rowMaker.endRow();
@ -1012,7 +1012,7 @@ public:
startTableSection();
const QString moreId(QStringLiteral("editionsMore"));
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Editions/chapters"));
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "file has %1 edition(s)", 0, static_cast<int>(editionEntries.size())).arg(editionEntries.size()));
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "file has %1 edition(s)", nullptr, static_cast<int>(editionEntries.size())).arg(editionEntries.size()));
mkSpace();
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
m_rowMaker.endRow();
@ -1030,7 +1030,7 @@ public:
startTableSection();
const QString moreId(QStringLiteral("chaptersMore"));
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "chapters"));
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "file has %1 chapter(s)", 0, static_cast<int>(chapterCount)).arg(chapterCount));
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "file has %1 chapter(s)", nullptr, static_cast<int>(chapterCount)).arg(chapterCount));
mkSpace();
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
m_rowMaker.endRow();

View File

@ -99,7 +99,7 @@ string qstringToString(const QString &value, TagTextEncoding textEncoding)
codec = QTextCodec::codecForLocale();
}
const auto encodedString = codec->fromUnicode(value);
return string(encodedString.data(), encodedString.size());
return string(encodedString.data(), static_cast<string::size_type>(encodedString.size()));
}
return string();
}