mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
Add gst_strtoi().
Original commit message from CVS: Add gst_strtoi().
This commit is contained in:
parent
c0f04fe675
commit
ea1135ec9f
2 changed files with 20 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
2004-01-11 David Schleef,,, <set EMAIL_ADDRESS environment variable>
|
||||
|
||||
* gst/gststructure.c: (gst_strtoi), (gst_value_from_string): Add
|
||||
a function to parse integers in ways that strto[u]l() does not.
|
||||
|
||||
2004-01-11 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||
|
||||
* tools/gst-inspect.c: (print_caps):
|
||||
|
|
|
@ -1109,6 +1109,20 @@ _gst_structure_parse_string (gchar *s, gchar **end, gchar **next)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
gst_strtoi (const char *s, char **end, int base)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (s[0] == '-') {
|
||||
i = - (int) strtoul (s + 1, end, base);
|
||||
} else {
|
||||
i = strtoul (s, end, base);
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_value_from_string (GValue *value, const char *s)
|
||||
{
|
||||
|
@ -1122,7 +1136,7 @@ gst_value_from_string (GValue *value, const char *s)
|
|||
case G_TYPE_INT:
|
||||
{
|
||||
int x;
|
||||
x = strtol (s, &end, 0);
|
||||
x = gst_strtoi (s, &end, 0);
|
||||
if (*end == 0) {
|
||||
ret = TRUE;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue