summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-09-09 08:45:28 +0100
committerVincent Sanders <vince@kyllikki.org>2016-09-10 23:05:24 +0100
commita91c7cdf04436af33aa6e8656889add097ca15e8 (patch)
tree31d2db50b0868e0d067b996fbd7848a2dc797ca9 /content
parentfa1af79e7ca9cd2e0923f21bb6fd7069cf827f12 (diff)
downloadnetsurf-a91c7cdf04436af33aa6e8656889add097ca15e8.tar.gz
netsurf-a91c7cdf04436af33aa6e8656889add097ca15e8.tar.bz2
make urldb parsing of ascii data explicit
Diffstat (limited to 'content')
-rw-r--r--content/urldb.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/content/urldb.c b/content/urldb.c
index 8c2a3ae04..b27e23c17 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -88,7 +88,6 @@
*/
#include <assert.h>
-#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -105,6 +104,7 @@
#include "utils/bloom.h"
#include "utils/time.h"
#include "utils/nsurl.h"
+#include "utils/ascii.h"
#include "netsurf/bitmap.h"
#include "desktop/cookie_manager.h"
#include "desktop/gui_internal.h"
@@ -1023,10 +1023,11 @@ static struct search_node **urldb_get_search_tree_direct(const char *host)
{
assert(host);
- if (urldb__host_is_ip_address(host))
+ if (urldb__host_is_ip_address(host)) {
return &search_trees[ST_IP];
- else if (isalpha(*host))
- return &search_trees[ST_DN + tolower(*host) - 'a'];
+ } else if (ascii_is_alpha(*host)) {
+ return &search_trees[ST_DN + ascii_to_lower(*host) - 'a'];
+ }
return &search_trees[ST_EE];
}
@@ -1607,9 +1608,11 @@ static bool urldb_parse_avpair(struct cookie_internal_data *c, char *n,
/* Strip dayname from date (these are hugely variable
* and liable to break the parser. They also serve no
* useful purpose) */
- for (datenoday = v; *datenoday && !isdigit(*datenoday);
- datenoday++)
- ; /* do nothing */
+ for (datenoday = v;
+ *datenoday && !ascii_is_digit(*datenoday);
+ datenoday++) {
+ /* do nothing */
+ }
res = nsc_strntimet(datenoday, strlen(datenoday), &expires);
if (res != NSERROR_OK) {