diff options
author | Robert Bragg <robert@linux.intel.com> | 2010-02-10 01:57:32 +0000 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2010-02-12 14:05:00 +0000 |
commit | 0f5f4e8645d12eb6c5ff99c13503f2380740bb10 (patch) | |
tree | 608ac1afdc5924f097bd6e140c6fc887070eb533 /cogl/cogl-feature-private.c | |
parent | 10fa7c7ce9a69b733e4652a51e101a98911d5bb8 (diff) | |
download | cogl-0f5f4e8645d12eb6c5ff99c13503f2380740bb10.tar.gz |
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
Diffstat (limited to 'cogl/cogl-feature-private.c')
-rw-r--r-- | cogl/cogl-feature-private.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cogl/cogl-feature-private.c b/cogl/cogl-feature-private.c index 2f98e275..db6fa76c 100644 --- a/cogl/cogl-feature-private.c +++ b/cogl/cogl-feature-private.c @@ -34,11 +34,12 @@ gboolean _cogl_feature_check (const CoglFeatureData *data, - guint gl_major, guint gl_minor, - const gchar *extensions_string) + unsigned int gl_major, + unsigned int gl_minor, + const char *extensions_string) { - const gchar *suffix = NULL; + const char *suffix = NULL; int func_num; _COGL_GET_CONTEXT (ctx, FALSE); @@ -51,14 +52,14 @@ _cogl_feature_check (const CoglFeatureData *data, else { /* Otherwise try all of the extensions */ - const gchar *namespace, *namespace_suffix; - guint namespace_len; + const char *namespace, *namespace_suffix; + unsigned int namespace_len; for (namespace = data->namespaces; *namespace; namespace += strlen (namespace) + 1) { - const gchar *extension; + const char *extension; GString *full_extension_name = g_string_new (""); /* If the namespace part contains a ':' then the suffix for @@ -110,7 +111,7 @@ _cogl_feature_check (const CoglFeatureData *data, for (func_num = 0; data->functions[func_num].name; func_num++) { void *func; - gchar *full_function_name; + char *full_function_name; full_function_name = g_strconcat (data->functions[func_num].name, suffix, NULL); @@ -121,7 +122,7 @@ _cogl_feature_check (const CoglFeatureData *data, break; /* Set the function pointer in the context */ - *(void **) ((guchar *) ctx + + *(void **) ((guint8 *) ctx + data->functions[func_num].pointer_offset) = func; } @@ -132,7 +133,7 @@ _cogl_feature_check (const CoglFeatureData *data, if (data->functions[func_num].name) { while (func_num-- > 0) - *(void **) ((guchar *) ctx + + *(void **) ((guint8 *) ctx + data->functions[func_num].pointer_offset) = NULL; return FALSE; } |