Merge branch 'master' of git://git.netsurf-browser.org/netsurf

This commit is contained in:
Chris Young 2012-10-22 20:01:51 +01:00
commit bcd43d3f59
34 changed files with 570 additions and 260 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 294 B

View File

@ -10,9 +10,9 @@
<ul class="nslinks">
<li><a href="http://www.netsurf-browser.org/">NetSurf Website</a></li>
<li><a href="/documentation/">Dokumentation</a></li>
<li><a href="/downloads/">Download neustes NetSurf</a></li>
<li><a href="/contact/">Kontakt zu den Entwicklern</a></li>
<li><a href="http://www.netsurf-browser.org/documentation/">Dokumentation</a></li>
<li><a href="http://www.netsurf-browser.org/downloads/">Download neustes NetSurf</a></li>
<li><a href="http://www.netsurf-browser.org/contact/">Kontakt zu den Entwicklern</a></li>
</ul>
<div class="onlycontent">

View File

@ -10,9 +10,9 @@
<ul class="nslinks">
<li><a href="http://www.netsurf-browser.org/">Pagina principale</a></li>
<li><a href="/documentation/">Documentazione</a></li>
<li><a href="/downloads/">Scarica NetSurf</a></li>
<li><a href="/contact/">Contatta gli sviluppatori</a></li>
<li><a href="http://www.netsurf-browser.org/documentation/">Documentazione</a></li>
<li><a href="http://www.netsurf-browser.org/downloads/">Scarica NetSurf</a></li>
<li><a href="http://www.netsurf-browser.org/contact/">Contatta gli sviluppatori</a></li>
</ul>
<div class="onlycontent">

View File

@ -11,9 +11,9 @@
<ul class="nslinks">
<li><a href="http://www.netsurf-browser.org/">NetSurfウェブサイト</a></li>
<li><a href="/documentation/">ドキュメンテーション</a></li>
<li><a href="/downloads/">最新のNetSurfをダウンロード</a></li>
<li><a href="/contact/">開発者とコンタクト</a></li>
<li><a href="http://www.netsurf-browser.org/documentation/">ドキュメンテーション</a></li>
<li><a href="http://www.netsurf-browser.org/downloads/">最新のNetSurfをダウンロード</a></li>
<li><a href="http://www.netsurf-browser.org/contact/">開発者とコンタクト</a></li>
</ul>
<div class="onlycontent">

View File

@ -64,7 +64,7 @@ else
ifeq ($(SUBTARGET),os3)
LDFLAGS += -liconv
else
LDFLAGS += -lauto -lpbl
LDFLAGS += -lauto -lpbl -liconv
endif
ifeq ($(NETSURF_AMIGA_CAIRO_AVAILABLE),yes)

View File

@ -259,10 +259,10 @@ ULONG ami_font_scan_fonts(struct MinList *list,
do {
nnode = (struct nsObject *)GetSucc((struct Node *)node);
ami_font_scan_gui_update(win, node->dtz_Node.ln_Name, font_num, total);
LOG(("Scanning %s\n", node->dtz_Node.ln_Name));
LOG(("Scanning %s", node->dtz_Node.ln_Name));
found = ami_font_scan_font(node->dtz_Node.ln_Name, glypharray);
total += found;
LOG(("Found %ld new glyphs (total = %ld)\n", found, total));
LOG(("Found %ld new glyphs (total = %ld)", found, total));
font_num++;
} while(node = nnode);
@ -308,7 +308,7 @@ ULONG ami_font_scan_list(struct MinList *list)
if(node) {
node->dtz_Node.ln_Name = strdup(af[i].af_Attr.ta_Name);
found++;
LOG(("Added %s\n", af[i].af_Attr.ta_Name));
LOG(("Added %s", af[i].af_Attr.ta_Name));
}
}
}
@ -493,31 +493,4 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save,
LOG(("Initialised with %ld glyphs", found));
}
#ifdef AMI_FONT_SCAN_STANDALONE
/* This can be compiled as standalone using:
* gcc -o font_scan font_scan.c object.c -lwapcaplet -lauto -I .. -D__USE_INLINE__ -DAMI_FONT_SCAN_STANDALONE
*/
int main(int argc, char** argv)
{
lwc_string *glypharray[0xffff + 1];
ULONG found = 0;
BPTR fh;
struct MinList *list;
if(argc < 2) return 5;
printf("%s\n",argv[1]);
list = NewObjList();
ami_font_scan_init(argv[1], list, glypharray);
FreeObjList(list);
ami_font_scan_fini(glypharray);
return 0;
}
void ami_font_close(APTR discard) { }
void ami_mime_entry_free(APTR discard) { }
#endif

View File

