summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Revel <mmu_man@netsurf-browser.org>2011-03-21 21:15:58 +0000
committerFrançois Revel <mmu_man@netsurf-browser.org>2011-03-21 21:15:58 +0000
commitd2174fa8cc06c1e94d07bcab98efd00046a9ce8c (patch)
treea8f56de41ba41b3dcf2f5cf5b3c7e17a53cc83eb
parent0d534e8c4716a04f1b433a5bbec60a4224af7006 (diff)
downloadnetsurf-d2174fa8cc06c1e94d07bcab98efd00046a9ce8c.tar.gz
netsurf-d2174fa8cc06c1e94d07bcab98efd00046a9ce8c.tar.bz2
Change rsrc: fetcher to check the mime type of resources from the extension. Add needed resource to get about: working.
svn path=/trunk/netsurf/; revision=12119
-rw-r--r--beos/beos_fetch_rsrc.cpp13
-rw-r--r--beos/beos_filetype.cpp24
-rw-r--r--beos/beos_gui.cpp6
-rw-r--r--beos/beos_res.rdef7
-rw-r--r--beos/res/beosdefault.css2
l---------beos/res/en1
l---------beos/res/internal.css1
l---------beos/res/netsurf.png1
8 files changed, 29 insertions, 26 deletions
diff --git a/beos/beos_fetch_rsrc.cpp b/beos/beos_fetch_rsrc.cpp
index 24126a271..a0addd9ab 100644
--- a/beos/beos_fetch_rsrc.cpp
+++ b/beos/beos_fetch_rsrc.cpp
@@ -171,18 +171,11 @@ static bool fetch_rsrc_process(struct fetch_rsrc_context *c)
"Malformed rsrc: URL", 0, FETCH_ERROR_URL);
return false;
}
- comma = strchr(slash, ',');
+
+ // doesn't exist in the filesystem but we should hit the internal types.
+ c->mimetype = strdup(fetch_filetype(slash));
c->name = strdup(slash + 1);
- if (!comma) {
- /* there is no mimetype here, assume text/plain */
- c->mimetype = strdup("text/plain;charset=US-ASCII");
- } else {
- /* make a copy of everything after the comma */
- c->mimetype = strdup(comma + 1);
- c->name[strlen(c->name) - strlen(comma)] = '\0';
- }
-
if (c->mimetype == NULL) {
fetch_rsrc_send_callback(FETCH_ERROR, c,
"Unable to allocate memory for mimetype in rsrc: URL",
diff --git a/beos/beos_filetype.cpp b/beos/beos_filetype.cpp
index 75fe870c8..d8920902d 100644
--- a/beos/beos_filetype.cpp
+++ b/beos/beos_filetype.cpp
@@ -96,6 +96,18 @@ const char *fetch_filetype(const char *unix_path)
// NOT THREADSAFE
static char type[B_MIME_TYPE_LENGTH];
+ // override reading the mime type for known types
+ // avoids getting CSS files as text/x-source-code
+ // even though it's the mime sniffer rules that should be fixed.
+ BString ext(unix_path);
+ ext.Remove(0, ext.FindLast('.') + 1);
+ for (i = 0; default_types[i].type; i++) {
+ if (ext == default_types[i].ext1)
+ return default_types[i].type;
+ if (ext == default_types[i].ext2)
+ return default_types[i].type;
+ }
+
BEntry entry(unix_path, true);
BNode node(&entry);
err = node.InitCheck();
@@ -110,18 +122,6 @@ const char *fetch_filetype(const char *unix_path)
if (err < B_OK)
return "test/plain";
- // override reading the mime type for known types
- // avoids getting CSS files as text/x-source-code
- // even though it's the mime sniffer rules that should be fixed.
- BString ext(unix_path);
- ext.Remove(0, ext.FindLast('.') + 1);
- for (i = 0; default_types[i].type; i++) {
- if (ext == default_types[i].ext1)
- return default_types[i].type;
- if (ext == default_types[i].ext2)
- return default_types[i].type;
- }
-
err = info.GetType(type);
if (err < B_OK) {
// not there yet, sniff and retry
diff --git a/beos/beos_gui.cpp b/beos/beos_gui.cpp
index a389b211a..1c5d941b0 100644
--- a/beos/beos_gui.cpp
+++ b/beos/beos_gui.cpp
@@ -616,7 +616,7 @@ void gui_init(int argc, char** argv)
/* set up stylesheet urls */
#ifdef USE_RESOURCES
- default_stylesheet_url = strdup("rsrc:/beosdefault.css,text/css");
+ default_stylesheet_url = strdup("rsrc:/beosdefault.css");
#else
find_resource(buf, "beosdefault.css", "./beos/res/beosdefault.css");
default_stylesheet_url = path_to_url(buf);
@@ -625,7 +625,7 @@ void gui_init(int argc, char** argv)
LOG(("Using '%s' as Default CSS URL", default_stylesheet_url));
#ifdef USE_RESOURCES
- quirks_stylesheet_url = strdup("rsrc:/quirks.css,text/css");
+ quirks_stylesheet_url = strdup("rsrc:/quirks.css");
#else
find_resource(buf, "quirks.css", "./beos/res/quirks.css");
default_stylesheet_url = path_to_url(buf);
@@ -633,7 +633,7 @@ void gui_init(int argc, char** argv)
#ifdef USE_RESOURCES
- adblock_stylesheet_url = strdup("rsrc:/adblock.css,text/css");
+ adblock_stylesheet_url = strdup("rsrc:/adblock.css");
#else
find_resource(buf, "adblock.css", "./beos/res/adblock.css");
adblock_stylesheet_url = path_to_url(buf);
diff --git a/beos/beos_res.rdef b/beos/beos_res.rdef
index 1cf87f45d..bb438859e 100644
--- a/beos/beos_res.rdef
+++ b/beos/beos_res.rdef
@@ -25,6 +25,8 @@ resource(203, "ca-bundle.txt") #'data' import "res/ca-bundle.txt";
resource(204, "messages") #'data' import "res/messages";
/* resource(206, "about.en.html") #'data' import "res/about.en.html"; */
/* resource(210, "netsurf.xpm") #'data' import "res/netsurf.xpm"; */
+resource(205, "netsurf.png") #'data' import "res/netsurf.png";
+resource(206, "internal.css") #'data' import "res/internal.css";
/* throbber */
resource(400, "throbber0.png") #'data' import "res/throbber/throbber0.png";
@@ -37,6 +39,11 @@ resource(406, "throbber6.png") #'data' import "res/throbber/throbber6.png";
resource(407, "throbber7.png") #'data' import "res/throbber/throbber7.png";
resource(408, "throbber8.png") #'data' import "res/throbber/throbber8.png";
+/* */
+resource(500, "credits.html") #'data' import "res/en/credits.html,faf";
+resource(501, "licence.html") #'data' import "res/en/licence.html,faf";
+
+
resource(1, "BEOS:APP_FLAGS") (#'APPF') $"01000000";
resource(101, "BEOS:L:STD_ICON") #'ICON' array {
diff --git a/beos/res/beosdefault.css b/beos/res/beosdefault.css
index b32449172..da4681492 100644
--- a/beos/res/beosdefault.css
+++ b/beos/res/beosdefault.css
@@ -5,7 +5,7 @@
/* Load base stylesheet. */
/*@import "default.css";*/
-@import "rsrc:/default.css,text/css";
+@import "rsrc:/default.css";
/* Apply GTK specific rules. */
diff --git a/beos/res/en b/beos/res/en
new file mode 120000
index 000000000..d1dfaa9d2
--- /dev/null
+++ b/beos/res/en
@@ -0,0 +1 @@
+../../!NetSurf/Resources/en \ No newline at end of file
diff --git a/beos/res/internal.css b/beos/res/internal.css
new file mode 120000
index 000000000..e777d8ae1
--- /dev/null
+++ b/beos/res/internal.css
@@ -0,0 +1 @@
+../../!NetSurf/Resources/internal.css,f79 \ No newline at end of file
diff --git a/beos/res/netsurf.png b/beos/res/netsurf.png
new file mode 120000
index 000000000..0fbf42709
--- /dev/null
+++ b/beos/res/netsurf.png
@@ -0,0 +1 @@
+../../!NetSurf/Resources/netsurf.png,b60 \ No newline at end of file