From 84053a76f42f0194838af7858942b93eeeeac1ea Mon Sep 17 00:00:00 2001 From: lordmulder Date: Tue, 8 Nov 2011 15:12:31 +0100 Subject: [PATCH] Use qMin() and qMax() instead of min() and max() macros. Also use qBound() where appropriate. --- src/Dialog_About.cpp | 8 ++++---- src/Dialog_CueImport.cpp | 2 +- src/Dialog_DropBox.cpp | 4 ++-- src/Dialog_MainWindow.cpp | 6 +++--- src/Dialog_Processing.cpp | 14 +++++++------- src/Encoder_AAC.cpp | 9 +++------ src/Encoder_AAC_FHG.cpp | 5 +---- src/Encoder_AC3.cpp | 13 +++++-------- src/Encoder_Abstract.cpp | 4 ++-- src/Encoder_FLAC.cpp | 5 +---- src/Encoder_MP3.cpp | 8 ++++---- src/Encoder_Vorbis.cpp | 11 ++++------- src/Encoder_Wave.cpp | 2 -- src/Filter_Normalize.cpp | 4 ++-- src/Filter_Resample.cpp | 2 +- src/Filter_ToneAdjust.cpp | 4 ++-- src/Global.cpp | 2 +- src/Main.cpp | 2 +- src/Model_CueSheet.cpp | 2 +- src/Thread_CueSplitter.cpp | 4 ++-- src/Thread_DiskObserver.cpp | 2 +- src/Thread_FileAnalyzer.cpp | 8 ++++---- src/Thread_Initialization.cpp | 8 ++++---- 23 files changed, 56 insertions(+), 73 deletions(-) diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index b7082033..9bed83b4 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -99,7 +99,7 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta const QString copyrightStr = QString().sprintf ( "Copyright (C) 2004-%04d LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.", - max(lamexp_version_date().year(), QDate::currentDate().year()) + qMax(lamexp_version_date().year(), QDate::currentDate().year()) ); for(int i = 0; i < 4; i++) @@ -116,12 +116,12 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta if(LAMEXP_DEBUG) { - int daysLeft = max(QDate::currentDate().daysTo(lamexp_version_expires()), 0); + int daysLeft = qMax(QDate::currentDate().daysTo(lamexp_version_expires()), 0); aboutText += QString("
%1").arg(NOBR(QString("!!! --- DEBUG BUILD --- Expires at: %1 · Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft)))); } else if(lamexp_version_demo()) { - int daysLeft = max(QDate::currentDate().daysTo(lamexp_version_expires()), 0); + int daysLeft = qMax(QDate::currentDate().daysTo(lamexp_version_expires()), 0); aboutText += QString("
%1").arg(NOBR(tr("Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left.").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft)))); } @@ -539,7 +539,7 @@ void AboutDialog::moveDisque(void) if(m_disqueDelay != _I64_MAX) { const double delay = static_cast(perfCount.QuadPart) - static_cast(m_disqueDelay); - delta = max(1, min(128, static_cast(ceil(delay / static_cast(perfFrequ.QuadPart) / 0.00512)))); + delta = qMax(1, qMin(128, static_cast(ceil(delay / static_cast(perfFrequ.QuadPart) / 0.00512)))); } m_disqueDelay = perfCount.QuadPart; } diff --git a/src/Dialog_CueImport.cpp b/src/Dialog_CueImport.cpp index 97d3468d..930d2c1d 100644 --- a/src/Dialog_CueImport.cpp +++ b/src/Dialog_CueImport.cpp @@ -164,7 +164,7 @@ void CueImportDialog::browseButtonClicked(void) while(QDir(currentDir).exists()) { - int pos = max(currentDir.lastIndexOf(QChar('\\')), currentDir.lastIndexOf(QChar('/'))); + int pos = qMax(currentDir.lastIndexOf(QChar('\\')), currentDir.lastIndexOf(QChar('/'))); if(pos > 0) currentDir.left(pos - 1); else break; } diff --git a/src/Dialog_DropBox.cpp b/src/Dialog_DropBox.cpp index 0693f50c..593b636e 100644 --- a/src/Dialog_DropBox.cpp +++ b/src/Dialog_DropBox.cpp @@ -188,8 +188,8 @@ void DropBox::mouseMoveEvent(QMouseEvent *event) const int max_x = screenGeometry.width() - frameGeometry().width() + screenGeometry.left(); const int max_y = screenGeometry.height() - frameGeometry().height() + screenGeometry.top(); - int new_x = min(max_x, max(screenGeometry.left(), m_windowReferencePoint.x() - delta_x)); - int new_y = min(max_y, max(screenGeometry.top(), m_windowReferencePoint.y() - delta_y)); + int new_x = qMin(max_x, qMax(screenGeometry.left(), m_windowReferencePoint.x() - delta_x)); + int new_y = qMin(max_y, qMax(screenGeometry.top(), m_windowReferencePoint.y() - delta_y)); if(new_x < magnetic) { diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index bfd36629..b2427898 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -2583,7 +2583,7 @@ void MainWindow::updateBitrate(int value) labelBitrate->setText(tr("Compression %1").arg(value)); break; case SettingsModel::AC3Encoder: - labelBitrate->setText(tr("Quality Level %1").arg(min(1024, max(0, value * 64)))); + labelBitrate->setText(tr("Quality Level %1").arg(qMin(1024, qMax(0, value * 64)))); break; case SettingsModel::PCMEncoder: labelBitrate->setText(tr("Uncompressed")); @@ -2609,7 +2609,7 @@ void MainWindow::updateBitrate(int value) labelBitrate->setText(tr("Uncompressed")); break; default: - labelBitrate->setText(QString("≈ %1 kbps").arg(min(500, value * 8))); + labelBitrate->setText(QString("≈ %1 kbps").arg(qMin(500, value * 8))); break; } break; @@ -2629,7 +2629,7 @@ void MainWindow::updateBitrate(int value) labelBitrate->setText(tr("Uncompressed")); break; default: - labelBitrate->setText(QString("%1 kbps").arg(min(500, value * 8))); + labelBitrate->setText(QString("%1 kbps").arg(qMin(500, value * 8))); break; } break; diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index b1dd2dd6..b6482c68 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -66,10 +66,10 @@ //////////////////////////////////////////////////////////// //Maximum number of parallel instances -#define MAX_INSTANCES 16 +#define MAX_INSTANCES 16U //Maximum number of CPU cores for auto-detection -#define MAX_CPU_COUNT 4 +#define MAX_CPU_COUNT 4U //////////////////////////////////////////////////////////// @@ -357,20 +357,20 @@ void ProcessingDialog::initEncoding(void) m_ramObserver->start(); } - int maximumInstances = max(min(m_settings->maximumInstances(), MAX_INSTANCES), 0); + unsigned int maximumInstances = qBound(0U, m_settings->maximumInstances(), MAX_INSTANCES); if(maximumInstances < 1) { lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features(); - maximumInstances = max(min(cpuFeatures.count, MAX_CPU_COUNT), 1); + maximumInstances = qBound(1U, static_cast(cpuFeatures.count), MAX_CPU_COUNT); } - int parallelThreadCount = max(min(maximumInstances, m_pendingJobs.count()), 1); + unsigned int parallelThreadCount = qBound(1U, maximumInstances, static_cast(m_pendingJobs.count())); if(parallelThreadCount > 1) { m_progressModel->addSystemMessage(tr("Multi-threading enabled: Running %1 instances in parallel!").arg(QString::number(parallelThreadCount))); } - for(int i = 0; i < parallelThreadCount; i++) + for(unsigned int i = 0; i < parallelThreadCount; i++) { startNextJob(); } @@ -537,7 +537,7 @@ void ProcessingDialog::logViewSectionSizeChanged(int logicalIndex, int oldSize, { if(QHeaderView *hdr = view_log->horizontalHeader()) { - hdr->setMinimumSectionSize(max(hdr->minimumSectionSize(), hdr->sectionSize(1))); + hdr->setMinimumSectionSize(qMax(hdr->minimumSectionSize(), hdr->sectionSize(1))); } } } diff --git a/src/Encoder_AAC.cpp b/src/Encoder_AAC.cpp index b4e29675..ceb99c06 100644 --- a/src/Encoder_AAC.cpp +++ b/src/Encoder_AAC.cpp @@ -27,9 +27,6 @@ #include #include -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define min(a,b) (((a) < (b)) ? (a) : (b)) - AACEncoder::AACEncoder(void) : m_binary_enc(lamexp_lookup_tool("neroAacEnc.exe")), @@ -57,13 +54,13 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf switch(m_configRCMode) { case SettingsModel::VBRMode: - args << "-q" << QString().sprintf("%.2f", min(1.0, max(0.0, static_cast(m_configBitrate * 5) / 100.0))); + args << "-q" << QString().sprintf("%.2f", qMin(1.0, qMax(0.0, static_cast(m_configBitrate * 5) / 100.0))); break; case SettingsModel::ABRMode: - args << "-br" << QString::number(max(32, min(500, (m_configBitrate * 8))) * 1000); + args << "-br" << QString::number(qMax(32, qMin(500, (m_configBitrate * 8))) * 1000); break; case SettingsModel::CBRMode: - args << "-cbr" << QString::number(max(32, min(500, (m_configBitrate * 8))) * 1000); + args << "-cbr" << QString::number(qMax(32, qMin(500, (m_configBitrate * 8))) * 1000); break; default: throw "Bad rate-control mode!"; diff --git a/src/Encoder_AAC_FHG.cpp b/src/Encoder_AAC_FHG.cpp index cb1b7a17..13d8f984 100644 --- a/src/Encoder_AAC_FHG.cpp +++ b/src/Encoder_AAC_FHG.cpp @@ -28,9 +28,6 @@ #include #include -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define min(a,b) (((a) < (b)) ? (a) : (b)) - FHGAACEncoder::FHGAACEncoder(void) : m_binary_enc(lamexp_lookup_tool("fhgaacenc.exe")), @@ -76,7 +73,7 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel &meta switch(m_configRCMode) { case SettingsModel::CBRMode: - args << "--cbr" << QString::number(max(32, min(maxBitrate, (m_configBitrate * 8)))); + args << "--cbr" << QString::number(qMax(32, qMin(maxBitrate, (m_configBitrate * 8)))); break; case SettingsModel::VBRMode: args << "--vbr" << QString::number(qRound(static_cast(m_configBitrate) / 5.0) + 1); diff --git a/src/Encoder_AC3.cpp b/src/Encoder_AC3.cpp index 2b62e571..d6aed475 100644 --- a/src/Encoder_AC3.cpp +++ b/src/Encoder_AC3.cpp @@ -27,9 +27,6 @@ #include #include -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define min(a,b) (((a) < (b)) ? (a) : (b)) - AC3Encoder::AC3Encoder(void) : m_binary(lamexp_lookup_tool("aften.exe")) @@ -57,10 +54,10 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf switch(m_configRCMode) { case SettingsModel::VBRMode: - args << "-q" << QString::number(max(0, min(1023, m_configBitrate * 64))); + args << "-q" << QString::number(qMax(0, qMin(1023, m_configBitrate * 64))); break; case SettingsModel::CBRMode: - args << "-b" << QString::number(SettingsModel::ac3Bitrates[max(0, min(18, m_configBitrate))]); + args << "-b" << QString::number(SettingsModel::ac3Bitrates[qMax(0, qMin(18, m_configBitrate))]); break; default: throw "Bad rate-control mode!"; @@ -154,17 +151,17 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf void AC3Encoder::setAudioCodingMode(int value) { - m_configAudioCodingMode = min(8, max(0, value)); + m_configAudioCodingMode = qMin(8, qMax(0, value)); } void AC3Encoder::setDynamicRangeCompression(int value) { - m_configDynamicRangeCompression = min(5, max(0, value)); + m_configDynamicRangeCompression = qMin(5, qMax(0, value)); } void AC3Encoder::setExponentSearchSize(int value) { - m_configExponentSearchSize = min(32, max(1, value)); + m_configExponentSearchSize = qMin(32, qMax(1, value)); } void AC3Encoder::setFastBitAllocation(bool value) diff --git a/src/Encoder_Abstract.cpp b/src/Encoder_Abstract.cpp index 9f6786f5..67dea371 100644 --- a/src/Encoder_Abstract.cpp +++ b/src/Encoder_Abstract.cpp @@ -38,8 +38,8 @@ AbstractEncoder::~AbstractEncoder(void) * Setters */ -void AbstractEncoder::setBitrate(int bitrate) { m_configBitrate = max(0, bitrate); } -void AbstractEncoder::setRCMode(int mode) { m_configRCMode = max(0, mode); } +void AbstractEncoder::setBitrate(int bitrate) { m_configBitrate = qMax(0, bitrate); } +void AbstractEncoder::setRCMode(int mode) { m_configRCMode = qMax(0, mode); } void AbstractEncoder::setCustomParams(const QString &customParams) { m_configCustomParams = customParams; } /* diff --git a/src/Encoder_FLAC.cpp b/src/Encoder_FLAC.cpp index 22e82073..04042a32 100644 --- a/src/Encoder_FLAC.cpp +++ b/src/Encoder_FLAC.cpp @@ -27,9 +27,6 @@ #include #include -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define min(a,b) (((a) < (b)) ? (a) : (b)) - FLACEncoder::FLACEncoder(void) : m_binary(lamexp_lookup_tool("flac.exe")) @@ -49,7 +46,7 @@ bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn QProcess process; QStringList args; - args << QString("-%1").arg(QString::number(max(0, min(8, m_configBitrate)))); + args << QString("-%1").arg(QString::number(qMax(0, qMin(8, m_configBitrate)))); if(!metaInfo.fileName().isEmpty()) args << "-T" << QString("title=%1").arg(metaInfo.fileName()); if(!metaInfo.fileArtist().isEmpty()) args << "-T" << QString("artist=%1").arg(metaInfo.fileArtist()); diff --git a/src/Encoder_MP3.cpp b/src/Encoder_MP3.cpp index b6dba696..2b851610 100644 --- a/src/Encoder_MP3.cpp +++ b/src/Encoder_MP3.cpp @@ -61,14 +61,14 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf switch(m_configRCMode) { case SettingsModel::VBRMode: - args << "-V" << QString::number(9 - min(9, m_configBitrate)); + args << "-V" << QString::number(9 - qMin(9, m_configBitrate)); break; case SettingsModel::ABRMode: - args << "--abr" << QString::number(SettingsModel::mp3Bitrates[max(0, min(13, m_configBitrate))]); + args << "--abr" << QString::number(SettingsModel::mp3Bitrates[qMax(0, qMin(13, m_configBitrate))]); break; case SettingsModel::CBRMode: args << "--cbr"; - args << "-b" << QString::number(SettingsModel::mp3Bitrates[max(0, min(13, m_configBitrate))]); + args << "-b" << QString::number(SettingsModel::mp3Bitrates[qMax(0, qMin(13, m_configBitrate))]); break; default: throw "Bad rate-control mode!"; @@ -254,7 +254,7 @@ void MP3Encoder::setChannelMode(int value) int MP3Encoder::clipBitrate(int bitrate) { - int targetBitrate = min(max(bitrate, 32), 320); + int targetBitrate = qMin(qMax(bitrate, 32), 320); int minDiff = INT_MAX; int minIndx = -1; diff --git a/src/Encoder_Vorbis.cpp b/src/Encoder_Vorbis.cpp index f6a766ff..65fa8e4a 100644 --- a/src/Encoder_Vorbis.cpp +++ b/src/Encoder_Vorbis.cpp @@ -27,9 +27,6 @@ #include #include -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define min(a,b) (((a) < (b)) ? (a) : (b)) - VorbisEncoder::VorbisEncoder(void) : m_binary(lamexp_lookup_tool("oggenc2.exe")) @@ -57,10 +54,10 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel &meta switch(m_configRCMode) { case SettingsModel::VBRMode: - args << "-q" << QString::number(max(-2, min(10, m_configBitrate))); + args << "-q" << QString::number(qMax(-2, qMin(10, m_configBitrate))); break; case SettingsModel::ABRMode: - args << "-b" << QString::number(max(32, min(500, (m_configBitrate * 8)))); + args << "-b" << QString::number(qMax(32, qMin(500, (m_configBitrate * 8)))); break; default: throw "Bad rate-control mode!"; @@ -69,8 +66,8 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel &meta if((m_configBitrateMaximum > 0) && (m_configBitrateMinimum > 0) && (m_configBitrateMinimum <= m_configBitrateMaximum)) { - args << "--min-bitrate" << QString::number(min(max(m_configBitrateMinimum, 32), 500)); - args << "--max-bitrate" << QString::number(min(max(m_configBitrateMaximum, 32), 500)); + args << "--min-bitrate" << QString::number(qMin(qMax(m_configBitrateMinimum, 32), 500)); + args << "--max-bitrate" << QString::number(qMin(qMax(m_configBitrateMaximum, 32), 500)); } if(m_configSamplingRate > 0) diff --git a/src/Encoder_Wave.cpp b/src/Encoder_Wave.cpp index 25fe5ae9..b7b7df77 100644 --- a/src/Encoder_Wave.cpp +++ b/src/Encoder_Wave.cpp @@ -27,8 +27,6 @@ #include #include -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define min(a,b) (((a) < (b)) ? (a) : (b)) #define FIX_SEPARATORS(STR) for(int i = 0; STR[i]; i++) { if(STR[i] == L'/') STR[i] = L'\\'; } WaveEncoder::WaveEncoder(void) diff --git a/src/Filter_Normalize.cpp b/src/Filter_Normalize.cpp index 7facb3bf..9b1b5474 100644 --- a/src/Filter_Normalize.cpp +++ b/src/Filter_Normalize.cpp @@ -36,8 +36,8 @@ NormalizeFilter::NormalizeFilter(int peakVolume, int equalizationMode) throw "Error initializing SoX filter. Tool 'sox.exe' is not registred!"; } - m_peakVolume = min(-50, max(-3200, peakVolume)); - m_equalizationMode = min(2, max(0, equalizationMode)); + m_peakVolume = qMin(-50, qMax(-3200, peakVolume)); + m_equalizationMode = qMin(2, qMax(0, equalizationMode)); } NormalizeFilter::~NormalizeFilter(void) diff --git a/src/Filter_Resample.cpp b/src/Filter_Resample.cpp index 6d831fee..6d327429 100644 --- a/src/Filter_Resample.cpp +++ b/src/Filter_Resample.cpp @@ -36,7 +36,7 @@ ResampleFilter::ResampleFilter(int samplingRate) throw "Error initializing SoX filter. Tool 'sox.exe' is not registred!"; } - m_samplingRate = min(192000, max(8000, samplingRate)); + m_samplingRate = qMin(192000, qMax(8000, samplingRate)); } ResampleFilter::~ResampleFilter(void) diff --git a/src/Filter_ToneAdjust.cpp b/src/Filter_ToneAdjust.cpp index 126636ca..0f2f6a19 100644 --- a/src/Filter_ToneAdjust.cpp +++ b/src/Filter_ToneAdjust.cpp @@ -37,8 +37,8 @@ ToneAdjustFilter::ToneAdjustFilter(int bass, int treble) throw "Error initializing SoX filter. Tool 'sox.exe' is not registred!"; } - m_bass = max(-2000, min(2000, bass)); - m_treble = max(-2000, min(2000, treble)); + m_bass = qMax(-2000, qMin(2000, bass)); + m_treble = qMax(-2000, qMin(2000, treble)); } ToneAdjustFilter::~ToneAdjustFilter(void) diff --git a/src/Global.cpp b/src/Global.cpp index add998b5..521ef7b8 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -569,7 +569,7 @@ lamexp_cpu_t lamexp_detect_cpu_features(int argc, char **argv) } __cpuid(CPUInfo, 0x80000000); - int nExIds = max(min(CPUInfo[0], 0x80000004), 0x80000000); + int nExIds = qMax(qMin(CPUInfo[0], 0x80000004), 0x80000000); for(int i = 0x80000002; i <= nExIds; ++i) { diff --git a/src/Main.cpp b/src/Main.cpp index c0dc5919..c7c4fd86 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -55,7 +55,7 @@ static int lamexp_main(int argc, char* argv[]) //Print version info qDebug("LameXP - Audio Encoder Front-End v%d.%02d %s (Build #%03d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build()); - qDebug("Copyright (c) 2004-%04d LoRd_MuldeR . Some rights reserved.", max(lamexp_version_date().year(),QDate::currentDate().year())); + qDebug("Copyright (c) 2004-%04d LoRd_MuldeR . Some rights reserved.", qMax(lamexp_version_date().year(),QDate::currentDate().year())); qDebug("Built on %s at %s with %s for Win-%s.\n", lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(), lamexp_version_time(), lamexp_version_compiler(), lamexp_version_arch()); //print license info diff --git a/src/Model_CueSheet.cpp b/src/Model_CueSheet.cpp index 673a1fec..88c8bd94 100644 --- a/src/Model_CueSheet.cpp +++ b/src/Model_CueSheet.cpp @@ -825,7 +825,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic CueSheetTrack *currentTrack = currentFile->track(j); CueSheetTrack *previousTrack = currentFile->track(j-1); double duration = currentTrack->startIndex() - previousTrack->startIndex(); - previousTrack->setDuration(max(0.0, duration)); + previousTrack->setDuration(qMax(0.0, duration)); } } } diff --git a/src/Thread_CueSplitter.cpp b/src/Thread_CueSplitter.cpp index 43d8ebdb..cd3b30e9 100644 --- a/src/Thread_CueSplitter.cpp +++ b/src/Thread_CueSplitter.cpp @@ -336,7 +336,7 @@ void CueSplitter::splitFile(const QString &output, const int trackNo, const QStr int progress = rxProgress.cap(1).toInt(&ok); if(ok) { - maxProgress = max(maxProgress, progress); + maxProgress = qMax(maxProgress, progress); emit fileSelected(QString("%1 [%2%]").arg(baseName, QString::number(maxProgress))); } } @@ -372,7 +372,7 @@ void CueSplitter::splitFile(const QString &output, const int trackNo, const QStr qDebug("Duration updated from SoX info!"); int duration = intputLen - static_cast(floor(offset + 0.5)); if(duration < 0) qWarning("Track is out of bounds: Track offset exceeds input file duration!"); - outFileInfo.setFileDuration(max(0, duration)); + outFileInfo.setFileDuration(qMax(0, duration)); } else { diff --git a/src/Thread_DiskObserver.cpp b/src/Thread_DiskObserver.cpp index 5d0aaa5d..0c3d4326 100644 --- a/src/Thread_DiskObserver.cpp +++ b/src/Thread_DiskObserver.cpp @@ -80,7 +80,7 @@ void DiskObserverThread::observe(void) { qWarning("Free diskspace on '%s' dropped below %s MB, only %s MB free!", m_path.toUtf8().constData(), QString::number(minimumSpace / 1048576ui64).toUtf8().constData(), QString::number(freeSpace / 1048576ui64).toUtf8().constData()); emit messageLogged(tr("Low diskspace on drive '%1' detected (only %2 MB are free), problems can occur!").arg(QDir::toNativeSeparators(m_path), QString::number(freeSpace / 1048576ui64)), true); - minimumSpace = min(freeSpace, (minimumSpace >> 1)); + minimumSpace = qMin(freeSpace, (minimumSpace >> 1)); } if(freeSpace != previousSpace) { diff --git a/src/Thread_FileAnalyzer.cpp b/src/Thread_FileAnalyzer.cpp index 6b69ddc1..f8003897 100644 --- a/src/Thread_FileAnalyzer.cpp +++ b/src/Thread_FileAnalyzer.cpp @@ -475,25 +475,25 @@ unsigned int FileAnalyzer::parseDuration(const QString &str) time = QTime::fromString(str, "z'ms'"); if(time.isValid()) { - return max(1, (time.hour() * 60 * 60) + (time.minute() * 60) + time.second()); + return qMax(1, (time.hour() * 60 * 60) + (time.minute() * 60) + time.second()); } time = QTime::fromString(str, "s's 'z'ms'"); if(time.isValid()) { - return max(1, (time.hour() * 60 * 60) + (time.minute() * 60) + time.second()); + return qMax(1, (time.hour() * 60 * 60) + (time.minute() * 60) + time.second()); } time = QTime::fromString(str, "m'mn 's's'"); if(time.isValid()) { - return max(1, (time.hour() * 60 * 60) + (time.minute() * 60) + time.second()); + return qMax(1, (time.hour() * 60 * 60) + (time.minute() * 60) + time.second()); } time = QTime::fromString(str, "h'h 'm'mn'"); if(time.isValid()) { - return max(1, (time.hour() * 60 * 60) + (time.minute() * 60) + time.second()); + return qMax(1, (time.hour() * 60 * 60) + (time.minute() * 60) + time.second()); } return 0; diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp index 8b86d714..eb7b4f2d 100644 --- a/src/Thread_Initialization.cpp +++ b/src/Thread_Initialization.cpp @@ -360,10 +360,10 @@ void InitializationThread::initNeroAac(void) if(versionTokens.count() == 4) { neroVersion = 0; - neroVersion += min(9, max(0, versionTokens.at(3).toInt())); - neroVersion += min(9, max(0, versionTokens.at(2).toInt())) * 10; - neroVersion += min(9, max(0, versionTokens.at(1).toInt())) * 100; - neroVersion += min(9, max(0, versionTokens.at(0).toInt())) * 1000; + neroVersion += qMin(9, qMax(0, versionTokens.at(3).toInt())); + neroVersion += qMin(9, qMax(0, versionTokens.at(2).toInt())) * 10; + neroVersion += qMin(9, qMax(0, versionTokens.at(1).toInt())) * 100; + neroVersion += qMin(9, qMax(0, versionTokens.at(0).toInt())) * 1000; } } }