summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2006-04-21 23:49:52 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2006-04-21 23:49:52 +0000
commita2465c779fed2fb5eeecd62e692d4bd113a8908f (patch)
treed16d5c1878697895086a0236d3abf03ee95c4d09 /riscos
parent3e0e5f4d17193d2dd8b2bfc9f4cc9cf4cad9545e (diff)
downloadnetsurf-a2465c779fed2fb5eeecd62e692d4bd113a8908f.tar.gz
netsurf-a2465c779fed2fb5eeecd62e692d4bd113a8908f.tar.bz2
Remove RISC OS dependencies from filename code.
svn path=/trunk/netsurf/; revision=2540
Diffstat (limited to 'riscos')
-rw-r--r--riscos/bitmap.c29
-rw-r--r--riscos/configure/con_cache.c7
-rw-r--r--riscos/gui.c31
3 files changed, 46 insertions, 21 deletions
diff --git a/riscos/bitmap.c b/riscos/bitmap.c
index 706d3bd62..5ab2f20e5 100644
--- a/riscos/bitmap.c
+++ b/riscos/bitmap.c
@@ -17,17 +17,18 @@
#include <stdbool.h>
#include <string.h>
#include <swis.h>
+#include <unixlib/local.h>
#include "oslib/osfile.h"
#include "oslib/osspriteop.h"
#include "netsurf/content/content.h"
#include "netsurf/image/bitmap.h"
#include "netsurf/riscos/bitmap.h"
-#include "netsurf/riscos/filename.h"
#include "netsurf/riscos/image.h"
#include "netsurf/riscos/options.h"
#include "netsurf/riscos/palettes.h"
#include "netsurf/riscos/sprite.h"
#include "netsurf/riscos/tinct.h"
+#include "netsurf/utils/filename.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/utils.h"
@@ -82,6 +83,7 @@ struct bitmap_compressed_header {
unsigned int input_size;
};
+char bitmap_unixname[256];
char bitmap_filename[256];
@@ -209,7 +211,7 @@ struct bitmap *bitmap_create_file(char *file)
if (file[0] == '\0')
return NULL;
- if (!ro_filename_claim(file))
+ if (!filename_claim(file))
return NULL;
bitmap = calloc(1, sizeof(struct bitmap));
if (!bitmap)
@@ -806,13 +808,20 @@ void bitmap_load_file(struct bitmap *bitmap)
int len;
fileswitch_object_type obj_type;
os_error *error;
+ char *r;
struct bitmap_compressed_header *bitmap_compressed;
osspriteop_header *bitmap_direct;
assert(bitmap->filename);
- sprintf(bitmap_filename, "%s.%s", CACHE_FILENAME_PREFIX,
+ sprintf(bitmap_unixname, "%s/%s", TEMP_FILENAME_PREFIX,
bitmap->filename);
+ r = __riscosify(bitmap_unixname, 0, __RISCOSIFY_NO_SUFFIX,
+ bitmap_filename, 256, 0);
+ if (r == 0) {
+ LOG(("__riscosify failed"));
+ return;
+ }
error = xosfile_read_stamped_no_path(bitmap_filename,
&obj_type, 0, 0, &len, 0, 0);
if ((error) || (obj_type != fileswitch_IS_FILE))
@@ -879,7 +888,7 @@ void bitmap_load_file(struct bitmap *bitmap)
void bitmap_save_file(struct bitmap *bitmap)
{
unsigned int area_size;
- char *filename;
+ char *filename, *r;
os_error *error;
struct bitmap_compressed_header *header;
@@ -897,10 +906,16 @@ void bitmap_save_file(struct bitmap *bitmap)
}
/* dump the data (compressed or otherwise) to disk */
- filename = ro_filename_request();
+ filename = filename_request();
strcpy(bitmap->filename, filename);
- sprintf(bitmap_filename, "%s.%s", CACHE_FILENAME_PREFIX,
+ sprintf(bitmap_unixname, "%s/%s", TEMP_FILENAME_PREFIX,
bitmap->filename);
+ r = __riscosify(bitmap_unixname, 0, __RISCOSIFY_NO_SUFFIX,
+ bitmap_filename, 256, 0);
+ if (r == 0) {
+ LOG(("__riscosify failed"));
+ return;
+ }
if (bitmap->compressed) {
header = (struct bitmap_compressed_header *)bitmap->compressed;
area_size = header->input_size +
@@ -940,7 +955,7 @@ void bitmap_save_file(struct bitmap *bitmap)
void bitmap_delete_file(struct bitmap *bitmap)
{
assert(bitmap->filename[0]);
- ro_filename_release(bitmap->filename);
+ filename_release(bitmap->filename);
bitmap->filename[0] = 0;
}
diff --git a/riscos/configure/con_cache.c b/riscos/configure/con_cache.c
index 29dbd38de..a21b54fbf 100644
--- a/riscos/configure/con_cache.c
+++ b/riscos/configure/con_cache.c
@@ -5,15 +5,16 @@
* Copyright 2005 Richard Wilson <info@tinct.net>
*/
+#include "oslib/hourglass.h"
#include "netsurf/desktop/options.h"
#include "netsurf/riscos/dialog.h"
-#include "netsurf/riscos/filename.h"
#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/options.h"
#include "netsurf/riscos/wimp.h"
#include "netsurf/riscos/wimp_event.h"
#include "netsurf/riscos/configure.h"
#include "netsurf/riscos/configure/configure.h"
+#include "netsurf/utils/filename.h"
#include "netsurf/utils/messages.h"
#include "netsurf/utils/utils.h"
@@ -63,7 +64,9 @@ bool ro_gui_options_cache_click(wimp_pointer *pointer) {
28, 0);
return true;
case CACHE_MAINTAIN_BUTTON:
- ro_filename_flush();
+ xhourglass_on();
+ filename_flush();
+ xhourglass_off();
return true;
}
return false;
diff --git a/riscos/gui.c b/riscos/gui.c
index 512b7bf43..619a27548 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -50,7 +50,6 @@
#include "netsurf/riscos/bitmap.h"
#include "netsurf/riscos/buffer.h"
#include "netsurf/riscos/dialog.h"
-#include "netsurf/riscos/filename.h"
#include "netsurf/riscos/global_history.h"
#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/help.h"
@@ -78,6 +77,7 @@
#include "netsurf/riscos/url_complete.h"
#include "netsurf/riscos/wimp.h"
#include "netsurf/riscos/wimp_event.h"
+#include "netsurf/utils/filename.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/messages.h"
#include "netsurf/utils/url.h"
@@ -307,7 +307,7 @@ void gui_init(int argc, char** argv)
prev_sigs.sigterm == SIG_ERR)
die("Failed registering signal handlers");
- ro_filename_initialise();
+ filename_initialise();
#ifdef WITH_SAVE_COMPLETE
save_complete_init();
@@ -1300,9 +1300,9 @@ void ro_gui_keypress(wimp_key *key)
*/
void ro_gui_user_message(wimp_event_no event, wimp_message *message)
{
- /* attempt automatic routing */
- if (ro_message_handle_message(event, message))
- return;
+ /* attempt automatic routing */
+ if (ro_message_handle_message(event, message))
+ return;
switch (message->action) {
case message_DATA_LOAD:
@@ -2139,8 +2139,9 @@ void ro_gui_open_help_page(const char *page)
void ro_gui_view_source(struct content *content)
{
os_error *error;
- char *temp_name;
- wimp_full_message_data_xfer message;
+ char full_name[256];
+ char *temp_name, *r;
+ wimp_full_message_data_xfer message;
if (!content || !content->source_data) {
warn_user("MiscError", "No document source");
@@ -2159,13 +2160,19 @@ void ro_gui_view_source(struct content *content)
bother releasing it and simply allow it to be re-used next time NetSurf
is started. The memory overhead from doing this is under 1 byte per
filename. */
- temp_name = ro_filename_request();
+ temp_name = filename_request();
if (!temp_name) {
- warn_user("NoMemory", 0);
- return;
+ warn_user("NoMemory", 0);
+ return;
+ }
+ snprintf(full_name, 256, "%s/%s", TEMP_FILENAME_PREFIX, temp_name);
+ full_name[255] = '\0';
+ r = __riscosify(full_name, 0, __RISCOSIFY_NO_SUFFIX, message.file_name,
+ 212, 0);
+ if (r == 0) {
+ LOG(("__riscosify failed"));
+ return;
}
- snprintf(message.file_name, 212, "%s.%s",
- CACHE_FILENAME_PREFIX, temp_name);
message.file_name[211] = '\0';
error = xosfile_save_stamped(message.file_name,
ro_content_filetype(content),