Use the THROW macro instead of plain "throw" in the complete project.

This commit is contained in:
LoRd_MuldeR 2013-10-18 21:37:40 +02:00
parent 414b261c0d
commit 8a64624ba4
53 changed files with 955 additions and 922 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
<context> <context>
<name>CueImportDialog</name> <name>CueImportDialog</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="413"/> <location filename="../../src/Dialog_CueImport.cpp" line="419"/>
<source>Process was aborted by the user after %n track(s)!</source> <source>Process was aborted by the user after %n track(s)!</source>
<translation> <translation>
<numerusform>Process was aborted by the user after %n track!</numerusform> <numerusform>Process was aborted by the user after %n track!</numerusform>
@ -12,7 +12,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="421"/> <location filename="../../src/Dialog_CueImport.cpp" line="427"/>
<source>Imported %n track(s) from the Cue Sheet.</source> <source>Imported %n track(s) from the Cue Sheet.</source>
<translation> <translation>
<numerusform>Imported %n track from the Cue Sheet.</numerusform> <numerusform>Imported %n track from the Cue Sheet.</numerusform>
@ -20,7 +20,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="421"/> <location filename="../../src/Dialog_CueImport.cpp" line="427"/>
<source>Skipped %n track(s).</source> <source>Skipped %n track(s).</source>
<translation> <translation>
<numerusform>Skipped %n track.</numerusform> <numerusform>Skipped %n track.</numerusform>
@ -31,7 +31,7 @@
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="719"/> <location filename="../../src/Dialog_MainWindow.cpp" line="718"/>
<source>%n file(s) have been rejected, because read access was not granted!</source> <source>%n file(s) have been rejected, because read access was not granted!</source>
<translation> <translation>
<numerusform>%n file have been rejected, because read access was not granted!</numerusform> <numerusform>%n file have been rejected, because read access was not granted!</numerusform>
@ -39,7 +39,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="723"/> <location filename="../../src/Dialog_MainWindow.cpp" line="722"/>
<source>%n file(s) have been rejected, because they are dummy CDDA files!</source> <source>%n file(s) have been rejected, because they are dummy CDDA files!</source>
<translation> <translation>
<numerusform>%n file have been rejected, because they are dummy CDDA files!</numerusform> <numerusform>%n file have been rejected, because they are dummy CDDA files!</numerusform>
@ -47,7 +47,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="727"/> <location filename="../../src/Dialog_MainWindow.cpp" line="726"/>
<source>%n file(s) have been rejected, because they appear to be Cue Sheet images!</source> <source>%n file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation> <translation>
<numerusform>%n file have been rejected, because they appear to be Cue Sheet images!</numerusform> <numerusform>%n file have been rejected, because they appear to be Cue Sheet images!</numerusform>
@ -55,7 +55,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="731"/> <location filename="../../src/Dialog_MainWindow.cpp" line="730"/>
<source>%n file(s) have been rejected, because the file format could not be recognized!</source> <source>%n file(s) have been rejected, because the file format could not be recognized!</source>
<translation> <translation>
<numerusform>%n file have been rejected, because the file format could not be recognized!</numerusform> <numerusform>%n file have been rejected, because the file format could not be recognized!</numerusform>
@ -63,7 +63,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="3739"/> <location filename="../../src/Dialog_MainWindow.cpp" line="3740"/>
<source>%n Instance(s)</source> <source>%n Instance(s)</source>
<translation> <translation>
<numerusform>%n Instance</numerusform> <numerusform>%n Instance</numerusform>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@
#define VER_LAMEXP_MINOR_LO 9 #define VER_LAMEXP_MINOR_LO 9
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 3 #define VER_LAMEXP_PATCH 3
#define VER_LAMEXP_BUILD 1398 #define VER_LAMEXP_BUILD 1399
#define VER_LAMEXP_CONFG 1348 #define VER_LAMEXP_CONFG 1348
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -33,7 +33,7 @@ AACDecoder::AACDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing AAC decoder. Tool 'faad.exe' is not registred!"; THROW("Error initializing AAC decoder. Tool 'faad.exe' is not registred!");
} }
} }

View File

@ -33,7 +33,7 @@ AC3Decoder::AC3Decoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing Valib decoder. Tool 'valdec.exe' is not registred!"; THROW("Error initializing Valib decoder. Tool 'valdec.exe' is not registred!");
} }
} }

View File

@ -33,7 +33,7 @@ ADPCMDecoder::ADPCMDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing Vorbis decoder. Tool 'sox.exe' is not registred!"; THROW("Error initializing Vorbis decoder. Tool 'sox.exe' is not registred!");
} }
} }

View File

@ -34,7 +34,7 @@ ALACDecoder::ALACDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing ALAC decoder. Tool 'refalac.exe' is not registred!"; THROW("Error initializing ALAC decoder. Tool 'refalac.exe' is not registred!");
} }
} }

View File

@ -33,7 +33,7 @@ AvisynthDecoder::AvisynthDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing Avisynth decoder. Tool 'avs2wav.exe' is not registred!"; THROW("Error initializing Avisynth decoder. Tool 'avs2wav.exe' is not registred!");
} }
} }

View File

@ -33,7 +33,7 @@ FLACDecoder::FLACDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing FLAC decoder. Tool 'flac.exe' is not registred!"; THROW("Error initializing FLAC decoder. Tool 'flac.exe' is not registred!");
} }
} }

View File

@ -33,7 +33,7 @@ MACDecoder::MACDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing MAC decoder. Tool 'mac.exe' is not registred!"; THROW("Error initializing MAC decoder. Tool 'mac.exe' is not registred!");
} }
} }

View File

@ -33,7 +33,7 @@ MP3Decoder::MP3Decoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing MPG123 decoder. Tool 'mpg123.exe' is not registred!"; THROW("Error initializing MPG123 decoder. Tool 'mpg123.exe' is not registred!");
} }
} }

View File

