Drop support for URL file versions below 1.06

svn path=/trunk/netsurf/; revision=3945
This commit is contained in:
John Mark Bell 2008-03-13 18:25:41 +00:00
parent 2dadb5fac8
commit 9597b5359c

View File

@ -304,7 +304,7 @@ static struct search_node *search_trees[NUM_SEARCH_TREES] = {
#define MIN_COOKIE_FILE_VERSION 100 #define MIN_COOKIE_FILE_VERSION 100
#define COOKIE_FILE_VERSION 101 #define COOKIE_FILE_VERSION 101
static int loaded_cookie_file_version; static int loaded_cookie_file_version;
#define MIN_URL_FILE_VERSION 105 #define MIN_URL_FILE_VERSION 106
#define URL_FILE_VERSION 106 #define URL_FILE_VERSION 106
/** /**
@ -356,25 +356,14 @@ void urldb_load(const char *filename)
if (!fgets(s, MAXIMUM_URL_LENGTH, fp)) if (!fgets(s, MAXIMUM_URL_LENGTH, fp))
break; break;
urls = atoi(s); urls = atoi(s);
for (i = 0; i < ((version == 105 ? 6 : 8) * urls); /* Eight fields/url */
i++) for (i = 0; i < (8 * urls); i++) {
if (!fgets(s, MAXIMUM_URL_LENGTH, fp)) if (!fgets(s, MAXIMUM_URL_LENGTH, fp))
break; break;
}
continue; continue;
} }
if (version == 105) {
/* file:/ -> localhost */
if (strcasecmp(host, "file:/") == 0)
snprintf(host, sizeof host, "localhost");
else {
/* strip any port number */
char *colon = strrchr(host, ':');
if (colon)
*colon = '\0';
}
}
/* read number of URLs */ /* read number of URLs */
if (!fgets(s, MAXIMUM_URL_LENGTH, fp)) if (!fgets(s, MAXIMUM_URL_LENGTH, fp))
break; break;
@ -395,37 +384,6 @@ void urldb_load(const char *filename)
/* load the non-corrupt data */ /* load the non-corrupt data */
for (i = 0; i < urls; i++) { for (i = 0; i < urls; i++) {
struct path_data *p = NULL; struct path_data *p = NULL;
if (version == 105) {
if (!fgets(s, MAXIMUM_URL_LENGTH, fp))
break;
length = strlen(s) - 1;
s[length] = '\0';
if (strncasecmp(s, "file:", 5) == 0) {
/* local file, so fudge insertion */
char url[7 + 4096];
snprintf(url, sizeof url,
"file://%s", s + 5);
p = urldb_add_path("file", 0, h,
s + 5, NULL, NULL, url);
if (!p) {
LOG(("Failed inserting '%s'",
url));
die("Memory exhausted "
"whilst loading "
"URL file");
}
} else {
if (!urldb_add_url(s)) {
LOG(("Failed inserting '%s'",
s));
}
p = urldb_find_url(s);
}
} else {
char scheme[64], ports[10]; char scheme[64], ports[10];
char url[64 + 3 + 256 + 6 + 4096 + 1]; char url[64 + 3 + 256 + 6 + 4096 + 1];
unsigned int port; unsigned int port;
@ -466,7 +424,6 @@ void urldb_load(const char *filename)
die("Memory exhausted whilst loading " die("Memory exhausted whilst loading "
"URL file"); "URL file");
} }
}
if (!fgets(s, MAXIMUM_URL_LENGTH, fp)) if (!fgets(s, MAXIMUM_URL_LENGTH, fp))
break; break;