util/Error: new error passing library
Replaces GLib's GError.
This commit is contained in:
Makefile.am
src
AllCommands.cxxArchiveFile.hxxArchivePlugin.cxxArchivePlugin.hxxAudioConfig.cxxAudioParser.cxxAudioParser.hxxCheckAudioFormat.cxxCheckAudioFormat.hxxClientEvent.cxxClientFile.cxxClientFile.hxxClientInternal.hxxClientNew.cxxClientProcess.cxxCommandError.cxxCommandError.hxxCommandLine.cxxCommandLine.hxxConfigData.cxxConfigData.hxxConfigError.cxxConfigError.hxxConfigFile.cxxConfigFile.hxxConfigGlobal.cxxConfigGlobal.hxxConfigPath.cxxConfigPath.hxxDatabaseCommands.cxxDatabaseError.cxxDatabaseError.hxxDatabaseGlue.cxxDatabaseGlue.hxxDatabaseHelpers.cxxDatabaseHelpers.hxxDatabasePlaylist.cxxDatabasePlaylist.hxxDatabasePlugin.hxxDatabasePrint.cxxDatabasePrint.hxxDatabaseQueue.cxxDatabaseQueue.hxxDatabaseSave.cxxDatabaseSave.hxxDatabaseSimple.hxxDatabaseVisitor.hxxDecoderAPI.cxxDecoderControl.hxxDecoderError.cxxDecoderError.hxxDecoderThread.cxxDirectory.cxxDirectory.hxxDirectorySave.cxxDirectorySave.hxxEncoderPlugin.hxxFilterConfig.cxxFilterConfig.hxxFilterInternal.hxxFilterPlugin.cxxFilterPlugin.hxxInotifySource.cxxInotifySource.hxxInotifyUpdate.cxxInputInit.cxxInputInit.hxxInputLegacy.hxxInputPlugin.hxxInputStream.cxxListen.cxxListen.hxxLog.cxxLog.hxxMain.cxxMapper.hxxMixerAll.cxxMixerControl.cxxMixerControl.hxxMixerPlugin.hxxOtherCommands.cxxOutputAll.cxxOutputAll.hxxOutputControl.cxxOutputError.cxxOutputError.hxxOutputInit.cxxOutputInternal.hxxOutputPlugin.cxxOutputPlugin.hxxOutputThread.cxxPlayerControl.cxxPlayerControl.hxxPlayerThread.cxxPlaylistAny.cxxPlaylistCommands.cxxPlaylistDatabase.cxxPlaylistDatabase.hxxPlaylistEdit.cxxPlaylistError.cxxPlaylistError.hxxPlaylistFile.cxxPlaylistFile.hxxPlaylistPrint.cxxPlaylistPrint.hxxPlaylistRegistry.cxxPlaylistSave.cxxPlaylistSave.hxxPlaylistSong.cxxQueueCommands.cxxQueueSave.cxxSongSave.cxxSongSave.hxxSongSticker.hxxSongUpdate.cxxStats.cxxStickerCommands.cxxStickerDatabase.cxxStickerDatabase.hxxTagFile.cxxTagId3.cxxTagId3.hxxTextInputStream.cxxUpdateArchive.cxxUpdateGlue.cxx
archive
db
decoder
AdPlugDecoderPlugin.cxxAudiofileDecoderPlugin.cxxDsdLib.cxxDsdiffDecoderPlugin.cxxDsfDecoderPlugin.cxxFaadDecoderPlugin.cxxFfmpegDecoderPlugin.cxxFlacCommon.cxxFlacDecoderPlugin.cxxFlacIOHandle.cxxFlacInput.cxxFluidsynthDecoderPlugin.cxxGmeDecoderPlugin.cxxMadDecoderPlugin.cxxMpcdecDecoderPlugin.cxxMpg123DecoderPlugin.cxxOpusDecoderPlugin.cxxPcmDecoderPlugin.cxxSndfileDecoderPlugin.cxxVorbisDecoderPlugin.cxxWavpackDecoderPlugin.cxxWildmidiDecoderPlugin.cxx
encoder
FlacEncoderPlugin.cxxLameEncoderPlugin.cxxNullEncoderPlugin.cxxOpusEncoderPlugin.cxxTwolameEncoderPlugin.cxxVorbisEncoderPlugin.cxxWaveEncoderPlugin.cxx
event
filter
AutoConvertFilterPlugin.cxxChainFilterPlugin.cxxConvertFilterPlugin.cxxNormalizeFilterPlugin.cxxNullFilterPlugin.cxxReplayGainFilterPlugin.cxxRouteFilterPlugin.cxxVolumeFilterPlugin.cxx
input
ArchiveInputPlugin.cxxCdioParanoiaInputPlugin.cxxCurlInputPlugin.cxxDespotifyInputPlugin.cxxFfmpegInputPlugin.cxxFileInputPlugin.cxxMmsInputPlugin.cxxRewindInputPlugin.cxx
mixer
AlsaMixerPlugin.cxxOssMixerPlugin.cxxPulseMixerPlugin.cxxRoarMixerPlugin.cxxSoftwareMixerPlugin.cxxWinmmMixerPlugin.cxx
mpd_error.houtput
AlsaOutputPlugin.cxxAoOutputPlugin.cxxFifoOutputPlugin.cxxHttpdClient.cxxHttpdClient.hxxHttpdInternal.hxxHttpdOutputPlugin.cxxJackOutputPlugin.cxxNullOutputPlugin.cxxOSXOutputPlugin.cxxOpenALOutputPlugin.cxxOssOutputPlugin.cxxPipeOutputPlugin.cxxPulseOutputPlugin.cxxPulseOutputPlugin.hxxRecorderOutputPlugin.cxxRoarOutputPlugin.cxxShoutOutputPlugin.cxxSolarisOutputPlugin.cxxWinmmOutputPlugin.cxx
pcm
PcmConvert.cxxPcmConvert.hxxPcmResample.cxxPcmResample.hxxPcmResampleInternal.hxxPcmResampleLibsamplerate.cxx
playlist
AsxPlaylistPlugin.cxxLastFMPlaylistPlugin.cxxPlsPlaylistPlugin.cxxRssPlaylistPlugin.cxxSoundCloudPlaylistPlugin.cxxXspfPlaylistPlugin.cxx
protocol
system
FatalError.cxxFatalError.hxxResolver.cxxResolver.hxxSocketError.cxxSocketError.hxxSocketUtil.cxxSocketUtil.hxx
util
test
@ -27,6 +27,7 @@
|
||||
#include "conf.h"
|
||||
#include "Tag.hxx"
|
||||
#include "fs/Path.hxx"
|
||||
#include "util/Error.hxx"
|
||||
|
||||
#include <iostream>
|
||||
using std::cout;
|
||||
@ -46,14 +47,14 @@ my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
|
||||
}
|
||||
|
||||
static bool
|
||||
DumpDirectory(const Directory &directory, GError **)
|
||||
DumpDirectory(const Directory &directory, Error &)
|
||||
{
|
||||
cout << "D " << directory.path << endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
DumpSong(Song &song, GError **)
|
||||
DumpSong(Song &song, Error &)
|
||||
{
|
||||
cout << "S " << song.parent->path << "/" << song.uri << endl;
|
||||
return true;
|
||||
@ -61,7 +62,7 @@ DumpSong(Song &song, GError **)
|
||||
|
||||
static bool
|
||||
DumpPlaylist(const PlaylistInfo &playlist,
|
||||
const Directory &directory, GError **)
|
||||
const Directory &directory, Error &)
|
||||
{
|
||||
cout << "P " << directory.path << "/" << playlist.name.c_str() << endl;
|
||||
return true;
|
||||
@ -70,8 +71,6 @@ DumpPlaylist(const PlaylistInfo &playlist,
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
GError *error = nullptr;
|
||||
|
||||
if (argc != 3) {
|
||||
cerr << "Usage: DumpDatabase CONFIG PLUGIN" << endl;
|
||||
return 1;
|
||||
@ -98,9 +97,9 @@ main(int argc, char **argv)
|
||||
|
||||
config_global_init();
|
||||
|
||||
if (!ReadConfigFile(config_path, &error)) {
|
||||
cerr << error->message << endl;
|
||||
g_error_free(error);
|
||||
Error error;
|
||||
if (!ReadConfigFile(config_path, error)) {
|
||||
cerr << error.GetMessage() << endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@ -113,29 +112,26 @@ main(int argc, char **argv)
|
||||
if (path != nullptr)
|
||||
param.AddBlockParam("path", path->value, path->line);
|
||||
|
||||
Database *db = plugin->create(param, &error);
|
||||
Database *db = plugin->create(param, error);
|
||||
|
||||
if (db == nullptr) {
|
||||
cerr << error->message << endl;
|
||||
g_error_free(error);
|
||||
cerr << error.GetMessage() << endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!db->Open(&error)) {
|
||||
if (!db->Open(error)) {
|
||||
delete db;
|
||||
cerr << error->message << endl;
|
||||
g_error_free(error);
|
||||
cerr << error.GetMessage() << endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
const DatabaseSelection selection("", true);
|
||||
|
||||
if (!db->Visit(selection, DumpDirectory, DumpSong, DumpPlaylist,
|
||||
&error)) {
|
||||
error)) {
|
||||
db->Close();
|
||||
delete db;
|
||||
cerr << error->message << endl;
|
||||
g_error_free(error);
|
||||
cerr << error.GetMessage() << endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user