@ -34,7 +34,7 @@ MusepackDecoder::MusepackDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing Musepack decoder. Tool 'mpcdec.exe' is not registred!"; THROW("Error initializing Musepack decoder. Tool 'mpcdec.exe' is not registred!");
} }
} }

View File

@ -36,7 +36,7 @@ OpusDecoder::OpusDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing Opus decoder. Tool 'opusdec.exe' is not registred!"; THROW("Error initializing Opus decoder. Tool 'opusdec.exe' is not registred!");
} }
} }

View File

@ -34,7 +34,7 @@ ShortenDecoder::ShortenDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing Shorten decoder. Tool 'shorten.exe' is not registred!"; THROW("Error initializing Shorten decoder. Tool 'shorten.exe' is not registred!");
} }
} }

View File

@ -33,7 +33,7 @@ SpeexDecoder::SpeexDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing Speex decoder. Tool 'speexdec.exe' is not registred!"; THROW("Error initializing Speex decoder. Tool 'speexdec.exe' is not registred!");
} }
} }

View File

@ -34,7 +34,7 @@ TTADecoder::TTADecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing TTA decoder. Tool 'ttaenc.exe' is not registred!"; THROW("Error initializing TTA decoder. Tool 'ttaenc.exe' is not registred!");
} }
} }

View File

@ -33,7 +33,7 @@ VorbisDecoder::VorbisDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing Vorbis decoder. Tool 'oggdec.exe' is not registred!"; THROW("Error initializing Vorbis decoder. Tool 'oggdec.exe' is not registred!");
} }
} }

View File

@ -35,7 +35,7 @@ WMADecoder::WMADecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing WMA decoder. Tool 'wma2wav.exe' is not registred!"; THROW("Error initializing WMA decoder. Tool 'wma2wav.exe' is not registred!");
} }
} }

View File

@ -33,7 +33,7 @@ WavPackDecoder::WavPackDecoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing WavPack decoder. Tool 'wvunpack.exe' is not registred!"; THROW("Error initializing WavPack decoder. Tool 'wvunpack.exe' is not registred!");
} }
} }

View File

@ -338,10 +338,16 @@ void CueImportDialog::importCueSheet(void)
try try
{ {
m_locks << new LockedFile(temp); m_locks << new LockedFile(temp);
} }
catch(char *err) catch(const std::exception &error)
{ {
qWarning("Failed to lock file: %s", err); qWarning("Failed to lock file:\n%s\n", error.what());
continue;
}
catch(...)
{
qWarning("Failed to lock file!");
continue; continue;
} }
files << temp; files << temp;

View File

