diff options
Diffstat (limited to '')
-rw-r--r-- | src/ClientWrite.cxx (renamed from src/client_write.c) | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/client_write.c b/src/ClientWrite.cxx index 78cfca8a1..825029fb9 100644 --- a/src/client_write.c +++ b/src/ClientWrite.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * Copyright (C) 2003-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -18,14 +18,14 @@ */ #include "config.h" -#include "client_internal.h" +#include "ClientInternal.hxx" #include <assert.h> #include <string.h> #include <stdio.h> static size_t -client_write_deferred_buffer(struct client *client, +client_write_deferred_buffer(Client *client, const struct deferred_buffer *buffer) { GError *error = NULL; @@ -67,12 +67,13 @@ client_write_deferred_buffer(struct client *client, } void -client_write_deferred(struct client *client) +client_write_deferred(Client *client) { size_t ret; while (!g_queue_is_empty(client->deferred_send)) { struct deferred_buffer *buf = + (struct deferred_buffer *) g_queue_peek_head(client->deferred_send); assert(buf->size > 0); @@ -108,8 +109,8 @@ client_write_deferred(struct client *client) } } -static void client_defer_output(struct client *client, - const void *data, size_t length) +static void +client_defer_output(Client *client, const void *data, size_t length) { size_t alloc; struct deferred_buffer *buf; @@ -129,15 +130,15 @@ static void client_defer_output(struct client *client, return; } - buf = g_malloc(alloc); + buf = (struct deferred_buffer *)g_malloc(alloc); buf->size = length; memcpy(buf->data, data, length); g_queue_push_tail(client->deferred_send, buf); } -static void client_write_direct(struct client *client, - const char *data, size_t length) +static void +client_write_direct(Client *client, const char *data, size_t length) { GError *error = NULL; GIOStatus status; @@ -181,7 +182,7 @@ static void client_write_direct(struct client *client, } void -client_write_output(struct client *client) +client_write_output(Client *client) { if (client_is_expired(client) || !client->send_buf_used) return; @@ -211,7 +212,8 @@ client_write_output(struct client *client) /** * Write a block of data to the client. */ -static void client_write(struct client *client, const char *buffer, size_t buflen) +static void +client_write(Client *client, const char *buffer, size_t buflen) { /* if the client is going to be closed, do nothing */ if (client_is_expired(client)) @@ -236,17 +238,18 @@ static void client_write(struct client *client, const char *buffer, size_t bufle } } -void client_puts(struct client *client, const char *s) +void +client_puts(Client *client, const char *s) { client_write(client, s, strlen(s)); } -void client_vprintf(struct client *client, const char *fmt, va_list args) +void +client_vprintf(Client *client, const char *fmt, va_list args) { #ifndef G_OS_WIN32 va_list tmp; int length; - char *buffer; va_copy(tmp, args); length = vsnprintf(NULL, 0, fmt, tmp); @@ -256,7 +259,7 @@ void client_vprintf(struct client *client, const char *fmt, va_list args) /* wtf.. */ return; - buffer = g_malloc(length + 1); + char *buffer = (char *)g_malloc(length + 1); vsnprintf(buffer, length + 1, fmt, args); client_write(client, buffer, length); g_free(buffer); @@ -274,7 +277,9 @@ void client_vprintf(struct client *client, const char *fmt, va_list args) #endif } -G_GNUC_PRINTF(2, 3) void client_printf(struct client *client, const char *fmt, ...) +G_GNUC_PRINTF(2, 3) +void +client_printf(Client *client, const char *fmt, ...) { va_list args; |