Skip to content

Commit

Permalink
Tidy up LOC (and D3DLOC) in libmythui
Browse files Browse the repository at this point in the history
  • Loading branch information
Beirdo committed Jul 10, 2011
1 parent 26c8a9e commit f31086b
Show file tree
Hide file tree
Showing 28 changed files with 465 additions and 466 deletions.
22 changes: 12 additions & 10 deletions mythtv/libs/libmythui/AppleRemote.cpp
Expand Up @@ -22,7 +22,7 @@
AppleRemote* AppleRemote::_instance = 0;
const int AppleRemote::REMOTE_SWITCH_COOKIE = 19;

const QString LOC = "AppleRemote::";
#define LOG QString("AppleRemote::")

static io_object_t _findAppleRemoteDevice(const char *devName);

Expand Down Expand Up @@ -67,7 +67,7 @@ void AppleRemote::startListening()
!_createDeviceInterface(hidDevice) ||
!_initCookies() || !_openDevice())
{
LOG(VB_GENERAL, LOG_ERR, "startListening() failed");
LOG(VB_GENERAL, LOG_ERR, LOC + "startListening() failed");
stopListening();
return;
}
Expand Down Expand Up @@ -220,8 +220,8 @@ static io_object_t _findAppleRemoteDevice(const char *devName)
if ((ioReturnValue == kIOReturnSuccess) && (hidObjectIterator != 0))
hidDevice = IOIteratorNext(hidObjectIterator);
else
LOG(VB_GENERAL, LOG_ERR, QString("_findAppleRemoteDevice(%1) failed")
.arg(devName));
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("_findAppleRemoteDevice(%1) failed").arg(devName));

// IOServiceGetMatchingServices consumes a reference to the dictionary,
// so we don't need to release the dictionary ref.
Expand Down Expand Up @@ -290,7 +290,7 @@ bool AppleRemote::_createDeviceInterface(io_object_t hidDevice)
(LPVOID*) (&hidDeviceInterface));

if (plugInResult != S_OK)
LOG(VB_GENERAL, LOG_ERR, "_createDeviceInterface() failed");
LOG(VB_GENERAL, LOG_ERR, LOC + "_createDeviceInterface() failed");

// Release
if (plugInInterface)
Expand All @@ -315,19 +315,20 @@ bool AppleRemote::_openDevice()

if (ioReturnValue != KERN_SUCCESS)
{
LOG(VB_GENERAL, LOG_ERR, "_openDevice() failed");
LOG(VB_GENERAL, LOG_ERR, LOC + "_openDevice() failed");
return false;
}
queue = (*hidDeviceInterface)->allocQueue(hidDeviceInterface);
if (!queue)
{
LOG(VB_GENERAL, LOG_ERR, "_openDevice() - error allocating queue");
LOG(VB_GENERAL, LOG_ERR, LOC +
"_openDevice() - error allocating queue");
return false;
}

HRESULT result = (*queue)->create(queue, 0, 12);
if (result != S_OK || !queue)
LOG(VB_GENERAL, LOG_ERR, "_openDevice() - error creating queue");
LOG(VB_GENERAL, LOG_ERR, LOC + "_openDevice() - error creating queue");