@ -1597,6 +1597,8 @@ void MainWindow::aboutButtonClicked(void)
aboutBox->exec(); aboutBox->exec();
LAMEXP_DELETE(aboutBox); LAMEXP_DELETE(aboutBox);
); );
THROW_FMT("TEST ALDER %u!", 667);
} }
/* /*
@ -3162,7 +3164,7 @@ void MainWindow::outputFolderMouseEventOccurred(QWidget *sender, QEvent *event)
} }
else else
{ {
throw "Oups, this is not supposed to happen!"; THROW("Oups, this is not supposed to happen!");
} }
} }
} }
@ -3241,7 +3243,7 @@ void MainWindow::updateEncoder(int id)
if(ui->radioButtonModeQuality->isEnabled()) ui->radioButtonModeQuality->setChecked(true); if(ui->radioButtonModeQuality->isEnabled()) ui->radioButtonModeQuality->setChecked(true);
else if(ui->radioButtonModeAverageBitrate->isEnabled()) ui->radioButtonModeAverageBitrate->setChecked(true); else if(ui->radioButtonModeAverageBitrate->isEnabled()) ui->radioButtonModeAverageBitrate->setChecked(true);
else if(ui->radioButtonConstBitrate->isEnabled()) ui->radioButtonConstBitrate->setChecked(true); else if(ui->radioButtonConstBitrate->isEnabled()) ui->radioButtonConstBitrate->setChecked(true);
else throw "It appears that the encoder does not support *any* RC mode!"; else THROW("It appears that the encoder does not support *any* RC mode!");
//Apply current RC mode //Apply current RC mode
const int currentRCMode = EncoderRegistry::loadEncoderMode(m_settings, id); const int currentRCMode = EncoderRegistry::loadEncoderMode(m_settings, id);
@ -3250,7 +3252,7 @@ void MainWindow::updateEncoder(int id)
case SettingsModel::VBRMode: if(ui->radioButtonModeQuality->isEnabled()) ui->radioButtonModeQuality->setChecked(true); break; case SettingsModel::VBRMode: if(ui->radioButtonModeQuality->isEnabled()) ui->radioButtonModeQuality->setChecked(true); break;
case SettingsModel::ABRMode: if(ui->radioButtonModeAverageBitrate->isEnabled()) ui->radioButtonModeAverageBitrate->setChecked(true); break; case SettingsModel::ABRMode: if(ui->radioButtonModeAverageBitrate->isEnabled()) ui->radioButtonModeAverageBitrate->setChecked(true); break;
case SettingsModel::CBRMode: if(ui->radioButtonConstBitrate->isEnabled()) ui->radioButtonConstBitrate->setChecked(true); break; case SettingsModel::CBRMode: if(ui->radioButtonConstBitrate->isEnabled()) ui->radioButtonConstBitrate->setChecked(true); break;
default: throw "updateEncoder(): Unknown rc-mode encountered!"; default: THROW("updateEncoder(): Unknown rc-mode encountered!");
} }
//Display encoder description //Display encoder description
@ -3371,7 +3373,7 @@ void MainWindow::updateBitrate(int value)
ui->labelBitrate->setText(tr("Uncompressed")); ui->labelBitrate->setText(tr("Uncompressed"));
break; break;
default: default:
throw "Unknown display value type encountered!"; THROW("Unknown display value type encountered!");
break; break;
} }
} }

View File

@ -209,7 +209,7 @@ UpdateDialog::UpdateDialog(SettingsModel *settings, QWidget *parent)
{ {
if(m_binaryWGet.isEmpty() || m_binaryGnuPG.isEmpty() || m_binaryUpdater.isEmpty() || m_binaryKeys.isEmpty()) if(m_binaryWGet.isEmpty() || m_binaryGnuPG.isEmpty() || m_binaryUpdater.isEmpty() || m_binaryKeys.isEmpty())
{ {
throw "Tools not initialized correctly!"; THROW("Tools not initialized correctly!");
} }
//Init the dialog, from the .ui file //Init the dialog, from the .ui file

View File

@ -48,7 +48,7 @@ class AACEncoderInfo : public AbstractEncoderInfo
return true; return true;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -64,7 +64,7 @@ class AACEncoderInfo : public AbstractEncoderInfo
return 41; return 41;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -80,7 +80,7 @@ class AACEncoderInfo : public AbstractEncoderInfo
return qBound(8, index2bitrate(index), 400); return qBound(8, index2bitrate(index), 400);
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -98,7 +98,7 @@ class AACEncoderInfo : public AbstractEncoderInfo
return TYPE_BITRATE; return TYPE_BITRATE;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -122,7 +122,7 @@ AACEncoder::AACEncoder(void)
{ {
if(m_binary_enc.isEmpty() || m_binary_tag.isEmpty() || m_binary_sox.isEmpty()) if(m_binary_enc.isEmpty() || m_binary_tag.isEmpty() || m_binary_sox.isEmpty())
{ {
throw "Error initializing AAC encoder. Tool 'neroAacEnc.exe' is not registred!"; THROW("Error initializing AAC encoder. Tool 'neroAacEnc.exe' is not registred!");
} }
m_configProfile = 0; m_configProfile = 0;
@ -151,7 +151,7 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
args << "-cbr" << QString::number(qBound(8, index2bitrate(m_configBitrate), 400) * 1000); args << "-cbr" << QString::number(qBound(8, index2bitrate(m_configBitrate), 400) * 1000);
break; break;
default: default:
throw "Bad rate-control mode!"; THROW("Bad rate-control mode!");
break; break;
} }

View File

@ -51,7 +51,7 @@ class FHGAACEncoderInfo : public AbstractEncoderInfo
return false; return false;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -67,7 +67,7 @@ class FHGAACEncoderInfo : public AbstractEncoderInfo
return 52; return 52;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -83,7 +83,7 @@ class FHGAACEncoderInfo : public AbstractEncoderInfo
return qBound(8, index2bitrate(index), 576); return qBound(8, index2bitrate(index), 576);
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -101,7 +101,7 @@ class FHGAACEncoderInfo : public AbstractEncoderInfo
return TYPE_BITRATE; return TYPE_BITRATE;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -124,7 +124,7 @@ FHGAACEncoder::FHGAACEncoder(void)
{ {
if(m_binary_enc.isEmpty() || m_binary_dll.isEmpty()) if(m_binary_enc.isEmpty() || m_binary_dll.isEmpty())
{ {
throw "Error initializing FhgAacEnc. Tool 'fhgaacenc.exe' is not registred!"; THROW("Error initializing FhgAacEnc. Tool 'fhgaacenc.exe' is not registred!");
} }
m_configProfile = 0; m_configProfile = 0;
@ -168,7 +168,7 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
args << "--vbr" << QString::number(qBound(1, m_configBitrate + 1, 6)); args << "--vbr" << QString::number(qBound(1, m_configBitrate + 1, 6));
break; break;
default: default:
throw "Bad rate-control mode!"; THROW("Bad rate-control mode!");
break; break;
} }

View File

@ -52,7 +52,7 @@ class QAACEncoderInfo : public AbstractEncoderInfo
return true; return true;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -68,7 +68,7 @@ class QAACEncoderInfo : public AbstractEncoderInfo
return 52; return 52;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -84,7 +84,7 @@ class QAACEncoderInfo : public AbstractEncoderInfo
return qBound(8, index2bitrate(index), 576); return qBound(8, index2bitrate(index), 576);
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -102,7 +102,7 @@ class QAACEncoderInfo : public AbstractEncoderInfo
return TYPE_BITRATE; return TYPE_BITRATE;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -125,7 +125,7 @@ QAACEncoder::QAACEncoder(void)
{ {
if(m_binary_enc.isEmpty() || m_binary_dll.isEmpty()) if(m_binary_enc.isEmpty() || m_binary_dll.isEmpty())
{ {
throw "Error initializing QAAC. Tool 'qaac.exe' is not registred!"; THROW("Error initializing QAAC. Tool 'qaac.exe' is not registred!");
} }
m_configProfile = 0; m_configProfile = 0;
@ -169,7 +169,7 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
args << "--tvbr" << QString::number(g_qaacVBRQualityLUT[qBound(0, m_configBitrate , 14)]); args << "--tvbr" << QString::number(g_qaacVBRQualityLUT[qBound(0, m_configBitrate , 14)]);
break; break;
default: default:
throw "Bad rate-control mode!"; THROW("Bad rate-control mode!");
break; break;
} }

View File

@ -47,7 +47,7 @@ class AC3EncoderInfo : public AbstractEncoderInfo
return false; return false;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -65,7 +65,7 @@ class AC3EncoderInfo : public AbstractEncoderInfo
return 19; return 19;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -81,7 +81,7 @@ class AC3EncoderInfo : public AbstractEncoderInfo
return g_ac3BitratesLUT[qBound(0, index, 18)]; return g_ac3BitratesLUT[qBound(0, index, 18)];
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -97,7 +97,7 @@ class AC3EncoderInfo : public AbstractEncoderInfo
return TYPE_BITRATE; return TYPE_BITRATE;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -119,7 +119,7 @@ AC3Encoder::AC3Encoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing FLAC encoder. Tool 'aften.exe' is not registred!"; THROW("Error initializing FLAC encoder. Tool 'aften.exe' is not registred!");
} }
m_configAudioCodingMode = 0; m_configAudioCodingMode = 0;
@ -146,7 +146,7 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
args << "-b" << QString::number(g_ac3BitratesLUT[qBound(0, m_configBitrate, 18)]); args << "-b" << QString::number(g_ac3BitratesLUT[qBound(0, m_configBitrate, 18)]);
break; break;
default: default:
throw "Bad rate-control mode!"; THROW("Bad rate-control mode!");
break; break;
} }

View File

@ -21,6 +21,7 @@
#pragma once #pragma once
#include "Global.h"
#include "Tool_Abstract.h" #include "Tool_Abstract.h"
#include "Model_AudioFile.h" #include "Model_AudioFile.h"
@ -74,7 +75,7 @@ public:
//Encoder info //Encoder info
static const AbstractEncoderInfo *getEncoderInfo(void) static const AbstractEncoderInfo *getEncoderInfo(void)
{ {
throw "This method shall be re-implemented in derived classes!"; THROW("This method shall be re-implemented in derived classes!");
return NULL; return NULL;
} }

View File

@ -51,7 +51,7 @@ class DCAEncoderInfo : public AbstractEncoderInfo
return true; return true;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -67,7 +67,7 @@ class DCAEncoderInfo : public AbstractEncoderInfo
return 32; return 32;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -83,7 +83,7 @@ class DCAEncoderInfo : public AbstractEncoderInfo
return qBound(32, index2bitrate(index), 4096); return qBound(32, index2bitrate(index), 4096);
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -99,7 +99,7 @@ class DCAEncoderInfo : public AbstractEncoderInfo
return TYPE_BITRATE; return TYPE_BITRATE;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -121,7 +121,7 @@ DCAEncoder::DCAEncoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing DCA encoder. Tool 'dcaenc.exe' is not registred!"; THROW("Error initializing DCA encoder. Tool 'dcaenc.exe' is not registred!");
} }
} }

View File

@ -46,7 +46,7 @@ public:
return false; return false;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -62,7 +62,7 @@ public:
return 0; return 0;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -78,7 +78,7 @@ public:
return -1; return -1;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -93,7 +93,7 @@ public:
case SettingsModel::CBRMode: case SettingsModel::CBRMode:
return -1; return -1;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -115,7 +115,7 @@ FLACEncoder::FLACEncoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing FLAC encoder. Tool 'flac.exe' is not registred!"; THROW("Error initializing FLAC encoder. Tool 'flac.exe' is not registred!");
} }
} }

View File

@ -48,7 +48,7 @@ class MP3EncoderInfo : public AbstractEncoderInfo
return true; return true;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -64,7 +64,7 @@ class MP3EncoderInfo : public AbstractEncoderInfo
return 14; return 14;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -80,7 +80,7 @@ class MP3EncoderInfo : public AbstractEncoderInfo
return g_mp3BitrateLUT[qBound(0, index, 13)]; return g_mp3BitrateLUT[qBound(0, index, 13)];
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -98,7 +98,7 @@ class MP3EncoderInfo : public AbstractEncoderInfo
return TYPE_BITRATE; return TYPE_BITRATE;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -120,7 +120,7 @@ MP3Encoder::MP3Encoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing MP3 encoder. Tool 'lame.exe' is not registred!"; THROW("Error initializing MP3 encoder. Tool 'lame.exe' is not registred!");
} }
m_algorithmQuality = 3; m_algorithmQuality = 3;
@ -155,7 +155,7 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
args << "-b" << QString::number(g_mp3BitrateLUT[qBound(0, m_configBitrate, 13)]); args << "-b" << QString::number(g_mp3BitrateLUT[qBound(0, m_configBitrate, 13)]);
break; break;
default: default:
throw "Bad rate-control mode!"; THROW("Bad rate-control mode!");
break; break;
} }

View File

@ -44,7 +44,7 @@ class OpusEncoderInfo : public AbstractEncoderInfo
return true; return true;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -58,7 +58,7 @@ class OpusEncoderInfo : public AbstractEncoderInfo
return 32; return 32;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -72,7 +72,7 @@ class OpusEncoderInfo : public AbstractEncoderInfo
return qBound(8, (index + 1) * 8, 256); return qBound(8, (index + 1) * 8, 256);
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -88,7 +88,7 @@ class OpusEncoderInfo : public AbstractEncoderInfo
return TYPE_BITRATE; return TYPE_BITRATE;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -110,7 +110,7 @@ OpusEncoder::OpusEncoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing Opus encoder. Tool 'opusenc.exe' is not registred!"; THROW("Error initializing Opus encoder. Tool 'opusenc.exe' is not registred!");
} }
m_configOptimizeFor = 0; m_configOptimizeFor = 0;
@ -139,7 +139,7 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
args << "--hard-cbr"; args << "--hard-cbr";
break; break;
default: default:
throw "Bad rate-control mode!"; THROW("Bad rate-control mode!");
break; break;
} }

View File

@ -45,7 +45,7 @@ class VorbisEncoderInfo : public AbstractEncoderInfo
return false; return false;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -61,7 +61,7 @@ class VorbisEncoderInfo : public AbstractEncoderInfo
return 60; return 60;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -77,7 +77,7 @@ class VorbisEncoderInfo : public AbstractEncoderInfo
return qBound(32, (index + 4) * 8, 500); return qBound(32, (index + 4) * 8, 500);
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -95,7 +95,7 @@ class VorbisEncoderInfo : public AbstractEncoderInfo
return TYPE_BITRATE; return TYPE_BITRATE;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -117,7 +117,7 @@ VorbisEncoder::VorbisEncoder(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing Vorbis encoder. Tool 'oggenc2.exe' is not registred!"; THROW("Error initializing Vorbis encoder. Tool 'oggenc2.exe' is not registred!");
} }
m_configBitrateMaximum = 0; m_configBitrateMaximum = 0;
@ -144,7 +144,7 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
args << "-b" << QString::number(qBound(32, (m_configBitrate + 4) * 8, 500)); args << "-b" << QString::number(qBound(32, (m_configBitrate + 4) * 8, 500));
break; break;
default: default:
throw "Bad rate-control mode!"; THROW("Bad rate-control mode!");
break; break;
} }

View File

@ -53,7 +53,7 @@ public:
return true; return true;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -67,7 +67,7 @@ public:
return 0; return 0;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -81,7 +81,7 @@ public:
return -1; return -1;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }
@ -95,7 +95,7 @@ public:
return TYPE_UNCOMPRESSED; return TYPE_UNCOMPRESSED;
break; break;
default: default:
throw "Bad RC mode specified!"; THROW("Bad RC mode specified!");
} }
} }

View File

@ -35,7 +35,7 @@ DownmixFilter::DownmixFilter(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing SoX filter. Tool 'sox.exe' is not registred!"; THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!");
} }
} }

View File

@ -33,7 +33,7 @@ NormalizeFilter::NormalizeFilter(int peakVolume, int equalizationMode)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing SoX filter. Tool 'sox.exe' is not registred!"; THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!");
} }
m_peakVolume = qMin(-50, qMax(-3200, peakVolume)); m_peakVolume = qMin(-50, qMax(-3200, peakVolume));

View File

@ -39,7 +39,7 @@ ResampleFilter::ResampleFilter(int samplingRate, int bitDepth)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing SoX filter. Tool 'sox.exe' is not registred!"; THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!");
} }
m_samplingRate = (samplingRate > 0) ? qBound(8000, samplingRate, 192000) : 0; m_samplingRate = (samplingRate > 0) ? qBound(8000, samplingRate, 192000) : 0;

View File

@ -34,7 +34,7 @@ ToneAdjustFilter::ToneAdjustFilter(int bass, int treble)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing SoX filter. Tool 'sox.exe' is not registred!"; THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!");
} }
m_bass = qMax(-2000, qMin(2000, bass)); m_bass = qMax(-2000, qMin(2000, bass));

View File

@ -485,7 +485,7 @@ const QDate &lamexp_version_date(void)
} }
else else
{ {
throw "Internal error: Date format could not be recognized!"; THROW("Internal error: Date format could not be recognized!");
} }
} }
@ -531,7 +531,7 @@ const lamexp_os_version_t *lamexp_get_os_version(void)
} }
else else
{ {
throw "GetVersionEx() has failed. This is not supposed to happen!"; THROW("GetVersionEx() has failed. This is not supposed to happen!");
} }
g_lamexp_os_version.bInitialized = true; g_lamexp_os_version.bInitialized = true;
@ -1419,7 +1419,7 @@ void lamexp_ipc_send(unsigned int command, const char* message)
if(!g_lamexp_ipc_ptr.sharedmem || !g_lamexp_ipc_ptr.semaphore_read || !g_lamexp_ipc_ptr.semaphore_write || !g_lamexp_ipc_ptr.semaphore_read_mutex || !g_lamexp_ipc_ptr.semaphore_write_mutex) if(!g_lamexp_ipc_ptr.sharedmem || !g_lamexp_ipc_ptr.semaphore_read || !g_lamexp_ipc_ptr.semaphore_write || !g_lamexp_ipc_ptr.semaphore_read_mutex || !g_lamexp_ipc_ptr.semaphore_write_mutex)
{ {
throw "Shared memory for IPC not initialized yet."; THROW("Shared memory for IPC not initialized yet.");
} }
lamexp_ipc_data_t ipc_data; lamexp_ipc_data_t ipc_data;
@ -1456,7 +1456,7 @@ void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize)
if(!g_lamexp_ipc_ptr.sharedmem || !g_lamexp_ipc_ptr.semaphore_read || !g_lamexp_ipc_ptr.semaphore_write || !g_lamexp_ipc_ptr.semaphore_read_mutex || !g_lamexp_ipc_ptr.semaphore_write_mutex) if(!g_lamexp_ipc_ptr.sharedmem || !g_lamexp_ipc_ptr.semaphore_read || !g_lamexp_ipc_ptr.semaphore_write || !g_lamexp_ipc_ptr.semaphore_read_mutex || !g_lamexp_ipc_ptr.semaphore_write_mutex)
{ {
throw "Shared memory for IPC not initialized yet."; THROW("Shared memory for IPC not initialized yet.");
} }
lamexp_ipc_data_t ipc_data; lamexp_ipc_data_t ipc_data;
@ -1688,7 +1688,7 @@ void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned in
if(g_lamexp_tools.registry->contains(toolName.toLower())) if(g_lamexp_tools.registry->contains(toolName.toLower()))
{ {
throw "lamexp_register_tool: Tool is already registered!"; THROW("lamexp_register_tool: Tool is already registered!");
} }
g_lamexp_tools.registry->insert(toolName.toLower(), file); g_lamexp_tools.registry->insert(toolName.toLower(), file);
@ -2273,7 +2273,7 @@ void lamexp_blink_window(QWidget *poWindow, unsigned int count, unsigned int del
QApplication::processEvents(); QApplication::processEvents();
blinkMutex.unlock(); blinkMutex.unlock();
} }
catch (...) catch(...)
{ {
blinkMutex.unlock(); blinkMutex.unlock();
qWarning("Exception error while blinking!"); qWarning("Exception error while blinking!");
@ -3064,6 +3064,6 @@ unsigned long lamexp_dbg_private_bytes(void)
GetProcessMemoryInfo(GetCurrentProcess(), (PPROCESS_MEMORY_COUNTERS) &memoryCounters, sizeof(PROCESS_MEMORY_COUNTERS_EX)); GetProcessMemoryInfo(GetCurrentProcess(), (PPROCESS_MEMORY_COUNTERS) &memoryCounters, sizeof(PROCESS_MEMORY_COUNTERS_EX));
return memoryCounters.PrivateUsage; return memoryCounters.PrivateUsage;
#else #else
throw "Cannot call this function in a non-debug build!"; THROW("Cannot call this function in a non-debug build!");
#endif //LAMEXP_DEBUG #endif //LAMEXP_DEBUG
} }

View File

@ -252,11 +252,15 @@ while(0)
#endif #endif
//Helper macro for throwing exceptions //Helper macro for throwing exceptions
#define THROW(MESSAGE) throw std::runtime_error((MESSAGE)) #define THROW(MESSAGE) do \
#define THROW_FMT(FORMAT, ...) do \
{ \ { \
char error_msg[512]; \ throw std::runtime_error((MESSAGE)); \
_snprintf_s(error_msg, 512, _TRUNCATE, (FORMAT), __VA_ARGS__); \ } \
throw std::runtime_error(error_msg); \ while(0)
#define THROW_FMT(FORMAT, ...) do \
{ \
char _error_msg[512]; \
_snprintf_s(_error_msg, 512, _TRUNCATE, (FORMAT), __VA_ARGS__); \
throw std::runtime_error(_error_msg); \
} \ } \
while(0) while(0)

View File

@ -243,29 +243,16 @@ static int _main(int argc, char* argv[])
iResult = lamexp_main(argc, argv); iResult = lamexp_main(argc, argv);
lamexp_finalization(); lamexp_finalization();
} }
catch(const std::runtime_error &error) catch(const std::exception &error)
{ {
fflush(stdout); fflush(stderr); fflush(stdout); fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error:\n%s\n", error); fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
}
catch(char *error)
{
fflush(stdout); fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error message: %s\n", error);
lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
}
catch(int error)
{
fflush(stdout); fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error code: 0x%X\n", error);
lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!"); lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
} }
catch(...) catch(...)
{ {
fflush(stdout); fflush(stdout); fflush(stderr);
fflush(stderr); fprintf(stderr, "\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
fprintf(stderr, "\nGURU MEDITATION !!!\n");
lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!"); lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
} }
return iResult; return iResult;

View File

@ -113,7 +113,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett
} }
break; break;
default: default:
throw "makeEncoder(): Unknown AAC encoder specified!"; THROW("makeEncoder(): Unknown AAC encoder specified!");
break; break;
} }
} }
@ -162,13 +162,13 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett
break; break;
/*-------- default --------*/ /*-------- default --------*/
default: default:
throw "Unsupported encoder!"; THROW("Unsupported encoder!");
} }
//Sanity checking //Sanity checking
if(!encoder) if(!encoder)
{ {
throw "No encoder instance has been assigend!"; THROW("No encoder instance has been assigend!");
} }
//Apply common settings //Apply common settings
@ -202,16 +202,16 @@ const AbstractEncoderInfo *EncoderRegistry::getEncoderInfo(const int encoderId)
case SettingsModel::AAC_ENCODER_QAAC: info = QAACEncoder::getEncoderInfo(); break; case SettingsModel::AAC_ENCODER_QAAC: info = QAACEncoder::getEncoderInfo(); break;
case SettingsModel::AAC_ENCODER_FHG: info = FHGAACEncoder::getEncoderInfo(); break; case SettingsModel::AAC_ENCODER_FHG: info = FHGAACEncoder::getEncoderInfo(); break;
case SettingsModel::AAC_ENCODER_NERO: info = AACEncoder::getEncoderInfo(); break; case SettingsModel::AAC_ENCODER_NERO: info = AACEncoder::getEncoderInfo(); break;
default: throw "Unknown AAC encoder specified!"; default: THROW("Unknown AAC encoder specified!");
} }
break; break;
default: throw "Unsupported encoder!"; default: THROW("Unsupported encoder!");
} }
//Sanity checking //Sanity checking
if(!info) if(!info)
{ {
throw "No encoder instance has been assigend!"; THROW("No encoder instance has been assigend!");
} }
return info; return info;
@ -238,7 +238,7 @@ void EncoderRegistry::saveEncoderMode(SettingsModel *settings, const int encoder
//Sanity checking //Sanity checking
if((rcMode < SettingsModel::VBRMode) || (rcMode > SettingsModel::CBRMode)) if((rcMode < SettingsModel::VBRMode) || (rcMode > SettingsModel::CBRMode))
{ {
throw "Unknown rate-control mode!"; THROW("Unknown rate-control mode!");
} }
//Store the encoder bitrate/quality value //Store the encoder bitrate/quality value
@ -252,7 +252,7 @@ void EncoderRegistry::saveEncoderMode(SettingsModel *settings, const int encoder
case SettingsModel::OpusEncoder: STORE_MODE(OpusEnc, rcMode); break; case SettingsModel::OpusEncoder: STORE_MODE(OpusEnc, rcMode); break;
case SettingsModel::DCAEncoder: STORE_MODE(DcaEnc, rcMode); break; case SettingsModel::DCAEncoder: STORE_MODE(DcaEnc, rcMode); break;
case SettingsModel::PCMEncoder: STORE_MODE(Wave, rcMode); break; case SettingsModel::PCMEncoder: STORE_MODE(Wave, rcMode); break;
default: throw "Unsupported encoder!"; default: THROW("Unsupported encoder!");
} }
} }
@ -271,7 +271,7 @@ int EncoderRegistry::loadEncoderMode(const SettingsModel *settings, const int en
case SettingsModel::OpusEncoder: LOAD_MODE(rcMode, OpusEnc); break; case SettingsModel::OpusEncoder: LOAD_MODE(rcMode, OpusEnc); break;
case SettingsModel::DCAEncoder: LOAD_MODE(rcMode, DcaEnc); break; case SettingsModel::DCAEncoder: LOAD_MODE(rcMode, DcaEnc); break;
case SettingsModel::PCMEncoder: LOAD_MODE(rcMode, Wave); break; case SettingsModel::PCMEncoder: LOAD_MODE(rcMode, Wave); break;
default: throw "Unsupported encoder!"; default: THROW("Unsupported encoder!");
} }
return rcMode; return rcMode;
@ -302,7 +302,7 @@ void EncoderRegistry::saveEncoderValue(SettingsModel *settings, const int encode
//Sanity checking //Sanity checking
if((rcMode < SettingsModel::VBRMode) || (rcMode > SettingsModel::CBRMode)) if((rcMode < SettingsModel::VBRMode) || (rcMode > SettingsModel::CBRMode))
{ {
throw "Unknown rate-control mode!"; THROW("Unknown rate-control mode!");
} }
//Store the encoder bitrate/quality value //Store the encoder bitrate/quality value
@ -316,7 +316,7 @@ void EncoderRegistry::saveEncoderValue(SettingsModel *settings, const int encode
case SettingsModel::OpusEncoder: STORE_VALUE(OpusEnc, rcMode, value); break; case SettingsModel::OpusEncoder: STORE_VALUE(OpusEnc, rcMode, value); break;
case SettingsModel::DCAEncoder: STORE_VALUE(DcaEnc, rcMode, value); break; case SettingsModel::DCAEncoder: STORE_VALUE(DcaEnc, rcMode, value); break;
case SettingsModel::PCMEncoder: STORE_VALUE(Wave, rcMode, value); break; case SettingsModel::PCMEncoder: STORE_VALUE(Wave, rcMode, value); break;
default: throw "Unsupported encoder!"; default: THROW("Unsupported encoder!");
} }
} }
@ -327,7 +327,7 @@ int EncoderRegistry::loadEncoderValue(const SettingsModel *settings, const int e
//Sanity checking //Sanity checking
if((rcMode < SettingsModel::VBRMode) || (rcMode > SettingsModel::CBRMode)) if((rcMode < SettingsModel::VBRMode) || (rcMode > SettingsModel::CBRMode))
{ {
throw "Unknown rate-control mode!"; THROW("Unknown rate-control mode!");
} }
//Load the encoder bitrate/quality value //Load the encoder bitrate/quality value
@ -341,7 +341,7 @@ int EncoderRegistry::loadEncoderValue(const SettingsModel *settings, const int e
case SettingsModel::OpusEncoder: LOAD_VALUE(value, OpusEnc, rcMode); break; case SettingsModel::OpusEncoder: LOAD_VALUE(value, OpusEnc, rcMode); break;
case SettingsModel::DCAEncoder: LOAD_VALUE(value, DcaEnc, rcMode); break; case SettingsModel::DCAEncoder: LOAD_VALUE(value, DcaEnc, rcMode); break;
case SettingsModel::PCMEncoder: LOAD_VALUE(value, Wave, rcMode); break; case SettingsModel::PCMEncoder: LOAD_VALUE(value, Wave, rcMode); break;
default: throw "Unsupported encoder!"; default: THROW("Unsupported encoder!");
} }
return value; return value;
@ -376,7 +376,7 @@ void EncoderRegistry::saveEncoderCustomParams(SettingsModel *settings, const int
case SettingsModel::OpusEncoder: STORE_PARAMS(OpusEnc, params.trimmed()); break; case SettingsModel::OpusEncoder: STORE_PARAMS(OpusEnc, params.trimmed()); break;
case SettingsModel::DCAEncoder: STORE_PARAMS(DcaEnc, params.trimmed()); break; case SettingsModel::DCAEncoder: STORE_PARAMS(DcaEnc, params.trimmed()); break;
case SettingsModel::PCMEncoder: STORE_PARAMS(Wave, params.trimmed()); break; case SettingsModel::PCMEncoder: STORE_PARAMS(Wave, params.trimmed()); break;
default: throw "Unsupported encoder!"; default: THROW("Unsupported encoder!");
} }
} }
@ -395,7 +395,7 @@ QString EncoderRegistry::loadEncoderCustomParams(const SettingsModel *settings,
case SettingsModel::OpusEncoder: LOAD_PARAMS(params, OpusEnc); break; case SettingsModel::OpusEncoder: LOAD_PARAMS(params, OpusEnc); break;
case SettingsModel::DCAEncoder: LOAD_PARAMS(params, DcaEnc); break; case SettingsModel::DCAEncoder: LOAD_PARAMS(params, DcaEnc); break;
case SettingsModel::PCMEncoder: LOAD_PARAMS(params, Wave); break; case SettingsModel::PCMEncoder: LOAD_PARAMS(params, Wave); break;
default: throw "Unsupported encoder!"; default: THROW("Unsupported encoder!");
} }
return params; return params;

