[clutter] interval: Validate more fundamental types
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] interval: Validate more fundamental types
- Date: Mon, 18 Jun 2012 17:07:15 +0000 (UTC)
commit 44642b6a57e753bbe0f68a7583917218c3e1b9f0
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Mon Jun 18 17:52:37 2012 +0100
interval: Validate more fundamental types
64bit integers and floating point values should be validated as well.
clutter/clutter-interval.c | 75 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 75 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-interval.c b/clutter/clutter-interval.c
index 3a0f303..8bace27 100644
--- a/clutter/clutter-interval.c
+++ b/clutter/clutter-interval.c
@@ -135,6 +135,21 @@ clutter_interval_real_validate (ClutterInterval *interval,
}
break;
+ case G_TYPE_INT64:
+ {
+ GParamSpecInt64 *pspec_int = G_PARAM_SPEC_INT64 (pspec);
+ gint64 a, b;
+
+ a = b = 0;
+ clutter_interval_get_interval (interval, &a, &b);
+ if ((a >= pspec_int->minimum && a <= pspec_int->maximum) &&
+ (b >= pspec_int->minimum && b <= pspec_int->maximum))
+ return TRUE;
+ else
+ return FALSE;
+ }
+ break;
+
case G_TYPE_UINT:
{
GParamSpecUInt *pspec_uint = G_PARAM_SPEC_UINT (pspec);
@@ -150,6 +165,36 @@ clutter_interval_real_validate (ClutterInterval *interval,
}
break;
+ case G_TYPE_UINT64:
+ {
+ GParamSpecUInt64 *pspec_int = G_PARAM_SPEC_UINT64 (pspec);
+ guint64 a, b;
+
+ a = b = 0;
+ clutter_interval_get_interval (interval, &a, &b);
+ if ((a >= pspec_int->minimum && a <= pspec_int->maximum) &&
+ (b >= pspec_int->minimum && b <= pspec_int->maximum))
+ return TRUE;
+ else
+ return FALSE;
+ }
+ break;
+
+ case G_TYPE_CHAR:
+ {
+ GParamSpecChar *pspec_char = G_PARAM_SPEC_CHAR (pspec);
+ guchar a, b;
+
+ a = b = 0;
+ clutter_interval_get_interval (interval, &a, &b);
+ if ((a >= pspec_char->minimum && a <= pspec_char->maximum) &&
+ (b >= pspec_char->minimum && b <= pspec_char->maximum))
+ return TRUE;
+ else
+ return FALSE;
+ }
+ break;
+
case G_TYPE_UCHAR:
{
GParamSpecUChar *pspec_uchar = G_PARAM_SPEC_UCHAR (pspec);
@@ -165,6 +210,36 @@ clutter_interval_real_validate (ClutterInterval *interval,
}
break;
+ case G_TYPE_FLOAT:
+ {
+ GParamSpecFloat *pspec_flt = G_PARAM_SPEC_FLOAT (pspec);
+ float a, b;
+
+ a = b = 0.f;
+ clutter_interval_get_interval (interval, &a, &b);
+ if ((a >= pspec_flt->minimum && a <= pspec_flt->maximum) &&
+ (b >= pspec_flt->minimum && b <= pspec_flt->maximum))
+ return TRUE;
+ else
+ return FALSE;
+ }
+ break;
+
+ case G_TYPE_DOUBLE:
+ {
+ GParamSpecDouble *pspec_flt = G_PARAM_SPEC_DOUBLE (pspec);
+ double a, b;
+
+ a = b = 0;
+ clutter_interval_get_interval (interval, &a, &b);
+ if ((a >= pspec_flt->minimum && a <= pspec_flt->maximum) &&
+ (b >= pspec_flt->minimum && b <= pspec_flt->maximum))
+ return TRUE;
+ else
+ return FALSE;
+ }
+ break;
+
case G_TYPE_BOOLEAN:
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]