fix error codes handling

MPD_ERROR_* and MPD_SERVER_ERROR_* flags can have the same
value, so we need to store it separately in error_code.
This commit is contained in:
Andrzej Rybczak
2010-03-23 22:56:14 +01:00
parent 08e9b0ee3d
commit 6b396bfbf2
2 changed files with 8 additions and 3 deletions

View File

@@ -191,7 +191,11 @@ void TraceMpdStatus()
void NcmpcppErrorCallback(MPD::Connection *, int errorid, const char *msg, void *)
{
if (errorid == MPD_SERVER_ERROR_PERMISSION)
// for errorid:
// - 0-7 bits define MPD_ERROR_* codes, compare them with (0xff & errorid)
// - 8-15 bits define MPD_SERVER_ERROR_* codes, compare them with (errorid >> 8)
if ((errorid >> 8) == MPD_SERVER_ERROR_PERMISSION)
{
wFooter->SetGetStringHelper(0);
Statusbar() << "Password: ";