mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-13 09:45:27 +00:00
return long long, not int, so gint64 deserialization actually works. Is there any flag that makes the compiler check...
Original commit message from CVS: * check/gst/gstvalue.c: (START_TEST): * gst/gstvalue.c: (gst_value_deserialize): return long long, not int, so gint64 deserialization actually works. Is there any flag that makes the compiler check this ? Fixes #308559
This commit is contained in:
parent
202c113397
commit
bdc643ddb9
4 changed files with 88 additions and 77 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2005-06-22 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
* check/gst/gstvalue.c: (START_TEST):
|
||||||
|
* gst/gstvalue.c: (gst_value_deserialize):
|
||||||
|
return long long, not int, so gint64 deserialization actually
|
||||||
|
works. Is there any flag that makes the compiler check this ?
|
||||||
|
Fixes #308559
|
||||||
|
|
||||||
2005-06-22 Wim Taymans <wim@fluendo.com>
|
2005-06-22 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/gstbuffer.h:
|
* gst/gstbuffer.h:
|
||||||
|
|
|
@ -36,14 +36,13 @@ END_TEST;
|
||||||
START_TEST (test_deserialize_gint64)
|
START_TEST (test_deserialize_gint64)
|
||||||
{
|
{
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
|
const char *string = "12345678901";
|
||||||
|
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_INT64);
|
g_value_init (&value, G_TYPE_INT64);
|
||||||
fail_unless (gst_value_deserialize (&value, "12345678901"));
|
fail_unless (gst_value_deserialize (&value, string));
|
||||||
/* FIXME:
|
|
||||||
* this test actually fails, gasp.
|
|
||||||
fail_unless (g_value_get_int64 (&value) == 12345678901LL,
|
fail_unless (g_value_get_int64 (&value) == 12345678901LL,
|
||||||
"resulting value is %" G_GINT64_FORMAT ", not 12345678901");
|
"resulting value is %" G_GINT64_FORMAT ", not %s", value, string);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_TEST;
|
END_TEST;
|
||||||
|
|
|
@ -984,7 +984,7 @@ gst_value_deserialize_boolean (GValue * dest, const char *s)
|
||||||
* int *
|
* int *
|
||||||
*******/
|
*******/
|
||||||
|
|
||||||
static int
|
static long long
|
||||||
gst_strtoll (const char *s, char **end, int base)
|
gst_strtoll (const char *s, char **end, int base)
|
||||||
{
|
{
|
||||||
long long i;
|
long long i;
|
||||||
|
@ -1066,7 +1066,8 @@ gst_value_deserialize_ ## _type (GValue * dest, const char *s) \
|
||||||
{ \
|
{ \
|
||||||
long long x; \
|
long long x; \
|
||||||
\
|
\
|
||||||
if (gst_value_deserialize_int_helper (&x, s, G_MIN ## _macro, G_MAX ## _macro)) { \
|
if (gst_value_deserialize_int_helper (&x, s, G_MIN ## _macro, \
|
||||||
|
G_MAX ## _macro)) { \
|
||||||
g_value_set_ ## _type (dest, x); \
|
g_value_set_ ## _type (dest, x); \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
} else { \
|
} else { \
|
||||||
|
@ -1115,7 +1116,8 @@ gst_value_deserialize_ ## _type (GValue * dest, const char *s) \
|
||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REGISTER_SERIALIZATION(_gtype, _type) G_STMT_START{ \
|
#define REGISTER_SERIALIZATION(_gtype, _type) \
|
||||||
|
G_STMT_START { \
|
||||||
static const GstValueTable gst_value = { \
|
static const GstValueTable gst_value = { \
|
||||||
_gtype, \
|
_gtype, \
|
||||||
gst_value_compare_ ## _type, \
|
gst_value_compare_ ## _type, \
|
||||||
|
@ -2494,17 +2496,20 @@ gst_value_deserialize (GValue * dest, const gchar * src)
|
||||||
table = &g_array_index (gst_value_table, GstValueTable, i);
|
table = &g_array_index (gst_value_table, GstValueTable, i);
|
||||||
if (table->serialize == NULL)
|
if (table->serialize == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (table->type == G_VALUE_TYPE (dest)) {
|
if (table->type == G_VALUE_TYPE (dest)) {
|
||||||
best = table;
|
best = table;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_type_is_a (G_VALUE_TYPE (dest), table->type)) {
|
if (g_type_is_a (G_VALUE_TYPE (dest), table->type)) {
|
||||||
if (!best || g_type_is_a (table->type, best->type))
|
if (!best || g_type_is_a (table->type, best->type))
|
||||||
best = table;
|
best = table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (best)
|
if (best) {
|
||||||
return best->deserialize (dest, src);
|
return best->deserialize (dest, src);
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,14 +36,13 @@ END_TEST;
|
||||||
START_TEST (test_deserialize_gint64)
|
START_TEST (test_deserialize_gint64)
|
||||||
{
|
{
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
|
const char *string = "12345678901";
|
||||||
|
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_INT64);
|
g_value_init (&value, G_TYPE_INT64);
|
||||||
fail_unless (gst_value_deserialize (&value, "12345678901"));
|
fail_unless (gst_value_deserialize (&value, string));
|
||||||
/* FIXME:
|
|
||||||
* this test actually fails, gasp.
|
|
||||||
fail_unless (g_value_get_int64 (&value) == 12345678901LL,
|
fail_unless (g_value_get_int64 (&value) == 12345678901LL,
|
||||||
"resulting value is %" G_GINT64_FORMAT ", not 12345678901");
|
"resulting value is %" G_GINT64_FORMAT ", not %s", value, string);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_TEST;
|
END_TEST;
|
||||||
|
|
Loading…
Reference in a new issue