@ -158,6 +158,7 @@ static char *current_user_dir;
const char tree_directory_icon_name[] = "def_drawer.info";
const char tree_content_icon_name[] = "def_project.info";
static const __attribute__((used)) char *stack_cookie = "\0$STACK:131072\0";
static struct DrawInfo *dri;
@ -540,6 +541,13 @@ nsurl *gui_get_resource_url(const char *path)
return url;
}
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
ami_set_options(); /* check options and set defaults where required */
}
void gui_init(int argc, char** argv)
{
BPTR lock = 0;
@ -549,8 +557,6 @@ void gui_init(int argc, char** argv)
ami_clipboard_init();
ami_openurl_open();
ami_set_options(); /* check options and set defaults where required */
win_destroyed = false;
nsscreentitle = ASPrintf("NetSurf %s",netsurf_version);

View File

@ -104,6 +104,9 @@ int window_create( struct gui_window * gw,
if( inflags & WIDGET_RESIZE ){
flags |= ( SIZER );
}
if( inflags & WIDGET_STATUSBAR ){
flags |= ( INFO );
}
gw->root = malloc( sizeof(struct s_gui_win_root) );
if( gw->root == NULL )
@ -142,7 +145,9 @@ int window_create( struct gui_window * gw,
/* create statusbar component: */
if( sb ) {
gw->root->statusbar = sb_create( gw );
#ifdef WITH_COMOPONENT_STATUSBAR
mt_CompAttach( &app, gw->root->cmproot, gw->root->statusbar->comp );
#endif
} else {
gw->root->statusbar = NULL;
}
@ -231,7 +236,7 @@ void window_open( struct gui_window * gw, GRECT pos )
plot_set_dimensions(br.g_x, br.g_y, br.g_w, br.g_h);
gw->browser->attached = true;
if( gw->root->statusbar != NULL ){
gw->root->statusbar->attached = true;
sb_attach(gw->root->statusbar, gw);
}
tb_adjust_size( gw );
/*TBD: get already present content and set size? */
@ -247,7 +252,7 @@ void window_update_back_forward( struct gui_window * gw)
tb_update_buttons( gw, -1 );
}
void window_set_stauts( struct gui_window * gw , char * text )
void window_set_stauts(struct gui_window * gw , char * text )
{
if( gw->root == NULL )
return;
@ -428,13 +433,11 @@ static void __CDECL evnt_window_dd( WINDOW *win, short wbuff[8], void * data )
if( !strncmp( ext, "ARGS", 4) && dd_msg > 0)
{
ddreply(dd_hdl, DD_OK);
buff = (char*)alloca(sizeof(char)*(size+1));
if( buff != NULL )
{
if( Fread(dd_hdl, size, buff ) == size)
buff = (char*)malloc(sizeof(char)*(size+1));
if (buff != NULL)
{
if (Fread(dd_hdl, size, buff ) == size)
buff[size] = 0;
}
LOG(("file: %s, ext: %s, size: %d dropped at: %d,%d\n",
(char*)buff, (char*)&ext,
size, mx, my
@ -451,8 +454,9 @@ static void __CDECL evnt_window_dd( WINDOW *win, short wbuff[8], void * data )
utf8_convert_ret ret;
char *utf8_fn;
ret = utf8_from_local_encoding( buff, 0, &utf8_fn);
ret = utf8_from_local_encoding(buff, 0, &utf8_fn);
if (ret != UTF8_CONVERT_OK) {
free(buff);
/* A bad encoding should never happen */
LOG(("utf8_from_local_encoding failed"));
assert(ret != UTF8_CONVERT_BADENC);
@ -463,7 +467,8 @@ static void __CDECL evnt_window_dd( WINDOW *win, short wbuff[8], void * data )
mx+gw->browser->scroll.current.x,
my+gw->browser->scroll.current.y,
utf8_fn );
free( utf8_fn );
free(utf8_fn);
free(buff);
}
}
}

View File

@ -41,7 +41,7 @@ char * local_file_to_url( const char * filename )
return( NULL );
}
char * fname_local = alloca( strlen(filename)+1 );
char * fname_local = malloc( strlen(filename)+1 );
char * start = (char*)fname_local;
strcpy( start, filename );
@ -72,6 +72,9 @@ char * local_file_to_url( const char * filename )
url = malloc( strlen(start) + FILE_SCHEME_PREFIX_LEN + 1);
strcpy( url, FILE_SCHEME_PREFIX );
strcat( url, start );
free(fname_local);
return( url );
#undef BACKSLASH
}

View File

@ -911,6 +911,17 @@ nsurl *gui_get_resource_url(const char *path)
return url;
}
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
nsoption_setnull_charp(cookie_file, strdup("cookies"));
if (nsoption_charp(cookie_file) == NULL) {
die("Failed initialising string options");
}
}
static void gui_init(int argc, char** argv)
{
char buf[PATH_MAX];
@ -961,9 +972,6 @@ static void gui_init(int argc, char** argv)
urldb_load(nsoption_charp(url_file));
}
if (nsoption_charp(cookie_file) == NULL ){
nsoption_set_charp(cookie_file, (char*)"cookies");
}
LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) ));
if( strlen(nsoption_charp(cookie_file)) ){
urldb_load_cookies(nsoption_charp(cookie_file));

View File

@ -45,6 +45,7 @@
#include "atari/plot/plot.h"
#include "atari/osspec.h"
#ifdef WITH_CUSTOM_STATUSBAR
extern int atari_plot_vdi_handle;
static
@ -183,6 +184,7 @@ void sb_destroy( CMP_STATUSBAR s )
void sb_set_text( CMP_STATUSBAR sb , char * text )
{
LGRECT work;
assert( sb != NULL );
assert( sb->comp != NULL );
@ -198,3 +200,41 @@ void sb_set_text( CMP_STATUSBAR sb , char * text )
}
}
}
#else
CMP_STATUSBAR sb_create( struct gui_window * gw )
{
CMP_STATUSBAR s = malloc( sizeof(struct s_statusbar) );
s->attached = false;
sb_set_text( s, (char*)"" );
return( s );
}
void sb_destroy( CMP_STATUSBAR s )
{
LOG(("%s\n", __FUNCTION__ ));
if( s ) {
free( s );
}
}
void sb_attach(CMP_STATUSBAR sb, struct gui_window * gw)
{
sb->aes_win = gw->root->handle->handle;
sb->attached = true;
}
void sb_set_text(CMP_STATUSBAR sb, char * text )
{
LGRECT work;
assert( sb != NULL );
strncpy(sb->text, text, STATUSBAR_MAX_SLEN);
sb->text[STATUSBAR_MAX_SLEN]=0;
sb->textlen = strlen(sb->text);
if(sb->attached){
wind_set_str(sb->aes_win, WF_INFO, sb->text);
}
}
#endif

View File

