-/* $Id$ */
-
/***
This file is part of PulseAudio.
+ Copyright 2004-2006 Lennart Poettering
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2 of the License,
+ by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
#endif
#include <string.h>
-#include <assert.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <pulse/xmalloc.h>
+#include <pulse/i18n.h>
#include <pulsecore/x11prop.h>
#include <pulsecore/log.h>
#include <pulsecore/core-util.h>
+#include <pulsecore/macro.h>
#include "client-conf-x11.h"
int ret = -1;
char t[1024];
- if (!dname && !getenv("DISPLAY"))
+ pa_assert(c);
+
+ if (!dname && !(dname = getenv("DISPLAY")))
goto finish;
-
+
+ if (*dname == 0)
+ goto finish;
+
if (!(d = XOpenDisplay(dname))) {
- pa_log("XOpenDisplay() failed");
+ pa_log(_("XOpenDisplay() failed"));
goto finish;
}
uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
if (pa_parsehex(t, cookie, sizeof(cookie)) != sizeof(cookie)) {
- pa_log("failed to parse cookie data");
+ pa_log(_("Failed to parse cookie data"));
goto finish;
}
- assert(sizeof(cookie) == sizeof(c->cookie));
+ pa_assert(sizeof(cookie) == sizeof(c->cookie));
memcpy(c->cookie, cookie, sizeof(cookie));
- c->cookie_valid = 1;
+ c->cookie_valid = TRUE;
pa_xfree(c->cookie_file);
c->cookie_file = NULL;
XCloseDisplay(d);
return ret;
-
+
}