X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=error.h;h=d10ac76abcaa669abb381b07325040338b85c100;hp=899c574b315cd9e8ee7356eb29c1828e1dd6ae04;hb=fc8dfbb416ff07cca08fbf4e13efcaa25e17cc54;hpb=21c6e0b09b42e61e72b741bd726856ab0bcd1d64 diff --git a/error.h b/error.h index 899c574b..d10ac76a 100644 --- a/error.h +++ b/error.h @@ -56,7 +56,6 @@ PARA_ERROR(BAD_BAND, "invalid or unexpected band designator"), \ PARA_ERROR(BAD_CHANNEL_COUNT, "channel count not supported"), \ PARA_ERROR(BAD_CHANNEL, "invalid channel"), \ - PARA_ERROR(BAD_CMD, "invalid command"), \ PARA_ERROR(BAD_CONFIG, "syntax error in config file"), \ PARA_ERROR(BAD_CT, "invalid chunk table or bad FEC configuration"), \ PARA_ERROR(BAD_FEATURE, "invalid feature request"), \ @@ -64,7 +63,6 @@ PARA_ERROR(BAD_FILTER_OPTIONS, "invalid filter option given"), \ PARA_ERROR(BAD_LL, "invalid loglevel"), \ PARA_ERROR(BAD_PATH, "invalid path"), \ - PARA_ERROR(BAD_PLAY_CMD, "invalid command"), \ PARA_ERROR(BAD_PRIVATE_KEY, "invalid private key"), \ PARA_ERROR(BAD_SAMPLE_FORMAT, "sample format not supported"), \ PARA_ERROR(BAD_SAMPLERATE, "sample rate not supported"), \ @@ -135,7 +133,6 @@ PARA_ERROR(ID3_SETENCODING, "could not set id3 text encoding field"), \ PARA_ERROR(ID3_SETSTRING, "could not set id3 string field"), \ PARA_ERROR(INCOHERENT_BLOCK_LEN, "incoherent block length"), \ - PARA_ERROR(INVALID_AUDIOD_CMD, "invalid command"), \ PARA_ERROR(KEY_MARKER, "invalid/missing key header or footer"), \ PARA_ERROR(KEY_PERM, "unprotected private key"), \ PARA_ERROR(LIBSAMPLERATE, "secret rabbit code error"), \ @@ -186,7 +183,6 @@ PARA_ERROR(PERM, "permission denied"), \ PARA_ERROR(PLAYLIST_EMPTY, "attempted to load empty playlist"), \ PARA_ERROR(PLAYLIST_LOADED, ""), /* not really an error */ \ - PARA_ERROR(PLAY_SYNTAX, "para_play: syntax error"), \ PARA_ERROR(PREBUFFER_SUCCESS, "prebuffering complete"), \ PARA_ERROR(PRIVATE_KEY, "can not read private key"), \ PARA_ERROR(PUBLIC_KEY, "can not read public key"), \ @@ -194,7 +190,6 @@ PARA_ERROR(READ_PATTERN, "did not read expected pattern"), \ PARA_ERROR(RECV_EOF, "end of file"), \ PARA_ERROR(RECVMSG, "recvmsg() failed"), \ - PARA_ERROR(RECV_SYNTAX, "recv syntax error"), \ PARA_ERROR(REGEX, "regular expression error"), \ PARA_ERROR(RESAMPLE_EOF, "resample filter: end of file"), \ PARA_ERROR(RSA, "RSA error"), \ @@ -287,19 +282,28 @@ extern const char * const para_errlist[]; */ #define OSL_ERROR_BIT 29 +#define LLS_ERROR_BIT 28 + /** Check whether the system error bit is set. */ #define IS_SYSTEM_ERROR(num) (!!((num) & (1 << SYSTEM_ERROR_BIT))) /** Check whether the osl error bit is set. */ #define IS_OSL_ERROR(num) (!!((num) & (1 << OSL_ERROR_BIT))) +/** Check whether the lopsub error bit is set. */ +#define IS_LLS_ERROR(num) (!!((num) & (1 << LLS_ERROR_BIT))) + /** Set the system error bit for the given number. */ #define ERRNO_TO_PARA_ERROR(num) ((num) | (1 << SYSTEM_ERROR_BIT)) /** Set the osl error bit for the given number. */ #define OSL_ERRNO_TO_PARA_ERROR(num) ((num) | (1 << OSL_ERROR_BIT)) +/** Set the lopsub error bit for the error code. */ +#define LLS_ERRNO_TO_PARA_ERROR(num) ((num) | (1 << LLS_ERROR_BIT)) + static const char *weak_osl_strerror(int) __attribute__ ((weakref("osl_strerror"))); +static const char *weak_lls_strerror(int) __attribute__ ((weakref("lls_strerror"))); /** * Paraslash's version of strerror(3). * @@ -314,6 +318,10 @@ _static_inline_ const char *para_strerror(int num) assert(weak_osl_strerror); return weak_osl_strerror(num & ~(1U << OSL_ERROR_BIT)); } + if (IS_LLS_ERROR(num)) { + assert(weak_lls_strerror); + return weak_lls_strerror(num & ~(1U << LLS_ERROR_BIT)); + } if (IS_SYSTEM_ERROR(num)) return strerror(num & ~(1U << SYSTEM_ERROR_BIT)); return para_errlist[num]; @@ -336,3 +344,16 @@ _static_inline_ int osl(int ret) return ret; return -OSL_ERRNO_TO_PARA_ERROR(-ret); } + +/** + * Wrapper for lopsub library calls. + * + * \param ret See osl(). + * \return See osl(). + */ +_static_inline_ int lls(int ret) +{ + if (ret >= 0) + return ret; + return -LLS_ERRNO_TO_PARA_ERROR(-ret); +}