mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
Accept float widths (ceiling them)
Especially percentages might be floats instead of integer, see e.g. http://www.armitunes.com/cgi-bin/icecast/playing.cgi.
This commit is contained in:
parent
d0f7a9279e
commit
85c9c54d00
@ -310,7 +310,8 @@ get_width(unsigned char *a, unsigned char *name, int limited,
|
||||
|
||||
/* @end points into the @value string so check @end position
|
||||
* before freeing @value. */
|
||||
if (errno || *end || width >= INT_MAX) {
|
||||
/* We will accept floats but ceil() them. */
|
||||
if (errno || (*end && *end != '.') || width >= INT_MAX) {
|
||||
/* Not a valid number. */
|
||||
mem_free(value);
|
||||
return -1;
|
||||
|
@ -128,7 +128,7 @@ get_column_width(unsigned char *attr, int *width, int sh,
|
||||
al[len - 1] = '\0';
|
||||
errno = 0;
|
||||
n = strtoul(al, (char **) &en, 10);
|
||||
if (!errno && n >= 0 && !*en)
|
||||
if (!errno && n >= 0 && (!*en || *en == '.'))
|
||||
*width = WIDTH_RELATIVE - n;
|
||||
} else {
|
||||
int w = get_width(attr, "width", sh, html_context);
|
||||
|
Loading…
Reference in New Issue
Block a user