diff --git a/gio/gdbusdaemon.c b/gio/gdbusdaemon.c index 2e67b5d67..3516183f9 100644 --- a/gio/gdbusdaemon.c +++ b/gio/gdbusdaemon.c @@ -204,7 +204,7 @@ name_lookup (GDBusDaemon *daemon, const char *str) } static gboolean -is_key (const char *key_start, const char *key_end, char *value) +is_key (const char *key_start, const char *key_end, const char *value) { gsize len = strlen (value); @@ -1463,7 +1463,7 @@ filter_function (GDBusConnection *connection, gpointer user_data) { Client *client = user_data; - char *types[] = {"invalid", "method_call", "method_return", "error", "signal" }; + const char *types[] = {"invalid", "method_call", "method_return", "error", "signal" }; if (0) g_printerr ("%s%s %s %d(%d) sender: %s destination: %s %s %s.%s\n", diff --git a/gio/tests/file.c b/gio/tests/file.c index 1519448ee..baf0bd745 100644 --- a/gio/tests/file.c +++ b/gio/tests/file.c @@ -153,9 +153,9 @@ typedef struct gint monitor_created; gint monitor_deleted; gint monitor_changed; - gchar *monitor_path; + const gchar *monitor_path; gint pos; - gchar *data; + const gchar *data; gchar *buffer; guint timeout; } CreateDeleteData; diff --git a/gio/tests/fileattributematcher.c b/gio/tests/fileattributematcher.c index 6956e6a36..553d57b19 100644 --- a/gio/tests/fileattributematcher.c +++ b/gio/tests/fileattributematcher.c @@ -3,7 +3,7 @@ static void test_exact (void) { - char *exact_matches[] = { + const char *exact_matches[] = { "*", "a::*", "a::*,b::*", @@ -29,8 +29,8 @@ static void test_equality (void) { struct { - char *expected; - char *actual; + const char *expected; + const char *actual; } equals[] = { /* star makes everything else go away */ { "*", "*,*" }, @@ -70,9 +70,9 @@ static void test_subtract (void) { struct { - char *attributes; - char *subtract; - char *result; + const char *attributes; + const char *subtract; + const char *result; } subtractions[] = { /* * subtracts everything */ { "*", "*", NULL }, diff --git a/gio/tests/gschema-compile.c b/gio/tests/gschema-compile.c index 65f656c52..81ded83fa 100644 --- a/gio/tests/gschema-compile.c +++ b/gio/tests/gschema-compile.c @@ -22,17 +22,17 @@ test_schema_do_compile (gpointer data) SchemaTest *test = (SchemaTest *) data; gchar *filename = g_strconcat (test->name, ".gschema.xml", NULL); gchar *path = g_test_build_filename (G_TEST_DIST, "schema-tests", filename, NULL); - gchar *argv[] = { + const gchar *argv[] = { GLIB_COMPILE_SCHEMAS, "--strict", "--dry-run", "--schema-file", path, - (gchar *)test->opt, + test->opt, NULL }; gchar *envp[] = { NULL }; - execve (argv[0], argv, envp); + execve (argv[0], (char **) argv, envp); g_assert_not_reached (); } diff --git a/gio/tests/pollable.c b/gio/tests/pollable.c index c61525d09..826eaecad 100644 --- a/gio/tests/pollable.c +++ b/gio/tests/pollable.c @@ -61,7 +61,7 @@ check_source_readability_callback (gpointer user_data) static gboolean write_callback (gpointer user_data) { - char *buf = "x"; + const char *buf = "x"; gssize nwrote; GError *error = NULL; diff --git a/gio/tests/simple-proxy.c b/gio/tests/simple-proxy.c index 00bdb2ea4..f1eb6af9b 100644 --- a/gio/tests/simple-proxy.c +++ b/gio/tests/simple-proxy.c @@ -32,7 +32,7 @@ static void test_uris (void) { GProxyResolver *resolver; - gchar *ignore_hosts[2] = { "127.0.0.1", NULL }; + const gchar *ignore_hosts[2] = { "127.0.0.1", NULL }; gchar **proxies; GError *error = NULL; const gchar *uri; @@ -41,7 +41,7 @@ test_uris (void) /* Valid URI. */ uri = "http://%E0%B4%A8%E0%B4%B2:80/"; - resolver = g_simple_proxy_resolver_new (NULL, ignore_hosts); + resolver = g_simple_proxy_resolver_new (NULL, (char **) ignore_hosts); proxies = g_proxy_resolver_lookup (resolver, uri, NULL, &error); g_assert_no_error (error); @@ -60,7 +60,7 @@ test_uris (void) /* Invalid URI. */ uri = "%E0%B4%A8%E0%B4%B2"; str = g_strdup_printf ("Invalid URI ā€˜%sā€™", uri); - resolver = g_simple_proxy_resolver_new (NULL, ignore_hosts); + resolver = g_simple_proxy_resolver_new (NULL, (char **) ignore_hosts); proxies = g_proxy_resolver_lookup (resolver, uri, NULL, &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT); @@ -81,7 +81,7 @@ test_uris (void) g_object_unref (resolver); g_free (str); - resolver = g_simple_proxy_resolver_new ("default://", ignore_hosts); + resolver = g_simple_proxy_resolver_new ("default://", (char **) ignore_hosts); g_simple_proxy_resolver_set_uri_proxy (G_SIMPLE_PROXY_RESOLVER (resolver), "http", "http://proxy.example.com"); g_simple_proxy_resolver_set_uri_proxy (G_SIMPLE_PROXY_RESOLVER (resolver), @@ -136,11 +136,11 @@ static void test_socks (void) { GProxyResolver *resolver; - gchar *ignore_hosts[2] = { "127.0.0.1", NULL }; + const gchar *ignore_hosts[2] = { "127.0.0.1", NULL }; gchar **proxies; GError *error = NULL; - resolver = g_simple_proxy_resolver_new ("socks://proxy.example.com", ignore_hosts); + resolver = g_simple_proxy_resolver_new ("socks://proxy.example.com", (char **) ignore_hosts); proxies = g_proxy_resolver_lookup (resolver, "http://one.example.com/", NULL, &error); @@ -160,7 +160,7 @@ test_socks (void) g_object_unref (resolver); - resolver = g_simple_proxy_resolver_new ("default-proxy://", ignore_hosts); + resolver = g_simple_proxy_resolver_new ("default-proxy://", (char **) ignore_hosts); g_simple_proxy_resolver_set_uri_proxy (G_SIMPLE_PROXY_RESOLVER (resolver), "http", "socks://proxy.example.com"); diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c index db2bf05d2..5300c6838 100644 --- a/glib/gbacktrace.c +++ b/glib/gbacktrace.c @@ -226,7 +226,7 @@ g_on_error_stack_trace (const gchar *prg_name) #if defined(G_OS_UNIX) pid_t pid; gchar buf[16]; - gchar *args[4] = { "gdb", NULL, NULL, NULL }; + const gchar *args[4] = { "gdb", NULL, NULL, NULL }; int status; if (!prg_name) @@ -234,7 +234,7 @@ g_on_error_stack_trace (const gchar *prg_name) _g_sprintf (buf, "%u", (guint) getpid ()); - args[1] = (gchar*) prg_name; + args[1] = prg_name; args[2] = buf; pid = fork (); diff --git a/glib/gcharset.c b/glib/gcharset.c index 8aa549694..bfcd12590 100644 --- a/glib/gcharset.c +++ b/glib/gcharset.c @@ -235,8 +235,8 @@ g_get_codeset (void) /* read an alias file for the locales */ static void -read_aliases (gchar *file, - GHashTable *alias_table) +read_aliases (const gchar *file, + GHashTable *alias_table) { FILE *fp; char buf[256]; diff --git a/glib/gdatetime.c b/glib/gdatetime.c index 0820e0d8b..1bd916587 100644 --- a/glib/gdatetime.c +++ b/glib/gdatetime.c @@ -2767,11 +2767,11 @@ format_z (GString *outstr, } static void -format_number (GString *str, - gboolean use_alt_digits, - gchar *pad, - gint width, - guint32 number) +format_number (GString *str, + gboolean use_alt_digits, + const gchar *pad, + gint width, + guint32 number) { const gchar *ascii_digits[10] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" @@ -2909,7 +2909,7 @@ g_date_time_format_locale (GDateTime *datetime, gunichar c; gboolean alt_digits = FALSE; gboolean pad_set = FALSE; - gchar *pad = ""; + const gchar *pad = ""; const gchar *name; const gchar *tz; diff --git a/glib/tests/convert.c b/glib/tests/convert.c index 03c0d7209..5ffee6162 100644 --- a/glib/tests/convert.c +++ b/glib/tests/convert.c @@ -34,8 +34,8 @@ static void test_iconv_state (void) { - gchar *in = "\xf4\xe5\xf8\xe5\xed"; - gchar *expected = "\xd7\xa4\xd7\x95\xd7\xa8\xd7\x95\xd7\x9d"; + const gchar *in = "\xf4\xe5\xf8\xe5\xed"; + const gchar *expected = "\xd7\xa4\xd7\x95\xd7\xa8\xd7\x95\xd7\x9d"; gchar *out; gsize bytes_read = 0; gsize bytes_written = 0; @@ -107,7 +107,7 @@ test_byte_order (void) { gchar in_be[4] = { 0xfe, 0xff, 0x03, 0x93}; /* capital gamma */ gchar in_le[4] = { 0xff, 0xfe, 0x93, 0x03}; - gchar *expected = "\xce\x93"; + const gchar *expected = "\xce\x93"; gchar *out; gsize bytes_read = 0; gsize bytes_written = 0; @@ -588,7 +588,7 @@ check_utf16_to_ucs4 (const gunichar2 *utf16, static void test_unicode_conversions (void) { - char *utf8; + const char *utf8; gunichar ucs4[100]; gunichar2 utf16[100]; @@ -913,7 +913,7 @@ test_filename_from_utf8_embedded_nul_iconv (void) static void test_no_conv (void) { - gchar *in = ""; + const gchar *in = ""; gchar *out G_GNUC_UNUSED; gsize bytes_read = 0; gsize bytes_written = 0;