[mutter] Fix const qualifier usage
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] Fix const qualifier usage
- Date: Tue, 22 Jan 2019 17:39:45 +0000 (UTC)
commit 01cea0d9ef44c5312c0b8e262dfafdfdf3e2e782
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Sun Jan 20 11:46:46 2019 +0100
Fix const qualifier usage
As with the commits earlier, this also adds const qualifiers where
expected. However, the const variables are casted to non-const variants
so they can be passed to glib functions that take non-const variants but
expect const-like input.
src/backends/meta-egl.c | 26 +++++++++++++-------------
src/backends/meta-egl.h | 26 +++++++++++++-------------
src/backends/meta-gles3.c | 6 +++---
src/backends/meta-gles3.h | 6 +++---
src/backends/native/meta-renderer-native.c | 13 +++++++------
src/wayland/meta-wayland.c | 2 +-
src/wayland/meta-wayland.h | 2 +-
7 files changed, 41 insertions(+), 40 deletions(-)
---
diff --git a/src/backends/meta-egl.c b/src/backends/meta-egl.c
index c60dd2eaa..8b953449a 100644
--- a/src/backends/meta-egl.c
+++ b/src/backends/meta-egl.c
@@ -161,13 +161,13 @@ set_egl_error (GError **error)
}
gboolean
-meta_extensions_string_has_extensions_valist (const char *extensions_str,
- char ***missing_extensions,
- char *first_extension,
- va_list var_args)
+meta_extensions_string_has_extensions_valist (const char *extensions_str,
+ const char ***missing_extensions,
+ const char *first_extension,
+ va_list var_args)
{
char **extensions;
- char *extension;
+ const char *extension;
size_t num_missing_extensions = 0;
if (missing_extensions)
@@ -203,10 +203,10 @@ meta_extensions_string_has_extensions_valist (const char *extensions_str,
}
gboolean
-meta_egl_has_extensions (MetaEgl *egl,
- EGLDisplay display,
- char ***missing_extensions,
- char *first_extension,
+meta_egl_has_extensions (MetaEgl *egl,
+ EGLDisplay display,
+ const char ***missing_extensions,
+ const char *first_extension,
...)
{
va_list var_args;
@@ -669,10 +669,10 @@ meta_egl_query_device_string (MetaEgl *egl,
}
gboolean
-meta_egl_egl_device_has_extensions (MetaEgl *egl,
- EGLDeviceEXT device,
- char ***missing_extensions,
- char *first_extension,
+meta_egl_egl_device_has_extensions (MetaEgl *egl,
+ EGLDeviceEXT device,
+ const char ***missing_extensions,
+ const char *first_extension,
...)
{
va_list var_args;
diff --git a/src/backends/meta-egl.h b/src/backends/meta-egl.h
index 060c7cd2d..ff37f124f 100644
--- a/src/backends/meta-egl.h
+++ b/src/backends/meta-egl.h
@@ -37,15 +37,15 @@ G_DECLARE_FINAL_TYPE (MetaEgl, meta_egl, META, EGL, GObject)
GQuark meta_egl_error_quark (void);
gboolean
-meta_extensions_string_has_extensions_valist (const char *extensions_str,
- char ***missing_extensions,
- char *first_extension,
- va_list var_args);
-
-gboolean meta_egl_has_extensions (MetaEgl *egl,
- EGLDisplay display,
- char ***missing_extensions,
- char *first_extension,
+meta_extensions_string_has_extensions_valist (const char *extensions_str,
+ const char ***missing_extensions,
+ const char *first_extension,
+ va_list var_args);
+
+gboolean meta_egl_has_extensions (MetaEgl *egl,
+ EGLDisplay display,
+ const char ***missing_extensions,
+ const char *first_extension,
...);
gboolean meta_egl_initialize (MetaEgl *egl,
@@ -158,10 +158,10 @@ const char * meta_egl_query_device_string (MetaEgl *egl,
EGLint name,
GError **error);
-gboolean meta_egl_egl_device_has_extensions (MetaEgl *egl,
- EGLDeviceEXT device,
- char ***missing_extensions,
- char *first_extension,
+gboolean meta_egl_egl_device_has_extensions (MetaEgl *egl,
+ EGLDeviceEXT device,
+ const char ***missing_extensions,
+ const char *first_extension,
...);
gboolean meta_egl_get_output_layers (MetaEgl *egl,
diff --git a/src/backends/meta-gles3.c b/src/backends/meta-gles3.c
index f467a8f94..727b3c125 100644
--- a/src/backends/meta-gles3.c
+++ b/src/backends/meta-gles3.c
@@ -114,9 +114,9 @@ meta_gles3_validate (MetaGles3 *gles3,
}
gboolean
-meta_gles3_has_extensions (MetaGles3 *gles3,
- char ***missing_extensions,
- char *first_extension,
+meta_gles3_has_extensions (MetaGles3 *gles3,
+ const char ***missing_extensions,
+ const char *first_extension,
...)
{
va_list var_args;
diff --git a/src/backends/meta-gles3.h b/src/backends/meta-gles3.h
index 6f42be2e0..89206cc8f 100644
--- a/src/backends/meta-gles3.h
+++ b/src/backends/meta-gles3.h
@@ -43,9 +43,9 @@ void meta_gles3_ensure_loaded (MetaGles3 *gles,
gpointer *func,
const char *name);
-gboolean meta_gles3_has_extensions (MetaGles3 *gles3,
- char ***missing_extensions,
- char *first_extension,
+gboolean meta_gles3_has_extensions (MetaGles3 *gles3,
+ const char ***missing_extensions,
+ const char *first_extension,
...);
MetaGles3 * meta_gles3_new (MetaEgl *egl);
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 1b74ae17c..abc4c200c 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -3207,7 +3207,7 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data,
EGLDisplay egl_display = renderer_gpu_data->egl_display;
EGLConfig egl_config;
EGLContext egl_context;
- char **missing_gl_extensions;
+ const char **missing_gl_extensions;
const char *renderer_str;
gboolean is_hardware;
@@ -3247,7 +3247,8 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data,
{
char *missing_gl_extensions_str;
- missing_gl_extensions_str = g_strjoinv (", ", missing_gl_extensions);
+ missing_gl_extensions_str = g_strjoinv (", ",
+ (char **) missing_gl_extensions);
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Missing OpenGL ES extensions: %s",
missing_gl_extensions_str);
@@ -3381,7 +3382,7 @@ find_egl_device (MetaRendererNative *renderer_native,
GError **error)
{
MetaEgl *egl = meta_renderer_native_get_egl (renderer_native);
- char **missing_extensions;
+ const char **missing_extensions;
EGLint num_devices;
EGLDeviceEXT *devices;
const char *kms_file_path;
@@ -3396,7 +3397,7 @@ find_egl_device (MetaRendererNative *renderer_native,
{
char *missing_extensions_str;
- missing_extensions_str = g_strjoinv (", ", missing_extensions);
+ missing_extensions_str = g_strjoinv (", ", (char **) missing_extensions);
g_set_error (error, G_IO_ERROR,
G_IO_ERROR_FAILED,
"Missing EGL extensions required for EGLDevice renderer: %s",
@@ -3484,7 +3485,7 @@ create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native,
GError **error)
{
MetaEgl *egl = meta_renderer_native_get_egl (renderer_native);
- char **missing_extensions;
+ const char **missing_extensions;
EGLDeviceEXT egl_device;
EGLDisplay egl_display;
MetaRendererNativeGpuData *renderer_gpu_data;
@@ -3523,7 +3524,7 @@ create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native,
{
char *missing_extensions_str;
- missing_extensions_str = g_strjoinv (", ", missing_extensions);
+ missing_extensions_str = g_strjoinv (", ", (char **) missing_extensions);
g_set_error (error, G_IO_ERROR,
G_IO_ERROR_FAILED,
"Missing EGL extensions required for EGLDevice renderer: %s",
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index a06d2d7d8..a593f0a7b 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -356,7 +356,7 @@ meta_xwayland_global_filter (const struct wl_client *client,
}
void
-meta_wayland_override_display_name (char *display_name)
+meta_wayland_override_display_name (const char *display_name)
{
g_clear_pointer (&_display_name_override, g_free);
_display_name_override = g_strdup (display_name);
diff --git a/src/wayland/meta-wayland.h b/src/wayland/meta-wayland.h
index 57f1a857d..0749e7980 100644
--- a/src/wayland/meta-wayland.h
+++ b/src/wayland/meta-wayland.h
@@ -27,7 +27,7 @@
#include "meta/types.h"
#include "wayland/meta-wayland-types.h"
-void meta_wayland_override_display_name (char *display_name);
+void meta_wayland_override_display_name (const char *display_name);
void meta_wayland_pre_clutter_init (void);
void meta_wayland_init (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]