@ -24,14 +24,18 @@
struct s_statusbar
{
#ifdef WITH_COMPONENT_STATUSBAR
COMPONENT * comp;
#endif
char text[STATUSBAR_MAX_SLEN+1];
size_t textlen;
bool attached;
short aes_win;
};
CMP_STATUSBAR sb_create( struct gui_window * gw );
void sb_destroy( CMP_STATUSBAR s );
void sb_set_text( CMP_STATUSBAR sb , char * text );
void sb_attach(CMP_STATUSBAR sb, struct gui_window * gw);
#endif

View File

@ -475,6 +475,12 @@ int main(int argc, char** argv)
return 0;
}
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
}
void gui_init(int argc, char** argv)
{

View File

@ -41,7 +41,9 @@ endif
CFLAGS += -I/usr/include/libxml2
CFLAGS += -include cocoa/Prefix.pch
VERSION_FULL := $(shell sed -n '/\"/{s/.*"\(.*\)\".*/\1/;p;}' desktop/version.c)
# VERSION_FULL := $(shell sed -n '/\"/{s/.*"\(.*\)\".*/\1/;p;}' desktop/version.c)
# TODO: this needs fixing properly everywhere
VERSION_FULL := "3.0 (Dev)"
VERSION_MAJ := $(shell sed -n '/_major/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
VERSION_MIN := $(shell sed -n '/_minor/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
@ -218,12 +220,27 @@ NetSurf.app/Contents/Info.plist: cocoa/res/NetSurf-Info.plist cocoa/Makefile.tar
package-cocoa: NetSurf.dmg
.INTERMEDIATE: NetSurf.tmp.dmg
NetSurf.tmp.dmg: NetSurf.app
hdiutil create -size 8m -fs HFS+ -volname "NetSurf" $@
sleep 2
hdiutil attach $@
cp -a $^ /Volumes/NetSurf/
sleep 2
cp -pPR $^ /Volumes/NetSurf/
hdiutil detach $$(echo $$(hdiutil attach $@ | cut -f 1) | cut -f 1 -d ' ')
sleep 2
NetSurf.dmg: NetSurf.tmp.dmg
hdiutil convert $^ -format UDZO -o $@
CLEANS += clean-package-cocoa
clean-package-cocoa:
$(VQ)echo " CLEAN: NetSurf.tmp.dmg"
$(Q)$(RM) NetSurf.tmp.dmg
$(VQ)echo " CLEAN: NetSurf.dmg"
$(Q)$(RM) NetSurf.dmg
$(VQ)echo " CLEAN: NetSurf.app"
$(Q)$(RM) -r NetSurf.app

View File

@ -164,15 +164,21 @@ void cocoa_autorelease( void )
pool = [[NSAutoreleasePool alloc] init];
}
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
const char * const ca_bundle = [[[NSBundle mainBundle] pathForResource: @"ca-bundle" ofType: @""] UTF8String];
nsoption_setnull_charp(ca_bundle, strdup(ca_bundle));
}
int main( int argc, char **argv )
{
cocoa_autorelease();
const char * const messages = [[[NSBundle mainBundle] pathForResource: @"Messages" ofType: @""] UTF8String];
const char * const options = cocoa_get_options_file();
const char * const ca_bundle = [[[NSBundle mainBundle] pathForResource: @"ca-bundle" ofType: @""] UTF8String];
nsoption_setnull_charp(ca_bundle, strdup(ca_bundle));
netsurf_init(&argc, &argv, options, messages);

View File

@ -67,6 +67,7 @@ typedef enum {
CONTENT_MSG_READY, /**< may be displayed */
CONTENT_MSG_DONE, /**< finished */
CONTENT_MSG_ERROR, /**< error occurred */
CONTENT_MSG_ERRORCODE, /**< error occurred return nserror */
CONTENT_MSG_STATUS, /**< new status string */
CONTENT_MSG_REFORMAT, /**< content_reformat done */
CONTENT_MSG_REDRAW, /**< needs redraw (eg. new animation frame) */
@ -97,6 +98,8 @@ struct content_rfc5988_link {
union content_msg_data {
/** CONTENT_MSG_ERROR - Error message */
const char *error;
/** CONTENT_MSG_ERRORCODE - Error code */
nserror errorcode;
/** CONTENT_MSG_REDRAW - Area of content which needs redrawing */
struct {
int x, y, width, height;

View File

@ -1187,6 +1187,127 @@ static void browser_window_update_favicon(hlcache_handle *c,
nsurl_unref(nsurl);
}
/** window callback errorcode handling */
static void
browser_window_callback_errorcode(hlcache_handle *c,
struct browser_window *bw,
nserror code)
{
const char* message;
switch (code) {
case NSERROR_OK:
/**< No error */
message = messages_get("OK");
break;
case NSERROR_NOMEM:
/**< Memory exhaustion */
message = messages_get("NoMemory");
break;
case NSERROR_NO_FETCH_HANDLER:
/**< No fetch handler for URL scheme */
message = messages_get("NoHandler");
break;
case NSERROR_NOT_FOUND:
/**< Requested item not found */
message = messages_get("NotFound");
break;
case NSERROR_SAVE_FAILED:
/**< Failed to save data */
message = messages_get("SaveFailed");
break;
case NSERROR_CLONE_FAILED:
/**< Failed to clone handle */
message = messages_get("CloneFailed");
break;
case NSERROR_INIT_FAILED:
/**< Initialisation failed */
message = messages_get("InitFailed");
break;
case NSERROR_MNG_ERROR:
/**< An MNG error occurred */
message = messages_get("MNGError");
break;
case NSERROR_BAD_ENCODING:
/**< The character set is unknown */
message = messages_get("BadEncoding");
break;
case NSERROR_NEED_DATA:
/**< More data needed */
message = messages_get("NeedData");
break;
case NSERROR_ENCODING_CHANGE:
/**< The character set encoding change was unhandled */
message = messages_get("EncodingChanged");
break;
case NSERROR_BAD_PARAMETER:
/**< Bad Parameter */
message = messages_get("BadParameter");
break;
case NSERROR_INVALID:
/**< Invalid data */
message = messages_get("Invalid");
break;
case NSERROR_BOX_CONVERT:
/**< Box conversion failed */
message = messages_get("BoxConvert");
break;
case NSERROR_STOPPED:
/**< Content conversion stopped */
message = messages_get("Stopped");
break;
case NSERROR_DOM:
/**< DOM call returned error */
message = messages_get("ParsingFail");
break;
case NSERROR_BAD_URL:
/**< Bad URL */
message = messages_get("BadURL");
break;
default:
case NSERROR_UNKNOWN:
/**< Unknown error */
message = messages_get("Unknown");
break;
}
browser_window_set_status(bw, message);
/* Only warn the user about errors in top-level windows */
if (bw->browser_window_type == BROWSER_WINDOW_NORMAL) {
warn_user(message, 0);
}
if (c == bw->loading_content) {
bw->loading_content = NULL;
} else if (c == bw->current_content) {
bw->current_content = NULL;
browser_window_remove_caret(bw);
}
hlcache_handle_release(c);
browser_window_stop_throbber(bw);
}
/**
* Callback for fetchcache() for browser window fetches.
*/
@ -1320,6 +1441,10 @@ nserror browser_window_callback(hlcache_handle *c,
browser_window_refresh, bw);
break;
case CONTENT_MSG_ERRORCODE:
browser_window_callback_errorcode(c, bw, event->data.errorcode);
break;
case CONTENT_MSG_ERROR:
browser_window_set_status(bw, event->data.error);

View File

@ -287,11 +287,14 @@ bool history_global_initialise(struct tree *tree, const char* folder_icon_name)
if (!history_global_initialise_nodes())
return false;
LOG(("Building history tree"));
global_history_initialised = true;
urldb_iterate_entries(global_history_add_internal);
global_history_initialised = false;
tree_set_node_expanded(global_history_tree, global_history_tree_root,
false, true, true);
LOG(("History tree built"));
return true;
}

View File

@ -166,6 +166,7 @@ nserror netsurf_init(int *pargc,
LOG(("Using '%s' for Options file", options));
nsoption_read(options);
gui_options_init_defaults();
messages_load(messages);

View File

@ -114,13 +114,16 @@ extern struct ns_options nsoptions;
} \
} while (0)
#define nsoption_setnull_charp(OPTION, VALUE) do { \
#define nsoption_setnull_charp(OPTION, VALUE) \
do { \
if (nsoptions.OPTION == NULL) { \
nsoptions.OPTION = VALUE; \
if (*nsoptions.OPTION == 0) { \
free(nsoptions.OPTION); \
nsoptions.OPTION = NULL; \
} \
} else { \
free(VALUE); \
} \
} while (0)
@ -175,5 +178,10 @@ int nsoption_snoptionf(char *string, size_t size, unsigned int option,
*/
void nsoption_commandline(int *pargc, char **argv);
/**
* Set default values for unset front-end specific options
*/
void gui_options_init_defaults(void);
#endif

View File

@ -17,6 +17,8 @@ NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
NETSURF_FEATURE_HUBBUB_CFLAGS := -DWITH_HUBBUB
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0
NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0
CFLAGS += -Dnsframebuffer
@ -39,6 +41,8 @@ CFLAGS += '-DNETSURF_FB_FONT_FANTASY="$(NETSURF_FB_FONT_FANTASY)"'
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add,JS,mozilla-js,JavaScript))
CFLAGS += -std=c99 -g -I. -Dsmall $(WARNFLAGS) \
-D_BSD_SOURCE \

View File

@ -476,26 +476,27 @@ process_cmdline(int argc, char** argv)
return true;
}
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
nsoption_setnull_charp(cookie_file, strdup("~/.netsurf/Cookies"));
nsoption_setnull_charp(cookie_jar, strdup("~/.netsurf/Cookies"));
if (nsoption_charp(cookie_file) == NULL ||
nsoption_charp(cookie_jar == NULL)) {
die("Failed initialising cookie options");
}
}
static void
gui_init(int argc, char** argv)
{
nsfb_t *nsfb;
/* Override, since we have no support for non-core SELECT menu */
nsoption_set_bool(core_select_menu, true);
if (nsoption_charp(cookie_file) == NULL) {
nsoption_set_charp(cookie_file, strdup("~/.netsurf/Cookies"));
LOG(("Using '%s' as Cookies file", nsoption_charp(cookie_file)));
}
if (nsoption_charp(cookie_jar) == NULL) {
nsoption_set_charp(cookie_jar, strdup("~/.netsurf/Cookies"));
LOG(("Using '%s' as Cookie Jar file", nsoption_charp(cookie_jar)));
}
if (nsoption_charp(cookie_file) == NULL || nsoption_charp(cookie_jar == NULL))
die("Failed initialising cookie options");
if (process_cmdline(argc,argv) != true)
die("unable to process command line.\n");

View File

@ -241,11 +241,49 @@ nsgtk_init_glade(char **respath)
widWarning = GTK_WIDGET(gtk_builder_get_object(gladeWarning, "labelWarning"));
}
static void check_options(char **respath)
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
char *hdir = getenv("HOME");
char buf[PATH_MAX];
/* Set defaults for absent option strings */
snprintf(buf, PATH_MAX, "%s/.netsurf/Cookies", hdir);
nsoption_setnull_charp(cookie_file, strdup(buf));
nsoption_setnull_charp(cookie_jar, strdup(buf));
if (nsoption_charp(cookie_file) == NULL ||
nsoption_charp(cookie_jar) == NULL)
die("Failed initialising cookie options");
if (nsoption_charp(downloads_directory) == NULL) {
snprintf(buf, PATH_MAX, "%s/", hdir);
nsoption_set_charp(downloads_directory, strdup(buf));
}
if (nsoption_charp(url_file) == NULL) {
snprintf(buf, PATH_MAX, "%s/.netsurf/URLs", hdir);
nsoption_set_charp(url_file, strdup(buf));
}
if (nsoption_charp(hotlist_path) == NULL) {
snprintf(buf, PATH_MAX, "%s/.netsurf/Hotlist", hdir);
nsoption_set_charp(hotlist_path, strdup(buf));
}
nsoption_setnull_charp(ca_path, strdup("/etc/ssl/certs"));
if (nsoption_charp(url_file) == NULL ||
nsoption_charp(ca_path) == NULL ||
nsoption_charp(downloads_directory) == NULL ||
nsoption_charp(hotlist_path) == NULL) {
die("Failed initialising string options");
}
}
static void check_options(char **respath)
{
char *hdir = getenv("HOME");
char buf[PATH_MAX];
nsoption_set_bool(core_select_menu, true);
/* Attempt to handle nonsense status bar widths. These may exist
@ -262,54 +300,10 @@ static void check_options(char **respath)
snprintf(buf, PATH_MAX, "%s/.netsurf/Choices", hdir);
options_file_location = strdup(buf);
/* VRS - I do not beleive these setting should search the
* resource path, they should just be set to the default
* values!
*/
if (nsoption_charp(cookie_file) == NULL) {
filepath_sfinddef(respath, buf, "Cookies", "~/.netsurf/");
LOG(("Using '%s' as Cookies file", buf));
nsoption_set_charp(cookie_file, strdup(buf));
}
if (nsoption_charp(cookie_jar) == NULL) {
filepath_sfinddef(respath, buf, "Cookies", "~/.netsurf/");
LOG(("Using '%s' as Cookie Jar file", buf));
nsoption_set_charp(cookie_jar, strdup(buf));
}
if (nsoption_charp(cookie_file) == NULL ||
nsoption_charp(cookie_jar) == NULL)
die("Failed initialising cookie options");
if (nsoption_charp(url_file) == NULL) {
filepath_sfinddef(respath, buf, "URLs", "~/.netsurf/");
LOG(("Using '%s' as URL file", buf));
nsoption_set_charp(url_file, strdup(buf));
}
if (nsoption_charp(ca_path) == NULL) {
filepath_sfinddef(respath, buf, "certs", "/etc/ssl/");
LOG(("Using '%s' as certificate path", buf));
nsoption_set_charp(ca_path, strdup(buf));
}
if (nsoption_charp(downloads_directory) == NULL) {
LOG(("Using '%s' as download directory", hdir));
nsoption_set_charp(downloads_directory, strdup(hdir));
}
filepath_sfinddef(respath, buf, "icons/", "~/.netsurf/");
LOG(("Using '%s' as Tree icons dir", buf));
tree_set_icon_dir(strdup(buf));
if (nsoption_charp(hotlist_path) == NULL) {
filepath_sfinddef(respath, buf, "Hotlist", "~/.netsurf/");
LOG(("Using '%s' as Hotlist file", buf));
nsoption_set_charp(hotlist_path, strdup(buf));
}
if (nsoption_charp(hotlist_path) == NULL)
die("Failed initialising hotlist option");
filepath_sfinddef(respath, buf, "Print", "~/.netsurf/");
LOG(("Using '%s' as Print Settings file", buf));
print_options_file_location = strdup(buf);

View File

@ -8,26 +8,30 @@
# ----------------------------------------------------------------------------
LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl libdom libcss)
LDFLAGS += $(shell $(PKG_CONFIG) --libs openssl)
LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl libdom libcss)
LDFLAGS += $(shell $(PKG_CONFIG) --libs openssl)
# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here
NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
NETSURF_FEATURE_WEBP_CFLAGS := -DWITH_WEBP
# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here
NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
NETSURF_FEATURE_WEBP_CFLAGS := -DWITH_WEBP
NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0
NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0
# add a line similar to below for each optional pkg-configed lib here
$(eval $(call pkg_config_find_and_add,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
# add a line similar to below for each optional pkg-configed lib here
$(eval $(call pkg_config_find_and_add,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
$(eval $(call pkg_config_find_and_add,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add,JS,mozilla-js,JavaScript))
# no pkg-config for this library
$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp -lvpx,WebP (libwebp)))
# no pkg-config for this library
$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp -lvpx,WebP (libwebp)))
MONKEYCFLAGS := -std=c99 -Dmonkey -Dnsmonkey \
-D_BSD_SOURCE \

