netsurf: branch master updated. release/3.0-1029-gdba69de
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/dba69de613e519306ad51...
...commit http://git.netsurf-browser.org/netsurf.git/commit/dba69de613e519306ad5122...
...tree http://git.netsurf-browser.org/netsurf.git/tree/dba69de613e519306ad5122bd...
The branch, master has been updated
via dba69de613e519306ad5122bd2e16e372193bb3d (commit)
from 0b50b8f3f79c41a1c1d2891819ad7c43471f2957 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=dba69de613e519306ad...
commit dba69de613e519306ad5122bd2e16e372193bb3d
Author: François Revol <revol(a)free.fr>
Commit: François Revol <revol(a)free.fr>
beos: Fix build (missing includes)
diff --git a/beos/about.cpp b/beos/about.cpp
index 1c43c46..cd8070e 100644
--- a/beos/about.cpp
+++ b/beos/about.cpp
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
extern "C" {
+#include "desktop/netsurf.h"
#include "utils/log.h"
#include "utils/testament.h"
#include "utils/useragent.h"
diff --git a/beos/download.cpp b/beos/download.cpp
index 8a55e9d..af5b498 100644
--- a/beos/download.cpp
+++ b/beos/download.cpp
@@ -18,9 +18,12 @@
#define __STDBOOL_H__ 1
#include <stdbool.h>
+#include <sys/types.h>
extern "C" {
+#include "desktop/download.h"
#include "desktop/gui.h"
+#include "utils/utils.h"
}
#include "beos/download.h"
diff --git a/beos/window.cpp b/beos/window.cpp
index 5009c26..2302793 100644
--- a/beos/window.cpp
+++ b/beos/window.cpp
@@ -26,6 +26,7 @@ extern "C" {
#include "desktop/browser_private.h"
#include "desktop/mouse.h"
#include "utils/nsoption.h"
+#include "desktop/netsurf.h"
#include "desktop/textinput.h"
#include "render/font.h"
#include "utils/log.h"
-----------------------------------------------------------------------
Summary of changes:
beos/about.cpp | 1 +
beos/download.cpp | 3 +++
beos/window.cpp | 1 +
3 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/beos/about.cpp b/beos/about.cpp
index 1c43c46..cd8070e 100644
--- a/beos/about.cpp
+++ b/beos/about.cpp
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
extern "C" {
+#include "desktop/netsurf.h"
#include "utils/log.h"
#include "utils/testament.h"
#include "utils/useragent.h"
diff --git a/beos/download.cpp b/beos/download.cpp
index 8a55e9d..af5b498 100644
--- a/beos/download.cpp
+++ b/beos/download.cpp
@@ -18,9 +18,12 @@
#define __STDBOOL_H__ 1
#include <stdbool.h>
+#include <sys/types.h>
extern "C" {
+#include "desktop/download.h"
#include "desktop/gui.h"
+#include "utils/utils.h"
}
#include "beos/download.h"
diff --git a/beos/window.cpp b/beos/window.cpp
index 5009c26..2302793 100644
--- a/beos/window.cpp
+++ b/beos/window.cpp
@@ -26,6 +26,7 @@ extern "C" {
#include "desktop/browser_private.h"
#include "desktop/mouse.h"
#include "utils/nsoption.h"
+#include "desktop/netsurf.h"
#include "desktop/textinput.h"
#include "render/font.h"
#include "utils/log.h"
--
NetSurf Browser
9 years, 1 month
netsurf: branch master updated. release/3.0-1027-g236e135
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/236e135d6309413ce97c4...
...commit http://git.netsurf-browser.org/netsurf.git/commit/236e135d6309413ce97c453...
...tree http://git.netsurf-browser.org/netsurf.git/tree/236e135d6309413ce97c453e2...
The branch, master has been updated
via 236e135d6309413ce97c453e23242dae04bc73f4 (commit)
from 7798dae86a1d85dc020de1e04e37f8ff2713094c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=236e135d6309413ce97...
commit 236e135d6309413ce97c453e23242dae04bc73f4
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
fix missing stdlib include
diff --git a/atari/encoding.c b/atari/encoding.c
index d0af00a..7a60eee 100644
--- a/atari/encoding.c
+++ b/atari/encoding.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdlib.h>
+
#include "desktop/gui.h"
#include "atari/encoding.h"
diff --git a/riscos/ucstables.c b/riscos/ucstables.c
index 62f0b97..cc6fe05 100644
--- a/riscos/ucstables.c
+++ b/riscos/ucstables.c
@@ -27,7 +27,7 @@
#include <oslib/territory.h>
#include "utils/config.h"
-#include "utils/nserrors.h"
+#include "utils/errors.h"
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
-----------------------------------------------------------------------
Summary of changes:
atari/encoding.c | 2 ++
riscos/ucstables.c | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/atari/encoding.c b/atari/encoding.c
index d0af00a..7a60eee 100644
--- a/atari/encoding.c
+++ b/atari/encoding.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdlib.h>
+
#include "desktop/gui.h"
#include "atari/encoding.h"
diff --git a/riscos/ucstables.c b/riscos/ucstables.c
index 62f0b97..cc6fe05 100644
--- a/riscos/ucstables.c
+++ b/riscos/ucstables.c
@@ -27,7 +27,7 @@
#include <oslib/territory.h>
#include "utils/config.h"
-#include "utils/nserrors.h"
+#include "utils/errors.h"
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
--
NetSurf Browser
9 years, 1 month
netsurf: branch master updated. release/3.0-1026-g7798dae
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/7798dae86a1d85dc020de...
...commit http://git.netsurf-browser.org/netsurf.git/commit/7798dae86a1d85dc020de1e...
...tree http://git.netsurf-browser.org/netsurf.git/tree/7798dae86a1d85dc020de1e04...
The branch, master has been updated
via 7798dae86a1d85dc020de1e04e37f8ff2713094c (commit)
from 886a3106db6d6a60d2d706d2caad3e883dd70b14 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=7798dae86a1d85dc020...
commit 7798dae86a1d85dc020de1e04e37f8ff2713094c
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
fix missing includes
diff --git a/amiga/gui.c b/amiga/gui.c
index f186328..e482f52 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -145,6 +145,8 @@
#define EXTRADOWN (IECODE_5TH_BUTTON)
#define EXTRAUP (IECODE_5TH_BUTTON | IECODE_UP_PREFIX)
+extern struct gui_utf8_table *amiga_utf8_table;
+
struct ami_gui_tb_userdata {
struct List *sblist;
struct gui_window_2 *gw;
diff --git a/atari/encoding.c b/atari/encoding.c
index f57a3d7..d0af00a 100644
--- a/atari/encoding.c
+++ b/atari/encoding.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "desktop/gui.h"
+
#include "atari/encoding.h"
diff --git a/cocoa/fetch.m b/cocoa/fetch.m
index 7bf00e0..70d3805 100644
--- a/cocoa/fetch.m
+++ b/cocoa/fetch.m
@@ -19,6 +19,7 @@
#import <Cocoa/Cocoa.h>
#import "utils/log.h"
+#import "utils/nsurl.h"
#import "desktop/gui.h"
#import "cocoa/fetch.h"
diff --git a/riscos/ucstables.c b/riscos/ucstables.c
index 3b7f8a4..62f0b97 100644
--- a/riscos/ucstables.c
+++ b/riscos/ucstables.c
@@ -27,12 +27,14 @@
#include <oslib/territory.h>
#include "utils/config.h"
-#include "riscos/ucstables.h"
+#include "utils/nserrors.h"
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
#include "desktop/gui.h"
+#include "riscos/ucstables.h"
+
/* Common values (ASCII) */
#define common \
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \
-----------------------------------------------------------------------
Summary of changes:
amiga/gui.c | 2 ++
atari/encoding.c | 2 ++
cocoa/fetch.m | 1 +
riscos/ucstables.c | 4 +++-
4 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index f186328..e482f52 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -145,6 +145,8 @@
#define EXTRADOWN (IECODE_5TH_BUTTON)
#define EXTRAUP (IECODE_5TH_BUTTON | IECODE_UP_PREFIX)
+extern struct gui_utf8_table *amiga_utf8_table;
+
struct ami_gui_tb_userdata {
struct List *sblist;
struct gui_window_2 *gw;
diff --git a/atari/encoding.c b/atari/encoding.c
index f57a3d7..d0af00a 100644
--- a/atari/encoding.c
+++ b/atari/encoding.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "desktop/gui.h"
+
#include "atari/encoding.h"
diff --git a/cocoa/fetch.m b/cocoa/fetch.m
index 7bf00e0..70d3805 100644
--- a/cocoa/fetch.m
+++ b/cocoa/fetch.m
@@ -19,6 +19,7 @@
#import <Cocoa/Cocoa.h>
#import "utils/log.h"
+#import "utils/nsurl.h"
#import "desktop/gui.h"
#import "cocoa/fetch.h"
diff --git a/riscos/ucstables.c b/riscos/ucstables.c
index 3b7f8a4..62f0b97 100644
--- a/riscos/ucstables.c
+++ b/riscos/ucstables.c
@@ -27,12 +27,14 @@
#include <oslib/territory.h>
#include "utils/config.h"
-#include "riscos/ucstables.h"
+#include "utils/nserrors.h"
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
#include "desktop/gui.h"
+#include "riscos/ucstables.h"
+
/* Common values (ASCII) */
#define common \
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \
--
NetSurf Browser
9 years, 1 month
netsurf: branch master updated. release/3.0-1025-g886a310
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/886a3106db6d6a60d2d70...
...commit http://git.netsurf-browser.org/netsurf.git/commit/886a3106db6d6a60d2d706d...
...tree http://git.netsurf-browser.org/netsurf.git/tree/886a3106db6d6a60d2d706d2c...
The branch, master has been updated
via 886a3106db6d6a60d2d706d2caad3e883dd70b14 (commit)
via 427f127fa9d42cdf9005d06813c580d18d5e0d6a (commit)
from 00bdf39dc21cd51216ef362529dca12f98cd1cf2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=886a3106db6d6a60d2d...
commit 886a3106db6d6a60d2d706d2caad3e883dd70b14
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
move utf8 local conversion operations to table
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index d39e89e..6768dde 100644
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -16,10 +16,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <proto/iffparse.h>
+#include <proto/intuition.h>
+#include <proto/exec.h>
+#include <proto/datatypes.h>
+#include <proto/diskfont.h>
+
+#include <diskfont/diskfonttag.h>
+#include <datatypes/textclass.h>
+#include <datatypes/pictureclass.h>
+
+#include "utils/nsoption.h"
+#include "utils/utf8.h"
#include "desktop/gui.h"
#include "desktop/plotters.h"
#include "desktop/textinput.h"
-#include "utils/nsoption.h"
#include "amiga/bitmap.h"
#include "amiga/clipboard.h"
@@ -31,18 +42,6 @@
#include "amiga/menu.h"
#include "amiga/utf8.h"
-#include "utils/utf8.h"
-
-#include <proto/iffparse.h>
-#include <proto/intuition.h>
-#include <proto/exec.h>
-#include <proto/datatypes.h>
-#include <proto/diskfont.h>
-
-#include <diskfont/diskfonttag.h>
-#include <datatypes/textclass.h>
-#include <datatypes/pictureclass.h>
-
#define ID_UTF8 MAKE_ID('U','T','F','8')
struct IFFHandle *iffh = NULL;
diff --git a/amiga/gui.c b/amiga/gui.c
index 074dfaf..f186328 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5223,6 +5223,7 @@ int main(int argc, char** argv)
.clipboard = amiga_clipboard_table,
.download = amiga_download_table,
.fetch = &amiga_fetch_table,
+ .utf8 = amiga_utf8_table,
};
/* Open popupmenu.library just to check the version.
diff --git a/amiga/utf8.c b/amiga/utf8.c
index d182492..a8e415d 100755
--- a/amiga/utf8.c
+++ b/amiga/utf8.c
@@ -18,13 +18,44 @@
#include <stdlib.h>
#include <string.h>
-
#include <sys/types.h>
+
#include "utils/utf8.h"
+#include "desktop/gui.h"
#include <proto/exec.h>
#include <proto/diskfont.h>
#include <diskfont/diskfonttag.h>
+#include "amiga/utf8.h"
+
+nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
+{
+ const char *encname = "ISO-8859-1";
+
+#ifdef __amigaos4__
+ LONG charset;
+
+ charset = GetDiskFontCtrl(DFCTRL_CHARSET);
+ encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
+#endif
+
+ return utf8_from_enc(string,encname,len,result,NULL);
+}
+
+nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
+{
+ const char *encname = "ISO-8859-1";
+
+#ifdef __amigaos4__
+ LONG charset;
+
+ charset = GetDiskFontCtrl(DFCTRL_CHARSET);
+ encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
+#endif
+
+ return utf8_to_enc(string,encname,len,result);
+}
+
void ami_utf8_free(char *ptr)
{
if(ptr) free(ptr);
@@ -58,32 +89,10 @@ char *ami_to_utf8_easy(const char *string)
}
}
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- const char *encname = "ISO-8859-1";
-
-#ifdef __amigaos4__
- LONG charset;
-
- charset = GetDiskFontCtrl(DFCTRL_CHARSET);
- encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
-#endif
-
- return utf8_from_enc(string,encname,len,result,NULL);
-}
-
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
-{
- const char *encname = "ISO-8859-1";
-
-#ifdef __amigaos4__
- LONG charset;
-
- charset = GetDiskFontCtrl(DFCTRL_CHARSET);
- encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
-#endif
-
- return utf8_to_enc(string,encname,len,result);
-}
+static struct gui_utf8_table utf8_table = {
+ .utf8_to_local = utf8_to_local_encoding,
+ .local_to_utf8 = utf8_from_local_encoding,
+};
+struct gui_utf8_table *amiga_utf8_table = &utf8_table;
diff --git a/amiga/utf8.h b/amiga/utf8.h
index 7956523..065a149 100755
--- a/amiga/utf8.h
+++ b/amiga/utf8.h
@@ -18,7 +18,14 @@
#ifndef AMIGA_UTF8_H
#define AMIGA_UTF8_H
+
+extern struct gui_utf8_table *ami_utf8_table;
+
char *ami_utf8_easy(const char *string);
void ami_utf8_free(char *ptr);
char *ami_to_utf8_easy(const char *string);
+
+nserror utf8_from_local_encoding(const char *string, size_t len, char **result);
+nserror utf8_to_local_encoding(const char *string, size_t len, char **result);
+
#endif
diff --git a/atari/encoding.c b/atari/encoding.c
index 626f57a..f57a3d7 100644
--- a/atari/encoding.c
+++ b/atari/encoding.c
@@ -67,3 +67,9 @@ int atari_to_ucs4(unsigned char atari)
}
+static struct gui_utf8_table utf8_table = {
+ .utf8_to_local = utf8_to_local_encoding,
+ .local_to_utf8 = utf8_from_local_encoding,
+};
+
+struct gui_utf8_table *atari_utf8_table = &utf8_table;
diff --git a/atari/encoding.h b/atari/encoding.h
index c85bac9..d0289b6 100644
--- a/atari/encoding.h
+++ b/atari/encoding.h
@@ -1,32 +1,37 @@
-/*
- * Copyright 2012 Ole Loots <ole(a)monochrom.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/>.
+/*
+ * Copyright 2012 Ole Loots <ole(a)monochrom.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/>.
*/
#ifndef NS_ATARI_ENCODING_H
#define NS_ATARI_ENCODING_H
-#include <inttypes.h>
-#include <assert.h>
+#include <inttypes.h>
+#include <assert.h>
#include <stdbool.h>
-#include "css/css.h"
+#include "css/css.h"
#include "render/font.h"
-#include "utils/utf8.h"
-
+#include "utils/utf8.h"
+
+struct gui_utf8_table *atari_utf8_table;
+
+nserror utf8_to_local_encoding(const char *string, size_t len, char **result);
+nserror utf8_from_local_encoding(const char *string, size_t len, char **result);
+
int atari_to_ucs4( unsigned char atarichar);
#endif
diff --git a/atari/gui.c b/atari/gui.c
index af5e1f8..afd3be5 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -30,6 +30,12 @@
#include <stdbool.h>
#include <hubbub/hubbub.h>
+#include "utils/schedule.h"
+#include "utils/url.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+#include "utils/nsoption.h"
#include "content/urldb.h"
#include "content/fetch.h"
#include "content/fetchers/resource.h"
@@ -38,8 +44,6 @@
#include "desktop/local_history.h"
#include "desktop/plotters.h"
#include "desktop/netsurf.h"
-
-#include "utils/nsoption.h"
#include "desktop/save_complete.h"
#include "desktop/textinput.h"
#include "desktop/treeview.h"
@@ -47,11 +51,6 @@
#include "desktop/browser_private.h"
#include "desktop/mouse.h"
#include "render/font.h"
-#include "utils/schedule.h"
-#include "utils/url.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
#include "atari/gemtk/gemtk.h"
#include "atari/gui.h"
@@ -1113,6 +1112,7 @@ int main(int argc, char** argv)
.clipboard = &atari_clipboard_table,
.download = atari_download_table,
.fetch = &atari_fetch_table,
+ .utf8 = atari_utf8_table,
};
/* @todo logging file descriptor update belongs in a nslog_init callback */
diff --git a/atari/plot/font_vdi.c b/atari/plot/font_vdi.c
index 0c914b8..a73300c 100755
--- a/atari/plot/font_vdi.c
+++ b/atari/plot/font_vdi.c
@@ -26,6 +26,8 @@
#include "utils/utf8.h"
#include "utils/log.h"
+#include "atari/encoding.h"
+
diff --git a/atari/toolbar.c b/atari/toolbar.c
index 8044d16..f40c07a 100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -55,6 +55,7 @@
#include "desktop/textarea.h"
#include "desktop/textinput.h"
#include "content/hlcache.h"
+#include "atari/encoding.h"
#define TB_BUTTON_WIDTH 32
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 97117e0..07bbc3e 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -963,35 +963,6 @@ static void nsbeos_create_ssl_verify_window(struct browser_window *bw,
CALLED();
}
-
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
-{
- assert(string && result);
-
- if (len == 0)
- len = strlen(string);
-
- *result = strndup(string, len);
- if (!(*result))
- return NSERROR_NOMEM;
-
- return NSERROR_OK;
-}
-
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- assert(string && result);
-
- if (len == 0)
- len = strlen(string);
-
- *result = strndup(string, len);
- if (!(*result))
- return NSERROR_NOMEM;
-
- return NSERROR_OK;
-}
-
static char *path_to_url(const char *path)
{
int urllen = strlen(path) + FILE_SCHEME_PREFIX_LEN + 1;
diff --git a/cocoa/Makefile.target b/cocoa/Makefile.target
index 49f67f0..40e8d43 100644
--- a/cocoa/Makefile.target
+++ b/cocoa/Makefile.target
@@ -95,7 +95,6 @@ S_COCOA := \
schedule.m \
selection.m \
thumbnail.m \
- utf8.m \
utils.m \
ArrowBox.m \
ArrowWindow.m \
diff --git a/cocoa/utf8.m b/cocoa/utf8.m
deleted file mode 100644
index 7b69918..0000000
--- a/cocoa/utf8.m
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer(a)gmail.com>
- *
- * 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/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "utils/utf8.h"
-
-nserror utf8_to_local_encoding(const char *string, size_t len,
- char **result)
-{
- NSCParameterAssert( NULL != result );
-
- char *newString = malloc( len + 1 );
- if (NULL == newString) return NSERROR_NOMEM;
- memcpy( newString, string, len );
- newString[len] = 0;
- *result = newString;
- return NSERROR_OK;
-}
-
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- /* same function, local encoding = UTF-8 */
- return utf8_to_local_encoding( string, len, result );
-}
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index b61fdf0..8996ab5 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -272,6 +272,11 @@ static void gui_default_set_clipboard(const char *buffer, size_t length,
{
}
+static struct gui_clipboard_table default_clipboard_table = {
+ .get = gui_default_get_clipboard,
+ .set = gui_default_set_clipboard,
+};
+
/** verify clipboard table is valid */
static nserror verify_clipboard_register(struct gui_clipboard_table *gct)
{
@@ -290,6 +295,54 @@ static nserror verify_clipboard_register(struct gui_clipboard_table *gct)
return NSERROR_OK;
}
+/**
+ * The default utf8 conversion implementation.
+ *
+ * The default implementation assumes the local encoding is utf8
+ * allowing the conversion to be a simple copy.
+ *
+ * @param [in] string The source string.
+ * @param [in] len The \a string length or 0 to compute it.
+ * @param [out] result A pointer to the converted string.
+ * @result NSERROR_OK or NSERROR_NOMEM if memory could not be allocated.
+ */
+static nserror gui_default_utf8(const char *string, size_t len, char **result)
+{
+ assert(string && result);
+
+ if (len == 0)
+ len = strlen(string);
+
+ *result = strndup(string, len);
+ if (!(*result))
+ return NSERROR_NOMEM;
+
+ return NSERROR_OK;
+}
+
+static struct gui_utf8_table default_utf8_table = {
+ .utf8_to_local = gui_default_utf8,
+ .local_to_utf8 = gui_default_utf8,
+};
+
+/** verify clipboard table is valid */
+static nserror verify_utf8_register(struct gui_utf8_table *gut)
+{
+ /* check table is present */
+ if (gut == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ /* mandantory operations */
+ if (gut->utf8_to_local == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+ if (gut->local_to_utf8 == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+ return NSERROR_OK;
+}
+
static nsurl *gui_default_get_resource_url(const char *path)
{
return NULL;
@@ -370,6 +423,13 @@ static void gui_default_401login_open(nsurl *url, const char *realm,
cb(false, cbpw);
}
+static struct gui_download_table default_download_table = {
+ .create = gui_default_download_create,
+ .data = gui_default_download_data,
+ .error = gui_default_download_error,
+ .done = gui_default_download_done,
+};
+
/** verify browser table is valid */
static nserror verify_browser_register(struct gui_browser_table *gbt)
{
@@ -406,19 +466,6 @@ static nserror verify_browser_register(struct gui_browser_table *gbt)
}
-
-static struct gui_download_table default_download_table = {
- .create = gui_default_download_create,
- .data = gui_default_download_data,
- .error = gui_default_download_error,
- .done = gui_default_download_done,
-};
-
-static struct gui_clipboard_table default_clipboard_table = {
- .get = gui_default_get_clipboard,
- .set = gui_default_set_clipboard,
-};
-
/* exported interface documented in desktop/gui_factory.h */
nserror gui_factory_register(struct gui_table *gt)
{
@@ -472,6 +519,16 @@ nserror gui_factory_register(struct gui_table *gt)
return err;
}
+ /* utf8 table */
+ if (gt->utf8 == NULL) {
+ /* set default clipboard table */
+ gt->utf8 = &default_utf8_table;
+ }
+ err = verify_utf8_register(gt->utf8);
+ if (err != NSERROR_OK) {
+ return err;
+ }
+
guit = gt;
return NSERROR_OK;
diff --git a/desktop/save_text.c b/desktop/save_text.c
index 38f8c53..bc4d4c5 100644
--- a/desktop/save_text.c
+++ b/desktop/save_text.c
@@ -28,14 +28,16 @@
#include <dom/dom.h>
#include "utils/config.h"
+#include "utils/log.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
#include "content/content.h"
#include "content/hlcache.h"
-#include "desktop/save_text.h"
#include "render/box.h"
#include "render/html.h"
-#include "utils/log.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
+
+#include "desktop/gui_factory.h"
+#include "desktop/save_text.h"
static void extract_text(struct box *box, bool *first,
save_text_whitespace *before, struct save_text_state *save);
@@ -69,7 +71,7 @@ void save_as_text(hlcache_handle *c, char *path)
if (!save.block)
return;
- ret = utf8_to_local_encoding(save.block, save.length, &result);
+ ret = guit->utf8->utf8_to_local(save.block, save.length, &result);
free(save.block);
if (ret != NSERROR_OK) {
diff --git a/framebuffer/font.h b/framebuffer/font.h
index 5ae5bb3..6350421 100644
--- a/framebuffer/font.h
+++ b/framebuffer/font.h
@@ -21,6 +21,8 @@
#include "utils/utf8.h"
+extern struct gui_utf8_table *framebuffer_utf8_table;
+
bool fb_font_init(void);
bool fb_font_finalise(void);
diff --git a/framebuffer/font_freetype.c b/framebuffer/font_freetype.c
index eb7278c..4381db6 100644
--- a/framebuffer/font_freetype.c
+++ b/framebuffer/font_freetype.c
@@ -23,13 +23,14 @@
#include <ft2build.h>
#include FT_CACHE_H
-#include "css/css.h"
-#include "css/utils.h"
-#include "render/font.h"
#include "utils/filepath.h"
#include "utils/utf8.h"
#include "utils/log.h"
#include "utils/nsoption.h"
+#include "css/css.h"
+#include "css/utils.h"
+#include "render/font.h"
+#include "desktop/gui.h"
#include "framebuffer/gui.h"
#include "framebuffer/font.h"
@@ -74,30 +75,6 @@ enum fb_face_e {
static fb_faceid_t *fb_faces[FB_FACE_COUNT];
-
-nserror utf8_to_local_encoding(const char *string,
- size_t len,
- char **result)
-{
- return utf8_to_enc(string, "UTF-8", len, result);
-}
-
-nserror utf8_from_local_encoding(const char *string,
- size_t len,
- char **result)
-{
- *result = malloc(len + 1);
- if (*result == NULL) {
- return NSERROR_NOMEM;
- }
-
- memcpy(*result, string, len);
-
- (*result)[len] = '\0';
-
- return NSERROR_OK;
-}
-
/* map cache manager handle to face id */
static FT_Error ft_face_requester(FTC_FaceID face_id, FT_Library library, FT_Pointer request_data, FT_Face *face )
{
@@ -581,6 +558,8 @@ const struct font_functions nsfont = {
nsfont_split
};
+struct gui_utf8_table *framebuffer_utf8_table = NULL;
+
/*
* Local Variables:
* c-basic-offset:8
diff --git a/framebuffer/font_internal.c b/framebuffer/font_internal.c
index 1eed006..da5ca92 100644
--- a/framebuffer/font_internal.c
+++ b/framebuffer/font_internal.c
@@ -19,12 +19,13 @@
#include <inttypes.h>
#include <string.h>
-
#include <assert.h>
-#include "css/css.h"
-#include "render/font.h"
+
#include "utils/nsoption.h"
#include "utils/utf8.h"
+#include "desktop/gui.h"
+#include "css/css.h"
+#include "render/font.h"
#include "framebuffer/gui.h"
#include "framebuffer/font.h"
@@ -68,7 +69,7 @@ nserror utf8_to_font_encoding(const struct fb_font_desc* font,
}
-nserror utf8_to_local_encoding(const char *string,
+static nserror utf8_to_local(const char *string,
size_t len,
char **result)
{
@@ -76,7 +77,7 @@ nserror utf8_to_local_encoding(const char *string,
}
-nserror utf8_from_local_encoding(const char *string,
+static nserror utf8_from_local(const char *string,
size_t len,
char **result)
{
@@ -183,6 +184,14 @@ const struct font_functions nsfont = {
nsfont_split
};
+static struct gui_utf8_table utf8_table = {
+ .utf8_to_local = utf8_to_local,
+ .local_to_utf8 = utf8_from_local,
+};
+
+struct gui_utf8_table *framebuffer_utf8_table = &utf8_table;
+
+
/*
* Local Variables:
* c-basic-offset:8
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index e7f456d..678010d 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -1815,6 +1815,7 @@ main(int argc, char** argv)
.window = &framebuffer_window_table,
.clipboard = framebuffer_clipboard_table,
.fetch = framebuffer_fetch_table,
+ .utf8 = framebuffer_utf8_table,
};
respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);
diff --git a/gtk/gui.c b/gtk/gui.c
index fdf64ad..74da733 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -788,37 +788,6 @@ gboolean nsgtk_ssl_delete_event(GtkWidget *w, GdkEvent *event, gpointer data)
return FALSE;
}
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
-{
- assert(string && result);
-
- if (len == 0)
- len = strlen(string);
-
- *result = strndup(string, len);
- if (!(*result))
- return NSERROR_NOMEM;
-
- return NSERROR_OK;
-}
-
-
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- assert(string && result);
-
- if (len == 0)
- len = strlen(string);
-
- *result = strndup(string, len);
- if (!(*result))
- return NSERROR_NOMEM;
-
- return NSERROR_OK;
-}
-
-
-
#ifdef WITH_PDF_EXPORT
void PDF_Password(char **owner_pass, char **user_pass, char *path)
diff --git a/monkey/utils.c b/monkey/utils.c
index 742c300..e1a702f 100644
--- a/monkey/utils.c
+++ b/monkey/utils.c
@@ -22,10 +22,6 @@
#include "utils/config.h"
#include "utils/utils.h"
-#include "utils/url.h"
-#include "utils/utf8.h"
-
-
void warn_user(const char *warning, const char *detail)
{
@@ -37,17 +33,3 @@ void die(const char * const error)
fprintf(stderr, "DIE %s\n", error);
exit(EXIT_FAILURE);
}
-
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
-{
- *result = strndup(string, len);
- return (*result == NULL) ? NSERROR_NOMEM : NSERROR_OK;
-}
-
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- *result = strndup(string, len);
- return (*result == NULL) ? NSERROR_NOMEM : NSERROR_OK;
-}
-
-
diff --git a/render/html.c b/render/html.c
index bd23aac..f9d8858 100644
--- a/render/html.c
+++ b/render/html.c
@@ -29,14 +29,27 @@
#include <stdlib.h>
#include "utils/config.h"
+#include "utils/corestrings.h"
+#include "utils/http.h"
+#include "utils/libdom.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/schedule.h"
+#include "utils/talloc.h"
+#include "utils/url.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
+#include "utils/nsoption.h"
#include "content/content_protected.h"
#include "content/fetch.h"
#include "content/hlcache.h"
-#include "utils/nsoption.h"
#include "desktop/selection.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
#include "image/bitmap.h"
+#include "javascript/js.h"
+#include "desktop/gui_factory.h"
+
#include "render/box.h"
#include "render/font.h"
#include "render/form.h"
@@ -44,17 +57,6 @@
#include "render/imagemap.h"
#include "render/layout.h"
#include "render/search.h"
-#include "javascript/js.h"
-#include "utils/corestrings.h"
-#include "utils/http.h"
-#include "utils/libdom.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/schedule.h"
-#include "utils/talloc.h"
-#include "utils/url.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
#define CHUNK 4096
@@ -1770,10 +1772,10 @@ static void html__set_file_gadget_filename(struct content *c,
html_content *html = (html_content *)c;
struct box *file_box = gadget->box;
- ret = utf8_from_local_encoding(fn,0, &utf8_fn);
+ ret = guit->utf8->local_to_utf8(fn,0, &utf8_fn);
if (ret != NSERROR_OK) {
assert(ret != NSERROR_BAD_ENCODING);
- LOG(("utf8_from_local_encoding failed"));
+ LOG(("utf8 to local encoding conversion failed"));
/* Load was for us - just no memory */
return;
}
@@ -1915,11 +1917,11 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
/* TODO: Sniff for text? */
/* Convert to UTF-8 */
- ret = utf8_from_local_encoding(buffer, file_len, &utf8_buff);
+ ret = guit->utf8->local_to_utf8(buffer, file_len, &utf8_buff);
if (ret != NSERROR_OK) {
/* bad encoding shouldn't happen */
assert(ret != NSERROR_BAD_ENCODING);
- LOG(("utf8_from_local_encoding failed"));
+ LOG(("local to utf8 encoding failed"));
free(buffer);
warn_user("NoMemory", NULL);
return true;
diff --git a/riscos/download.c b/riscos/download.c
index b89334f..b10c6c1 100644
--- a/riscos/download.c
+++ b/riscos/download.c
@@ -58,6 +58,7 @@
#include "utils/url.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "riscos/ucstables.h"
#define ICON_DOWNLOAD_ICON 0
#define ICON_DOWNLOAD_URL 1
diff --git a/riscos/gui.c b/riscos/gui.c
index a5a9c94..83add25 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -99,7 +99,7 @@
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/window.h"
-
+#include "riscos/ucstables.h"
#ifndef FILETYPE_ACORN_URI
@@ -2389,6 +2389,7 @@ int main(int argc, char** argv)
.clipboard = riscos_clipboard_table,
.download = riscos_download_table,
.fetch = &riscos_fetch_table,
+ .utf8 = riscos_utf8_table,
};
/* Consult NetSurf$Logging environment variable to decide if logging
diff --git a/riscos/gui/url_bar.c b/riscos/gui/url_bar.c
index 681824d..b898e6f 100644
--- a/riscos/gui/url_bar.c
+++ b/riscos/gui/url_bar.c
@@ -42,6 +42,7 @@
#include "utils/messages.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "riscos/ucstables.h"
#define URLBAR_HEIGHT 52
#define URLBAR_FAVICON_SIZE 16
diff --git a/riscos/help.c b/riscos/help.c
index 9da52f3..3c74e54 100644
--- a/riscos/help.c
+++ b/riscos/help.c
@@ -44,6 +44,7 @@
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "riscos/ucstables.h"
/* Recognised help keys
diff --git a/riscos/menus.c b/riscos/menus.c
index d8e2f2c..a0baca0 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -31,6 +31,12 @@
#include "oslib/osgbpb.h"
#include "oslib/territory.h"
#include "oslib/wimp.h"
+
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/url.h"
+#include "utils/utils.h"
+#include "utils/utf8.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
@@ -40,6 +46,7 @@
#include "desktop/local_history.h"
#include "desktop/netsurf.h"
#include "desktop/textinput.h"
+
#include "riscos/dialog.h"
#include "riscos/configure.h"
#include "riscos/cookies.h"
@@ -56,11 +63,7 @@
#include "riscos/url_suggest.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/url.h"
-#include "utils/utils.h"
-#include "utils/utf8.h"
+#include "riscos/ucstables.h"
struct menu_definition_entry {
menu_action action; /**< menu action */
diff --git a/riscos/query.c b/riscos/query.c
index 2268494..2be2e2a 100644
--- a/riscos/query.c
+++ b/riscos/query.c
@@ -29,6 +29,7 @@
#include "utils/messages.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "riscos/ucstables.h"
#define ICON_QUERY_MESSAGE 0
#define ICON_QUERY_YES 1
diff --git a/riscos/save.c b/riscos/save.c
index d58da1a..fa638d3 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -69,6 +69,7 @@
#include "riscos/thumbnail.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
+#include "riscos/ucstables.h"
//typedef enum
//{
diff --git a/riscos/textselection.c b/riscos/textselection.c
index 68e71a9..5215a62 100644
--- a/riscos/textselection.c
+++ b/riscos/textselection.c
@@ -39,6 +39,7 @@
#include "riscos/mouse.h"
#include "riscos/save.h"
#include "riscos/textselection.h"
+#include "riscos/ucstables.h"
#ifndef wimp_DRAG_CLAIM_SUPPRESS_DRAGBOX
diff --git a/riscos/ucstables.c b/riscos/ucstables.c
index b9f196d..3b7f8a4 100644
--- a/riscos/ucstables.c
+++ b/riscos/ucstables.c
@@ -31,6 +31,7 @@
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "desktop/gui.h"
/* Common values (ASCII) */
#define common \
@@ -684,3 +685,10 @@ nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
return NSERROR_OK;
}
+
+static struct gui_utf8_table utf8_table = {
+ .utf8_to_local = utf8_to_local_encoding,
+ .local_to_utf8 = utf8_from_local_encoding,
+};
+
+struct gui_utf8_table *riscos_utf8_table = &utf8_table;
diff --git a/riscos/ucstables.h b/riscos/ucstables.h
index 0be0658..e5d8382 100644
--- a/riscos/ucstables.h
+++ b/riscos/ucstables.h
@@ -21,4 +21,9 @@
* This is only used if nothing claims Service_International,8
*/
+struct gui_utf8_table *riscos_utf8_table;
+
+nserror utf8_to_local_encoding(const char *string, size_t len, char **result);
+nserror utf8_from_local_encoding(const char *string, size_t len, char **result);
+
const int *ucstable_from_alphabet(int alphabet);
diff --git a/riscos/wimp.c b/riscos/wimp.c
index 2e48891..f59fa67 100644
--- a/riscos/wimp.c
+++ b/riscos/wimp.c
@@ -40,6 +40,7 @@
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "riscos/ucstables.h"
static void ro_gui_wimp_cache_furniture_sizes(wimp_w w);
diff --git a/riscos/window.c b/riscos/window.c
index 72230a7..0116a97 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -90,6 +90,7 @@
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/window.h"
+#include "riscos/ucstables.h"
void gui_window_redraw_window(struct gui_window *g);
diff --git a/utils/utf8.c b/utils/utf8.c
index ab7bbae..cc8039c 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -29,6 +29,8 @@
#include <parserutils/charset/utf8.h>
+#include "desktop/gui_factory.h"
+
#include "utils/config.h"
#include "utils/log.h"
#include "utils/utf8.h"
@@ -463,8 +465,7 @@ bool utf8_save_text(const char *utf8_text, const char *path)
char *conv;
FILE *out;
- ret = utf8_to_local_encoding(utf8_text, strlen(utf8_text), &conv);
-
+ ret = guit->utf8->utf8_to_local(utf8_text, strlen(utf8_text), &conv);
if (ret != NSERROR_OK) {
LOG(("failed to convert to local encoding, return %d", ret));
return false;
diff --git a/utils/utf8.h b/utils/utf8.h
index 7c450b5..7509dde 100644
--- a/utils/utf8.h
+++ b/utils/utf8.h
@@ -161,9 +161,4 @@ bool utf8_save_text(const char *utf8_text, const char *path);
*/
nserror utf8_finalise(void);
-/* These two are platform specific */
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result);
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result);
-
-
#endif
diff --git a/windows/font.c b/windows/font.c
index 98269a3..09adeed 100644
--- a/windows/font.c
+++ b/windows/font.c
@@ -43,14 +43,14 @@ nserror utf8_to_font_encoding(const struct font_desc* font,
return utf8_to_enc(string, font->encoding, len, result);
}
-nserror utf8_to_local_encoding(const char *string,
+static nserror utf8_to_local_encoding(const char *string,
size_t len,
char **result)
{
return utf8_to_enc(string, "UCS-2", len, result);
}
-nserror utf8_from_local_encoding(const char *string, size_t len,
+static nserror utf8_from_local_encoding(const char *string, size_t len,
char **result)
{
assert(string && result);
@@ -234,3 +234,10 @@ const struct font_functions nsfont = {
nsfont_position_in_string,
nsfont_split
};
+
+static struct gui_utf8_table utf8_table = {
+ .utf8_to_local = utf8_to_local_encoding,
+ .local_to_utf8 = utf8_from_local_encoding,
+};
+
+struct gui_utf8_table *win32_utf8_table = &utf8_table;
diff --git a/windows/gui.h b/windows/gui.h
index 1ff849d..d8e1b1d 100644
--- a/windows/gui.h
+++ b/windows/gui.h
@@ -28,6 +28,7 @@ extern struct gui_window_table *win32_window_table;
extern struct gui_clipboard_table *win32_clipboard_table;
extern struct gui_fetch_table *win32_fetch_table;
extern struct gui_browser_table *win32_browser_table;
+extern struct gui_utf8_table *win32_utf8_table;
extern HINSTANCE hInstance;
diff --git a/windows/main.c b/windows/main.c
index 94e0eee..6a53e0c 100644
--- a/windows/main.c
+++ b/windows/main.c
@@ -111,6 +111,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
.clipboard = win32_clipboard_table,
.download = win32_download_table,
.fetch = win32_fetch_table,
+ .utf8 = win32_utf8_table,
};
win32_fetch_table->get_resource_url = gui_get_resource_url;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=427f127fa9d42cdf900...
commit 427f127fa9d42cdf9005d06813c580d18d5e0d6a
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
remove further extraneous includes
diff --git a/desktop/gui.h b/desktop/gui.h
index 37066e1..5fb656c 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -17,18 +17,14 @@
*/
/** \file
- * Interface to platform-specific gui functions.
+ * Interface to platform-specific gui operation tables.
*/
#ifndef _NETSURF_DESKTOP_GUI_H_
#define _NETSURF_DESKTOP_GUI_H_
-#include <stdbool.h>
-#include <stdlib.h>
-
#include "utils/types.h"
#include "utils/errors.h"
-#include "utils/nsurl.h"
#include "desktop/plot_style.h"
#include "desktop/mouse.h"
@@ -63,6 +59,7 @@ struct form_control;
struct ssl_cert_info;
struct hlcache_handle;
struct download_context;
+struct nsurl;
typedef struct nsnsclipboard_styles {
size_t start; /**< Start of run */
@@ -356,7 +353,7 @@ struct gui_fetch_table {
* \return A string containing the full URL of the target object or
* NULL if no suitable resource can be found.
*/
- nsurl* (*get_resource_url)(const char *path);
+ struct nsurl* (*get_resource_url)(const char *path);
/**
* Find a MIME type for a local file
@@ -437,12 +434,12 @@ struct gui_browser_table {
/**
* verify certificate
*/
- void (*cert_verify)(nsurl *url, const struct ssl_cert_info *certs, unsigned long num, nserror (*cb)(bool proceed, void *pw), void *cbpw);
+ void (*cert_verify)(struct nsurl *url, const struct ssl_cert_info *certs, unsigned long num, nserror (*cb)(bool proceed, void *pw), void *cbpw);
/**
* Prompt user for login
*/
- void (*login)(nsurl *url, const char *realm,
+ void (*login)(struct nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);
};
diff --git a/framebuffer/fetch.c b/framebuffer/fetch.c
index f350f36..2942c2d 100644
--- a/framebuffer/fetch.c
+++ b/framebuffer/fetch.c
@@ -21,13 +21,15 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <limits.h>
-#include "desktop/gui.h"
+#include "utils/nsurl.h"
#include "utils/url.h"
#include "utils/log.h"
#include "utils/filepath.h"
+#include "desktop/gui.h"
#include "framebuffer/findfile.h"
#include "framebuffer/fetch.h"
diff --git a/gtk/fetch.c b/gtk/fetch.c
index 0043cd0..8db102c 100644
--- a/gtk/fetch.c
+++ b/gtk/fetch.c
@@ -17,6 +17,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/monkey/cert.c b/monkey/cert.c
index 48359e8..6f21727 100644
--- a/monkey/cert.c
+++ b/monkey/cert.c
@@ -19,8 +19,9 @@
#include <stdlib.h>
#include <stdio.h>
-#include "desktop/gui.h"
#include "utils/ring.h"
+#include "utils/nsurl.h"
+#include "desktop/gui.h"
#include "monkey/cert.h"
-----------------------------------------------------------------------
Summary of changes:
amiga/clipboard.c | 25 ++++++-------
amiga/gui.c | 1 +
amiga/utf8.c | 65 +++++++++++++++++++--------------
amiga/utf8.h | 7 ++++
atari/encoding.c | 6 +++
atari/encoding.h | 47 +++++++++++++-----------
atari/gui.c | 14 ++++----
atari/plot/font_vdi.c | 2 +
atari/toolbar.c | 1 +
beos/gui.cpp | 29 ---------------
cocoa/Makefile.target | 1 -
cocoa/utf8.m | 40 --------------------
desktop/gui.h | 13 +++----
desktop/gui_factory.c | 83 ++++++++++++++++++++++++++++++++++++-------
desktop/save_text.c | 12 ++++---
framebuffer/fetch.c | 4 ++-
framebuffer/font.h | 2 +
framebuffer/font_freetype.c | 33 +++--------------
framebuffer/font_internal.c | 19 +++++++---
framebuffer/gui.c | 1 +
gtk/fetch.c | 1 +
gtk/gui.c | 31 ----------------
monkey/cert.c | 3 +-
monkey/utils.c | 18 ---------
render/html.c | 34 +++++++++--------
riscos/download.c | 1 +
riscos/gui.c | 3 +-
riscos/gui/url_bar.c | 1 +
riscos/help.c | 1 +
riscos/menus.c | 13 ++++---
riscos/query.c | 1 +
riscos/save.c | 1 +
riscos/textselection.c | 1 +
riscos/ucstables.c | 8 ++++
riscos/ucstables.h | 5 +++
riscos/wimp.c | 1 +
riscos/window.c | 1 +
utils/utf8.c | 5 ++-
utils/utf8.h | 5 ---
windows/font.c | 11 +++++-
windows/gui.h | 1 +
windows/main.c | 1 +
42 files changed, 273 insertions(+), 279 deletions(-)
delete mode 100644 cocoa/utf8.m
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index d39e89e..6768dde 100644
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -16,10 +16,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <proto/iffparse.h>
+#include <proto/intuition.h>
+#include <proto/exec.h>
+#include <proto/datatypes.h>
+#include <proto/diskfont.h>
+
+#include <diskfont/diskfonttag.h>
+#include <datatypes/textclass.h>
+#include <datatypes/pictureclass.h>
+
+#include "utils/nsoption.h"
+#include "utils/utf8.h"
#include "desktop/gui.h"
#include "desktop/plotters.h"
#include "desktop/textinput.h"
-#include "utils/nsoption.h"
#include "amiga/bitmap.h"
#include "amiga/clipboard.h"
@@ -31,18 +42,6 @@
#include "amiga/menu.h"
#include "amiga/utf8.h"
-#include "utils/utf8.h"
-
-#include <proto/iffparse.h>
-#include <proto/intuition.h>
-#include <proto/exec.h>
-#include <proto/datatypes.h>
-#include <proto/diskfont.h>
-
-#include <diskfont/diskfonttag.h>
-#include <datatypes/textclass.h>
-#include <datatypes/pictureclass.h>
-
#define ID_UTF8 MAKE_ID('U','T','F','8')
struct IFFHandle *iffh = NULL;
diff --git a/amiga/gui.c b/amiga/gui.c
index 074dfaf..f186328 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5223,6 +5223,7 @@ int main(int argc, char** argv)
.clipboard = amiga_clipboard_table,
.download = amiga_download_table,
.fetch = &amiga_fetch_table,
+ .utf8 = amiga_utf8_table,
};
/* Open popupmenu.library just to check the version.
diff --git a/amiga/utf8.c b/amiga/utf8.c
index d182492..a8e415d 100755
--- a/amiga/utf8.c
+++ b/amiga/utf8.c
@@ -18,13 +18,44 @@
#include <stdlib.h>
#include <string.h>
-
#include <sys/types.h>
+
#include "utils/utf8.h"
+#include "desktop/gui.h"
#include <proto/exec.h>
#include <proto/diskfont.h>
#include <diskfont/diskfonttag.h>
+#include "amiga/utf8.h"
+
+nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
+{
+ const char *encname = "ISO-8859-1";
+
+#ifdef __amigaos4__
+ LONG charset;
+
+ charset = GetDiskFontCtrl(DFCTRL_CHARSET);
+ encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
+#endif
+
+ return utf8_from_enc(string,encname,len,result,NULL);
+}
+
+nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
+{
+ const char *encname = "ISO-8859-1";
+
+#ifdef __amigaos4__
+ LONG charset;
+
+ charset = GetDiskFontCtrl(DFCTRL_CHARSET);
+ encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
+#endif
+
+ return utf8_to_enc(string,encname,len,result);
+}
+
void ami_utf8_free(char *ptr)
{
if(ptr) free(ptr);
@@ -58,32 +89,10 @@ char *ami_to_utf8_easy(const char *string)
}
}
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- const char *encname = "ISO-8859-1";
-
-#ifdef __amigaos4__
- LONG charset;
-
- charset = GetDiskFontCtrl(DFCTRL_CHARSET);
- encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
-#endif
-
- return utf8_from_enc(string,encname,len,result,NULL);
-}
-
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
-{
- const char *encname = "ISO-8859-1";
-
-#ifdef __amigaos4__
- LONG charset;
-
- charset = GetDiskFontCtrl(DFCTRL_CHARSET);
- encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
-#endif
-
- return utf8_to_enc(string,encname,len,result);
-}
+static struct gui_utf8_table utf8_table = {
+ .utf8_to_local = utf8_to_local_encoding,
+ .local_to_utf8 = utf8_from_local_encoding,
+};
+struct gui_utf8_table *amiga_utf8_table = &utf8_table;
diff --git a/amiga/utf8.h b/amiga/utf8.h
index 7956523..065a149 100755
--- a/amiga/utf8.h
+++ b/amiga/utf8.h
@@ -18,7 +18,14 @@
#ifndef AMIGA_UTF8_H
#define AMIGA_UTF8_H
+
+extern struct gui_utf8_table *ami_utf8_table;
+
char *ami_utf8_easy(const char *string);
void ami_utf8_free(char *ptr);
char *ami_to_utf8_easy(const char *string);
+
+nserror utf8_from_local_encoding(const char *string, size_t len, char **result);
+nserror utf8_to_local_encoding(const char *string, size_t len, char **result);
+
#endif
diff --git a/atari/encoding.c b/atari/encoding.c
index 626f57a..f57a3d7 100644
--- a/atari/encoding.c
+++ b/atari/encoding.c
@@ -67,3 +67,9 @@ int atari_to_ucs4(unsigned char atari)
}
+static struct gui_utf8_table utf8_table = {
+ .utf8_to_local = utf8_to_local_encoding,
+ .local_to_utf8 = utf8_from_local_encoding,
+};
+
+struct gui_utf8_table *atari_utf8_table = &utf8_table;
diff --git a/atari/encoding.h b/atari/encoding.h
index c85bac9..d0289b6 100644
--- a/atari/encoding.h
+++ b/atari/encoding.h
@@ -1,32 +1,37 @@
-/*
- * Copyright 2012 Ole Loots <ole(a)monochrom.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/>.
+/*
+ * Copyright 2012 Ole Loots <ole(a)monochrom.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/>.
*/
#ifndef NS_ATARI_ENCODING_H
#define NS_ATARI_ENCODING_H
-#include <inttypes.h>
-#include <assert.h>
+#include <inttypes.h>
+#include <assert.h>
#include <stdbool.h>
-#include "css/css.h"
+#include "css/css.h"
#include "render/font.h"
-#include "utils/utf8.h"
-
+#include "utils/utf8.h"
+
+struct gui_utf8_table *atari_utf8_table;
+
+nserror utf8_to_local_encoding(const char *string, size_t len, char **result);
+nserror utf8_from_local_encoding(const char *string, size_t len, char **result);
+
int atari_to_ucs4( unsigned char atarichar);
#endif
diff --git a/atari/gui.c b/atari/gui.c
index af5e1f8..afd3be5 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -30,6 +30,12 @@
#include <stdbool.h>
#include <hubbub/hubbub.h>
+#include "utils/schedule.h"
+#include "utils/url.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+#include "utils/nsoption.h"
#include "content/urldb.h"
#include "content/fetch.h"
#include "content/fetchers/resource.h"
@@ -38,8 +44,6 @@
#include "desktop/local_history.h"
#include "desktop/plotters.h"
#include "desktop/netsurf.h"
-
-#include "utils/nsoption.h"
#include "desktop/save_complete.h"
#include "desktop/textinput.h"
#include "desktop/treeview.h"
@@ -47,11 +51,6 @@
#include "desktop/browser_private.h"
#include "desktop/mouse.h"
#include "render/font.h"
-#include "utils/schedule.h"
-#include "utils/url.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
#include "atari/gemtk/gemtk.h"
#include "atari/gui.h"
@@ -1113,6 +1112,7 @@ int main(int argc, char** argv)
.clipboard = &atari_clipboard_table,
.download = atari_download_table,
.fetch = &atari_fetch_table,
+ .utf8 = atari_utf8_table,
};
/* @todo logging file descriptor update belongs in a nslog_init callback */
diff --git a/atari/plot/font_vdi.c b/atari/plot/font_vdi.c
index 0c914b8..a73300c 100755
--- a/atari/plot/font_vdi.c
+++ b/atari/plot/font_vdi.c
@@ -26,6 +26,8 @@
#include "utils/utf8.h"
#include "utils/log.h"
+#include "atari/encoding.h"
+
diff --git a/atari/toolbar.c b/atari/toolbar.c
index 8044d16..f40c07a 100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -55,6 +55,7 @@
#include "desktop/textarea.h"
#include "desktop/textinput.h"
#include "content/hlcache.h"
+#include "atari/encoding.h"
#define TB_BUTTON_WIDTH 32
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 97117e0..07bbc3e 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -963,35 +963,6 @@ static void nsbeos_create_ssl_verify_window(struct browser_window *bw,
CALLED();
}
-
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
-{
- assert(string && result);
-
- if (len == 0)
- len = strlen(string);
-
- *result = strndup(string, len);
- if (!(*result))
- return NSERROR_NOMEM;
-
- return NSERROR_OK;
-}
-
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- assert(string && result);
-
- if (len == 0)
- len = strlen(string);
-
- *result = strndup(string, len);
- if (!(*result))
- return NSERROR_NOMEM;
-
- return NSERROR_OK;
-}
-
static char *path_to_url(const char *path)
{
int urllen = strlen(path) + FILE_SCHEME_PREFIX_LEN + 1;
diff --git a/cocoa/Makefile.target b/cocoa/Makefile.target
index 49f67f0..40e8d43 100644
--- a/cocoa/Makefile.target
+++ b/cocoa/Makefile.target
@@ -95,7 +95,6 @@ S_COCOA := \
schedule.m \
selection.m \
thumbnail.m \
- utf8.m \
utils.m \
ArrowBox.m \
ArrowWindow.m \
diff --git a/cocoa/utf8.m b/cocoa/utf8.m
deleted file mode 100644
index 7b69918..0000000
--- a/cocoa/utf8.m
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer(a)gmail.com>
- *
- * 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/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "utils/utf8.h"
-
-nserror utf8_to_local_encoding(const char *string, size_t len,
- char **result)
-{
- NSCParameterAssert( NULL != result );
-
- char *newString = malloc( len + 1 );
- if (NULL == newString) return NSERROR_NOMEM;
- memcpy( newString, string, len );
- newString[len] = 0;
- *result = newString;
- return NSERROR_OK;
-}
-
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- /* same function, local encoding = UTF-8 */
- return utf8_to_local_encoding( string, len, result );
-}
diff --git a/desktop/gui.h b/desktop/gui.h
index 37066e1..5fb656c 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -17,18 +17,14 @@
*/
/** \file
- * Interface to platform-specific gui functions.
+ * Interface to platform-specific gui operation tables.
*/
#ifndef _NETSURF_DESKTOP_GUI_H_
#define _NETSURF_DESKTOP_GUI_H_
-#include <stdbool.h>
-#include <stdlib.h>
-
#include "utils/types.h"
#include "utils/errors.h"
-#include "utils/nsurl.h"
#include "desktop/plot_style.h"
#include "desktop/mouse.h"
@@ -63,6 +59,7 @@ struct form_control;
struct ssl_cert_info;
struct hlcache_handle;
struct download_context;
+struct nsurl;
typedef struct nsnsclipboard_styles {
size_t start; /**< Start of run */
@@ -356,7 +353,7 @@ struct gui_fetch_table {
* \return A string containing the full URL of the target object or
* NULL if no suitable resource can be found.
*/
- nsurl* (*get_resource_url)(const char *path);
+ struct nsurl* (*get_resource_url)(const char *path);
/**
* Find a MIME type for a local file
@@ -437,12 +434,12 @@ struct gui_browser_table {
/**
* verify certificate
*/
- void (*cert_verify)(nsurl *url, const struct ssl_cert_info *certs, unsigned long num, nserror (*cb)(bool proceed, void *pw), void *cbpw);
+ void (*cert_verify)(struct nsurl *url, const struct ssl_cert_info *certs, unsigned long num, nserror (*cb)(bool proceed, void *pw), void *cbpw);
/**
* Prompt user for login
*/
- void (*login)(nsurl *url, const char *realm,
+ void (*login)(struct nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);
};
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index b61fdf0..8996ab5 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -272,6 +272,11 @@ static void gui_default_set_clipboard(const char *buffer, size_t length,
{
}
+static struct gui_clipboard_table default_clipboard_table = {
+ .get = gui_default_get_clipboard,
+ .set = gui_default_set_clipboard,
+};
+
/** verify clipboard table is valid */
static nserror verify_clipboard_register(struct gui_clipboard_table *gct)
{
@@ -290,6 +295,54 @@ static nserror verify_clipboard_register(struct gui_clipboard_table *gct)
return NSERROR_OK;
}
+/**
+ * The default utf8 conversion implementation.
+ *
+ * The default implementation assumes the local encoding is utf8
+ * allowing the conversion to be a simple copy.
+ *
+ * @param [in] string The source string.
+ * @param [in] len The \a string length or 0 to compute it.
+ * @param [out] result A pointer to the converted string.
+ * @result NSERROR_OK or NSERROR_NOMEM if memory could not be allocated.
+ */
+static nserror gui_default_utf8(const char *string, size_t len, char **result)
+{
+ assert(string && result);
+
+ if (len == 0)
+ len = strlen(string);
+
+ *result = strndup(string, len);
+ if (!(*result))
+ return NSERROR_NOMEM;
+
+ return NSERROR_OK;
+}
+
+static struct gui_utf8_table default_utf8_table = {
+ .utf8_to_local = gui_default_utf8,
+ .local_to_utf8 = gui_default_utf8,
+};
+
+/** verify clipboard table is valid */
+static nserror verify_utf8_register(struct gui_utf8_table *gut)
+{
+ /* check table is present */
+ if (gut == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ /* mandantory operations */
+ if (gut->utf8_to_local == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+ if (gut->local_to_utf8 == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+ return NSERROR_OK;
+}
+
static nsurl *gui_default_get_resource_url(const char *path)
{
return NULL;
@@ -370,6 +423,13 @@ static void gui_default_401login_open(nsurl *url, const char *realm,
cb(false, cbpw);
}
+static struct gui_download_table default_download_table = {
+ .create = gui_default_download_create,
+ .data = gui_default_download_data,
+ .error = gui_default_download_error,
+ .done = gui_default_download_done,
+};
+
/** verify browser table is valid */
static nserror verify_browser_register(struct gui_browser_table *gbt)
{
@@ -406,19 +466,6 @@ static nserror verify_browser_register(struct gui_browser_table *gbt)
}
-
-static struct gui_download_table default_download_table = {
- .create = gui_default_download_create,
- .data = gui_default_download_data,
- .error = gui_default_download_error,
- .done = gui_default_download_done,
-};
-
-static struct gui_clipboard_table default_clipboard_table = {
- .get = gui_default_get_clipboard,
- .set = gui_default_set_clipboard,
-};
-
/* exported interface documented in desktop/gui_factory.h */
nserror gui_factory_register(struct gui_table *gt)
{
@@ -472,6 +519,16 @@ nserror gui_factory_register(struct gui_table *gt)
return err;
}
+ /* utf8 table */
+ if (gt->utf8 == NULL) {
+ /* set default clipboard table */
+ gt->utf8 = &default_utf8_table;
+ }
+ err = verify_utf8_register(gt->utf8);
+ if (err != NSERROR_OK) {
+ return err;
+ }
+
guit = gt;
return NSERROR_OK;
diff --git a/desktop/save_text.c b/desktop/save_text.c
index 38f8c53..bc4d4c5 100644
--- a/desktop/save_text.c
+++ b/desktop/save_text.c
@@ -28,14 +28,16 @@
#include <dom/dom.h>
#include "utils/config.h"
+#include "utils/log.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
#include "content/content.h"
#include "content/hlcache.h"
-#include "desktop/save_text.h"
#include "render/box.h"
#include "render/html.h"
-#include "utils/log.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
+
+#include "desktop/gui_factory.h"
+#include "desktop/save_text.h"
static void extract_text(struct box *box, bool *first,
save_text_whitespace *before, struct save_text_state *save);
@@ -69,7 +71,7 @@ void save_as_text(hlcache_handle *c, char *path)
if (!save.block)
return;
- ret = utf8_to_local_encoding(save.block, save.length, &result);
+ ret = guit->utf8->utf8_to_local(save.block, save.length, &result);
free(save.block);
if (ret != NSERROR_OK) {
diff --git a/framebuffer/fetch.c b/framebuffer/fetch.c
index f350f36..2942c2d 100644
--- a/framebuffer/fetch.c
+++ b/framebuffer/fetch.c
@@ -21,13 +21,15 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <limits.h>
-#include "desktop/gui.h"
+#include "utils/nsurl.h"
#include "utils/url.h"
#include "utils/log.h"
#include "utils/filepath.h"
+#include "desktop/gui.h"
#include "framebuffer/findfile.h"
#include "framebuffer/fetch.h"
diff --git a/framebuffer/font.h b/framebuffer/font.h
index 5ae5bb3..6350421 100644
--- a/framebuffer/font.h
+++ b/framebuffer/font.h
@@ -21,6 +21,8 @@
#include "utils/utf8.h"
+extern struct gui_utf8_table *framebuffer_utf8_table;
+
bool fb_font_init(void);
bool fb_font_finalise(void);
diff --git a/framebuffer/font_freetype.c b/framebuffer/font_freetype.c
index eb7278c..4381db6 100644
--- a/framebuffer/font_freetype.c
+++ b/framebuffer/font_freetype.c
@@ -23,13 +23,14 @@
#include <ft2build.h>
#include FT_CACHE_H
-#include "css/css.h"
-#include "css/utils.h"
-#include "render/font.h"
#include "utils/filepath.h"
#include "utils/utf8.h"
#include "utils/log.h"
#include "utils/nsoption.h"
+#include "css/css.h"
+#include "css/utils.h"
+#include "render/font.h"
+#include "desktop/gui.h"
#include "framebuffer/gui.h"
#include "framebuffer/font.h"
@@ -74,30 +75,6 @@ enum fb_face_e {
static fb_faceid_t *fb_faces[FB_FACE_COUNT];
-
-nserror utf8_to_local_encoding(const char *string,
- size_t len,
- char **result)
-{
- return utf8_to_enc(string, "UTF-8", len, result);
-}
-
-nserror utf8_from_local_encoding(const char *string,
- size_t len,
- char **result)
-{
- *result = malloc(len + 1);
- if (*result == NULL) {
- return NSERROR_NOMEM;
- }
-
- memcpy(*result, string, len);
-
- (*result)[len] = '\0';
-
- return NSERROR_OK;
-}
-
/* map cache manager handle to face id */
static FT_Error ft_face_requester(FTC_FaceID face_id, FT_Library library, FT_Pointer request_data, FT_Face *face )
{
@@ -581,6 +558,8 @@ const struct font_functions nsfont = {
nsfont_split
};
+struct gui_utf8_table *framebuffer_utf8_table = NULL;
+
/*
* Local Variables:
* c-basic-offset:8
diff --git a/framebuffer/font_internal.c b/framebuffer/font_internal.c
index 1eed006..da5ca92 100644
--- a/framebuffer/font_internal.c
+++ b/framebuffer/font_internal.c
@@ -19,12 +19,13 @@
#include <inttypes.h>
#include <string.h>
-
#include <assert.h>
-#include "css/css.h"
-#include "render/font.h"
+
#include "utils/nsoption.h"
#include "utils/utf8.h"
+#include "desktop/gui.h"
+#include "css/css.h"
+#include "render/font.h"
#include "framebuffer/gui.h"
#include "framebuffer/font.h"
@@ -68,7 +69,7 @@ nserror utf8_to_font_encoding(const struct fb_font_desc* font,
}
-nserror utf8_to_local_encoding(const char *string,
+static nserror utf8_to_local(const char *string,
size_t len,
char **result)
{
@@ -76,7 +77,7 @@ nserror utf8_to_local_encoding(const char *string,
}
-nserror utf8_from_local_encoding(const char *string,
+static nserror utf8_from_local(const char *string,
size_t len,
char **result)
{
@@ -183,6 +184,14 @@ const struct font_functions nsfont = {
nsfont_split
};
+static struct gui_utf8_table utf8_table = {
+ .utf8_to_local = utf8_to_local,
+ .local_to_utf8 = utf8_from_local,
+};
+
+struct gui_utf8_table *framebuffer_utf8_table = &utf8_table;
+
+
/*
* Local Variables:
* c-basic-offset:8
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index e7f456d..678010d 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -1815,6 +1815,7 @@ main(int argc, char** argv)
.window = &framebuffer_window_table,
.clipboard = framebuffer_clipboard_table,
.fetch = framebuffer_fetch_table,
+ .utf8 = framebuffer_utf8_table,
};
respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);
diff --git a/gtk/fetch.c b/gtk/fetch.c
index 0043cd0..8db102c 100644
--- a/gtk/fetch.c
+++ b/gtk/fetch.c
@@ -17,6 +17,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/gtk/gui.c b/gtk/gui.c
index fdf64ad..74da733 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -788,37 +788,6 @@ gboolean nsgtk_ssl_delete_event(GtkWidget *w, GdkEvent *event, gpointer data)
return FALSE;
}
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
-{
- assert(string && result);
-
- if (len == 0)
- len = strlen(string);
-
- *result = strndup(string, len);
- if (!(*result))
- return NSERROR_NOMEM;
-
- return NSERROR_OK;
-}
-
-
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- assert(string && result);
-
- if (len == 0)
- len = strlen(string);
-
- *result = strndup(string, len);
- if (!(*result))
- return NSERROR_NOMEM;
-
- return NSERROR_OK;
-}
-
-
-
#ifdef WITH_PDF_EXPORT
void PDF_Password(char **owner_pass, char **user_pass, char *path)
diff --git a/monkey/cert.c b/monkey/cert.c
index 48359e8..6f21727 100644
--- a/monkey/cert.c
+++ b/monkey/cert.c
@@ -19,8 +19,9 @@
#include <stdlib.h>
#include <stdio.h>
-#include "desktop/gui.h"
#include "utils/ring.h"
+#include "utils/nsurl.h"
+#include "desktop/gui.h"
#include "monkey/cert.h"
diff --git a/monkey/utils.c b/monkey/utils.c
index 742c300..e1a702f 100644
--- a/monkey/utils.c
+++ b/monkey/utils.c
@@ -22,10 +22,6 @@
#include "utils/config.h"
#include "utils/utils.h"
-#include "utils/url.h"
-#include "utils/utf8.h"
-
-
void warn_user(const char *warning, const char *detail)
{
@@ -37,17 +33,3 @@ void die(const char * const error)
fprintf(stderr, "DIE %s\n", error);
exit(EXIT_FAILURE);
}
-
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
-{
- *result = strndup(string, len);
- return (*result == NULL) ? NSERROR_NOMEM : NSERROR_OK;
-}
-
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- *result = strndup(string, len);
- return (*result == NULL) ? NSERROR_NOMEM : NSERROR_OK;
-}
-
-
diff --git a/render/html.c b/render/html.c
index bd23aac..f9d8858 100644
--- a/render/html.c
+++ b/render/html.c
@@ -29,14 +29,27 @@
#include <stdlib.h>
#include "utils/config.h"
+#include "utils/corestrings.h"
+#include "utils/http.h"
+#include "utils/libdom.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/schedule.h"
+#include "utils/talloc.h"
+#include "utils/url.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
+#include "utils/nsoption.h"
#include "content/content_protected.h"
#include "content/fetch.h"
#include "content/hlcache.h"
-#include "utils/nsoption.h"
#include "desktop/selection.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
#include "image/bitmap.h"
+#include "javascript/js.h"
+#include "desktop/gui_factory.h"
+
#include "render/box.h"
#include "render/font.h"
#include "render/form.h"
@@ -44,17 +57,6 @@
#include "render/imagemap.h"
#include "render/layout.h"
#include "render/search.h"
-#include "javascript/js.h"
-#include "utils/corestrings.h"
-#include "utils/http.h"
-#include "utils/libdom.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/schedule.h"
-#include "utils/talloc.h"
-#include "utils/url.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
#define CHUNK 4096
@@ -1770,10 +1772,10 @@ static void html__set_file_gadget_filename(struct content *c,
html_content *html = (html_content *)c;
struct box *file_box = gadget->box;
- ret = utf8_from_local_encoding(fn,0, &utf8_fn);
+ ret = guit->utf8->local_to_utf8(fn,0, &utf8_fn);
if (ret != NSERROR_OK) {
assert(ret != NSERROR_BAD_ENCODING);
- LOG(("utf8_from_local_encoding failed"));
+ LOG(("utf8 to local encoding conversion failed"));
/* Load was for us - just no memory */
return;
}
@@ -1915,11 +1917,11 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
/* TODO: Sniff for text? */
/* Convert to UTF-8 */
- ret = utf8_from_local_encoding(buffer, file_len, &utf8_buff);
+ ret = guit->utf8->local_to_utf8(buffer, file_len, &utf8_buff);
if (ret != NSERROR_OK) {
/* bad encoding shouldn't happen */
assert(ret != NSERROR_BAD_ENCODING);
- LOG(("utf8_from_local_encoding failed"));
+ LOG(("local to utf8 encoding failed"));
free(buffer);
warn_user("NoMemory", NULL);
return true;
diff --git a/riscos/download.c b/riscos/download.c
index b89334f..b10c6c1 100644
--- a/riscos/download.c
+++ b/riscos/download.c
@@ -58,6 +58,7 @@
#include "utils/url.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "riscos/ucstables.h"
#define ICON_DOWNLOAD_ICON 0
#define ICON_DOWNLOAD_URL 1
diff --git a/riscos/gui.c b/riscos/gui.c
index a5a9c94..83add25 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -99,7 +99,7 @@
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/window.h"
-
+#include "riscos/ucstables.h"
#ifndef FILETYPE_ACORN_URI
@@ -2389,6 +2389,7 @@ int main(int argc, char** argv)
.clipboard = riscos_clipboard_table,
.download = riscos_download_table,
.fetch = &riscos_fetch_table,
+ .utf8 = riscos_utf8_table,
};
/* Consult NetSurf$Logging environment variable to decide if logging
diff --git a/riscos/gui/url_bar.c b/riscos/gui/url_bar.c
index 681824d..b898e6f 100644
--- a/riscos/gui/url_bar.c
+++ b/riscos/gui/url_bar.c
@@ -42,6 +42,7 @@
#include "utils/messages.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "riscos/ucstables.h"
#define URLBAR_HEIGHT 52
#define URLBAR_FAVICON_SIZE 16
diff --git a/riscos/help.c b/riscos/help.c
index 9da52f3..3c74e54 100644
--- a/riscos/help.c
+++ b/riscos/help.c
@@ -44,6 +44,7 @@
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "riscos/ucstables.h"
/* Recognised help keys
diff --git a/riscos/menus.c b/riscos/menus.c
index d8e2f2c..a0baca0 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -31,6 +31,12 @@
#include "oslib/osgbpb.h"
#include "oslib/territory.h"
#include "oslib/wimp.h"
+
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/url.h"
+#include "utils/utils.h"
+#include "utils/utf8.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
@@ -40,6 +46,7 @@
#include "desktop/local_history.h"
#include "desktop/netsurf.h"
#include "desktop/textinput.h"
+
#include "riscos/dialog.h"
#include "riscos/configure.h"
#include "riscos/cookies.h"
@@ -56,11 +63,7 @@
#include "riscos/url_suggest.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/url.h"
-#include "utils/utils.h"
-#include "utils/utf8.h"
+#include "riscos/ucstables.h"
struct menu_definition_entry {
menu_action action; /**< menu action */
diff --git a/riscos/query.c b/riscos/query.c
index 2268494..2be2e2a 100644
--- a/riscos/query.c
+++ b/riscos/query.c
@@ -29,6 +29,7 @@
#include "utils/messages.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "riscos/ucstables.h"
#define ICON_QUERY_MESSAGE 0
#define ICON_QUERY_YES 1
diff --git a/riscos/save.c b/riscos/save.c
index d58da1a..fa638d3 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -69,6 +69,7 @@
#include "riscos/thumbnail.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
+#include "riscos/ucstables.h"
//typedef enum
//{
diff --git a/riscos/textselection.c b/riscos/textselection.c
index 68e71a9..5215a62 100644
--- a/riscos/textselection.c
+++ b/riscos/textselection.c
@@ -39,6 +39,7 @@
#include "riscos/mouse.h"
#include "riscos/save.h"
#include "riscos/textselection.h"
+#include "riscos/ucstables.h"
#ifndef wimp_DRAG_CLAIM_SUPPRESS_DRAGBOX
diff --git a/riscos/ucstables.c b/riscos/ucstables.c
index b9f196d..3b7f8a4 100644
--- a/riscos/ucstables.c
+++ b/riscos/ucstables.c
@@ -31,6 +31,7 @@
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "desktop/gui.h"
/* Common values (ASCII) */
#define common \
@@ -684,3 +685,10 @@ nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
return NSERROR_OK;
}
+
+static struct gui_utf8_table utf8_table = {
+ .utf8_to_local = utf8_to_local_encoding,
+ .local_to_utf8 = utf8_from_local_encoding,
+};
+
+struct gui_utf8_table *riscos_utf8_table = &utf8_table;
diff --git a/riscos/ucstables.h b/riscos/ucstables.h
index 0be0658..e5d8382 100644
--- a/riscos/ucstables.h
+++ b/riscos/ucstables.h
@@ -21,4 +21,9 @@
* This is only used if nothing claims Service_International,8
*/
+struct gui_utf8_table *riscos_utf8_table;
+
+nserror utf8_to_local_encoding(const char *string, size_t len, char **result);
+nserror utf8_from_local_encoding(const char *string, size_t len, char **result);
+
const int *ucstable_from_alphabet(int alphabet);
diff --git a/riscos/wimp.c b/riscos/wimp.c
index 2e48891..f59fa67 100644
--- a/riscos/wimp.c
+++ b/riscos/wimp.c
@@ -40,6 +40,7 @@
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "riscos/ucstables.h"
static void ro_gui_wimp_cache_furniture_sizes(wimp_w w);
diff --git a/riscos/window.c b/riscos/window.c
index 72230a7..0116a97 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -90,6 +90,7 @@
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/window.h"
+#include "riscos/ucstables.h"
void gui_window_redraw_window(struct gui_window *g);
diff --git a/utils/utf8.c b/utils/utf8.c
index ab7bbae..cc8039c 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -29,6 +29,8 @@
#include <parserutils/charset/utf8.h>
+#include "desktop/gui_factory.h"
+
#include "utils/config.h"
#include "utils/log.h"
#include "utils/utf8.h"
@@ -463,8 +465,7 @@ bool utf8_save_text(const char *utf8_text, const char *path)
char *conv;
FILE *out;
- ret = utf8_to_local_encoding(utf8_text, strlen(utf8_text), &conv);
-
+ ret = guit->utf8->utf8_to_local(utf8_text, strlen(utf8_text), &conv);
if (ret != NSERROR_OK) {
LOG(("failed to convert to local encoding, return %d", ret));
return false;
diff --git a/utils/utf8.h b/utils/utf8.h
index 7c450b5..7509dde 100644
--- a/utils/utf8.h
+++ b/utils/utf8.h
@@ -161,9 +161,4 @@ bool utf8_save_text(const char *utf8_text, const char *path);
*/
nserror utf8_finalise(void);
-/* These two are platform specific */
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result);
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result);
-
-
#endif
diff --git a/windows/font.c b/windows/font.c
index 98269a3..09adeed 100644
--- a/windows/font.c
+++ b/windows/font.c
@@ -43,14 +43,14 @@ nserror utf8_to_font_encoding(const struct font_desc* font,
return utf8_to_enc(string, font->encoding, len, result);
}
-nserror utf8_to_local_encoding(const char *string,
+static nserror utf8_to_local_encoding(const char *string,
size_t len,
char **result)
{
return utf8_to_enc(string, "UCS-2", len, result);
}
-nserror utf8_from_local_encoding(const char *string, size_t len,
+static nserror utf8_from_local_encoding(const char *string, size_t len,
char **result)
{
assert(string && result);
@@ -234,3 +234,10 @@ const struct font_functions nsfont = {
nsfont_position_in_string,
nsfont_split
};
+
+static struct gui_utf8_table utf8_table = {
+ .utf8_to_local = utf8_to_local_encoding,
+ .local_to_utf8 = utf8_from_local_encoding,
+};
+
+struct gui_utf8_table *win32_utf8_table = &utf8_table;
diff --git a/windows/gui.h b/windows/gui.h
index 1ff849d..d8e1b1d 100644
--- a/windows/gui.h
+++ b/windows/gui.h
@@ -28,6 +28,7 @@ extern struct gui_window_table *win32_window_table;
extern struct gui_clipboard_table *win32_clipboard_table;
extern struct gui_fetch_table *win32_fetch_table;
extern struct gui_browser_table *win32_browser_table;
+extern struct gui_utf8_table *win32_utf8_table;
extern HINSTANCE hInstance;
diff --git a/windows/main.c b/windows/main.c
index 94e0eee..6a53e0c 100644
--- a/windows/main.c
+++ b/windows/main.c
@@ -111,6 +111,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
.clipboard = win32_clipboard_table,
.download = win32_download_table,
.fetch = win32_fetch_table,
+ .utf8 = win32_utf8_table,
};
win32_fetch_table->get_resource_url = gui_get_resource_url;
--
NetSurf Browser
9 years, 1 month
netsurf: branch master updated. release/3.0-1023-g00bdf39
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/00bdf39dc21cd51216ef3...
...commit http://git.netsurf-browser.org/netsurf.git/commit/00bdf39dc21cd51216ef362...
...tree http://git.netsurf-browser.org/netsurf.git/tree/00bdf39dc21cd51216ef36252...
The branch, master has been updated
via 00bdf39dc21cd51216ef362529dca12f98cd1cf2 (commit)
from 8bb0e87b1a8fc9872762f5caa856f64c4e9f1cdd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=00bdf39dc21cd51216e...
commit 00bdf39dc21cd51216ef362529dca12f98cd1cf2
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
remove unnecessary includes
diff --git a/gtk/selection.c b/gtk/selection.c
index 22b4bfe..c07e888 100644
--- a/gtk/selection.c
+++ b/gtk/selection.c
@@ -21,8 +21,8 @@
#include "utils/log.h"
-#include "desktop/gui.h"
#include "desktop/browser.h"
+#include "desktop/gui.h"
#include "gtk/window.h"
static GString *current_selection = NULL;
diff --git a/gtk/theme.c b/gtk/theme.c
index ff0144c..adc4341 100644
--- a/gtk/theme.c
+++ b/gtk/theme.c
@@ -22,21 +22,24 @@
#include <sys/stat.h>
#include <unistd.h>
+#include "utils/config.h"
+#include "utils/nsoption.h"
+#include "utils/container.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+#include "desktop/browser.h"
#include "content/content.h"
#include "content/content_type.h"
#include "content/hlcache.h"
+
#include "gtk/compat.h"
#include "gtk/gui.h"
#include "gtk/scaffolding.h"
#include "gtk/menu.h"
#include "gtk/theme.h"
#include "gtk/window.h"
-#include "utils/nsoption.h"
#include "gtk/dialogs/preferences.h"
-#include "utils/container.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
enum image_sets {
IMAGE_SET_MAIN_MENU = 0,
diff --git a/gtk/window.c b/gtk/window.c
index 0ba3c50..015ef4d 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -26,14 +26,18 @@
#include <gdk/gdkkeysyms.h>
#include <gdk-pixbuf/gdk-pixdata.h>
+#include "utils/log.h"
+#include "utils/utils.h"
+#include "utils/nsoption.h"
#include "content/hlcache.h"
#include "gtk/window.h"
#include "gtk/selection.h"
+#include "desktop/gui.h"
#include "desktop/browser_private.h"
#include "desktop/mouse.h"
-#include "utils/nsoption.h"
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
+
#include "gtk/compat.h"
#include "gtk/gui.h"
#include "gtk/scaffolding.h"
@@ -42,8 +46,6 @@
#include "gtk/tabs.h"
#include "gtk/bitmap.h"
#include "gtk/gdk.h"
-#include "utils/log.h"
-#include "utils/utils.h"
/* helper macro to conenct signals to callbacks */
#define CONNECT(obj, sig, callback, ptr) \
diff --git a/gtk/window.h b/gtk/window.h
index e242b6e..e4a4fda 100644
--- a/gtk/window.h
+++ b/gtk/window.h
@@ -19,8 +19,6 @@
#ifndef NETSURF_GTK_WINDOW_H
#define NETSURF_GTK_WINDOW_H 1
-#include "desktop/gui.h"
-#include "desktop/browser.h"
#include "gtk/scaffolding.h"
extern struct gui_window_table *nsgtk_window_table;
-----------------------------------------------------------------------
Summary of changes:
gtk/selection.c | 2 +-
gtk/theme.c | 13 ++++++++-----
gtk/window.c | 8 +++++---
gtk/window.h | 2 --
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/gtk/selection.c b/gtk/selection.c
index 22b4bfe..c07e888 100644
--- a/gtk/selection.c
+++ b/gtk/selection.c
@@ -21,8 +21,8 @@
#include "utils/log.h"
-#include "desktop/gui.h"
#include "desktop/browser.h"
+#include "desktop/gui.h"
#include "gtk/window.h"
static GString *current_selection = NULL;
diff --git a/gtk/theme.c b/gtk/theme.c
index ff0144c..adc4341 100644
--- a/gtk/theme.c
+++ b/gtk/theme.c
@@ -22,21 +22,24 @@
#include <sys/stat.h>
#include <unistd.h>
+#include "utils/config.h"
+#include "utils/nsoption.h"
+#include "utils/container.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+#include "desktop/browser.h"
#include "content/content.h"
#include "content/content_type.h"
#include "content/hlcache.h"
+
#include "gtk/compat.h"
#include "gtk/gui.h"
#include "gtk/scaffolding.h"
#include "gtk/menu.h"
#include "gtk/theme.h"
#include "gtk/window.h"
-#include "utils/nsoption.h"
#include "gtk/dialogs/preferences.h"
-#include "utils/container.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
enum image_sets {
IMAGE_SET_MAIN_MENU = 0,
diff --git a/gtk/window.c b/gtk/window.c
index 0ba3c50..015ef4d 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -26,14 +26,18 @@
#include <gdk/gdkkeysyms.h>
#include <gdk-pixbuf/gdk-pixdata.h>
+#include "utils/log.h"
+#include "utils/utils.h"
+#include "utils/nsoption.h"
#include "content/hlcache.h"
#include "gtk/window.h"
#include "gtk/selection.h"
+#include "desktop/gui.h"
#include "desktop/browser_private.h"
#include "desktop/mouse.h"
-#include "utils/nsoption.h"
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
+
#include "gtk/compat.h"
#include "gtk/gui.h"
#include "gtk/scaffolding.h"
@@ -42,8 +46,6 @@
#include "gtk/tabs.h"
#include "gtk/bitmap.h"
#include "gtk/gdk.h"
-#include "utils/log.h"
-#include "utils/utils.h"
/* helper macro to conenct signals to callbacks */
#define CONNECT(obj, sig, callback, ptr) \
diff --git a/gtk/window.h b/gtk/window.h
index e242b6e..e4a4fda 100644
--- a/gtk/window.h
+++ b/gtk/window.h
@@ -19,8 +19,6 @@
#ifndef NETSURF_GTK_WINDOW_H
#define NETSURF_GTK_WINDOW_H 1
-#include "desktop/gui.h"
-#include "desktop/browser.h"
#include "gtk/scaffolding.h"
extern struct gui_window_table *nsgtk_window_table;
--
NetSurf Browser
9 years, 1 month
netsurf: branch master updated. release/3.0-1022-g8bb0e87
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/8bb0e87b1a8fc9872762f...
...commit http://git.netsurf-browser.org/netsurf.git/commit/8bb0e87b1a8fc9872762f5c...
...tree http://git.netsurf-browser.org/netsurf.git/tree/8bb0e87b1a8fc9872762f5caa...
The branch, master has been updated
via 8bb0e87b1a8fc9872762f5caa856f64c4e9f1cdd (commit)
from 1f62b5a980020b0e5df0e68cb476083ba2dc1fe5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=8bb0e87b1a8fc987276...
commit 8bb0e87b1a8fc9872762f5caa856f64c4e9f1cdd
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
make clipboard table operations static and remove unecessary includes
diff --git a/gtk/gui.c b/gtk/gui.c
index c885ad3..fdf64ad 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -1021,11 +1021,6 @@ uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *key)
}
-static struct gui_clipboard_table nsgtk_clipboard_table = {
- .get = gui_get_clipboard,
- .set = gui_set_clipboard,
-};
-
static struct gui_browser_table nsgtk_browser_table = {
.poll = gui_poll,
@@ -1048,7 +1043,7 @@ int main(int argc, char** argv)
struct gui_table nsgtk_gui_table = {
.browser = &nsgtk_browser_table,
.window = nsgtk_window_table,
- .clipboard = &nsgtk_clipboard_table,
+ .clipboard = nsgtk_clipboard_table,
.download = nsgtk_download_table,
.fetch = nsgtk_fetch_table,
};
diff --git a/gtk/scaffolding.h b/gtk/scaffolding.h
index 757da82..285f9bb 100644
--- a/gtk/scaffolding.h
+++ b/gtk/scaffolding.h
@@ -19,15 +19,11 @@
#ifndef NETSURF_GTK_SCAFFOLDING_H
#define NETSURF_GTK_SCAFFOLDING_H 1
-#include <gtk/gtk.h>
-#include <glib.h>
-
-#include "content/hlcache.h"
-#include "desktop/gui.h"
-#include "desktop/plotters.h"
-#include "gtk/menu.h"
-#include "gtk/sexy_icon_entry.h"
+#include <stdbool.h>
+#include "utils/errors.h"
+struct hlcache_handle;
+struct gui_window;
typedef struct gtk_scaffolding nsgtk_scaffolding;
typedef enum {
@@ -182,6 +178,6 @@ void gui_window_set_title(struct gui_window *g, const char *title);
void gui_window_set_url(struct gui_window *g, const char *url);
void gui_window_start_throbber(struct gui_window *g);
void gui_window_stop_throbber(struct gui_window *g);
-void gui_set_search_ico(hlcache_handle *ico);
+void gui_set_search_ico(struct hlcache_handle *ico);
#endif /* NETSURF_GTK_SCAFFOLDING_H */
diff --git a/gtk/selection.c b/gtk/selection.c
index 8bdc0f8..22b4bfe 100644
--- a/gtk/selection.c
+++ b/gtk/selection.c
@@ -23,7 +23,6 @@
#include "desktop/gui.h"
#include "desktop/browser.h"
-#include "gtk/selection.h"
#include "gtk/window.h"
static GString *current_selection = NULL;
@@ -36,7 +35,7 @@ static GtkClipboard *clipboard;
* \param buffer UTF-8 text, allocated by front end, ownership yeilded to core
* \param length Byte length of UTF-8 text in buffer
*/
-void gui_get_clipboard(char **buffer, size_t *length)
+static void gui_get_clipboard(char **buffer, size_t *length)
{
gchar *gtext;
@@ -72,7 +71,7 @@ void gui_get_clipboard(char **buffer, size_t *length)
* \param styles Array of styles given to text runs, owned by core, or NULL
* \param n_styles Number of text run styles in array
*/
-void gui_set_clipboard(const char *buffer, size_t length,
+static void gui_set_clipboard(const char *buffer, size_t length,
nsclipboard_styles styles[], int n_styles)
{
clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
@@ -88,3 +87,9 @@ void gui_set_clipboard(const char *buffer, size_t length,
gtk_clipboard_set_text(clipboard, current_selection->str, -1);
}
+static struct gui_clipboard_table clipboard_table = {
+ .get = gui_get_clipboard,
+ .set = gui_set_clipboard,
+};
+
+struct gui_clipboard_table *nsgtk_clipboard_table = &clipboard_table;
diff --git a/gtk/selection.h b/gtk/selection.h
index 0d3ec73..6463692 100644
--- a/gtk/selection.h
+++ b/gtk/selection.h
@@ -19,11 +19,6 @@
#ifndef GTK_SELECTION_H
#define GTK_SELECTION_H
-#include <gtk/gtk.h>
-#include "desktop/gui.h"
-
-void gui_get_clipboard(char **buffer, size_t *length);
-void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles);
-
+struct gui_clipboard_table *nsgtk_clipboard_table;
#endif
-----------------------------------------------------------------------
Summary of changes:
gtk/gui.c | 7 +------
gtk/scaffolding.h | 14 +++++---------
gtk/selection.c | 11 ++++++++---
gtk/selection.h | 7 +------
4 files changed, 15 insertions(+), 24 deletions(-)
diff --git a/gtk/gui.c b/gtk/gui.c
index c885ad3..fdf64ad 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -1021,11 +1021,6 @@ uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *key)
}
-static struct gui_clipboard_table nsgtk_clipboard_table = {
- .get = gui_get_clipboard,
- .set = gui_set_clipboard,
-};
-
static struct gui_browser_table nsgtk_browser_table = {
.poll = gui_poll,
@@ -1048,7 +1043,7 @@ int main(int argc, char** argv)
struct gui_table nsgtk_gui_table = {
.browser = &nsgtk_browser_table,
.window = nsgtk_window_table,
- .clipboard = &nsgtk_clipboard_table,
+ .clipboard = nsgtk_clipboard_table,
.download = nsgtk_download_table,
.fetch = nsgtk_fetch_table,
};
diff --git a/gtk/scaffolding.h b/gtk/scaffolding.h
index 757da82..285f9bb 100644
--- a/gtk/scaffolding.h
+++ b/gtk/scaffolding.h
@@ -19,15 +19,11 @@
#ifndef NETSURF_GTK_SCAFFOLDING_H
#define NETSURF_GTK_SCAFFOLDING_H 1
-#include <gtk/gtk.h>
-#include <glib.h>
-
-#include "content/hlcache.h"
-#include "desktop/gui.h"
-#include "desktop/plotters.h"
-#include "gtk/menu.h"
-#include "gtk/sexy_icon_entry.h"
+#include <stdbool.h>
+#include "utils/errors.h"
+struct hlcache_handle;
+struct gui_window;
typedef struct gtk_scaffolding nsgtk_scaffolding;
typedef enum {
@@ -182,6 +178,6 @@ void gui_window_set_title(struct gui_window *g, const char *title);
void gui_window_set_url(struct gui_window *g, const char *url);
void gui_window_start_throbber(struct gui_window *g);
void gui_window_stop_throbber(struct gui_window *g);
-void gui_set_search_ico(hlcache_handle *ico);
+void gui_set_search_ico(struct hlcache_handle *ico);
#endif /* NETSURF_GTK_SCAFFOLDING_H */
diff --git a/gtk/selection.c b/gtk/selection.c
index 8bdc0f8..22b4bfe 100644
--- a/gtk/selection.c
+++ b/gtk/selection.c
@@ -23,7 +23,6 @@
#include "desktop/gui.h"
#include "desktop/browser.h"
-#include "gtk/selection.h"
#include "gtk/window.h"
static GString *current_selection = NULL;
@@ -36,7 +35,7 @@ static GtkClipboard *clipboard;
* \param buffer UTF-8 text, allocated by front end, ownership yeilded to core
* \param length Byte length of UTF-8 text in buffer
*/
-void gui_get_clipboard(char **buffer, size_t *length)
+static void gui_get_clipboard(char **buffer, size_t *length)
{
gchar *gtext;
@@ -72,7 +71,7 @@ void gui_get_clipboard(char **buffer, size_t *length)
* \param styles Array of styles given to text runs, owned by core, or NULL
* \param n_styles Number of text run styles in array
*/
-void gui_set_clipboard(const char *buffer, size_t length,
+static void gui_set_clipboard(const char *buffer, size_t length,
nsclipboard_styles styles[], int n_styles)
{
clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
@@ -88,3 +87,9 @@ void gui_set_clipboard(const char *buffer, size_t length,
gtk_clipboard_set_text(clipboard, current_selection->str, -1);
}
+static struct gui_clipboard_table clipboard_table = {
+ .get = gui_get_clipboard,
+ .set = gui_set_clipboard,
+};
+
+struct gui_clipboard_table *nsgtk_clipboard_table = &clipboard_table;
diff --git a/gtk/selection.h b/gtk/selection.h
index 0d3ec73..6463692 100644
--- a/gtk/selection.h
+++ b/gtk/selection.h
@@ -19,11 +19,6 @@
#ifndef GTK_SELECTION_H
#define GTK_SELECTION_H
-#include <gtk/gtk.h>
-#include "desktop/gui.h"
-
-void gui_get_clipboard(char **buffer, size_t *length);
-void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles);
-
+struct gui_clipboard_table *nsgtk_clipboard_table;
#endif
--
NetSurf Browser
9 years, 1 month
netsurf: branch master updated. release/3.0-1021-g1f62b5a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/1f62b5a980020b0e5df0e...
...commit http://git.netsurf-browser.org/netsurf.git/commit/1f62b5a980020b0e5df0e68...
...tree http://git.netsurf-browser.org/netsurf.git/tree/1f62b5a980020b0e5df0e68cb...
The branch, master has been updated
via 1f62b5a980020b0e5df0e68cb476083ba2dc1fe5 (commit)
from 356461244e9a31d9c22fab358cdf95cb3f22364f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=1f62b5a980020b0e5df...
commit 1f62b5a980020b0e5df0e68cb476083ba2dc1fe5
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
make the clipboard operation table and members static to textselection module and cleanup unnecessary includes
diff --git a/riscos/gui.c b/riscos/gui.c
index e862e93..a5a9c94 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -50,7 +50,13 @@
#include "oslib/wimpspriteop.h"
#include "oslib/uri.h"
#include "rufl.h"
+
#include "utils/config.h"
+#include "utils/filename.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/url.h"
+#include "utils/utils.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
@@ -61,6 +67,7 @@
#include "desktop/save_complete.h"
#include "desktop/treeview.h"
#include "render/font.h"
+
#include "riscos/content-handlers/artworks.h"
#include "riscos/bitmap.h"
#include "riscos/buffer.h"
@@ -92,11 +99,6 @@
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/window.h"
-#include "utils/filename.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/url.h"
-#include "utils/utils.h"
@@ -2348,10 +2350,6 @@ static bool path_add_part(char *path, int length, const char *newpart)
return true;
}
-static struct gui_clipboard_table riscos_clipboard_table = {
- .get = gui_get_clipboard,
- .set = gui_set_clipboard,
-};
static struct gui_fetch_table riscos_fetch_table = {
.filename_from_path = filename_from_path,
@@ -2388,7 +2386,7 @@ int main(int argc, char** argv)
struct gui_table riscos_gui_table = {
.browser = &riscos_browser_table,
.window = riscos_window_table,
- .clipboard = &riscos_clipboard_table,
+ .clipboard = riscos_clipboard_table,
.download = riscos_download_table,
.fetch = &riscos_fetch_table,
};
diff --git a/riscos/gui.h b/riscos/gui.h
index 56cb70e..823956c 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -27,7 +27,6 @@
#include "oslib/wimp.h"
#include "rufl.h"
#include "desktop/browser.h"
-#include "desktop/gui.h"
#include "content/content_type.h"
#include "utils/config.h"
@@ -213,10 +212,6 @@ extern int ro_plot_origin_y;
/* in theme_install.c */
bool ro_gui_theme_install_apply(wimp_w w);
-/* in textselection.c */
-void gui_get_clipboard(char **buffer, size_t *length);
-void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles);
-
/* in sslcert.c */
void gui_cert_verify(nsurl *url,
const struct ssl_cert_info *certs, unsigned long num,
diff --git a/riscos/save.c b/riscos/save.c
index cc12344..d58da1a 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -35,6 +35,13 @@
#include "oslib/osspriteop.h"
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
+
+#include "utils/config.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/url.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "desktop/hotlist.h"
@@ -43,8 +50,10 @@
#include "desktop/save_complete.h"
#include "desktop/save_text.h"
#include "desktop/thumbnail.h"
+#include "desktop/gui.h"
#include "image/bitmap.h"
#include "render/form.h"
+
#include "riscos/bitmap.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
@@ -60,12 +69,6 @@
#include "riscos/thumbnail.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
-#include "utils/config.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/url.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
//typedef enum
//{
diff --git a/riscos/textselection.c b/riscos/textselection.c
index c070754..68e71a9 100644
--- a/riscos/textselection.c
+++ b/riscos/textselection.c
@@ -25,25 +25,27 @@
#include <string.h>
#include "oslib/osfile.h"
#include "oslib/wimp.h"
+
+#include "utils/log.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
#include "content/hlcache.h"
#include "desktop/gui.h"
#include "desktop/textinput.h"
+
#include "riscos/gui.h"
#include "riscos/menus.h"
#include "riscos/message.h"
#include "riscos/mouse.h"
#include "riscos/save.h"
#include "riscos/textselection.h"
-#include "utils/log.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
+
#ifndef wimp_DRAG_CLAIM_SUPPRESS_DRAGBOX
#define wimp_DRAG_CLAIM_SUPPRESS_DRAGBOX ((wimp_drag_claim_flags) 0x2u)
#endif
-
/** Receive of Dragging message has claimed it */
static bool dragging_claimed = false;
static wimp_t dragging_claimant;
@@ -194,7 +196,7 @@ static void ro_gui_selection_drag_end(wimp_dragged *drag, void *data)
* \param styles Array of styles given to text runs, owned by core, or NULL
* \param n_styles Number of text run styles in array
*/
-void gui_set_clipboard(const char *buffer, size_t length,
+static void gui_set_clipboard(const char *buffer, size_t length,
nsclipboard_styles styles[], int n_styles)
{
char *new_cb;
@@ -245,7 +247,7 @@ void gui_set_clipboard(const char *buffer, size_t length,
* \param buffer UTF-8 text, allocated by front end, ownership yielded to core
* \param length Byte length of UTF-8 text in buffer
*/
-void gui_get_clipboard(char **buffer, size_t *length)
+static void gui_get_clipboard(char **buffer, size_t *length)
{
*buffer = NULL;
*length = 0;
@@ -652,3 +654,10 @@ void ro_gui_dragging_bounced(wimp_message *message)
{
dragging_claimed = false;
}
+
+static struct gui_clipboard_table clipboard_table = {
+ .get = gui_get_clipboard,
+ .set = gui_set_clipboard,
+};
+
+struct gui_clipboard_table *riscos_clipboard_table = &clipboard_table;
diff --git a/riscos/textselection.h b/riscos/textselection.h
index a4f436d..400e3dd 100644
--- a/riscos/textselection.h
+++ b/riscos/textselection.h
@@ -24,7 +24,8 @@
#define _NETSURF_RISCOS_TEXTSELECTION_H_
#include "oslib/wimp.h"
-#include "desktop/gui.h"
+
+struct gui_clipboard_table *riscos_clipboard_table;
void gui_start_selection(struct gui_window *g);
diff --git a/riscos/window.c b/riscos/window.c
index ed0f9e2..72230a7 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -40,7 +40,15 @@
#include "oslib/osspriteop.h"
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
+
#include "utils/config.h"
+#include "utils/nsoption.h"
+#include "utils/log.h"
+#include "utils/talloc.h"
+#include "utils/url.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
+#include "utils/messages.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
@@ -58,6 +66,7 @@
#include "desktop/gui.h"
#include "render/form.h"
#include "render/html.h"
+
#include "riscos/bitmap.h"
#include "riscos/buffer.h"
#include "riscos/cookies.h"
@@ -69,7 +78,6 @@
#include "riscos/hotlist.h"
#include "riscos/menus.h"
#include "riscos/mouse.h"
-#include "utils/nsoption.h"
#include "riscos/oslib_pre7.h"
#include "riscos/save.h"
#include "riscos/content-handlers/sprite.h"
@@ -82,12 +90,6 @@
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/window.h"
-#include "utils/log.h"
-#include "utils/talloc.h"
-#include "utils/url.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
-#include "utils/messages.h"
void gui_window_redraw_window(struct gui_window *g);
-----------------------------------------------------------------------
Summary of changes:
riscos/gui.c | 18 ++++++++----------
riscos/gui.h | 5 -----
riscos/save.c | 15 +++++++++------
riscos/textselection.c | 21 +++++++++++++++------
riscos/textselection.h | 3 ++-
riscos/window.c | 16 +++++++++-------
6 files changed, 43 insertions(+), 35 deletions(-)
diff --git a/riscos/gui.c b/riscos/gui.c
index e862e93..a5a9c94 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -50,7 +50,13 @@
#include "oslib/wimpspriteop.h"
#include "oslib/uri.h"
#include "rufl.h"
+
#include "utils/config.h"
+#include "utils/filename.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/url.h"
+#include "utils/utils.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
@@ -61,6 +67,7 @@
#include "desktop/save_complete.h"
#include "desktop/treeview.h"
#include "render/font.h"
+
#include "riscos/content-handlers/artworks.h"
#include "riscos/bitmap.h"
#include "riscos/buffer.h"
@@ -92,11 +99,6 @@
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/window.h"
-#include "utils/filename.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/url.h"
-#include "utils/utils.h"
@@ -2348,10 +2350,6 @@ static bool path_add_part(char *path, int length, const char *newpart)
return true;
}
-static struct gui_clipboard_table riscos_clipboard_table = {
- .get = gui_get_clipboard,
- .set = gui_set_clipboard,
-};
static struct gui_fetch_table riscos_fetch_table = {
.filename_from_path = filename_from_path,
@@ -2388,7 +2386,7 @@ int main(int argc, char** argv)
struct gui_table riscos_gui_table = {
.browser = &riscos_browser_table,
.window = riscos_window_table,
- .clipboard = &riscos_clipboard_table,
+ .clipboard = riscos_clipboard_table,
.download = riscos_download_table,
.fetch = &riscos_fetch_table,
};
diff --git a/riscos/gui.h b/riscos/gui.h
index 56cb70e..823956c 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -27,7 +27,6 @@
#include "oslib/wimp.h"
#include "rufl.h"
#include "desktop/browser.h"
-#include "desktop/gui.h"
#include "content/content_type.h"
#include "utils/config.h"
@@ -213,10 +212,6 @@ extern int ro_plot_origin_y;
/* in theme_install.c */
bool ro_gui_theme_install_apply(wimp_w w);
-/* in textselection.c */
-void gui_get_clipboard(char **buffer, size_t *length);
-void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles);
-
/* in sslcert.c */
void gui_cert_verify(nsurl *url,
const struct ssl_cert_info *certs, unsigned long num,
diff --git a/riscos/save.c b/riscos/save.c
index cc12344..d58da1a 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -35,6 +35,13 @@
#include "oslib/osspriteop.h"
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
+
+#include "utils/config.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/url.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "desktop/hotlist.h"
@@ -43,8 +50,10 @@
#include "desktop/save_complete.h"
#include "desktop/save_text.h"
#include "desktop/thumbnail.h"
+#include "desktop/gui.h"
#include "image/bitmap.h"
#include "render/form.h"
+
#include "riscos/bitmap.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
@@ -60,12 +69,6 @@
#include "riscos/thumbnail.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
-#include "utils/config.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/url.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
//typedef enum
//{
diff --git a/riscos/textselection.c b/riscos/textselection.c
index c070754..68e71a9 100644
--- a/riscos/textselection.c
+++ b/riscos/textselection.c
@@ -25,25 +25,27 @@
#include <string.h>
#include "oslib/osfile.h"
#include "oslib/wimp.h"
+
+#include "utils/log.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
#include "content/hlcache.h"
#include "desktop/gui.h"
#include "desktop/textinput.h"
+
#include "riscos/gui.h"
#include "riscos/menus.h"
#include "riscos/message.h"
#include "riscos/mouse.h"
#include "riscos/save.h"
#include "riscos/textselection.h"
-#include "utils/log.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
+
#ifndef wimp_DRAG_CLAIM_SUPPRESS_DRAGBOX
#define wimp_DRAG_CLAIM_SUPPRESS_DRAGBOX ((wimp_drag_claim_flags) 0x2u)
#endif
-
/** Receive of Dragging message has claimed it */
static bool dragging_claimed = false;
static wimp_t dragging_claimant;
@@ -194,7 +196,7 @@ static void ro_gui_selection_drag_end(wimp_dragged *drag, void *data)
* \param styles Array of styles given to text runs, owned by core, or NULL
* \param n_styles Number of text run styles in array
*/
-void gui_set_clipboard(const char *buffer, size_t length,
+static void gui_set_clipboard(const char *buffer, size_t length,
nsclipboard_styles styles[], int n_styles)
{
char *new_cb;
@@ -245,7 +247,7 @@ void gui_set_clipboard(const char *buffer, size_t length,
* \param buffer UTF-8 text, allocated by front end, ownership yielded to core
* \param length Byte length of UTF-8 text in buffer
*/
-void gui_get_clipboard(char **buffer, size_t *length)
+static void gui_get_clipboard(char **buffer, size_t *length)
{
*buffer = NULL;
*length = 0;
@@ -652,3 +654,10 @@ void ro_gui_dragging_bounced(wimp_message *message)
{
dragging_claimed = false;
}
+
+static struct gui_clipboard_table clipboard_table = {
+ .get = gui_get_clipboard,
+ .set = gui_set_clipboard,
+};
+
+struct gui_clipboard_table *riscos_clipboard_table = &clipboard_table;
diff --git a/riscos/textselection.h b/riscos/textselection.h
index a4f436d..400e3dd 100644
--- a/riscos/textselection.h
+++ b/riscos/textselection.h
@@ -24,7 +24,8 @@
#define _NETSURF_RISCOS_TEXTSELECTION_H_
#include "oslib/wimp.h"
-#include "desktop/gui.h"
+
+struct gui_clipboard_table *riscos_clipboard_table;
void gui_start_selection(struct gui_window *g);
diff --git a/riscos/window.c b/riscos/window.c
index ed0f9e2..72230a7 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -40,7 +40,15 @@
#include "oslib/osspriteop.h"
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
+
#include "utils/config.h"
+#include "utils/nsoption.h"
+#include "utils/log.h"
+#include "utils/talloc.h"
+#include "utils/url.h"
+#include "utils/utf8.h"
+#include "utils/utils.h"
+#include "utils/messages.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
@@ -58,6 +66,7 @@
#include "desktop/gui.h"
#include "render/form.h"
#include "render/html.h"
+
#include "riscos/bitmap.h"
#include "riscos/buffer.h"
#include "riscos/cookies.h"
@@ -69,7 +78,6 @@
#include "riscos/hotlist.h"
#include "riscos/menus.h"
#include "riscos/mouse.h"
-#include "utils/nsoption.h"
#include "riscos/oslib_pre7.h"
#include "riscos/save.h"
#include "riscos/content-handlers/sprite.h"
@@ -82,12 +90,6 @@
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/window.h"
-#include "utils/log.h"
-#include "utils/talloc.h"
-#include "utils/url.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
-#include "utils/messages.h"
void gui_window_redraw_window(struct gui_window *g);
--
NetSurf Browser
9 years, 1 month