util/Error: new error passing library

Replaces GLib's GError.
This commit is contained in:
Max Kellermann
2013-08-10 18:02:44 +02:00
parent c9fcc7f148
commit 29030b54c9
256 changed files with 3269 additions and 3371 deletions
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
encoder
event
filter
input
mixer
mpd_error.h
output
pcm
playlist
protocol
system
util
test

@ -24,6 +24,7 @@
#include "InputInit.hxx"
#include "InputLegacy.hxx"
#include "AudioFormat.hxx"
#include "util/Error.hxx"
#include "stdbin.h"
#include <glib.h>
@ -91,7 +92,8 @@ decoder_read(gcc_unused struct decoder *decoder,
struct input_stream *is,
void *buffer, size_t length)
{
return input_stream_lock_read(is, buffer, length, NULL);
Error error;
return input_stream_lock_read(is, buffer, length, error);
}
void
@ -144,7 +146,6 @@ decoder_mixramp(gcc_unused struct decoder *decoder,
int main(int argc, char **argv)
{
GError *error = NULL;
const char *decoder_name;
struct decoder decoder;
@ -165,9 +166,9 @@ int main(int argc, char **argv)
io_thread_init();
io_thread_start();
if (!input_stream_global_init(&error)) {
g_warning("%s", error->message);
g_error_free(error);
Error error;
if (!input_stream_global_init(error)) {
g_warning("%s", error.GetMessage());
return 2;
}
@ -189,12 +190,11 @@ int main(int argc, char **argv)
Cond cond;
struct input_stream *is =
input_stream_open(decoder.uri, mutex, cond, &error);
input_stream_open(decoder.uri, mutex, cond, error);
if (is == NULL) {
if (error != NULL) {
g_warning("%s", error->message);
g_error_free(error);
} else
if (error.IsDefined())
g_warning("%s", error.GetMessage());
else
g_printerr("input_stream_open() failed\n");
return 1;