View File

@ -91,6 +91,12 @@ static void quit_handler(int argc, char **argv)
netsurf_quit = true;
}
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
}
int
main(int argc, char **argv)
{

View File

@ -684,7 +684,7 @@ static char *form_url_encode(struct form *form,
{
char *name, *value;
char *s, *s2;
unsigned int len, len1;
unsigned int len, len1, len_init;
url_func_result url_err;
if (query_string)
@ -698,10 +698,10 @@ static char *form_url_encode(struct form *form,
if (query_string) {
s[0] = '?';
s[1] = '\0';
len = 1;
len_init = len = 1;
} else {
s[0] = '\0';
len = 0;
len_init = len = 0;
}
for (; control; control = control->next) {
@ -737,7 +737,8 @@ static char *form_url_encode(struct form *form,
free(value);
}
if (len)
if (len > len_init)
/* Replace trailing '&' */
s[len - 1] = '\0';
return s;
}

View File

@ -113,13 +113,14 @@ static void html_box_convert_done(html_content *c, bool success)
LOG(("Done XML to box (%p)", c));
/* Clean up and report error if unsuccessful or aborted */
if ((success == false) || c->aborted) {
if ((success == false) || (c->aborted)) {
if (success == false) {
msg_data.errorcode = NSERROR_BOX_CONVERT;
} else {
msg_data.errorcode = NSERROR_STOPPED;
}
html_destroy_objects(c);
if (success == false)
msg_data.error = messages_get("NoMemory");
else
msg_data.error = messages_get("Stopped");
content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
content_broadcast(&c->base, CONTENT_MSG_ERRORCODE, msg_data);
content_set_error(&c->base);
return;
}
@ -134,19 +135,22 @@ static void html_box_convert_done(html_content *c, bool success)
exc = dom_document_get_document_element(c->document, (void *) &html);
if ((exc != DOM_NO_ERR) || (html == NULL)) {
/** @todo should this call html_destroy_objects(c);
* like the other error paths
*/
LOG(("error retrieving html element from dom"));
msg_data.error = messages_get("ParsingFail");
content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
msg_data.errorcode = NSERROR_DOM;
content_broadcast(&c->base, CONTENT_MSG_ERRORCODE, msg_data);
content_set_error(&c->base);
return;
}
/* extract image maps - can't do this sensibly in xml_to_box */
if (imagemap_extract(c) == false) {
msg_data.errorcode = imagemap_extract(c);
if (msg_data.errorcode != NSERROR_OK) {
LOG(("imagemap extraction failed"));
html_destroy_objects(c);
msg_data.error = messages_get("NoMemory");
content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
content_broadcast(&c->base, CONTENT_MSG_ERRORCODE, msg_data);
content_set_error(&c->base);
dom_node_unref(html);
return;
@ -159,8 +163,9 @@ static void html_box_convert_done(html_content *c, bool success)
content_set_ready(&c->base);
if (c->base.active == 0)
if (c->base.active == 0) {
content_set_done(&c->base);
}
html_set_status(c, "");
dom_node_unref(html);
@ -413,9 +418,62 @@ html_create(const content_handler *handler,
return NSERROR_OK;
}
static nserror
parse_chunk_to_nserror(dom_hubbub_error error)
{
switch (error) {
/* HUBBUB_REPROCESS is not handled here because it can
* never occur outside the hubbub treebuilder
*/
case DOM_HUBBUB_OK:
/* parsed ok */
return NSERROR_OK;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_PAUSED):
/* hubbub input paused */
return NSERROR_OK;
case DOM_HUBBUB_NOMEM:
/* out of memory error from DOM */
return NSERROR_NOMEM;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_ENCODINGCHANGE):
/* encoding changed */
return NSERROR_ENCODING_CHANGE;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NOMEM):
/* out of memory error from parser */
return NSERROR_NOMEM;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADPARM):
return NSERROR_BAD_PARAMETER;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_INVALID):
return NSERROR_INVALID;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_FILENOTFOUND):
return NSERROR_NOT_FOUND;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NEEDDATA):
return NSERROR_NEED_DATA;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADENCODING):
return NSERROR_BAD_ENCODING;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_UNKNOWN):
/* currently only generated by the libdom hubbub binding */
default:
/* unknown error */
/** @todo better error handling and reporting */
return NSERROR_UNKNOWN;
}
return NSERROR_UNKNOWN;
}
static bool
static nserror
html_process_encoding_change(struct content *c,
const char *data,
unsigned int size)
@ -425,34 +483,30 @@ html_process_encoding_change(struct content *c,
const char *encoding;
const char *source_data;
unsigned long source_size;
union content_msg_data msg_data;
/* Retrieve new encoding */
encoding = dom_hubbub_parser_get_encoding(html->parser,
&html->encoding_source);
if (encoding == NULL) {
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
return false;
return NSERROR_NOMEM;
}
if (html->encoding != NULL)
if (html->encoding != NULL) {
free(html->encoding);
}
html->encoding = strdup(encoding);
if (html->encoding == NULL) {
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
return false;
return NSERROR_NOMEM;
}
/* Destroy binding */
dom_hubbub_parser_destroy(html->parser);
html->parser = NULL;
if (html->document != NULL)
if (html->document != NULL) {
dom_node_unref(html->document);
}
/* Create new binding, using the new encoding */
html->parser = dom_hubbub_parser_create(html->encoding,
@ -468,9 +522,7 @@ html_process_encoding_change(struct content *c,
free(html->encoding);
html->encoding = strdup("Windows-1252");
if (html->encoding == NULL) {
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
return false;
return NSERROR_NOMEM;
}
html->parser = dom_hubbub_parser_create(html->encoding,
@ -486,10 +538,7 @@ html_process_encoding_change(struct content *c,
* parser errors back instead of everything being
* OOM
*/
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
return false;
return NSERROR_NOMEM;
}
}
@ -498,21 +547,16 @@ html_process_encoding_change(struct content *c,
/* Reprocess all the data. This is safe because
* the encoding is now specified at parser start which means
* it cannot be changed again. */
error = dom_hubbub_parser_parse_chunk(html->parser, (const uint8_t *)source_data, source_size);
if ((error == DOM_HUBBUB_OK) ||
(error == (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_PAUSED))) {
return true;
}
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
return false;
* it cannot be changed again.
*/
error = dom_hubbub_parser_parse_chunk(html->parser,
(const uint8_t *)source_data,
source_size);
return parse_chunk_to_nserror(error);
}
/**
* Process data for CONTENT_HTML.
*/
@ -524,21 +568,27 @@ html_process_data(struct content *c, const char *data, unsigned int size)
dom_hubbub_error error;
union content_msg_data msg_data;
error = dom_hubbub_parser_parse_chunk(html->parser, (const uint8_t *) data, size);
msg_data.errorcode = NSERROR_OK; /* assume its all going to be ok */
if ((error == DOM_HUBBUB_OK) ||
(error == (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_PAUSED))) {
return true;
} else if (error == (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_ENCODINGCHANGE)) {
return html_process_encoding_change(c, data, size);
error = dom_hubbub_parser_parse_chunk(html->parser,
(const uint8_t *) data,
size);
msg_data.errorcode = parse_chunk_to_nserror(error);
/* deal with encoding change */
if (msg_data.errorcode == NSERROR_ENCODING_CHANGE) {
msg_data.errorcode = html_process_encoding_change(c, data, size);
}
/** @todo better error handling and reporting */
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
/* broadcast the error if necessary */
if (msg_data.errorcode != NSERROR_OK) {
content_broadcast(c, CONTENT_MSG_ERRORCODE, msg_data);
return false;
}
return true;
}

View File

@ -251,23 +251,25 @@ void imagemap_dump(html_content *c)
* \param map_str A dom_string which is "map"
* \return false on memory exhaustion, true otherwise
*/
bool
nserror
imagemap_extract(html_content *c)
{
dom_nodelist *nlist;
dom_exception exc;
unsigned long mapnr;
uint32_t maybe_maps;
nserror ret = NSERROR_OK;
exc = dom_document_get_elements_by_tag_name(c->document,
corestring_dom_map,
&nlist);
if (exc != DOM_NO_ERR) {
return false;
return NSERROR_DOM;
}
exc = dom_nodelist_get_length(nlist, &maybe_maps);
if (exc != DOM_NO_ERR) {
ret = NSERROR_DOM;
goto out_nlist;
}
@ -276,6 +278,7 @@ imagemap_extract(html_content *c)
dom_string *name;
exc = dom_nodelist_item(nlist, mapnr, &node);
if (exc != DOM_NO_ERR) {
ret = NSERROR_DOM;
goto out_nlist;
}
@ -283,6 +286,7 @@ imagemap_extract(html_content *c)
&name);
if (exc != DOM_NO_ERR) {
dom_node_unref(node);
ret = NSERROR_DOM;
goto out_nlist;
}
@ -292,6 +296,7 @@ imagemap_extract(html_content *c)
&name);
if (exc != DOM_NO_ERR) {
dom_node_unref(node);
ret = NSERROR_DOM;
goto out_nlist;
}
}
@ -301,6 +306,7 @@ imagemap_extract(html_content *c)
if (imagemap_extract_map(node, c, &entry) == false) {
dom_string_unref(name);
dom_node_unref(node);
ret = NSERROR_NOMEM; /** @todo check this */
goto out_nlist;
}
@ -313,6 +319,7 @@ imagemap_extract(html_content *c)
(imagemap_add(c, name, entry) == false)) {
dom_string_unref(name);
dom_node_unref(node);
ret = NSERROR_NOMEM; /** @todo check this */
goto out_nlist;
}
}
@ -321,14 +328,12 @@ imagemap_extract(html_content *c)
dom_node_unref(node);
}
dom_nodelist_unref(nlist);
return true;
out_nlist:
dom_nodelist_unref(nlist);
return false;
return ret;
}
/**

View File

@ -28,7 +28,7 @@ struct hlcache_handle;
void imagemap_destroy(struct html_content *c);
void imagemap_dump(struct html_content *c);
bool imagemap_extract(struct html_content *c);
nserror imagemap_extract(struct html_content *c);
nsurl *imagemap_get(struct html_content *c, const char *key,
unsigned long x, unsigned long y,

View File

@ -76,6 +76,7 @@ void nsfont_init(void)
nsfont_check_fonts();
LOG(("Initialise RUfl"));
code = rufl_init();
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
@ -87,6 +88,7 @@ void nsfont_init(void)
die("The Unicode font library could not be initialized. "
"Please report this to the developers.");
}
LOG(("RUfl initialised"));
if (rufl_family_list_entries == 0)
die("No fonts could be found. At least one font must be "

View File

@ -328,6 +328,47 @@ nsurl *gui_get_resource_url(const char *path)
return url;
}
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
nsoption_setnull_charp(theme, strdup("Aletheia"));
nsoption_setnull_charp(toolbar_browser, strdup("0123|58|9"));
nsoption_setnull_charp(toolbar_hotlist, strdup("40|12|3"));
nsoption_setnull_charp(toolbar_history, strdup("0|12|3"));
nsoption_setnull_charp(toolbar_cookies, strdup("0|12"));
nsoption_setnull_charp(ca_bundle, strdup("NetSurf:Resources.ca-bundle"));
nsoption_setnull_charp(cookie_file, strdup("NetSurf:Cookies"));
nsoption_setnull_charp(cookie_jar, strdup(CHOICES_PREFIX "Cookies"));
nsoption_setnull_charp(url_path, strdup("NetSurf:URL"));
nsoption_setnull_charp(url_save, strdup(CHOICES_PREFIX "URL"));
nsoption_setnull_charp(hotlist_path, strdup("NetSurf:Hotlist"));
nsoption_setnull_charp(hotlist_save, strdup(CHOICES_PREFIX "Hotlist"));
nsoption_setnull_charp(recent_path, strdup("NetSurf:Recent"));
nsoption_setnull_charp(recent_save, strdup(CHOICES_PREFIX "Recent"));
nsoption_setnull_charp(theme_path, strdup("NetSurf:Themes"));
nsoption_setnull_charp(theme_save, strdup(CHOICES_PREFIX "Themes"));
if (nsoption_charp(theme) == NULL ||
nsoption_charp(toolbar_browser) == NULL ||
nsoption_charp(toolbar_hotlist) == NULL ||
nsoption_charp(toolbar_history) == NULL ||
nsoption_charp(toolbar_cookies) == NULL ||
nsoption_charp(ca_bundle) == NULL ||
nsoption_charp(cookie_file) == NULL ||
nsoption_charp(cookie_jar) == NULL ||
nsoption_charp(url_path) == NULL ||
nsoption_charp(url_save) == NULL ||
nsoption_charp(hotlist_path) == NULL ||
nsoption_charp(hotlist_save) == NULL ||
nsoption_charp(recent_path) == NULL ||
nsoption_charp(recent_save) == NULL ||
nsoption_charp(theme_path) == NULL ||
nsoption_charp(theme_save) == NULL) {
die("Failed initialising string options");
}
}
/**
* Initialise the gui (RISC OS specific part).
*/
@ -347,6 +388,7 @@ static void gui_init(int argc, char** argv)
int length;
char *nsdir_temp;
byte *base;
char *tree_icons_dir;
/* re-enable all FPU exceptions/traps except inexact operations,
* which we're not interested in, and underflow which is incorrectly
@ -375,42 +417,11 @@ static void gui_init(int argc, char** argv)
ro_plot_patterned_lines = false;
}
/* Set defaults for absent option strings */
nsoption_setnull_charp(theme, strdup("Aletheia"));
nsoption_setnull_charp(toolbar_browser, strdup("0123|58|9"));
nsoption_setnull_charp(toolbar_hotlist, strdup("40|12|3"));
nsoption_setnull_charp(toolbar_history, strdup("0|12|3"));
nsoption_setnull_charp(toolbar_cookies, strdup("0|12"));
nsoption_setnull_charp(ca_bundle, strdup("NetSurf:Resources.ca-bundle"));
nsoption_setnull_charp(cookie_file, strdup("NetSurf:Cookies"));
nsoption_setnull_charp(cookie_jar, strdup(CHOICES_PREFIX "Cookies"));
nsoption_setnull_charp(url_path, strdup("NetSurf:URL"));
nsoption_setnull_charp(url_save, strdup(CHOICES_PREFIX "URL"));
nsoption_setnull_charp(hotlist_path, strdup("NetSurf:Hotlist"));
nsoption_setnull_charp(hotlist_save, strdup(CHOICES_PREFIX "Hotlist"));
nsoption_setnull_charp(recent_path, strdup("NetSurf:Recent"));
nsoption_setnull_charp(recent_save, strdup(CHOICES_PREFIX "Recent"));
nsoption_setnull_charp(theme_path, strdup("NetSurf:Themes"));
nsoption_setnull_charp(theme_save, strdup(CHOICES_PREFIX "Themes"));
tree_set_icon_dir(strdup("NetSurf:Resources.Icons"));
if (nsoption_charp(theme) == NULL ||
nsoption_charp(toolbar_browser) == NULL ||
nsoption_charp(toolbar_hotlist) == NULL ||
nsoption_charp(toolbar_history) == NULL ||
nsoption_charp(ca_bundle) == NULL ||
nsoption_charp(cookie_file) == NULL ||
nsoption_charp(cookie_jar) == NULL ||
nsoption_charp(url_path) == NULL ||
nsoption_charp(url_save) == NULL ||
nsoption_charp(hotlist_path) == NULL ||
nsoption_charp(hotlist_save) == NULL ||
nsoption_charp(recent_path) == NULL ||
nsoption_charp(recent_save) == NULL ||
nsoption_charp(theme_path) == NULL ||
nsoption_charp(theme_save) == NULL)
tree_icons_dir = strdup("NetSurf:Resources.Icons");
if (tree_icons_dir == NULL)
die("Failed initialising string options");
tree_set_icon_dir(tree_icons_dir);
/* Create our choices directories */
ro_gui_create_dirs();
@ -780,6 +791,8 @@ int main(int argc, char** argv)
setbuf(stderr, NULL);
/* Pass a NULL pointer for Messages path, because until the Choices
* are loaded in netsurf_init, we don't know the Messages path. */
netsurf_init(&argc, &argv, "NetSurf:Choices", NULL);
artworks_init();
@ -794,7 +807,9 @@ int main(int argc, char** argv)
"NetSurf:Resources.%s.Messages",
nsoption_charp(language))) < 0 || length >= (int)sizeof(path))
die("Failed to locate Messages resource.");
/* We disabled core Messages load, so have to load them here */
messages_load(path);
/* Also load some extra RISC OS specific Messages */
messages_load("NetSurf:Resources.LangNames");
gui_init(argc, argv);