for (std::vector<int>::iterator iter = cookies.begin();
iter != cookies.end();
Expand All @@ -340,7 +341,7 @@ bool AppleRemote::_openDevice()
ioReturnValue = (*queue)->createAsyncEventSource(queue, &eventSource);
if (ioReturnValue != KERN_SUCCESS)
{
LOG(VB_GENERAL, LOG_ERR,
LOG(VB_GENERAL, LOG_ERR, LOC +
"_openDevice() - failed to create async event source");
return false;
}
Expand All @@ -349,7 +350,8 @@ bool AppleRemote::_openDevice()
this, NULL);
if (ioReturnValue != KERN_SUCCESS)
{
LOG(VB_GENERAL, LOG_ERR, "_openDevice() - error registering callback");
LOG(VB_GENERAL, LOG_ERR, LOC +
"_openDevice() - error registering callback");
return false;
}

Expand Down
13 changes: 6 additions & 7 deletions mythtv/libs/libmythui/jsmenu.cpp
Expand Up @@ -49,7 +49,6 @@
#include "jsmenuevent.h"

#define LOC QString("JoystickMenuThread: ")
#define LOC_ERROR QString("JoystickMenuThread Error: ")

JoystickMenuThread::JoystickMenuThread(QObject *main_window)
: QThread(),
Expand Down Expand Up @@ -88,7 +87,7 @@ int JoystickMenuThread::Init(QString &config_file)
rc = ReadConfig(config_file);
if (rc)
{
LOG(VB_GENERAL, LOG_ERR,
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Joystick disabled - Failed to read %1") .arg(config_file));
return(rc);
}
Expand All @@ -99,7 +98,7 @@ int JoystickMenuThread::Init(QString &config_file)
m_fd = open(qPrintable(m_devicename), O_RDONLY);
if (m_fd == -1)
{
LOG(VB_GENERAL, LOG_ERR,
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Joystick disabled - Failed to open device %1")
.arg(m_devicename));
return -1;
Expand All @@ -108,15 +107,15 @@ int JoystickMenuThread::Init(QString &config_file)
rc = ioctl(m_fd, JSIOCGAXES, &m_axesCount);
if (rc == -1)
{
LOG(VB_GENERAL, LOG_ERR,
LOG(VB_GENERAL, LOG_ERR, LOC +
"Joystick disabled - ioctl JSIOCGAXES failed");
return(rc);
}

ioctl(m_fd, JSIOCGBUTTONS, &m_buttonCount);
if (rc == -1)
{
LOG(VB_GENERAL, LOG_ERR,
LOG(VB_GENERAL, LOG_ERR, LOC +
"Joystick disabled - ioctl JSIOCGBUTTONS failed");
return(rc);
}
Expand All @@ -130,7 +129,7 @@ int JoystickMenuThread::Init(QString &config_file)
m_axes = new int[m_axesCount];
memset(m_axes, '\0', sizeof(*m_axes * m_axesCount));

LOG(VB_GENERAL, LOG_INFO,
LOG(VB_GENERAL, LOG_INFO, LOC +
QString("Initialization of %1 succeeded using config file %2")
.arg(m_devicename) .arg(config_file));
return 0;
Expand Down Expand Up @@ -181,7 +180,7 @@ int JoystickMenuThread::ReadConfig(QString config_file)
else if (firstTok.startsWith("chord") && tokens.count() == 4)
m_map.AddButton(tokens[2].toInt(), tokens[3], tokens[1].toInt());
else
LOG(VB_GENERAL, LOG_ERR,
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("ReadConfig(%1) unrecognized or malformed line \"%2\" ")
.arg(line) .arg(rawline));
}
Expand Down
49 changes: 25 additions & 24 deletions mythtv/libs/libmythui/lirc.cpp
Expand Up @@ -37,8 +37,6 @@ using namespace std;
#include "mythlogging.h"

#define LOC QString("LIRC: ")
#define LOC_WARN QString("LIRC, Warning: ")
#define LOC_ERR QString("LIRC, Error: ")

class LIRCPriv
{
Expand Down Expand Up @@ -179,16 +177,17 @@ bool LIRC::Init(void)
QByteArray dev = lircdDevice.toLocal8Bit();
if (dev.size() > 107)
{
LOG(vtype, LOG_ERR, QString("lircdDevice '%1'").arg(lircdDevice) +
" is too long for the 'unix' socket API");
LOG(vtype, LOG_ERR, LOC +
QString("lircdDevice '%1'").arg(lircdDevice) +
" is too long for the 'unix' socket API");

return false;
}

lircd_socket = socket(AF_UNIX, SOCK_STREAM, 0);
if (lircd_socket < 0)
{
LOG(vtype, LOG_ERR, QString("Failed to open Unix socket '%1'")
LOG(vtype, LOG_ERR, LOC + QString("Failed to open Unix socket '%1'")
.arg(lircdDevice) + ENO);

return false;
Expand All @@ -204,7 +203,8 @@ bool LIRC::Init(void)

if (ret < 0)
{
LOG(vtype, LOG_ERR, QString("Failed to connect to Unix socket '%1'")
LOG(vtype, LOG_ERR, LOC +
QString("Failed to connect to Unix socket '%1'")
.arg(lircdDevice) + ENO);

close(lircd_socket);
Expand All @@ -216,7 +216,7 @@ bool LIRC::Init(void)
lircd_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (lircd_socket < 0)
{
LOG(vtype, LOG_ERR, QString("Failed to open TCP socket '%1'")
LOG(vtype, LOG_ERR, LOC + QString("Failed to open TCP socket '%1'")
.arg(lircdDevice) + ENO);

return false;
Expand All @@ -238,7 +238,7 @@ bool LIRC::Init(void)

if (!inet_aton(device.constData(), &addr.sin_addr))
{
LOG(vtype, LOG_ERR, QString("Failed to parse IP address '%1'")
LOG(vtype, LOG_ERR, LOC + QString("Failed to parse IP address '%1'")
.arg(dev));

close(lircd_socket);
Expand All @@ -249,7 +249,8 @@ bool LIRC::Init(void)
sizeof(addr));
if (ret < 0)
{
LOG(vtype, LOG_ERR, QString("Failed to connect TCP socket '%1'")
LOG(vtype, LOG_ERR, LOC +
QString("Failed to connect TCP socket '%1'")
.arg(lircdDevice) + ENO);

close(lircd_socket);
Expand All @@ -265,8 +266,8 @@ bool LIRC::Init(void)
ret = fcntl(lircd_socket, F_SETFD, flags | O_NONBLOCK);
if (ret < 0)
{
LOG(VB_GENERAL, LOG_WARNING,
QString("Failed set flags for socket '%1'")
LOG(VB_GENERAL, LOG_WARNING, LOC +
QString("Failed set flags for socket '%1'")
.arg(lircdDevice) + ENO);
}
}
Expand All @@ -293,17 +294,17 @@ bool LIRC::Init(void)
QByteArray cfg = configFile.toLocal8Bit();
if (lirc_readconfig(d->lircState, cfg.constData(), &d->lircConfig, NULL))
{
LOG(vtype, LOG_ERR,
QString("Failed to read config file '%1'").arg(configFile));
LOG(vtype, LOG_ERR, LOC +
QString("Failed to read config file '%1'").arg(configFile));

lirc_deinit(d->lircState);
d->lircState = NULL;
return false;
}
}

LOG(VB_GENERAL, LOG_INFO,
QString("Successfully initialized '%1' using '%2' config")
LOG(VB_GENERAL, LOG_INFO, LOC +
QString("Successfully initialized '%1' using '%2' config")
.arg(lircdDevice).arg(configFile));

return true;
Expand Down Expand Up @@ -398,7 +399,7 @@ void LIRC::run(void)
{
threadRegister("LIRC");
#if 0
LOG(VB_GENERAL, LOG_DEBUG, "run -- start");
LOG(VB_GENERAL, LOG_DEBUG, LOC + "run -- start");
#endif
/* Process all events read */
while (IsDoRunSet())
Expand All @@ -412,12 +413,12 @@ void LIRC::run(void)
eofCount = 0;
if (++retryCount > 1000)
{
LOG(VB_GENERAL, LOG_ERR,
"Failed to reconnect, exiting LIRC thread.");
LOG(VB_GENERAL, LOG_ERR, LOC +
"Failed to reconnect, exiting LIRC thread.");
doRun = false;
continue;
}
LOG(VB_FILE, LOG_WARNING, "EOF -- reconnecting");
LOG(VB_FILE, LOG_WARNING, LOC + "EOF -- reconnecting");

lirc_deinit(d->lircState);
d->lircState = NULL;
Expand All @@ -444,7 +445,7 @@ void LIRC::run(void)

if (ret < 0 && errno != EINTR)
{
LOG(VB_GENERAL, LOG_ERR, "select() failed" + ENO);
LOG(VB_GENERAL, LOG_ERR, LOC + "select() failed" + ENO);
continue;
}

Expand All @@ -458,7 +459,7 @@ void LIRC::run(void)
Process(codes[i]);
}
#if 0
LOG(VB_GENERAL, LOG_DEBUG, "run -- end");
LOG(VB_GENERAL, LOG_DEBUG, LOC + "run -- end");
#endif
threadDeregister();
}
Expand All @@ -484,13 +485,13 @@ QList<QByteArray> LIRC::GetCodes(void)
else if (107 == errno)
{
if (!eofCount)
LOG(VB_GENERAL, LOG_NOTICE, "GetCodes -- EOF?");
LOG(VB_GENERAL, LOG_NOTICE, LOC + "GetCodes -- EOF?");
eofCount++;
return ret;
}
else
{
LOG(VB_GENERAL, LOG_ERR, "Could not read socket" + ENO);
LOG(VB_GENERAL, LOG_ERR, LOC + "Could not read socket" + ENO);
return ret;
}

Expand All @@ -500,7 +501,7 @@ QList<QByteArray> LIRC::GetCodes(void)
if (0 == len)
{
if (!eofCount)
LOG(VB_GENERAL, LOG_NOTICE, "GetCodes -- eof?");
LOG(VB_GENERAL, LOG_NOTICE, LOC + "GetCodes -- eof?");
eofCount++;
return ret;
}
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythui/mythdialogbox.cpp
Expand Up @@ -382,14 +382,14 @@ MythConfirmationDialog *ShowOkPopup(const QString &message, QObject *parent,
stk = win->GetStack("popup stack");
else
{
LOG(VB_GENERAL, LOG_ERR, "no main window?");
LOG(VB_GENERAL, LOG_ERR, LOC + "no main window?");
return NULL;
}

if (!stk)
{
LOG(VB_GENERAL, LOG_ERR, "no popup stack? "
"Is there a MythThemeBase?");
LOG(VB_GENERAL, LOG_ERR, LOC + "no popup stack? "
"Is there a MythThemeBase?");
return NULL;
}
}
Expand All @@ -406,7 +406,7 @@ MythConfirmationDialog *ShowOkPopup(const QString &message, QObject *parent,
{
delete pop;
pop = NULL;
LOG(VB_GENERAL, LOG_ERR, "Couldn't Create() Dialog");
LOG(VB_GENERAL, LOG_ERR, LOC + "Couldn't Create() Dialog");
}

return pop;
Expand Down

0 comments on commit f31086b

Please sign in to comment.