View File

@ -52,7 +52,7 @@ QMutex ShellIntegration::m_mutex;
ShellIntegration::ShellIntegration(void) ShellIntegration::ShellIntegration(void)
{ {
throw "Cannot create instance of this class, sorry!"; THROW("Cannot create instance of this class, sorry!");
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -73,12 +73,17 @@ void CPUObserverThread::run(void)
{ {
observe(); observe();
} }
catch(const std::exception &error)
{
fflush(stdout); fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
}
catch(...) catch(...)
{ {
fflush(stdout); fflush(stdout); fflush(stderr);
fflush(stderr); fprintf(stderr, "\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
fprintf(stderr, "\nGURU MEDITATION !!!\n"); lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
lamexp_fatal_exit(L"Unhandeled exception error, application will exit!");
} }
while(m_semaphore.available()) m_semaphore.tryAcquire(); while(m_semaphore.available()) m_semaphore.tryAcquire();

View File

@ -54,12 +54,17 @@ void DiskObserverThread::run(void)
{ {
observe(); observe();
} }
catch(const std::exception &error)
{
fflush(stdout); fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
}
catch(...) catch(...)
{ {
fflush(stdout); fflush(stdout); fflush(stderr);
fflush(stderr); fprintf(stderr, "\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
fprintf(stderr, "\nGURU MEDITATION !!!\n"); lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
lamexp_fatal_exit(L"Unhandeled exception error, application will exit!");
} }
while(m_semaphore.available()) m_semaphore.tryAcquire(); while(m_semaphore.available()) m_semaphore.tryAcquire();

View File

@ -307,6 +307,11 @@ bool FileAnalyzer::createTemplate(void)
{ {
m_templateFile = new LockedFile(templatePath); m_templateFile = new LockedFile(templatePath);
} }
catch(const std::exception &error)
{
qWarning("Failed to lock template file:\n%s\n", error.what());
return false;
}
catch(...) catch(...)
{ {
qWarning("Failed to lock template file!"); qWarning("Failed to lock template file!");
@ -359,7 +364,7 @@ void FileAnalyzer::taskFileAnalyzed(const unsigned int taskId, const int fileTyp
m_filesRejected++; m_filesRejected++;
break; break;
default: default:
throw "Unknown file type identifier!"; THROW("Unknown file type identifier!");
} }
//Emit all pending files //Emit all pending files

View File

@ -78,9 +78,17 @@ void AnalyzeTask::run()
{ {
run_ex(); run_ex();
} }
catch(const std::exception &error)
{
fflush(stdout); fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
}
catch(...) catch(...)
{ {
qWarning("WARNING: Caught an in exception AnalyzeTask thread!"); fflush(stdout); fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
} }
} }

View File

@ -97,7 +97,7 @@ protected:
{ {
if(!getExcept()) doExtract(); if(!getExcept()) doExtract();
} }
catch(const std::runtime_error &e) catch(const std::exception &e)
{ {
QMutexLocker lock(&s_mutex); QMutexLocker lock(&s_mutex);
if(!s_bExcept) if(!s_bExcept)
@ -219,7 +219,7 @@ void InitializationThread::run()
PRINT_CPU_TYPE(CPU_TYPE_X86_SSE); break; PRINT_CPU_TYPE(CPU_TYPE_X86_SSE); break;
PRINT_CPU_TYPE(CPU_TYPE_X64_GEN); break; PRINT_CPU_TYPE(CPU_TYPE_X64_GEN); break;
PRINT_CPU_TYPE(CPU_TYPE_X64_SSE); break; PRINT_CPU_TYPE(CPU_TYPE_X64_SSE); break;
default: throw "CPU support undefined!"; default: THROW("CPU support undefined!");
} }
//Allocate maps //Allocate maps
@ -782,7 +782,7 @@ void InitializationThread::selfTest(void)
PRINT_CPU_TYPE(CPU_TYPE_X86_SSE); break; PRINT_CPU_TYPE(CPU_TYPE_X86_SSE); break;
PRINT_CPU_TYPE(CPU_TYPE_X64_GEN); break; PRINT_CPU_TYPE(CPU_TYPE_X64_GEN); break;
PRINT_CPU_TYPE(CPU_TYPE_X64_SSE); break; PRINT_CPU_TYPE(CPU_TYPE_X64_SSE); break;
default: throw "CPU support undefined!"; default: THROW("CPU support undefined!");
} }
int n = 0; int n = 0;
for(int i = 0; i < INT_MAX; i++) for(int i = 0; i < INT_MAX; i++)

View File

@ -125,7 +125,7 @@ bool ProcessThread::start(QThreadPool *pool)
//Make sure object was initialized correctly //Make sure object was initialized correctly
if(m_initialized < 0) if(m_initialized < 0)
{ {
throw "Object not initialized yet!"; THROW("Object not initialized yet!");
} }
if(m_initialized < 1) if(m_initialized < 1)
@ -177,12 +177,17 @@ void ProcessThread::run()
{ {
processFile(); processFile();
} }
catch(const std::exception &error)
{
fflush(stdout); fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
}
catch(...) catch(...)
{ {
fflush(stdout); fflush(stdout); fflush(stderr);
fflush(stderr); fprintf(stderr, "\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
fprintf(stderr, "\nGURU MEDITATION !!!\n"); lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
lamexp_fatal_exit(L"Unhandeled exception error, application will exit!");
} }
} }
@ -194,7 +199,7 @@ void ProcessThread::processFile()
//Make sure object was initialized correctly //Make sure object was initialized correctly
if(m_initialized < 1) if(m_initialized < 1)
{ {
throw "Object not initialized yet!"; THROW("Object not initialized yet!");
} }
QString sourceFile = m_audioFile.filePath(); QString sourceFile = m_audioFile.filePath();

