diff options
author | John-Mark Bell <jmb@netsurf-browser.org> | 2012-11-03 23:19:28 +0000 |
---|---|---|
committer | John-Mark Bell <jmb@netsurf-browser.org> | 2012-11-03 23:19:45 +0000 |
commit | f824ab8af4d3d2e34bd59b860b9c6d5568c3bb44 (patch) | |
tree | 70f5f8d5a3ec2f952b18f59a6ed632f207f8a50f /atari | |
parent | 3f1b68384562fe294a1a263214a3fd26ea869bc9 (diff) | |
download | netsurf-f824ab8af4d3d2e34bd59b860b9c6d5568c3bb44.tar.gz netsurf-f824ab8af4d3d2e34bd59b860b9c6d5568c3bb44.tar.bz2 |
Port save complete to libdom.
Diffstat (limited to 'atari')
-rw-r--r-- | atari/Makefile.target | 2 | ||||
-rwxr-xr-x | atari/global_evnt.c | 2 | ||||
-rw-r--r-- | atari/save.c | 88 |
3 files changed, 2 insertions, 90 deletions
diff --git a/atari/Makefile.target b/atari/Makefile.target index bccb15c48..844abfe31 100644 --- a/atari/Makefile.target +++ b/atari/Makefile.target @@ -82,7 +82,7 @@ S_ATARI := gui.c findfile.c filetype.c misc.c bitmap.c schedule.c \ redrawslots.c encoding.c \ browser_win.c toolbar.c statusbar.c browser.c \ global_evnt.c osspec.c dragdrop.c system_colour.c \ - ctxmenu.c save.c settings.c + ctxmenu.c settings.c S_ATARI := $(addprefix atari/,$(S_ATARI)) # This is the final source build list diff --git a/atari/global_evnt.c b/atari/global_evnt.c index 0c9dfdc1e..3b15af877 100755 --- a/atari/global_evnt.c +++ b/atari/global_evnt.c @@ -176,7 +176,7 @@ static void __CDECL menu_save_page(WINDOW *win, int item, int title, void *data) } while( !is_folder && path != NULL ); if( path != NULL ){ - save_complete( input_window->browser->bw->current_content, path ); + save_complete( input_window->browser->bw->current_content, path, NULL ); } }
diff --git a/atari/save.c b/atari/save.c deleted file mode 100644 index 83e4e410c..000000000 --- a/atari/save.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin@dfgh.net> - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <ctype.h> -#include <stdio.h> -#include <string.h> -#include <libxml/HTMLtree.h> - -#include "content/content.h" -#include "desktop/save_complete.h" -#include "utils/utils.h" - -/* - This code was simply taken from GTK frontend. It requires adjustment - within the core or frontend to work well. - ( mime type detection fails on load of the saved webpage, that's because - no file extension is saved. ) -*/ - -/** -* conducts the filesystem save appropriate to the gui -* \param path save path -* \param filename name of file to save -* \param len data length -* \param sourcedata pointer to data to save -* \param type content type -* \return true for success -*/ - -bool save_complete_gui_save(const char *path, const char *filename, - size_t len, const char *sourcedata, lwc_string *mime_type) -{ - int res; - int namelen; - namelen = strlen(path) + strlen(filename) + 2; /* '/', '\0' */ - char *fullpath = malloc(namelen); - if (!fullpath) { - warn_user("NoMemory", 0); - return false; - } - snprintf(fullpath, namelen, "%s/%s", path, filename); - FILE *f; - f = fopen(fullpath, "wb"); - free(fullpath); - if (f == NULL) - return false; - res = fwrite(sourcedata, len, 1, f); - fclose(f); - if (res != 1) - return false; - return true; -} - -/** -* wrapper for lib function htmlSaveFileFormat; front sets path from path -* + filename in a filesystem-specific way -*/ - -int save_complete_htmlSaveFileFormat(const char *path, const char *filename, - xmlDocPtr cur, const char *encoding, int format) -{ - int ret; - int len = strlen(path) + strlen(filename) + 2; - char *fullpath = malloc(len); - if (fullpath == NULL) { - warn_user("NoMemory", 0); - return -1; - } - snprintf(fullpath, len, "%s/%s", path, filename); - ret = htmlSaveFileFormat(fullpath, cur, encoding, format); - free(fullpath); - return ret; -} |