View File

@ -29,6 +29,8 @@
typedef enum {
NSERROR_OK, /**< No error */
NSERROR_UNKNOWN, /**< Unknown error - DO *NOT* USE */
NSERROR_NOMEM, /**< Memory exhaustion */
NSERROR_NO_FETCH_HANDLER, /**< No fetch handler for URL scheme */
@ -47,7 +49,19 @@ typedef enum {
NSERROR_NEED_DATA, /**< More data needed */
NSERROR_BAD_URL /**< More data needed */
NSERROR_ENCODING_CHANGE, /**< The character changed */
NSERROR_BAD_PARAMETER, /**< Bad Parameter */
NSERROR_INVALID, /**< Invalid data */
NSERROR_BOX_CONVERT, /**< Box conversion failed */
NSERROR_STOPPED, /**< Content conversion stopped */
NSERROR_DOM, /**< DOM call returned error */
NSERROR_BAD_URL /**< Bad URL */
} nserror;
#endif

View File

@ -31,7 +31,7 @@ bool libdom_treewalk(dom_node *root,
void *ctx)
{
dom_node *node;
bool result = true;;
bool result = true;
node = dom_node_ref(root); /* tree root */

View File

@ -79,6 +79,15 @@ bool nslog_ensure(FILE *fptr)
return true;
}
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
/* ensure homepage option has a default */
nsoption_setnull_charp(homepage_url, strdup(NETSURF_HOMEPAGE));
}
/**
* Entry point from operating system
**/
@ -138,9 +147,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
nsws_window_init_pointers(hInstance);
/* ensure homepage option has a default */
nsoption_setnull_charp(homepage_url, strdup(NETSURF_HOMEPAGE));
/* If there is a url specified on the command line use it */
if (argc > 1) {
addr = argv[1];