View File

@ -53,12 +53,17 @@ void RAMObserverThread::run(void)
{ {
observe(); observe();
} }
catch(const std::exception &error)
{
fflush(stdout); fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
}
catch(...) catch(...)
{ {
fflush(stdout); fflush(stdout); fflush(stderr);
fflush(stderr); fprintf(stderr, "\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
fprintf(stderr, "\nGURU MEDITATION !!!\n"); lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
lamexp_fatal_exit(L"Unhandeled exception error, application will exit!");
} }
while(m_semaphore.available()) m_semaphore.tryAcquire(); while(m_semaphore.available()) m_semaphore.tryAcquire();

View File

@ -32,7 +32,7 @@ WaveProperties::WaveProperties(void)
{ {
if(m_binary.isEmpty()) if(m_binary.isEmpty())
{ {
throw "Error initializing MP3 encoder. Tool 'lame.exe' is not registred!"; THROW("Error initializing MP3 encoder. Tool 'lame.exe' is not registred!");
} }
} }

View File

@ -35,7 +35,7 @@ static ITaskbarList3 *s_ptbl = NULL;
WinSevenTaskbar::WinSevenTaskbar(void) WinSevenTaskbar::WinSevenTaskbar(void)
{ {
throw "Cannot create instance of this class!"; THROW("Cannot create instance of this class!");
} }
WinSevenTaskbar::~WinSevenTaskbar(void) WinSevenTaskbar::~WinSevenTaskbar(void)