[Spice-devel] [PATCH] server: fix function prototypes
Alon Levy
alevy at redhat.com
Sun Sep 4 22:20:55 PDT 2011
On Mon, Sep 05, 2011 at 03:19:50AM +0200, Christophe Fergeau wrote:
> Several functions in server/ were not specifying an argument list,
> ie they were declared as void foo(); When compiling with
> -Wstrict-prototypes, this leads to:
> test_playback.c:93:5: erreur: function declaration isn’t a prototype
> [-Werror=strict-prototypes]
ACK
> ---
> common/quic.c | 4 +-
> common/rop3.c | 6 ++--
> server/inputs_channel.c | 2 +-
> server/red_channel.h | 2 +-
> server/red_worker.c | 2 +-
> server/reds.c | 44 +++++++++++------------
> server/reds.h | 4 +-
> server/tests/basic_event_loop.c | 2 +-
> server/tests/test_display_base.c | 8 ++--
> server/tests/test_display_no_ssl.c | 2 +-
> server/tests/test_display_streaming.c | 2 +-
> server/tests/test_empty_success.c | 2 +-
> server/tests/test_fail_on_null_core_interface.c | 2 +-
> server/tests/test_just_sockets_no_ssl.c | 2 +-
> server/tests/test_playback.c | 2 +-
> 15 files changed, 42 insertions(+), 44 deletions(-)
>
> diff --git a/common/quic.c b/common/quic.c
> index 5a41399..ca7ffd2 100644
> --- a/common/quic.c
> +++ b/common/quic.c
> @@ -251,7 +251,7 @@ static const unsigned int tabrand_chaos[TABRAND_TABSIZE] = {
> 0x81474925, 0xa8b6c7ad, 0xee5931de, 0xb2f8158d, 0x59fb7409, 0x2e3dfaed, 0x9af25a3f, 0xe1fed4d5,
> };
>
> -static unsigned int stabrand()
> +static unsigned int stabrand(void)
> {
> //ASSERT( !(TABRAND_SEEDMASK & TABRAND_TABSIZE));
> //ASSERT( TABRAND_SEEDMASK + 1 == TABRAND_TABSIZE );
> @@ -535,7 +535,7 @@ static int J[MELCSTATES] = {
> };
>
> /* creates the bit counting look-up table. */
> -static void init_zeroLUT()
> +static void init_zeroLUT(void)
> {
> int i, j, k, l;
>
> diff --git a/common/rop3.c b/common/rop3.c
> index af872c1..12d9f11 100644
> --- a/common/rop3.c
> +++ b/common/rop3.c
> @@ -31,7 +31,7 @@ typedef void (*rop3_with_pattern_handler_t)(pixman_image_t *d, pixman_image_t *s
> typedef void (*rop3_with_color_handler_t)(pixman_image_t *d, pixman_image_t *s,
> SpicePoint *src_pos, uint32_t rgb);
>
> -typedef void (*rop3_test_handler_t)();
> +typedef void (*rop3_test_handler_t)(void);
>
> #define ROP3_NUM_OPS 256
>
> @@ -56,7 +56,7 @@ static void default_rop3_withe_color_handler(pixman_image_t *d, pixman_image_t *
> WARN("not implemented");
> }
>
> -static void default_rop3_test_handler()
> +static void default_rop3_test_handler(void)
> {
> }
>
> @@ -127,7 +127,7 @@ static void rop3_handle_c##depth##_##name(pixman_image_t *d, pixman_image_t *s,
> } \
> } \
> \
> -static void rop3_test##depth##_##name() \
> +static void rop3_test##depth##_##name(void) \
> { \
> uint8_t d = 0xaa; \
> uint8_t s = 0xcc; \
> diff --git a/server/inputs_channel.c b/server/inputs_channel.c
> index a6dec83..24fc621 100644
> --- a/server/inputs_channel.c
> +++ b/server/inputs_channel.c
> @@ -198,7 +198,7 @@ static void inputs_channel_release_msg_rcv_buf(RedChannelClient *rcc, SpiceDataH
> ((state & SPICE_MOUSE_BUTTON_MASK_MIDDLE) ? VD_AGENT_MBUTTON_MASK : 0) | \
> ((state & SPICE_MOUSE_BUTTON_MASK_RIGHT) ? VD_AGENT_RBUTTON_MASK : 0))
>
> -static void activate_modifiers_watch()
> +static void activate_modifiers_watch(void)
> {
> core->timer_start(key_modifiers_timer, KEY_MODIFIERS_TTL);
> }
> diff --git a/server/red_channel.h b/server/red_channel.h
> index a24ff7d..2ebb6b6 100644
> --- a/server/red_channel.h
> +++ b/server/red_channel.h
> @@ -433,7 +433,7 @@ struct RedClient {
> int disconnecting;
> };
>
> -RedClient *red_client_new();
> +RedClient *red_client_new(void);
> MainChannelClient *red_client_get_main(RedClient *client);
> // main should be set once before all the other channels are created
> void red_client_set_main(RedClient *client, MainChannelClient *mcc);
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 43d0bae..91aba18 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -4616,7 +4616,7 @@ static void qxl_process_cursor(RedWorker *worker, RedCursorCmd *cursor_cmd, uint
> red_release_cursor(worker, cursor_item);
> }
>
> -static inline uint64_t red_now()
> +static inline uint64_t red_now(void)
> {
> struct timespec time;
>
> diff --git a/server/reds.c b/server/reds.c
> index c58586a..90779ff 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -111,8 +111,6 @@ void *red_tunnel = NULL;
> int agent_mouse = TRUE;
> int agent_copypaste = TRUE;
>
> -static void openssl_init();
> -
> #define MIGRATE_TIMEOUT (1000 * 10) /* 10sec */
> #define MM_TIMER_GRANULARITY_MS (1000 / 30)
> #define MM_TIME_DELTA 400 /*ms*/
> @@ -554,7 +552,7 @@ static RedsChannel *reds_find_channel(uint32_t type, uint32_t id)
> return channel;
> }
>
> -static void reds_mig_cleanup()
> +static void reds_mig_cleanup(void)
> {
> if (reds->mig_inprogress) {
> reds->mig_inprogress = FALSE;
> @@ -564,7 +562,7 @@ static void reds_mig_cleanup()
> }
> }
>
> -static void reds_reset_vdp()
> +static void reds_reset_vdp(void)
> {
> VDIPortState *state = &reds->agent_state;
> SpiceCharDeviceInterface *sif;
> @@ -653,7 +651,7 @@ static void reds_disconnect(void)
> reds_mig_cleanup();
> }
>
> -static void reds_mig_disconnect()
> +static void reds_mig_disconnect(void)
> {
> if (reds_main_channel_connected()) {
> reds_disconnect();
> @@ -682,7 +680,7 @@ int reds_get_agent_mouse(void)
> return agent_mouse;
> }
>
> -static void reds_update_mouse_mode()
> +static void reds_update_mouse_mode(void)
> {
> int allowed = 0;
> int qxl_count = red_dispatcher_qxl_count();
> @@ -704,7 +702,7 @@ static void reds_update_mouse_mode()
> }
> }
>
> -static void reds_agent_remove()
> +static void reds_agent_remove(void)
> {
> if (!reds->mig_target) {
> reds_reset_vdp();
> @@ -718,7 +716,7 @@ static void reds_agent_remove()
> }
> }
>
> -static void reds_push_tokens()
> +static void reds_push_tokens(void)
> {
> reds->agent_state.num_client_tokens += reds->agent_state.num_tokens;
> ASSERT(reds->agent_state.num_client_tokens <= REDS_AGENT_WINDOW_SIZE);
> @@ -728,7 +726,7 @@ static void reds_push_tokens()
>
> static int write_to_vdi_port(void);
>
> -static void vdi_port_write_timer_start()
> +static void vdi_port_write_timer_start(void)
> {
> if (reds->vdi_port_write_timer_started) {
> return;
> @@ -738,13 +736,13 @@ static void vdi_port_write_timer_start()
> VDI_PORT_WRITE_RETRY_TIMEOUT);
> }
>
> -static void vdi_port_write_retry()
> +static void vdi_port_write_retry(void *opaque)
> {
> reds->vdi_port_write_timer_started = FALSE;
> write_to_vdi_port();
> }
>
> -static int write_to_vdi_port()
> +static int write_to_vdi_port(void)
> {
> VDIPortState *state = &reds->agent_state;
> SpiceCharDeviceInterface *sif;
> @@ -960,7 +958,7 @@ void reds_handle_agent_mouse_event(const VDAgentMouseState *mouse_state)
> write_to_vdi_port();
> }
>
> -static void add_token()
> +static void add_token(void)
> {
> VDIPortState *state = &reds->agent_state;
>
> @@ -969,7 +967,7 @@ static void add_token()
> }
> }
>
> -int reds_num_of_channels()
> +int reds_num_of_channels(void)
> {
> return reds ? reds->num_of_channels : 0;
> }
> @@ -1525,7 +1523,7 @@ static void reds_send_link_result(RedLinkInfo *link, uint32_t error)
> sync_write(link->stream, &error, sizeof(error));
> }
>
> -int reds_expects_link_id()
> +int reds_expects_link_id(uint32_t connection_id)
> {
> red_printf("TODO: keep a list of connection_id's from migration, compare to them");
> return 1;
> @@ -2850,7 +2848,7 @@ static unsigned long pthreads_thread_id(void)
> return (ret);
> }
>
> -static void pthreads_locking_callback(int mode, int type, char *file, int line)
> +static void pthreads_locking_callback(int mode, int type, const char *file, int line)
> {
> if (mode & CRYPTO_LOCK) {
> pthread_mutex_lock(&(lock_cs[type]));
> @@ -2860,7 +2858,7 @@ static void pthreads_locking_callback(int mode, int type, char *file, int line)
> }
> }
>
> -static void openssl_thread_setup()
> +static void openssl_thread_setup(void)
> {
> int i;
>
> @@ -2872,11 +2870,11 @@ static void openssl_thread_setup()
> pthread_mutex_init(&(lock_cs[i]), NULL);
> }
>
> - CRYPTO_set_id_callback((unsigned long (*)())pthreads_thread_id);
> - CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback);
> + CRYPTO_set_id_callback(pthreads_thread_id);
> + CRYPTO_set_locking_callback(pthreads_locking_callback);
> }
>
> -static void reds_init_ssl()
> +static void reds_init_ssl(void)
> {
> #if OPENSSL_VERSION_NUMBER >= 0x10000000L
> const SSL_METHOD *ssl_method;
> @@ -2944,7 +2942,7 @@ static void reds_init_ssl()
> #endif
> }
>
> -static void reds_exit()
> +static void reds_exit(void)
> {
> if (reds->main_channel) {
> main_channel_close(reds->main_channel);
> @@ -2988,7 +2986,7 @@ enum {
> SPICE_TICKET_OPTION_CONNECTED,
> };
>
> -static inline void on_activating_ticketing()
> +static inline void on_activating_ticketing(void)
> {
> if (!ticketing_enabled && reds_main_channel_connected()) {
> red_printf("disconnecting");
> @@ -3255,7 +3253,7 @@ const char *spice_server_char_device_recognized_subtypes_list[] = {
> NULL,
> };
>
> -SPICE_GNUC_VISIBLE const char** spice_server_char_device_recognized_subtypes()
> +SPICE_GNUC_VISIBLE const char** spice_server_char_device_recognized_subtypes(void)
> {
> return spice_server_char_device_recognized_subtypes_list;
> }
> @@ -3461,7 +3459,7 @@ static void free_internal_agent_buff(VDIPortBuf *in_buf)
> }
> }
>
> -static void init_vd_agent_resources()
> +static void init_vd_agent_resources(void)
> {
> VDIPortState *state = &reds->agent_state;
> int i;
> diff --git a/server/reds.h b/server/reds.h
> index 81da46d..188bed5 100644
> --- a/server/reds.h
> +++ b/server/reds.h
> @@ -133,8 +133,8 @@ void reds_update_stat_value(uint32_t value);
> // callbacks from main channel messages
> void reds_on_main_agent_start(void);
> void reds_on_main_agent_data(MainChannelClient *mcc, void *message, size_t size);
> -void reds_on_main_migrate_connected();
> -void reds_on_main_migrate_connect_error();
> +void reds_on_main_migrate_connected(void);
> +void reds_on_main_migrate_connect_error(void);
> void reds_on_main_receive_migrate_data(MainMigrateData *data, uint8_t *end);
> void reds_on_main_mouse_mode_request(void *message, size_t size);
>
> diff --git a/server/tests/basic_event_loop.c b/server/tests/basic_event_loop.c
> index c74cbd8..e0cc06e 100644
> --- a/server/tests/basic_event_loop.c
> +++ b/server/tests/basic_event_loop.c
> @@ -159,7 +159,7 @@ void calc_next_timeout(SpiceTimer *next, struct timeval *timeout)
> tv_b_minus_a_return_le_zero(&now, &next->tv_start, timeout);
> }
>
> -void timeout_timers()
> +void timeout_timers(void)
> {
> SpiceTimer *next;
> struct timeval left;
> diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
> index d69f806..e83a0f7 100644
> --- a/server/tests/test_display_base.c
> +++ b/server/tests/test_display_base.c
> @@ -324,7 +324,7 @@ static void push_command(QXLCommandExt *ext)
> commands_end++;
> }
>
> -static struct QXLCommandExt *get_simple_command()
> +static struct QXLCommandExt *get_simple_command(void)
> {
> struct QXLCommandExt *ret = commands[commands_start%COMMANDS_SIZE];
> ASSERT(commands_start < commands_end);
> @@ -332,7 +332,7 @@ static struct QXLCommandExt *get_simple_command()
> return ret;
> }
>
> -static int num_commands()
> +static int num_commands(void)
> {
> return commands_end - commands_start;
> }
> @@ -350,7 +350,7 @@ static int get_command(QXLInstance *qin, struct QXLCommandExt *ext)
> static int *simple_commands = NULL;
> static int num_simple_commands = 0;
>
> -static void produce_command()
> +static void produce_command(void)
> {
> static int target_surface = 0;
> static int cmd_index = 0;
> @@ -410,7 +410,7 @@ static int req_cmd_notification(QXLInstance *qin)
> return TRUE;
> }
>
> -static void do_wakeup()
> +static void do_wakeup(void *opaque)
> {
> int notify;
> cursor_notify = NOTIFY_CURSOR_BATCH;
> diff --git a/server/tests/test_display_no_ssl.c b/server/tests/test_display_no_ssl.c
> index b72acc9..1eb83b3 100644
> --- a/server/tests/test_display_no_ssl.c
> +++ b/server/tests/test_display_no_ssl.c
> @@ -35,7 +35,7 @@ int simple_commands[] = {
> SIMPLE_UPDATE,
> };
>
> -int main()
> +int main(void)
> {
> core = basic_event_loop_init();
> server = test_init(core);
> diff --git a/server/tests/test_display_streaming.c b/server/tests/test_display_streaming.c
> index fdb1206..b402525 100644
> --- a/server/tests/test_display_streaming.c
> +++ b/server/tests/test_display_streaming.c
> @@ -14,7 +14,7 @@ int simple_commands[] = {
> SpiceCoreInterface *core;
> SpiceServer *server;
>
> -int main()
> +int main(void)
> {
> core = basic_event_loop_init();
> server = test_init(core);
> diff --git a/server/tests/test_empty_success.c b/server/tests/test_empty_success.c
> index 97aa772..3641eb7 100644
> --- a/server/tests/test_empty_success.c
> +++ b/server/tests/test_empty_success.c
> @@ -36,7 +36,7 @@ void channel_event(int event, SpiceChannelEventInfo *info)
> {
> }
>
> -int main()
> +int main(void)
> {
> SpiceServer *server = spice_server_new();
> SpiceCoreInterface core;
> diff --git a/server/tests/test_fail_on_null_core_interface.c b/server/tests/test_fail_on_null_core_interface.c
> index 699b2a2..6490a6a 100644
> --- a/server/tests/test_fail_on_null_core_interface.c
> +++ b/server/tests/test_fail_on_null_core_interface.c
> @@ -1,6 +1,6 @@
> #include <spice.h>
>
> -int main()
> +int main(void)
> {
> SpiceServer *server = spice_server_new();
> SpiceCoreInterface core;
> diff --git a/server/tests/test_just_sockets_no_ssl.c b/server/tests/test_just_sockets_no_ssl.c
> index 38d3a63..afa3558 100644
> --- a/server/tests/test_just_sockets_no_ssl.c
> +++ b/server/tests/test_just_sockets_no_ssl.c
> @@ -3,7 +3,7 @@
> #include <spice.h>
> #include "basic_event_loop.h"
>
> -int main()
> +int main(void)
> {
> SpiceServer *server = spice_server_new();
> SpiceCoreInterface *core = basic_event_loop_init();
> diff --git a/server/tests/test_playback.c b/server/tests/test_playback.c
> index cb1aa9b..0b95bfd 100644
> --- a/server/tests/test_playback.c
> +++ b/server/tests/test_playback.c
> @@ -90,7 +90,7 @@ void playback_timer_cb(void *opaque)
> core->timer_start(playback_timer, playback_timer_ms);
> }
>
> -int main()
> +int main(void)
> {
> SpiceServer *server = spice_server_new();
> core = basic_event_loop_init();
> --
> 1.7.6
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list