strtol() returns a long, as the name suggests; assign its return value

to a long, and check whether it fits in a gint before returning it as a
gint.

svn path=/trunk/; revision=25418
This commit is contained in:
Guy Harris 2008-06-03 23:51:39 +00:00
parent 2ad3cb9bba
commit 710ffd067b
1 changed files with 6 additions and 2 deletions

View File

@ -101,7 +101,7 @@ gint
capture_dev_user_linktype_find(const gchar *if_name)
{
gchar *p, *next;
gint linktype;
long linktype;
if (prefs.capture_devices_linktypes == NULL) {
/* There are no link-layer header types */
@ -119,8 +119,12 @@ capture_dev_user_linktype_find(const gchar *if_name)
/* Syntax error */
return -1;
}
if (linktype > G_MAXINT) {
/* Value doesn't fit in a gint */
return -1;
}
return linktype;
return (gint)linktype;
}
/*