r3269 rjek - in /trunk/netsurf/gtk: gtk_gui.c res/netsurf.glade
by netsurf@semichrome.net
Author: rjek
Date: Sun May 6 17:39:34 2007
New Revision: 3269
URL: http://svn.semichrome.net?rev=3D3269&view=3Drev
Log:
GTK warn_user() implementation
Modified:
trunk/netsurf/gtk/gtk_gui.c
trunk/netsurf/gtk/res/netsurf.glade
Modified: trunk/netsurf/gtk/gtk_gui.c
URL: http://svn.semichrome.net/trunk/netsurf/gtk/gtk_gui.c?rev=3D3269&r1=3D=
3268&r2=3D3269&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/gtk/gtk_gui.c (original)
+++ trunk/netsurf/gtk/gtk_gui.c Sun May 6 17:39:34 2007
@@ -57,7 +57,7 @@
struct gui_window *search_current_window =3D 0;
=
GtkWindow *wndAbout;
-
+GtkWindow *wndWarning;
GladeXML *gladeWindows;
GtkWindow *wndTooltip;
GtkLabel *labelTooltip;
@@ -234,6 +234,9 @@
fontdesc =3D pango_font_description_from_string("Monospace 8");
gtk_widget_modify_font(GTK_WIDGET(
glade_xml_get_widget(gladeWindows, "textviewGPL")), fontdesc);
+ =
+ wndWarning =3D GTK_WINDOW(glade_xml_get_widget(gladeWindows, "wndWarning"=
));
+
nsgtk_history_init();
}
=
@@ -382,6 +385,18 @@
=
void warn_user(const char *warning, const char *detail)
{
+ char buf[300]; /* 300 is the size the RISC OS GUI uses */
+
+ LOG(("%s %s", warning, detail));
+ fflush(stderr);
+
+ snprintf(buf, sizeof(buf), "%s %s", messages_get(warning),
+ detail ? detail : "");
+ buf[sizeof(buf) - 1] =3D 0;
+
+ gtk_label_set_text(GTK_LABEL(glade_xml_get_widget(gladeWindows, "labelWar=
ning")), buf);
+
+ gtk_widget_show_all(GTK_WIDGET(wndWarning));
}
=
void die(const char * const error)
Modified: trunk/netsurf/gtk/res/netsurf.glade
URL: http://svn.semichrome.net/trunk/netsurf/gtk/res/netsurf.glade?rev=3D32=
69&r1=3D3268&r2=3D3269&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/gtk/res/netsurf.glade (original)
+++ trunk/netsurf/gtk/res/netsurf.glade Sun May 6 17:39:34 2007
@@ -64,7 +64,6 @@
<child>
<widget class=3D"GtkMenuItem" id=3D"open_location">
<property name=3D"visible">True</property>
- <property name=3D"sensitive">True</property>
<property name=3D"tooltip" translatable=3D"yes">Open an address in=
to this browser window.</property>
<property name=3D"label" translatable=3D"yes">Open _location...</p=
roperty>
<property name=3D"use_underline">True</property>
@@ -5328,4 +5327,123 @@
</child>
</widget>
=
+<widget class=3D"GtkWindow" id=3D"wndWarning">
+ <property name=3D"title" translatable=3D"yes">Warning from NetSurf</prop=
erty>
+ <property name=3D"type">GTK_WINDOW_TOPLEVEL</property>
+ <property name=3D"window_position">GTK_WIN_POS_CENTER</property>
+ <property name=3D"modal">False</property>
+ <property name=3D"resizable">True</property>
+ <property name=3D"destroy_with_parent">False</property>
+ <property name=3D"icon_name">gtk-dialog-warning</property>
+ <property name=3D"decorated">True</property>
+ <property name=3D"skip_taskbar_hint">False</property>
+ <property name=3D"skip_pager_hint">False</property>
+ <property name=3D"type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name=3D"gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name=3D"focus_on_map">True</property>
+ <property name=3D"urgency_hint">True</property>
+
+ <child>
+ <widget class=3D"GtkVBox" id=3D"vbox32">
+ <property name=3D"border_width">2</property>
+ <property name=3D"visible">True</property>
+ <property name=3D"homogeneous">False</property>
+ <property name=3D"spacing">0</property>
+
+ <child>
+ <widget class=3D"GtkHBox" id=3D"hbox30">
+ <property name=3D"border_width">3</property>
+ <property name=3D"visible">True</property>
+ <property name=3D"homogeneous">False</property>
+ <property name=3D"spacing">0</property>
+
+ <child>
+ <widget class=3D"GtkImage" id=3D"image519">
+ <property name=3D"visible">True</property>
+ <property name=3D"icon_size">6</property>
+ <property name=3D"icon_name">gtk-dialog-warning</property>
+ <property name=3D"xalign">0.5</property>
+ <property name=3D"yalign">0.5</property>
+ <property name=3D"xpad">12</property>
+ <property name=3D"ypad">0</property>
+ </widget>
+ <packing>
+ <property name=3D"padding">0</property>
+ <property name=3D"expand">False</property>
+ <property name=3D"fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class=3D"GtkLabel" id=3D"labelWarning">
+ <property name=3D"visible">True</property>
+ <property name=3D"label" translatable=3D"yes">Help help help! I'm =
being held prisoner by a bunch of RISC OS zealots!</property>
+ <property name=3D"use_underline">False</property>
+ <property name=3D"use_markup">False</property>
+ <property name=3D"justify">GTK_JUSTIFY_LEFT</property>
+ <property name=3D"wrap">True</property>
+ <property name=3D"selectable">False</property>
+ <property name=3D"xalign">0.5</property>
+ <property name=3D"yalign">0.5</property>
+ <property name=3D"xpad">0</property>
+ <property name=3D"ypad">0</property>
+ <property name=3D"ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name=3D"width_chars">-1</property>
+ <property name=3D"single_line_mode">False</property>
+ <property name=3D"angle">0</property>
+ </widget>
+ <packing>
+ <property name=3D"padding">1</property>
+ <property name=3D"expand">True</property>
+ <property name=3D"fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name=3D"padding">0</property>
+ <property name=3D"expand">True</property>
+ <property name=3D"fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class=3D"GtkHSeparator" id=3D"hseparator2">
+ <property name=3D"visible">True</property>
+ </widget>
+ <packing>
+ <property name=3D"padding">3</property>
+ <property name=3D"expand">False</property>
+ <property name=3D"fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class=3D"GtkHButtonBox" id=3D"hbuttonbox2">
+ <property name=3D"visible">True</property>
+ <property name=3D"layout_style">GTK_BUTTONBOX_END</property>
+ <property name=3D"spacing">0</property>
+
+ <child>
+ <widget class=3D"GtkButton" id=3D"button14">
+ <property name=3D"visible">True</property>
+ <property name=3D"can_default">True</property>
+ <property name=3D"can_focus">True</property>
+ <property name=3D"label">gtk-ok</property>
+ <property name=3D"use_stock">True</property>
+ <property name=3D"relief">GTK_RELIEF_NORMAL</property>
+ <property name=3D"focus_on_click">True</property>
+ <signal name=3D"clicked" handler=3D"gtk_widget_hide" object=3D"wndW=
arning" last_modification_time=3D"Sun, 06 May 2007 16:35:28 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name=3D"padding">0</property>
+ <property name=3D"expand">False</property>
+ <property name=3D"fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
16 years
r3268 bursa - /trunk/netsurf/desktop/netsurf.c
by netsurf@semichrome.net
Author: bursa
Date: Sun May 6 07:11:00 2007
New Revision: 3268
URL: http://svn.semichrome.net?rev=3D3268&view=3Drev
Log:
Log libxml2 version in lib_init().
Modified:
trunk/netsurf/desktop/netsurf.c
Modified: trunk/netsurf/desktop/netsurf.c
URL: http://svn.semichrome.net/trunk/netsurf/desktop/netsurf.c?rev=3D3268&r=
1=3D3267&r2=3D3268&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/desktop/netsurf.c (original)
+++ trunk/netsurf/desktop/netsurf.c Sun May 6 07:11:00 2007
@@ -3,7 +3,7 @@
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
* Copyright 2003 Phil Mellor <monkeyson(a)users.sourceforge.net>
- * Copyright 2004 James Bursa <bursa(a)users.sourceforge.net>
+ * Copyright 2007 James Bursa <bursa(a)users.sourceforge.net>
* Copyright 2004 Andrew Timmins <atimmins(a)blueyonder.co.uk>
*/
=
@@ -12,6 +12,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/utsname.h>
+#include <libxml/encoding.h>
+#include <libxml/globals.h>
+#include <libxml/xmlversion.h>
#include "netsurf/utils/config.h"
#include "netsurf/content/fetch.h"
#include "netsurf/content/fetchcache.h"
@@ -120,12 +123,16 @@
/**
* Initialises the libraries used in NetSurf.
*/
-static void lib_init(void)
+void lib_init(void)
{
+ LOG(("xmlParserVersion %s, LIBXML_VERSION_STRING %s",
+ xmlParserVersion, LIBXML_VERSION_STRING));
+
/* Using encoding "X-SJIS" (unknown to libxmp2/iconv) instead as
* "Shift-JIS" is rather popular.
*/
- if (xmlAddEncodingAlias(xmlGetCharEncodingName(XML_CHAR_ENCODING_SHIFT_JI=
S), "X-SJIS") !=3D 0)
+ if (xmlAddEncodingAlias(xmlGetCharEncodingName(
+ XML_CHAR_ENCODING_SHIFT_JIS), "X-SJIS") !=3D 0)
die("Failed to add encoding alias");
}
=
16 years
r3267 bursa - /trunk/netsurf/content/fetch.c
by netsurf@semichrome.net
Author: bursa
Date: Sun May 6 06:55:13 2007
New Revision: 3267
URL: http://svn.semichrome.net?rev=3D3267&view=3Drev
Log:
Log curl_version() in fetch_init().
Modified:
trunk/netsurf/content/fetch.c
Modified: trunk/netsurf/content/fetch.c
URL: http://svn.semichrome.net/trunk/netsurf/content/fetch.c?rev=3D3267&r1=
=3D3266&r2=3D3267&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/content/fetch.c (original)
+++ trunk/netsurf/content/fetch.c Sun May 6 06:55:13 2007
@@ -41,7 +41,7 @@
#include "netsurf/desktop/netsurf.h"
#include "netsurf/desktop/options.h"
#include "netsurf/render/form.h"
-#define NDEBUG
+#undef NDEBUG
#include "netsurf/utils/log.h"
#include "netsurf/utils/messages.h"
#include "netsurf/utils/url.h"
@@ -141,7 +141,7 @@
* Assumes that the element is zeroed as appropriate.
*/
#define RING_INSERT(ring,element) \
- LOG(("RING_INSERT(%s, %p(%s))", #ring, element, element->host)); \
+ /*LOG(("RING_INSERT(%s, %p(%s))", #ring, element, element->host));*/ \
if (ring) { \
element->r_next =3D ring; \
element->r_prev =3D ring->r_prev; \
@@ -154,7 +154,7 @@
* Will zero the element as needed
*/
#define RING_REMOVE(ring, element) \
- LOG(("RING_REMOVE(%s, %p(%s)", #ring, element, element->host)); \
+ /*LOG(("RING_REMOVE(%s, %p(%s)", #ring, element, element->host));*/ \
if (element->r_next !=3D element ) { \
/* Not the only thing in the ring */ \
element->r_next->r_prev =3D element->r_prev; \
@@ -170,7 +170,7 @@
* provided element variable
*/
#define RING_FINDBYHOST(ring, element, hostname) \
- LOG(("RING_FINDBYHOST(%s, %s)", #ring, hostname)); \
+ /*LOG(("RING_FINDBYHOST(%s, %s)", #ring, hostname));*/ \
if (ring) { \
bool found =3D false; \
element =3D ring; \
@@ -186,7 +186,7 @@
=
/** Measure the size of a ring and put it in the supplied variable */
#define RING_GETSIZE(ringtype, ring, sizevar) \
- LOG(("RING_GETSIZE(%s)", #ring)); \
+ /*LOG(("RING_GETSIZE(%s)", #ring));*/ \
if (ring) { \
ringtype *p =3D ring; \
sizevar =3D 0; \
@@ -198,7 +198,7 @@
=
/** Count the number of elements in the ring which match the provided host=
name */
#define RING_COUNTBYHOST(ringtype, ring, sizevar, hostname) \
- LOG(("RING_COUNTBYHOST(%s, %s)", #ring, hostname)); \
+ /*LOG(("RING_COUNTBYHOST(%s, %s)", #ring, hostname));*/ \
if (ring) { \
ringtype *p =3D ring; \
sizevar =3D 0; \
@@ -221,6 +221,8 @@
void fetch_init(void)
{
CURLcode code;
+
+ LOG(("curl_version %s", curl_version()));
=
code =3D curl_global_init(CURL_GLOBAL_ALL);
if (code !=3D CURLE_OK)
@@ -619,11 +621,12 @@
{
int all_active, all_queued;
=
- if (!queue_ring) return; /* Nothing to do, the queue is empty */
+ if (!queue_ring)
+ return; /* Nothing to do, the queue is empty */
RING_GETSIZE(struct fetch, queue_ring, all_queued);
RING_GETSIZE(struct fetch, fetch_ring, all_active);
- while( all_queued && all_active < option_max_fetchers ) {
- LOG(("%d queued, %d fetching", all_queued, all_active));
+ while ( all_queued && all_active < option_max_fetchers ) {
+ /*LOG(("%d queued, %d fetching", all_queued, all_active));*/
if (fetch_choose_and_dispatch()) {
all_queued--;
all_active++;
@@ -1127,7 +1130,7 @@
return size * nmemb;
}
=
- LOG(("fetch %p, size %lu", f, size * nmemb));
+ /*LOG(("fetch %p, size %lu", f, size * nmemb));*/
=
if (f->abort || (!f->had_headers && fetch_process_headers(f))) {
f->stopped =3D true;
@@ -1135,7 +1138,7 @@
}
=
/* send data to the caller */
- LOG(("FETCH_DATA"));
+ /*LOG(("FETCH_DATA"));*/
f->callback(FETCH_DATA, f->p, data, size * nmemb);
=
if (f->abort) {
16 years
r3266 bursa - /trunk/netsurf/render/html.c
by netsurf@semichrome.net
Author: bursa
Date: Sun May 6 01:41:12 2007
New Revision: 3266
URL: http://svn.semichrome.net?rev=3D3266&view=3Drev
Log:
Return an error from html_convert() if the base stylesheet fails to load, i=
nstead of continuing to layout which will assert.
Modified:
trunk/netsurf/render/html.c
Modified: trunk/netsurf/render/html.c
URL: http://svn.semichrome.net/trunk/netsurf/render/html.c?rev=3D3266&r1=3D=
3265&r2=3D3266&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/render/html.c (original)
+++ trunk/netsurf/render/html.c Sun May 6 01:41:12 2007
@@ -2,7 +2,7 @@
* This file is part of NetSurf, http://netsurf-browser.org/
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
- * Copyright 2005 James Bursa <bursa(a)users.sourceforge.net>
+ * Copyright 2007 James Bursa <bursa(a)users.sourceforge.net>
*/
=
/** \file
@@ -396,11 +396,8 @@
}
=
/* get stylesheets */
- if (!html_find_stylesheets(c, head)) {
- msg_data.error =3D messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ if (!html_find_stylesheets(c, head))
return false;
- }
=
/* convert xml tree to box tree */
LOG(("XML to box"));
@@ -646,7 +643,7 @@
*
* \param c content structure
* \param head xml node of head element, or 0 if none
- * \return true on success, false on memory exhaustion
+ * \return true on success, false if an error occurred
*/
=
bool html_find_stylesheets(struct content *c, xmlNode *head)
@@ -665,7 +662,7 @@
c->data.html.stylesheet_content =3D talloc_array(c, struct content *,
STYLESHEET_START);
if (!c->data.html.stylesheet_content)
- return false;
+ goto no_memory;
c->data.html.stylesheet_content[STYLESHEET_ADBLOCK] =3D 0;
c->data.html.stylesheet_content[STYLESHEET_STYLE] =3D 0;
c->data.html.stylesheet_count =3D STYLESHEET_START;
@@ -678,7 +675,7 @@
STYLESHEET_BASE, c->width, c->height,
true, 0, 0, false, false);
if (!c->data.html.stylesheet_content[STYLESHEET_BASE])
- return false;
+ goto no_memory;
c->active++;
fetchcache_go(c->data.html.stylesheet_content[STYLESHEET_BASE],
c->url, html_convert_css_callback, (intptr_t) c,
@@ -692,7 +689,7 @@
STYLESHEET_ADBLOCK, c->width,
c->height, true, 0, 0, false, false);
if (!c->data.html.stylesheet_content[STYLESHEET_ADBLOCK])
- return false;
+ goto no_memory;
c->active++;
fetchcache_go(c->data.html.
stylesheet_content[STYLESHEET_ADBLOCK],
@@ -757,14 +754,14 @@
c->data.html.stylesheet_content,
struct content *, i + 1);
if (!stylesheet_content)
- return false;
+ goto no_memory;
c->data.html.stylesheet_content =3D stylesheet_content;
c->data.html.stylesheet_content[i] =3D fetchcache(url,
html_convert_css_callback,
(intptr_t) c, i, c->width, c->height,
true, 0, 0, false, false);
if (!c->data.html.stylesheet_content[i])
- return false;
+ goto no_memory;
c->active++;
fetchcache_go(c->data.html.stylesheet_content[i],
c->url,
@@ -802,14 +799,14 @@
content_create(c->data.html.
base_url);
if (!c->data.html.stylesheet_content[STYLESHEET_STYLE])
- return false;
+ goto no_memory;
if (!content_set_type(c->data.html.
stylesheet_content[STYLESHEET_STYLE],
CONTENT_CSS, "text/css",
params))
/** \todo not necessarily caused by
* memory exhaustion */
- return false;
+ goto no_memory;
}
=
/* can't just use xmlNodeGetContent(node), because that won't give
@@ -822,7 +819,7 @@
xmlFree(data);
/** \todo not necessarily caused by
* memory exhaustion */
- return false;
+ goto no_memory;
}
xmlFree(data);
}
@@ -839,7 +836,7 @@
(intptr_t) c, STYLESHEET_STYLE)) {
/* no memory */
c->data.html.stylesheet_content[STYLESHEET_STYLE] =3D 0;
- return false;
+ goto no_memory;
}
} else {
/* conversion failed */
@@ -858,16 +855,19 @@
gui_multitask();
}
=
-/* if (c->error) { */
-/* content_set_status(c, "Warning: some stylesheets failed to load"); */
-/* content_broadcast(c, CONTENT_MSG_STATUS, msg_data); */
-/* } */
-
- /* any of our stylesheets pointers could be NULL at this point if the
- CSS file(s) failed to load/fetch */
- if (c->data.html.stylesheet_content[STYLESHEET_BASE])
- css_set_origin(c->data.html.stylesheet_content[STYLESHEET_BASE],
+ /* check that the base stylesheet loaded; layout fails without it */
+ if (!c->data.html.stylesheet_content[STYLESHEET_BASE]) {
+ msg_data.error =3D "Base stylesheet failed to load";
+ content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ return false;
+ }
+
+ assert(c->data.html.stylesheet_content[STYLESHEET_BASE]);
+ css_set_origin(c->data.html.stylesheet_content[STYLESHEET_BASE],
CSS_ORIGIN_UA);
+
+ /* any of our other stylesheet pointers could be NULL at this point if
+ * the CSS file(s) failed to load/fetch */
if (c->data.html.stylesheet_content[STYLESHEET_ADBLOCK])
css_set_origin(c->data.html.stylesheet_content[
STYLESHEET_ADBLOCK], CSS_ORIGIN_UA);
@@ -883,9 +883,14 @@
c->data.html.stylesheet_content,
c->data.html.stylesheet_count);
if (!c->data.html.working_stylesheet)
- return false;
+ goto no_memory;
=
return true;
+
+no_memory:
+ msg_data.error =3D messages_get("NoMemory");
+ content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ return false;
}
=
=
@@ -905,6 +910,7 @@
if (css->type !=3D CONTENT_CSS) {
c->data.html.stylesheet_content[i] =3D 0;
c->active--;
+ LOG(("%s is not CSS", css->url));
content_add_error(c, "NotCSS", 0);
html_set_status(c, messages_get("NotCSS"));
content_broadcast(c, CONTENT_MSG_STATUS, data);
@@ -934,6 +940,7 @@
break;
=
case CONTENT_MSG_ERROR:
+ LOG(("stylesheet %s failed: %s", css->url, data.error));
/* The stylesheet we were fetching may have been
* redirected, in that case, the object pointers
* will differ, so ensure that the object that's
16 years
r3265 rjek - /trunk/netsurf/gtk/gtk_window.c
by netsurf@semichrome.net
Author: rjek
Date: Sat May 5 14:59:16 2007
New Revision: 3265
URL: http://svn.semichrome.net?rev=3D3265&view=3Drev
Log:
Initialise some of the gui_window structure for nsgtk to remove a condition=
al jump on uninitalised data later on
Modified:
trunk/netsurf/gtk/gtk_window.c
Modified: trunk/netsurf/gtk/gtk_window.c
URL: http://svn.semichrome.net/trunk/netsurf/gtk/gtk_window.c?rev=3D3265&r1=
=3D3264&r2=3D3265&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/gtk/gtk_window.c (original)
+++ trunk/netsurf/gtk/gtk_window.c Sat May 5 14:59:16 2007
@@ -97,7 +97,10 @@
}
=
LOG(("Creating gui window %p for browser window %p", g, bw));
- =
+ =
+ g->target_width =3D 0;
+ g->target_height =3D 0;
+
g->bw =3D bw;
g->current_pointer =3D GUI_POINTER_DEFAULT;
if (clone !=3D NULL)
16 years
r3264 bursa - /trunk/netsurf/render/box.c
by netsurf@semichrome.net
Author: bursa
Date: Wed May 2 04:20:01 2007
New Revision: 3264
URL: http://svn.semichrome.net?rev=3D3264&view=3Drev
Log:
Fix warning: format '%u' expects type 'unsigned int', but argument 3 has ty=
pe 'size_t'.
Modified:
trunk/netsurf/render/box.c
Modified: trunk/netsurf/render/box.c
URL: http://svn.semichrome.net/trunk/netsurf/render/box.c?rev=3D3264&r1=3D3=
263&r2=3D3264&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/render/box.c (original)
+++ trunk/netsurf/render/box.c Wed May 2 04:20:01 2007
@@ -528,7 +528,7 @@
}
=
if (box->text)
- fprintf(stderr, "%u '%.*s' ", box->byte_offset,
+ fprintf(stderr, "%li '%.*s' ", (unsigned long) box->byte_offset,
(int) box->length, box->text);
if (box->space)
fprintf(stderr, "space ");
16 years
r3263 bursa - /trunk/netsurf/css/css.c
by netsurf@semichrome.net
Author: bursa
Date: Wed May 2 04:17:19 2007
New Revision: 3263
URL: http://svn.semichrome.net?rev=3D3263&view=3Drev
Log:
Fix various warnings.
Modified:
trunk/netsurf/css/css.c
Modified: trunk/netsurf/css/css.c
URL: http://svn.semichrome.net/trunk/netsurf/css/css.c?rev=3D3263&r1=3D3262=
&r2=3D3263&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/css/css.c (original)
+++ trunk/netsurf/css/css.c Wed May 2 04:17:19 2007
@@ -395,7 +395,7 @@
=
c->data.css.css =3D malloc(sizeof *c->data.css.css);
parser =3D css_parser_Alloc(malloc);
- source_data =3D talloc_realloc(c, c->source_data, char,
+ source_data =3D (unsigned char *) talloc_realloc(c, c->source_data, char,
c->source_size + 10);
=
if (!c->data.css.css || !parser || !source_data) {
@@ -414,7 +414,7 @@
c->data.css.import_content =3D 0;
c->data.css.origin =3D CSS_ORIGIN_UA;
c->active =3D 0;
- c->source_data =3D source_data;
+ c->source_data =3D (char *) source_data;
=
for (i =3D 0; i !=3D 10; i++)
source_data[c->source_size + i] =3D 0;
@@ -424,13 +424,13 @@
while (current < end
&& (token =3D css_tokenise(¤t, end + 10,
&token_text))) {
- token_data.text =3D token_text;
+ token_data.text =3D (char *) token_text;
token_data.length =3D current - token_text;
css_parser_(parser, token, token_data, ¶m);
if (param.syntax_error) {
- LOG(("syntax error near offset %i (%s)",
- token_text - source_data,
- c->url));
+ LOG(("syntax error near offset %li (%s)",
+ (unsigned long) (token_text - source_data),
+ c->url));
param.syntax_error =3D false;
} else if (param.memory_error) {
LOG(("out of memory"));
@@ -1524,7 +1524,7 @@
return;
}
=
- strcpy(source_data, str);
+ strcpy((char *) source_data, str);
for (i =3D 0; i !=3D 10; i++)
source_data[length + i] =3D 0;
=
@@ -1535,12 +1535,12 @@
while (current < end
&& (token =3D css_tokenise(¤t, end + 10,
&token_text))) {
- token_data.text =3D token_text;
+ token_data.text =3D (char *) token_text;
token_data.length =3D current - token_text;
css_parser_(parser, token, token_data, ¶m);
if (param.syntax_error) {
- LOG(("syntax error near offset %i",
- token_text - source_data));
+ LOG(("syntax error near offset %li",
+ (unsigned long) (token_text - source_data)));
param.syntax_error =3D false;
} else if (param.memory_error) {
LOG(("out of memory"));
@@ -2146,6 +2146,7 @@
fprintf(stderr, " inherit");
break;
case CSS_BORDER_WIDTH_LENGTH:
+ fprintf(stderr, " ");
css_dump_length(&style->outline.width.value);
break;
case CSS_BORDER_WIDTH_NOT_SET:
16 years
r3262 bursa - /trunk/netsurf/content/urldb.c
by netsurf@semichrome.net
Author: bursa
Date: Wed May 2 04:06:52 2007
New Revision: 3262
URL: http://svn.semichrome.net?rev=3D3262&view=3Drev
Log:
Fix warning: field precision should have type 'int', but argument 4 has typ=
e 'long int'.
Modified:
trunk/netsurf/content/urldb.c
Modified: trunk/netsurf/content/urldb.c
URL: http://svn.semichrome.net/trunk/netsurf/content/urldb.c?rev=3D3262&r1=
=3D3261&r2=3D3262&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/content/urldb.c (original)
+++ trunk/netsurf/content/urldb.c Wed May 2 04:06:52 2007
@@ -1123,7 +1123,8 @@
* assume that we're looking for a path */
char *domain =3D host;
=
- snprintf(host, sizeof host, "%.*s", slash - prefix, prefix);
+ snprintf(host, sizeof host, "%.*s",
+ (int) (slash - prefix), prefix);
=
h =3D urldb_search_find(tree, host);
if (!h) {
16 years
r3261 bursa - /trunk/netsurf/content/fetch.c
by netsurf@semichrome.net
Author: bursa
Date: Wed May 2 03:47:39 2007
New Revision: 3261
URL: http://svn.semichrome.net?rev=3D3261&view=3Drev
Log:
Fix some warnings in recent gcc.
Modified:
trunk/netsurf/content/fetch.c
Modified: trunk/netsurf/content/fetch.c
URL: http://svn.semichrome.net/trunk/netsurf/content/fetch.c?rev=3D3261&r1=
=3D3260&r2=3D3261&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/content/fetch.c (original)
+++ trunk/netsurf/content/fetch.c Wed May 2 03:47:39 2007
@@ -998,7 +998,7 @@
ASN1_TIME_print(mem,
X509_get_notBefore(certs[i].cert));
BIO_get_mem_ptr(mem, &buf);
- BIO_set_close(mem, BIO_NOCLOSE);
+ (void) BIO_set_close(mem, BIO_NOCLOSE);
BIO_free(mem);
snprintf(ssl_certs[i].not_before,
min(sizeof ssl_certs[i].not_before,
@@ -1010,7 +1010,7 @@
ASN1_TIME_print(mem,
X509_get_notAfter(certs[i].cert));
BIO_get_mem_ptr(mem, &buf);
- BIO_set_close(mem, BIO_NOCLOSE);
+ (void) BIO_set_close(mem, BIO_NOCLOSE);
BIO_free(mem);
snprintf(ssl_certs[i].not_after,
min(sizeof ssl_certs[i].not_after,
@@ -1029,7 +1029,7 @@
0, XN_FLAG_SEP_CPLUS_SPC |
XN_FLAG_DN_REV | XN_FLAG_FN_NONE);
BIO_get_mem_ptr(mem, &buf);
- BIO_set_close(mem, BIO_NOCLOSE);
+ (void) BIO_set_close(mem, BIO_NOCLOSE);
BIO_free(mem);
snprintf(ssl_certs[i].issuer,
min(sizeof ssl_certs[i].issuer,
@@ -1043,7 +1043,7 @@
0, XN_FLAG_SEP_CPLUS_SPC |
XN_FLAG_DN_REV | XN_FLAG_FN_NONE);
BIO_get_mem_ptr(mem, &buf);
- BIO_set_close(mem, BIO_NOCLOSE);
+ (void) BIO_set_close(mem, BIO_NOCLOSE);
BIO_free(mem);
snprintf(ssl_certs[i].subject,
min(sizeof ssl_certs[i].subject,
16 years
r3260 bursa - in /trunk/netsurf: content/fetch.c utils/utils.c utils/utils.h
by netsurf@semichrome.net
Author: bursa
Date: Wed May 2 03:38:38 2007
New Revision: 3260
URL: http://svn.semichrome.net?rev=3D3260&view=3Drev
Log:
Move user-agent generation into fetch.c and simplify.
Modified:
trunk/netsurf/content/fetch.c
trunk/netsurf/utils/utils.c
trunk/netsurf/utils/utils.h
Modified: trunk/netsurf/content/fetch.c
URL: http://svn.semichrome.net/trunk/netsurf/content/fetch.c?rev=3D3260&r1=
=3D3259&r2=3D3260&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/content/fetch.c (original)
+++ trunk/netsurf/content/fetch.c Wed May 2 03:38:38 2007
@@ -3,7 +3,7 @@
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
* Copyright 2006 Daniel Silverstone <dsilvers(a)digital-scurf.org>
- * Copyright 2004 James Bursa <bursa(a)users.sourceforge.net>
+ * Copyright 2007 James Bursa <bursa(a)users.sourceforge.net>
* Copyright 2003 Phil Mellor <monkeyson(a)users.sourceforge.net>
*/
=
@@ -20,12 +20,14 @@
*/
=
#include <assert.h>
+#include <errno.h>
#include <stdbool.h>
#include <string.h>
#include <strings.h>
#include <time.h>
#include <sys/select.h>
#include <sys/stat.h>
+#include <sys/utsname.h>
#ifdef riscos
#include <unixlib/local.h>
#endif
@@ -36,6 +38,7 @@
#endif
#include "netsurf/content/fetch.h"
#include "netsurf/content/urldb.h"
+#include "netsurf/desktop/netsurf.h"
#include "netsurf/desktop/options.h"
#include "netsurf/render/form.h"
#define NDEBUG
@@ -100,7 +103,6 @@
struct cache_handle *r_next; /**< Next cached handle in ring. */
};
=
-static char *user_agent =3D "NetSurf";
CURLM *fetch_curl_multi; /**< Global cURL multi handle. */
/** Curl handle with default options set; not used for transfers. */
static CURL *fetch_blank_curl;
@@ -111,7 +113,9 @@
static char fetch_error_buffer[CURL_ERROR_SIZE]; /**< Error buffer for cUR=
L. */
static char fetch_progress_buffer[256]; /**< Progress buffer for cURL */
static char fetch_proxy_userpwd[100]; /**< Proxy authentication details. */
-
+static char fetch_user_agent[100] =3D "NetSurf";
+
+static void fetch_init_user_agent(void);
static CURLcode fetch_set_options(struct fetch *f);
#ifdef WITH_SSL
static CURLcode fetch_sslctxfun(CURL *curl_handle, SSL_CTX *sslctx, void *=
p);
@@ -217,10 +221,6 @@
void fetch_init(void)
{
CURLcode code;
- char *ua =3D make_useragent();
-
- if (ua !=3D NULL)
- user_agent =3D ua;
=
code =3D curl_global_init(CURL_GLOBAL_ALL);
if (code !=3D CURLE_OK)
@@ -231,6 +231,8 @@
if (!fetch_curl_multi)
die("Failed to initialise the fetch module "
"(curl_multi_init failed).");
+
+ fetch_init_user_agent();
=
/* Create a curl easy handle with the options that are common to all
fetches. */
@@ -250,7 +252,7 @@
SETOPT(CURLOPT_HEADERFUNCTION, fetch_curl_header);
SETOPT(CURLOPT_PROGRESSFUNCTION, fetch_curl_progress);
SETOPT(CURLOPT_NOPROGRESS, 0);
- SETOPT(CURLOPT_USERAGENT, user_agent);
+ SETOPT(CURLOPT_USERAGENT, fetch_user_agent);
SETOPT(CURLOPT_ENCODING, "gzip");
SETOPT(CURLOPT_LOW_SPEED_LIMIT, 1L);
SETOPT(CURLOPT_LOW_SPEED_TIME, 180L);
@@ -265,6 +267,33 @@
curl_easy_setopt_failed:
die("Failed to initialise the fetch module "
"(curl_easy_setopt failed).");
+}
+
+
+/**
+ * Fill fetch_user_agent with a string suitable for use as a user agent in
+ * HTTP requests.
+ */
+
+void fetch_init_user_agent(void)
+{
+ struct utsname un;
+
+ if (uname(&un) !=3D 0) {
+ LOG(("uname: %i %s", errno, strerror(errno)));
+ die("Failed to initialise the fetch module "
+ "(uname failed).");
+ }
+
+ snprintf(fetch_user_agent, sizeof fetch_user_agent,
+ "NetSurf/%d.%d (%s; %s)",
+ netsurf_version_major,
+ netsurf_version_minor,
+ un.sysname,
+ un.machine);
+ fetch_user_agent[sizeof fetch_user_agent - 1] =3D 0;
+
+ LOG(("fetch_user_agent \"%s\"", fetch_user_agent));
}
=
=
@@ -1098,7 +1127,7 @@
return size * nmemb;
}
=
- LOG(("fetch %p, size %u", f, size * nmemb));
+ LOG(("fetch %p, size %lu", f, size * nmemb));
=
if (f->abort || (!f->had_headers && fetch_process_headers(f))) {
f->stopped =3D true;
Modified: trunk/netsurf/utils/utils.c
URL: http://svn.semichrome.net/trunk/netsurf/utils/utils.c?rev=3D3260&r1=3D=
3259&r2=3D3260&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/utils/utils.c (original)
+++ trunk/netsurf/utils/utils.c Wed May 2 03:38:38 2007
@@ -16,7 +16,6 @@
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/utsname.h>
#include <sys/time.h>
#include <regex.h>
#include <time.h>
@@ -26,7 +25,6 @@
#include "netsurf/utils/messages.h"
#include "netsurf/utils/utf8.h"
#include "netsurf/utils/utils.h"
-#include "netsurf/desktop/netsurf.h"
=
=
char * strip(char * const s)
@@ -258,36 +256,6 @@
return ((tv.tv_sec * 100) + (tv.tv_usec / 10000));
}
=
-/** Generate a string suitable for use as a user agent in HTTP requests.
- *
- * \return heap-allocated result string, or NULL if the allocation failed.
- */
-#define UA_BUF_SIZE 128
-char *make_useragent(void)
-{
- struct utsname un;
- char ua_name[UA_BUF_SIZE];
- char ua_machine[UA_BUF_SIZE];
- char *r;
- =
- snprintf(ua_name, UA_BUF_SIZE, "NetSurf/%d.%d",
- netsurf_version_major,
- netsurf_version_minor);
- =
- if (uname(&un) !=3D 0) {
- strncpy(ua_machine, "unknown machine", UA_BUF_SIZE);
- } else {
- snprintf(ua_machine, UA_BUF_SIZE, "(%s; %s)", un.sysname,
- un.machine);
- }
- =
- if ((r =3D malloc(strlen(ua_name) + strlen(ua_machine) + 2)) =3D=3D NULL)
- return NULL;
- =
- sprintf(r, "%s %s", ua_name, ua_machine);
- =
- return r;
-}
=
#ifdef __FreeBSD__
=
Modified: trunk/netsurf/utils/utils.h
URL: http://svn.semichrome.net/trunk/netsurf/utils/utils.h?rev=3D3260&r1=3D=
3259&r2=3D3260&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/netsurf/utils/utils.h (original)
+++ trunk/netsurf/utils/utils.h Wed May 2 03:38:38 2007
@@ -59,7 +59,6 @@
char *strcasestr(const char *haystack, const char *needle);
#endif
unsigned int wallclock(void);
-char *make_useragent(void);
#ifdef __FreeBSD__
/* FreeBSD lacks strndup */
char *strndup(const char *s, size_t n);
16 years