summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Staudinger <robsta@gnome.org>2009-08-07 14:25:31 +0200
committerRobert Staudinger <robsta@gnome.org>2009-08-07 14:25:31 +0200
commit1f1120f727d79b6c5d16281c58e86846c3b703ec (patch)
tree8ac9b31fd8294d2e0ec5dd11af097b8b3eb4fb8b
parent270ddc8d6d72b358998c5e329ee8205f0be73cf3 (diff)
[coding style] Consistently use 'true' and 'false' from stdbool.h
-rw-r--r--ccss-gtk/ccss-gtk-color.c11
-rw-r--r--ccss-gtk/ccss-gtk-functions.c84
-rw-r--r--ccss-gtk/ccss-gtk-stylesheet.c8
-rw-r--r--ccss-gtk/ccss-stylesheet-to-gtkrc.c7
-rw-r--r--ccss/ccss-node.c14
-rw-r--r--ccss/ccss-selector.c4
-rw-r--r--ccss/ccss-style.c2
7 files changed, 66 insertions, 64 deletions
diff --git a/ccss-gtk/ccss-gtk-color.c b/ccss-gtk/ccss-gtk-color.c
index 6e7e3ce..3a3688e 100644
--- a/ccss-gtk/ccss-gtk-color.c
+++ b/ccss-gtk/ccss-gtk-color.c
@@ -24,6 +24,7 @@
* MA 02110-1301, USA.
*/
+#include <stdbool.h>
#include <gtk/gtk.h>
#include "ccss-gtk-color.h"
#include "config.h"
@@ -36,19 +37,19 @@ ccss_gtk_color_lookup (char const *spec,
GHashTable *colors;
GdkColor *system_color;
- g_return_val_if_fail (spec, FALSE);
+ g_return_val_if_fail (spec, false);
settings = gtk_settings_get_default ();
colors = NULL;
g_object_get (G_OBJECT (settings), "color-hash", &colors, NULL);
- g_return_val_if_fail (colors, FALSE);
+ g_return_val_if_fail (colors, false);
system_color = (GdkColor *) g_hash_table_lookup (colors, spec);
if (system_color) {
color->red = system_color->red;
color->green = system_color->green;
color->blue = system_color->blue;
- return TRUE;
+ return true;
}
/* Try to parse the color. */
@@ -215,7 +216,7 @@ ccss_gtk_color_mix (double factor,
result->green = factor * color1->green + (1.0 - factor) * color2->green;
result->blue = factor * color1->blue + (1.0 - factor) * color2->blue;
- return TRUE;
+ return true;
}
bool
@@ -250,6 +251,6 @@ ccss_gtk_color_shade (double factor,
color->green = (guint16) (green * 65535.0);
color->blue = (guint16) (blue * 65535.0);
- return TRUE;
+ return true;
}
diff --git a/ccss-gtk/ccss-gtk-functions.c b/ccss-gtk/ccss-gtk-functions.c
index 138ebf7..3192892 100644
--- a/ccss-gtk/ccss-gtk-functions.c
+++ b/ccss-gtk/ccss-gtk-functions.c
@@ -52,7 +52,7 @@ url (GSList const *args,
soup_uri_set_path (uri, resolved_path);
g_free (resolved_path), resolved_path = NULL;
- ret = soup_uri_to_string (uri, FALSE);
+ ret = soup_uri_to_string (uri, false);
soup_uri_free (uri), uri = NULL;
#else
char const *given_path;
@@ -77,7 +77,7 @@ color_walk_r (GdkColor *color,
char const *token;
gboolean ret;
- g_return_val_if_fail (*args && (*args)->data, FALSE);
+ g_return_val_if_fail (*args && (*args)->data, false);
if (function)
token = function;
@@ -88,50 +88,50 @@ color_walk_r (GdkColor *color,
double red, green, blue;
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* red */
red = g_ascii_strtod ((char const *) (*args)->data, NULL);
- *args = (*args)->next; if (!*args) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
/* "," */
- if (0 != g_strcmp0(",", (char const *) (*args)->data)) return FALSE;
- *args = (*args)->next; if (!*args) return FALSE;
+ if (0 != g_strcmp0(",", (char const *) (*args)->data)) return false;
+ *args = (*args)->next; if (!*args) return false;
/* green */
green = g_ascii_strtod ((char const *) (*args)->data, NULL);
- *args = (*args)->next; if (!*args) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
/* "," */
- if (0 != g_strcmp0(",", (char const *) (*args)->data)) return FALSE;
- *args = (*args)->next; if (!*args) return FALSE;
+ if (0 != g_strcmp0(",", (char const *) (*args)->data)) return false;
+ *args = (*args)->next; if (!*args) return false;
/* blue */
blue = g_ascii_strtod ((char const *) (*args)->data, NULL);
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
color->red = (guint16) (red * 65535.0);
color->green = (guint16) (green * 65535.0);
color->blue = (guint16) (blue * 65535.0);
- return TRUE;
+ return true;
} else if (0 == g_strcmp0 ("gtk-color(", token)) {
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* color */
ret = ccss_gtk_color_lookup ((char const *) (*args)->data, color);
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
return ret;
@@ -141,83 +141,83 @@ color_walk_r (GdkColor *color,
GdkColor color1;
GdkColor color2;
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* factor */
factor = g_ascii_strtod ((char const *) (*args)->data, NULL);
- *args = (*args)->next; if (!*args) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
/* "," */
- if (0 != g_strcmp0(",", (char const *) (*args)->data)) return FALSE;
- *args = (*args)->next; if (!*args) return FALSE;
+ if (0 != g_strcmp0(",", (char const *) (*args)->data)) return false;
+ *args = (*args)->next; if (!*args) return false;
/* color1 */
- if (!color_walk_r (&color1, args, NULL)) return FALSE;
+ if (!color_walk_r (&color1, args, NULL)) return false;
/* "," */
- if (0 != g_strcmp0(",", (char const *) (*args)->data)) return FALSE;
- *args = (*args)->next; if (!*args) return FALSE;
+ if (0 != g_strcmp0(",", (char const *) (*args)->data)) return false;
+ *args = (*args)->next; if (!*args) return false;
/* color2 */
- if (!color_walk_r (&color2, args, NULL)) return FALSE;
+ if (!color_walk_r (&color2, args, NULL)) return false;
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
return ccss_gtk_color_mix (factor, &color1, &color2, color);
} else if (0 == g_strcmp0 ("gtk-shade(", token)) {
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* factor */
factor = g_ascii_strtod ((char const *) (*args)->data, NULL);
- *args = (*args)->next; if (!*args) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
/* "," */
- if (0 != g_strcmp0(",", (char const *) (*args)->data)) return FALSE;
- *args = (*args)->next; if (!*args) return FALSE;
+ if (0 != g_strcmp0(",", (char const *) (*args)->data)) return false;
+ *args = (*args)->next; if (!*args) return false;
/* color */
- if (!color_walk_r (color, args, NULL)) return FALSE;
+ if (!color_walk_r (color, args, NULL)) return false;
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
return ccss_gtk_color_shade (factor, color);
} else if (0 == g_strcmp0 ("gtk-darker(", token)) {
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* color */
- if (!color_walk_r (color, args, NULL)) return FALSE;
+ if (!color_walk_r (color, args, NULL)) return false;
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
return ccss_gtk_color_shade (0.7, color);
} else if (0 == g_strcmp0 ("gtk-lighter(", token)) {
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* color */
- if (!color_walk_r (color, args, NULL)) return FALSE;
+ if (!color_walk_r (color, args, NULL)) return false;
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
return ccss_gtk_color_shade (1.3, color);
@@ -230,7 +230,7 @@ color_walk_r (GdkColor *color,
return ret;
}
- return FALSE;
+ return false;
}
static char *
@@ -245,7 +245,7 @@ dump (GSList const *args)
g_string_append (str, (char const *) iter->data);
}
- return g_string_free (str, FALSE);
+ return g_string_free (str, false);
}
static char *
diff --git a/ccss-gtk/ccss-gtk-stylesheet.c b/ccss-gtk/ccss-gtk-stylesheet.c
index a70c36e..a76105d 100644
--- a/ccss-gtk/ccss-gtk-stylesheet.c
+++ b/ccss-gtk/ccss-gtk-stylesheet.c
@@ -393,7 +393,7 @@ serialize (struct RcBlock const *block,
} else if (0 == strcmp ("*", block->type_name)) {
style = g_strdup ("default");
} else {
- return FALSE;
+ return false;
}
style_name = g_strdup_printf ("gce-%s", style);
@@ -449,10 +449,10 @@ serialize (struct RcBlock const *block,
g_string_append_printf (rc_string, "%s style \"%s\"\n\n", rc_selector, style_name);
}
- g_string_free (colors, TRUE);
+ g_string_free (colors, true);
g_free (style_name), style_name = NULL;
- return TRUE;
+ return true;
}
static void
@@ -499,7 +499,7 @@ ccss_gtk_stylesheet_to_gtkrc (ccss_stylesheet_t *self)
rc_string);
str = rc_string->str;
- g_string_free (rc_string, FALSE), rc_string = NULL;
+ g_string_free (rc_string, false), rc_string = NULL;
return str;
}
diff --git a/ccss-gtk/ccss-stylesheet-to-gtkrc.c b/ccss-gtk/ccss-stylesheet-to-gtkrc.c
index b5db3f1..04e665b 100644
--- a/ccss-gtk/ccss-stylesheet-to-gtkrc.c
+++ b/ccss-gtk/ccss-stylesheet-to-gtkrc.c
@@ -20,13 +20,14 @@
*/
#include <glib.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <ccss-gtk/ccss-gtk.h>
#include <gtk/gtk.h>
#include "config.h"
-static bool _dump = FALSE;
+static bool _dump = false;
static char const *_user_agent_file = NULL;
static char const *_user_file = NULL;
static char const *_author_file = NULL;
@@ -53,14 +54,14 @@ main (int argc,
context = g_option_context_new (" - CSS to GTKRC converter");
g_option_context_add_main_entries (context, _options, NULL);
- g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ g_option_context_add_group (context, gtk_get_option_group (true));
if (!g_option_context_parse (context, &argc, &argv, &error)) {
g_critical ("%s : %s", G_STRLOC, error->message);
g_clear_error (&error);
return EXIT_FAILURE;
}
if (!(_user_agent_file || _user_file || _author_file || _files)) {
- char *help = g_option_context_get_help (context, TRUE, NULL);
+ char *help = g_option_context_get_help (context, true, NULL);
fputs (help, stderr);
g_free (help), help = NULL;
return EXIT_SUCCESS;
diff --git a/ccss/ccss-node.c b/ccss/ccss-node.c
index 306b2a5..b69f80b 100644
--- a/ccss/ccss-node.c
+++ b/ccss/ccss-node.c
@@ -28,7 +28,7 @@ static bool
is_a (ccss_node_t *self,
char const *type_name)
{
- return FALSE;
+ return false;
}
static ccss_node_t *
@@ -165,9 +165,9 @@ ccss_node_is_a (ccss_node_t *self,
{
char const *node_type_name;
- g_return_val_if_fail (self, FALSE);
- g_return_val_if_fail (self->node_class, FALSE);
- g_return_val_if_fail (type_name, FALSE);
+ g_return_val_if_fail (self, false);
+ g_return_val_if_fail (self->node_class, false);
+ g_return_val_if_fail (type_name, false);
if (self->node_class->is_a != is_a) {
return self->node_class->is_a (self, type_name);
@@ -297,9 +297,9 @@ ccss_node_get_viewport (ccss_node_t const *self,
uint32_t *width,
uint32_t *height)
{
- g_return_val_if_fail (self, FALSE);
- g_return_val_if_fail (self->node_class, FALSE);
- g_return_val_if_fail (self->node_class->get_viewport, FALSE);
+ g_return_val_if_fail (self, false);
+ g_return_val_if_fail (self->node_class, false);
+ g_return_val_if_fail (self->node_class->get_viewport, false);
return self->node_class->get_viewport (self, x, y, width, height);
}
diff --git a/ccss/ccss-selector.c b/ccss/ccss-selector.c
index 17ab68e..7cd400f 100644
--- a/ccss/ccss-selector.c
+++ b/ccss/ccss-selector.c
@@ -555,7 +555,7 @@ ccss_selector_copy (ccss_selector_t const *original)
break;
default:
g_assert_not_reached ();
- return FALSE;
+ return false;
}
if (original->refinement) {
@@ -1159,7 +1159,7 @@ ccss_selector_dump (ccss_selector_t const *self)
ccss_selector_serialize_specificity (self, selector);
g_string_append (selector, " */\n");
printf ("%s", selector->str);
- g_string_free (selector, TRUE), selector = NULL;
+ g_string_free (selector, true), selector = NULL;
if (self->block) {
printf ("{\n");
diff --git a/ccss/ccss-style.c b/ccss/ccss-style.c
index 5068bd2..a9c0c57 100644
--- a/ccss/ccss-style.c
+++ b/ccss/ccss-style.c
@@ -290,7 +290,7 @@ ccss_style_set_property_selector (ccss_style_t *self,
/* Hash takes ownership. */
g_hash_table_insert (self->selectors, (gpointer) property, annotation->str);
- g_string_free (annotation, FALSE);
+ g_string_free (annotation, false);
#endif
}