46 lines
1.3 KiB
Plaintext
46 lines
1.3 KiB
Plaintext
$OpenBSD: patch-src_idle_c,v 1.2 2011/11/07 12:36:08 sthen Exp $
|
|
|
|
Fix build on gcc2.
|
|
|
|
--- src/idle.c.orig Mon Oct 24 04:43:05 2011
|
|
+++ src/idle.c Sun Oct 30 00:18:24 2011
|
|
@@ -60,7 +60,8 @@ static const char *const idle_names[] = {
|
|
const char *
|
|
mpd_idle_name(enum mpd_idle idle)
|
|
{
|
|
- for (unsigned i = 0; idle_names[i] != NULL; ++i)
|
|
+ unsigned i;
|
|
+ for (i = 0; idle_names[i] != NULL; ++i)
|
|
if (idle == (enum mpd_idle)(1 << i))
|
|
return idle_names[i];
|
|
|
|
@@ -70,9 +71,10 @@ mpd_idle_name(enum mpd_idle idle)
|
|
enum mpd_idle
|
|
mpd_idle_name_parse(const char *name)
|
|
{
|
|
+ unsigned i;
|
|
assert(name != NULL);
|
|
|
|
- for (unsigned i = 0; idle_names[i] != NULL; ++i)
|
|
+ for (i = 0; idle_names[i] != NULL; ++i)
|
|
if (strcmp(name, idle_names[i]) == 0)
|
|
return 1 << i;
|
|
|
|
@@ -144,6 +146,7 @@ mpd_send_idle(struct mpd_connection *connection)
|
|
bool
|
|
mpd_send_idle_mask(struct mpd_connection *connection, enum mpd_idle mask)
|
|
{
|
|
+ unsigned i;
|
|
/* this buffer is large enough even for the full mask */
|
|
char buffer[128] = "idle";
|
|
|
|
@@ -152,7 +155,7 @@ mpd_send_idle_mask(struct mpd_connection *connection,
|
|
if (mpd_error_is_defined(&connection->error))
|
|
return false;
|
|
|
|
- for (unsigned i = 0; idle_names[i] != NULL; ++i) {
|
|
+ for (i = 0; idle_names[i] != NULL; ++i) {
|
|
if (mask & (1 << i)) {
|
|
mask &= ~(1 << i);
|
|
strcat(buffer, " ");
|