From 3b3d15748a7450855d60f006ad15410923ad876d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 29 Jun 2012 15:40:49 +0100 Subject: [PATCH] examples: fix boolean option parsing Under gcc, sizeof(bool) is 1, while sizeof(gboolean) is 4 (on every platform we care about). This means that passing a bool * to a GLib function expecting a gboolean * leads to an overflow of 3 bytes. --- examples/dictionary-message.c | 6 +++--- examples/echo.c | 6 +++--- examples/file-transfer.c | 6 +++--- examples/status.c | 6 +++--- examples/video-profile/mock-player.c | 2 +- examples/video-profile/remote.c | 8 ++++---- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/dictionary-message.c b/examples/dictionary-message.c index 6393a10..48b337b 100644 --- a/examples/dictionary-message.c +++ b/examples/dictionary-message.c @@ -198,9 +198,9 @@ int main (int argc, char **argv) { - bool client = false; - bool server = true; - bool p2p = false; + gboolean client = false; + gboolean server = true; + gboolean p2p = false; GOptionEntry entries[] = { { "client", 'c', 0, G_OPTION_ARG_NONE, &client, "Run as client", NULL }, { "server", 's', 0, G_OPTION_ARG_NONE, &server, "Run as server (default)", NULL }, diff --git a/examples/echo.c b/examples/echo.c index 55dd3bf..a24c952 100644 --- a/examples/echo.c +++ b/examples/echo.c @@ -223,9 +223,9 @@ int main (int argc, char **argv) { - bool client = false; - bool server = true; - bool p2p = false; + gboolean client = false; + gboolean server = true; + gboolean p2p = false; GOptionEntry entries[] = { { "client", 'c', 0, G_OPTION_ARG_NONE, &client, "Run as client", NULL }, { "server", 's', 0, G_OPTION_ARG_NONE, &server, "Run as server (default)", NULL }, diff --git a/examples/file-transfer.c b/examples/file-transfer.c index cccd021..eb1ff7a 100644 --- a/examples/file-transfer.c +++ b/examples/file-transfer.c @@ -265,9 +265,9 @@ int main (int argc, char **argv) { - bool client = false; - bool server = true; - bool p2p = false; + gboolean client = false; + gboolean server = true; + gboolean p2p = false; char const *path = NULL; GOptionEntry entries[] = { { "client", 'c', 0, G_OPTION_ARG_NONE, &client, "Run as client", NULL }, diff --git a/examples/status.c b/examples/status.c index b289e85..737b4e5 100644 --- a/examples/status.c +++ b/examples/status.c @@ -212,9 +212,9 @@ int main (int argc, char **argv) { - bool client = false; - bool server = true; - bool p2p = false; + gboolean client = false; + gboolean server = true; + gboolean p2p = false; GOptionEntry entries[] = { { "client", 'c', 0, G_OPTION_ARG_NONE, &client, "Run as client", NULL }, { "server", 's', 0, G_OPTION_ARG_NONE, &server, "Run as server (default)", NULL }, diff --git a/examples/video-profile/mock-player.c b/examples/video-profile/mock-player.c index f26e691..b1545ff 100644 --- a/examples/video-profile/mock-player.c +++ b/examples/video-profile/mock-player.c @@ -69,7 +69,7 @@ typedef struct { char const *const *playlist; unsigned current; - bool playing; + gboolean playing; double volume; char *playable_uri; diff --git a/examples/video-profile/remote.c b/examples/video-profile/remote.c index 2c32588..3a1617d 100644 --- a/examples/video-profile/remote.c +++ b/examples/video-profile/remote.c @@ -46,10 +46,10 @@ typedef struct { char const *player_playing; double player_volume; char const *player_playable_uri; - bool player_play; - bool player_pause; - bool player_next; - bool player_prev; + gboolean player_play; + gboolean player_pause; + gboolean player_next; + gboolean player_prev; YtsVPPlayer *player; YtsVPTranscript *transcript; -- 1.7.10.4