netsurf: branch master updated. release/3.0-682-g6b29a69
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/6b29a697b9879c03146cc...
...commit http://git.netsurf-browser.org/netsurf.git/commit/6b29a697b9879c03146cca2...
...tree http://git.netsurf-browser.org/netsurf.git/tree/6b29a697b9879c03146cca24b...
The branch, master has been updated
via 6b29a697b9879c03146cca24bb30c64d25810cb8 (commit)
via f29306cc9aae8365ab52418c589700c0f448fbd4 (commit)
from 1d326a8a1c83f5dd7e1390d1b806138981f56574 (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=6b29a697b9879c03146...
commit 6b29a697b9879c03146cca24bb30c64d25810cb8
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
check ftell return value coverity 1109870
diff --git a/utils/container.c b/utils/container.c
index 26d4745..97f1d7e 100644
--- a/utils/container.c
+++ b/utils/container.c
@@ -80,11 +80,18 @@ struct container_ctx {
inline static size_t container_filelen(FILE *fd)
{
- long o = ftell(fd);
+ long o;
long a;
+ o = ftell(fd);
+ if (o == -1) {
+ LOG(("Could not get current stream position"));
+ return 0;
+ }
+
fseek(fd, 0, SEEK_END);
a = ftell(fd);
+
fseek(fd, o, SEEK_SET);
if (a == -1) {
LOG(("could not ascertain size of file in theme container; omitting"));
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=f29306cc9aae8365ab5...
commit f29306cc9aae8365ab52418c589700c0f448fbd4
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
improve gtk source save to use gtk overwrite protection feature coverity 1109873
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index e02344c..d37fb1a 100644
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -159,7 +159,7 @@ char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codeset, size
utf8_from_enc(ci_curr->ci_Data,
(const char *)ObtainCharsetInfo(DFCS_NUMBER,
codeset, DFCS_MIMENAME),
- ci_curr->ci_Size, (char **)&ci_next->ci_Data);
+ ci_curr->ci_Size, (char **)&ci_next->ci_Data, NULL);
ci_next->ci_Size = strlen(ci_next->ci_Data);
len += ci_next->ci_Size;
break;
diff --git a/amiga/utf8.c b/amiga/utf8.c
index 76e7b86..a620ac1 100755
--- a/amiga/utf8.c
+++ b/amiga/utf8.c
@@ -70,7 +70,7 @@ utf8_convert_ret utf8_from_local_encoding(const char *string, size_t len,
encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
#endif
- return utf8_from_enc(string,encname,len,result);
+ return utf8_from_enc(string,encname,len,result,NULL);
}
utf8_convert_ret utf8_to_local_encoding(const char *string, size_t len,
diff --git a/atari/encoding.c b/atari/encoding.c
index 75d0fec..0212d51 100644
--- a/atari/encoding.c
+++ b/atari/encoding.c
@@ -39,7 +39,7 @@ utf8_convert_ret utf8_from_local_encoding(const char *string,
size_t len,
char **result)
{
- return utf8_from_enc(string, "ATARIST", len, result);
+ return utf8_from_enc(string, "ATARIST", len, result, NULL);
}
diff --git a/gtk/dialogs/source.c b/gtk/dialogs/source.c
index 4499cca..fe9005c 100644
--- a/gtk/dialogs/source.c
+++ b/gtk/dialogs/source.c
@@ -48,6 +48,7 @@
struct nsgtk_source_window {
gchar *url;
char *data;
+ size_t data_len;
GtkWindow *sourcewindow;
GtkTextView *gv;
struct browser_window *bw;
@@ -113,7 +114,7 @@ static void nsgtk_attach_source_menu_handlers(GtkBuilder *xml, gpointer g)
static gboolean nsgtk_source_destroy_event(GtkBuilder *window, gpointer g)
{
- struct nsgtk_source_window *nsg = (struct nsgtk_source_window *) g;
+ struct nsgtk_source_window *nsg = (struct nsgtk_source_window *) g;
if (nsg->next != NULL)
nsg->next->prev = nsg->prev;
@@ -136,17 +137,17 @@ static gboolean nsgtk_source_delete_event(GtkWindow * window, gpointer g)
}
void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
-{
+{
char glade_Location[strlen(res_dir_location) + SLEN("source.gtk2.ui")
+ 1];
if (content_get_type(bw->current_content) != CONTENT_HTML)
return;
-
+
if (nsoption_bool(source_tab)) {
nsgtk_source_tab_init(parent, bw);
return;
}
-
+
sprintf(glade_Location, "%ssource.gtk2.ui", res_dir_location);
GError* error = NULL;
@@ -162,15 +163,17 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
const char *source_data;
unsigned long source_size;
char *data = NULL;
+ size_t data_len;
- source_data = content_get_source_data(bw->current_content,
+ source_data = content_get_source_data(bw->current_content,
&source_size);
utf8_convert_ret r = utf8_from_enc(
source_data,
html_get_encoding(bw->current_content),
source_size,
- &data);
+ &data,
+ &data_len);
if (r == UTF8_CONVERT_NOMEM) {
warn_user("NoMemory",0);
return;
@@ -194,8 +197,8 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
gtk_widget_set_sensitive(deletebutton, FALSE);
/* for now */
gtk_widget_set_sensitive(printbutton, FALSE);
-
- struct nsgtk_source_window *thiswindow =
+
+ struct nsgtk_source_window *thiswindow =
malloc(sizeof(struct nsgtk_source_window));
if (thiswindow == NULL) {
free(data);
@@ -213,7 +216,8 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
}
thiswindow->data = data;
-
+ thiswindow->data_len = data_len;
+
thiswindow->sourcewindow = wndSource;
thiswindow->bw = bw;
@@ -225,20 +229,20 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
if (nsgtk_source_list != NULL)
nsgtk_source_list->prev = thiswindow;
nsgtk_source_list = thiswindow;
-
+
nsgtk_attach_source_menu_handlers(glade_File, thiswindow);
-
+
gtk_window_set_title(wndSource, title);
-
+
g_signal_connect(G_OBJECT(wndSource), "destroy",
G_CALLBACK(nsgtk_source_destroy_event),
thiswindow);
- g_signal_connect(G_OBJECT(wndSource), "delete-event",
+ g_signal_connect(G_OBJECT(wndSource), "delete-event",
G_CALLBACK(nsgtk_source_delete_event),
thiswindow);
-
+
GtkTextView *sourceview = GTK_TEXT_VIEW(
- gtk_builder_get_object(glade_File,
+ gtk_builder_get_object(glade_File,
"source_view"));
PangoFontDescription *fontdesc =
@@ -249,7 +253,7 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
GtkTextBuffer *tb = gtk_text_view_get_buffer(sourceview);
gtk_text_buffer_set_text(tb, thiswindow->data, -1);
-
+
gtk_widget_show(GTK_WIDGET(wndSource));
}
@@ -262,6 +266,7 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
const char *source_data;
unsigned long source_size;
char *ndata = 0;
+ size_t ndata_len;
nsurl *url;
nserror error;
utf8_convert_ret r;
@@ -269,13 +274,14 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
char *fileurl;
gint handle;
- source_data = content_get_source_data(bw->current_content,
+ source_data = content_get_source_data(bw->current_content,
&source_size);
r = utf8_from_enc(source_data,
html_get_encoding(bw->current_content),
source_size,
- &ndata);
+ &ndata,
+ &ndata_len);
if (r == UTF8_CONVERT_NOMEM) {
warn_user("NoMemory",0);
return;
@@ -328,66 +334,33 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
free(fileurl);
}
-static void nsgtk_source_file_save(GtkWindow *parent, const char *filename,
- const char *data)
+static void nsgtk_source_file_save(GtkWindow *parent, const char *filename,
+ const char *data, size_t data_size)
{
FILE *f;
- bool auth = true;
- char temp[255];
- GtkWidget *notif, *label;
-
- if (!(access(filename, F_OK))) {
- GtkWidget *confd = gtk_dialog_new_with_buttons(
- messages_get("gtkOverwriteTitle"),
- parent,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_OK,
- GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_REJECT,
- NULL);
- const char *format = messages_get("gtkOverwrite");
- int len = strlen(filename) + strlen(format) + SLEN("\n\n") + 1;
- char warn[len];
- auth = false;
-
- warn[0] = '\n';
- snprintf(warn + 1, len - 2, format, filename);
- len = strlen(warn);
- warn[len - 1] = '\n';
- warn[len] = '\0';
-
- label = gtk_label_new(warn);
- gtk_container_add(GTK_CONTAINER(nsgtk_dialog_get_content_area(GTK_DIALOG(confd))),
- label);
- gtk_widget_show(label);
- if (gtk_dialog_run(GTK_DIALOG(confd)) == GTK_RESPONSE_ACCEPT) {
- auth = true;
- }
- gtk_widget_destroy(confd);
- }
+ GtkWidget *notif;
+ GtkWidget *label;
- if (auth) {
- f = fopen(filename, "w+");
- fprintf(f, "%s", data);
+ f = fopen(filename, "w+");
+ if (f != NULL) {
+ fwrite(data, data_size, 1, f);
fclose(f);
- snprintf(temp, sizeof(temp), "\n %s"
- " \n",
- messages_get("gtkSaveConfirm"));
- } else {
- snprintf(temp, sizeof(temp), "\n %s"
- " \n",
- messages_get("gtkSaveCancelled"));
+ return;
}
-
- notif = gtk_dialog_new_with_buttons(temp,
- parent, GTK_DIALOG_MODAL, GTK_STOCK_OK,
- GTK_RESPONSE_NONE, NULL);
+
+ /* inform user of faliure */
+ notif = gtk_dialog_new_with_buttons(messages_get("gtkSaveFailedTitle"),
+ parent,
+ GTK_DIALOG_MODAL, GTK_STOCK_OK,
+ GTK_RESPONSE_NONE, NULL);
+
g_signal_connect_swapped(notif, "response",
- G_CALLBACK(gtk_widget_destroy), notif);
- label = gtk_label_new(temp);
+ G_CALLBACK(gtk_widget_destroy), notif);
+
+ label = gtk_label_new(messages_get("gtkSaveFailed"));
gtk_container_add(GTK_CONTAINER(nsgtk_dialog_get_content_area(GTK_DIALOG(notif))), label);
gtk_widget_show_all(notif);
+
}
@@ -395,12 +368,12 @@ gboolean nsgtk_on_source_save_as_activate(GtkMenuItem *widget, gpointer g)
{
struct nsgtk_source_window *nsg = (struct nsgtk_source_window *) g;
GtkWidget *fc = gtk_file_chooser_dialog_new(
- messages_get("gtkSourceSave"),
+ messages_get("gtkSourceSave"),
nsg->sourcewindow,
- GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE,
+ GTK_STOCK_SAVE,
GTK_RESPONSE_ACCEPT,
NULL);
char *filename;
@@ -419,9 +392,12 @@ gboolean nsgtk_on_source_save_as_activate(GtkMenuItem *widget, gpointer g)
free(filename);
+ gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(fc),
+ TRUE);
+
if (gtk_dialog_run(GTK_DIALOG(fc)) == GTK_RESPONSE_ACCEPT) {
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc));
- nsgtk_source_file_save(nsg->sourcewindow, filename, nsg->data);
+ nsgtk_source_file_save(nsg->sourcewindow, filename, nsg->data, nsg->data_len);
g_free(filename);
}
@@ -443,7 +419,7 @@ gboolean nsgtk_on_source_close_activate( GtkMenuItem *widget, gpointer g)
struct nsgtk_source_window *nsg = (struct nsgtk_source_window *) g;
gtk_widget_destroy(GTK_WIDGET(nsg->sourcewindow));
-
+
return TRUE;
}
@@ -472,7 +448,7 @@ gboolean nsgtk_on_source_copy_activate(GtkMenuItem *widget, gpointer g)
struct nsgtk_source_window *nsg = (struct nsgtk_source_window *) g;
GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(nsg->gv));
- gtk_text_buffer_copy_clipboard(buf,
+ gtk_text_buffer_copy_clipboard(buf,
gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
return TRUE;
@@ -515,11 +491,11 @@ static void nsgtk_source_update_zoomlevel(gpointer g)
GtkTextIter start, end;
- gtk_text_buffer_get_bounds(GTK_TEXT_BUFFER(buf),
+ gtk_text_buffer_get_bounds(GTK_TEXT_BUFFER(buf),
&start, &end);
- gtk_text_buffer_remove_all_tags(GTK_TEXT_BUFFER(buf),
+ gtk_text_buffer_remove_all_tags(GTK_TEXT_BUFFER(buf),
&start, &end);
- gtk_text_buffer_apply_tag(GTK_TEXT_BUFFER(buf),
+ gtk_text_buffer_apply_tag(GTK_TEXT_BUFFER(buf),
GTK_TEXT_TAG(tag), &start, &end);
}
nsg = nsg->next;
@@ -561,4 +537,3 @@ gboolean nsgtk_on_source_about_activate(GtkMenuItem *widget, gpointer g)
return TRUE;
}
-
diff --git a/riscos/ucstables.c b/riscos/ucstables.c
index 0a57022..970caf1 100644
--- a/riscos/ucstables.c
+++ b/riscos/ucstables.c
@@ -618,7 +618,7 @@ utf8_convert_ret utf8_from_local_encoding(const char *string, size_t len,
/* 0 length has a special meaning to utf8_from_enc */
if (off - prev_off > 0) {
err = utf8_from_enc(string + prev_off, enc,
- off - prev_off, &temp);
+ off - prev_off, &temp, NULL);
if (err != UTF8_CONVERT_OK) {
assert(err != UTF8_CONVERT_BADENC);
LOG(("utf8_from_enc failed"));
@@ -660,7 +660,7 @@ utf8_convert_ret utf8_from_local_encoding(const char *string, size_t len,
* NB. 0 length has a special meaning to utf8_from_enc */
if (prev_off < len) {
err = utf8_from_enc(string + prev_off, enc, len - prev_off,
- &temp);
+ &temp, NULL);
if (err != UTF8_CONVERT_OK) {
assert(err != UTF8_CONVERT_BADENC);
LOG(("utf8_from_enc failed"));
diff --git a/utils/utf8.c b/utils/utf8.c
index 127ffe6..8e9587d 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -33,9 +33,6 @@
#include "utils/log.h"
#include "utils/utf8.h"
-static utf8_convert_ret utf8_convert(const char *string, size_t len,
- const char *from, const char *to, char **result);
-
/**
* Convert a UTF-8 multibyte sequence into a single UCS4 character
*
@@ -217,35 +214,6 @@ void utf8_finalise(void)
utf8_clear_cd_cache();
}
-/**
- * Convert a UTF8 string into the named encoding
- *
- * \param string The NULL-terminated string to convert
- * \param encname The encoding name (suitable for passing to iconv)
- * \param len Length of input string to consider (in bytes), or 0
- * \param result Pointer to location to store result (allocated on heap)
- * \return Appropriate utf8_convert_ret value
- */
-utf8_convert_ret utf8_to_enc(const char *string, const char *encname,
- size_t len, char **result)
-{
- return utf8_convert(string, len, "UTF-8", encname, result);
-}
-
-/**
- * Convert a string in the named encoding into a UTF-8 string
- *
- * \param string The NULL-terminated string to convert
- * \param encname The encoding name (suitable for passing to iconv)
- * \param len Length of input string to consider (in bytes), or 0
- * \param result Pointer to location to store result (allocated on heap)
- * \return Appropriate utf8_convert_ret value
- */
-utf8_convert_ret utf8_from_enc(const char *string, const char *encname,
- size_t len, char **result)
-{
- return utf8_convert(string, len, encname, "UTF-8", result);
-}
/**
* Convert a string from one encoding to another
@@ -254,11 +222,13 @@ utf8_convert_ret utf8_from_enc(const char *string, const char *encname,
* \param len Length of input string to consider (in bytes), or 0
* \param from The encoding name to convert from
* \param to The encoding name to convert to
- * \param result Pointer to location in which to store result
+ * \param result Pointer to location in which to store result.
+ * \param result_len Pointer to location in which to store result length.
* \return Appropriate utf8_convert_ret value
*/
-utf8_convert_ret utf8_convert(const char *string, size_t len,
- const char *from, const char *to, char **result)
+static utf8_convert_ret utf8_convert(const char *string, size_t len,
+ const char *from, const char *to,
+ char **result, size_t *result_len)
{
iconv_t cd;
char *temp, *out, *in;
@@ -356,9 +326,43 @@ utf8_convert_ret utf8_convert(const char *string, size_t len,
* converted to UTF-32 */
memset((*result) + (out - temp), 0, 4);
+ if (result_len != NULL) {
+ *result_len = (out - temp);
+ }
+
return UTF8_CONVERT_OK;
}
+/**
+ * Convert a UTF8 string into the named encoding
+ *
+ * \param string The NULL-terminated string to convert
+ * \param encname The encoding name (suitable for passing to iconv)
+ * \param len Length of input string to consider (in bytes), or 0
+ * \param result Pointer to location to store result (allocated on heap)
+ * \return Appropriate utf8_convert_ret value
+ */
+utf8_convert_ret utf8_to_enc(const char *string, const char *encname,
+ size_t len, char **result)
+{
+ return utf8_convert(string, len, "UTF-8", encname, result, NULL);
+}
+
+/**
+ * Convert a string in the named encoding into a UTF-8 string
+ *
+ * \param string The NULL-terminated string to convert
+ * \param encname The encoding name (suitable for passing to iconv)
+ * \param len Length of input string to consider (in bytes), or 0
+ * \param result Pointer to location to store result (allocated on heap)
+ * \return Appropriate utf8_convert_ret value
+ */
+utf8_convert_ret utf8_from_enc(const char *string, const char *encname,
+ size_t len, char **result, size_t *result_len)
+{
+ return utf8_convert(string, len, encname, "UTF-8", result, result_len);
+}
+
static utf8_convert_ret utf8_convert_html_chunk(iconv_t cd,
const char *chunk, size_t inlen,
char **out, size_t *outlen)
diff --git a/utils/utf8.h b/utils/utf8.h
index eb043c2..68d42d3 100644
--- a/utils/utf8.h
+++ b/utils/utf8.h
@@ -47,7 +47,7 @@ size_t utf8_next(const char *s, size_t l, size_t o);
utf8_convert_ret utf8_to_enc(const char *string, const char *encname,
size_t len, char **result);
utf8_convert_ret utf8_from_enc(const char *string, const char *encname,
- size_t len, char **result);
+ size_t len, char **result, size_t *result_len);
utf8_convert_ret utf8_to_html(const char *string, const char *encname,
size_t len, char **result);
-----------------------------------------------------------------------
Summary of changes:
amiga/clipboard.c | 2 +-
amiga/utf8.c | 2 +-
atari/encoding.c | 2 +-
gtk/dialogs/source.c | 135 ++++++++++++++++++++-----------------------------
riscos/ucstables.c | 4 +-
utils/container.c | 9 +++-
utils/utf8.c | 74 ++++++++++++++-------------
utils/utf8.h | 2 +-
8 files changed, 108 insertions(+), 122 deletions(-)
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index e02344c..d37fb1a 100644
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -159,7 +159,7 @@ char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codeset, size
utf8_from_enc(ci_curr->ci_Data,
(const char *)ObtainCharsetInfo(DFCS_NUMBER,
codeset, DFCS_MIMENAME),
- ci_curr->ci_Size, (char **)&ci_next->ci_Data);
+ ci_curr->ci_Size, (char **)&ci_next->ci_Data, NULL);
ci_next->ci_Size = strlen(ci_next->ci_Data);
len += ci_next->ci_Size;
break;
diff --git a/amiga/utf8.c b/amiga/utf8.c
index 76e7b86..a620ac1 100755
--- a/amiga/utf8.c
+++ b/amiga/utf8.c
@@ -70,7 +70,7 @@ utf8_convert_ret utf8_from_local_encoding(const char *string, size_t len,
encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
#endif
- return utf8_from_enc(string,encname,len,result);
+ return utf8_from_enc(string,encname,len,result,NULL);
}
utf8_convert_ret utf8_to_local_encoding(const char *string, size_t len,
diff --git a/atari/encoding.c b/atari/encoding.c
index 75d0fec..0212d51 100644
--- a/atari/encoding.c
+++ b/atari/encoding.c
@@ -39,7 +39,7 @@ utf8_convert_ret utf8_from_local_encoding(const char *string,
size_t len,
char **result)
{
- return utf8_from_enc(string, "ATARIST", len, result);
+ return utf8_from_enc(string, "ATARIST", len, result, NULL);
}
diff --git a/gtk/dialogs/source.c b/gtk/dialogs/source.c
index 4499cca..fe9005c 100644
--- a/gtk/dialogs/source.c
+++ b/gtk/dialogs/source.c
@@ -48,6 +48,7 @@
struct nsgtk_source_window {
gchar *url;
char *data;
+ size_t data_len;
GtkWindow *sourcewindow;
GtkTextView *gv;
struct browser_window *bw;
@@ -113,7 +114,7 @@ static void nsgtk_attach_source_menu_handlers(GtkBuilder *xml, gpointer g)
static gboolean nsgtk_source_destroy_event(GtkBuilder *window, gpointer g)
{
- struct nsgtk_source_window *nsg = (struct nsgtk_source_window *) g;
+ struct nsgtk_source_window *nsg = (struct nsgtk_source_window *) g;
if (nsg->next != NULL)
nsg->next->prev = nsg->prev;
@@ -136,17 +137,17 @@ static gboolean nsgtk_source_delete_event(GtkWindow * window, gpointer g)
}
void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
-{
+{
char glade_Location[strlen(res_dir_location) + SLEN("source.gtk2.ui")
+ 1];
if (content_get_type(bw->current_content) != CONTENT_HTML)
return;
-
+
if (nsoption_bool(source_tab)) {
nsgtk_source_tab_init(parent, bw);
return;
}
-
+
sprintf(glade_Location, "%ssource.gtk2.ui", res_dir_location);
GError* error = NULL;
@@ -162,15 +163,17 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
const char *source_data;
unsigned long source_size;
char *data = NULL;
+ size_t data_len;
- source_data = content_get_source_data(bw->current_content,
+ source_data = content_get_source_data(bw->current_content,
&source_size);
utf8_convert_ret r = utf8_from_enc(
source_data,
html_get_encoding(bw->current_content),
source_size,
- &data);
+ &data,
+ &data_len);
if (r == UTF8_CONVERT_NOMEM) {
warn_user("NoMemory",0);
return;
@@ -194,8 +197,8 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
gtk_widget_set_sensitive(deletebutton, FALSE);
/* for now */
gtk_widget_set_sensitive(printbutton, FALSE);
-
- struct nsgtk_source_window *thiswindow =
+
+ struct nsgtk_source_window *thiswindow =
malloc(sizeof(struct nsgtk_source_window));
if (thiswindow == NULL) {
free(data);
@@ -213,7 +216,8 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
}
thiswindow->data = data;
-
+ thiswindow->data_len = data_len;
+
thiswindow->sourcewindow = wndSource;
thiswindow->bw = bw;
@@ -225,20 +229,20 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
if (nsgtk_source_list != NULL)
nsgtk_source_list->prev = thiswindow;
nsgtk_source_list = thiswindow;
-
+
nsgtk_attach_source_menu_handlers(glade_File, thiswindow);
-
+
gtk_window_set_title(wndSource, title);
-
+
g_signal_connect(G_OBJECT(wndSource), "destroy",
G_CALLBACK(nsgtk_source_destroy_event),
thiswindow);
- g_signal_connect(G_OBJECT(wndSource), "delete-event",
+ g_signal_connect(G_OBJECT(wndSource), "delete-event",
G_CALLBACK(nsgtk_source_delete_event),
thiswindow);
-
+
GtkTextView *sourceview = GTK_TEXT_VIEW(
- gtk_builder_get_object(glade_File,
+ gtk_builder_get_object(glade_File,
"source_view"));
PangoFontDescription *fontdesc =
@@ -249,7 +253,7 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
GtkTextBuffer *tb = gtk_text_view_get_buffer(sourceview);
gtk_text_buffer_set_text(tb, thiswindow->data, -1);
-
+
gtk_widget_show(GTK_WIDGET(wndSource));
}
@@ -262,6 +266,7 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
const char *source_data;
unsigned long source_size;
char *ndata = 0;
+ size_t ndata_len;
nsurl *url;
nserror error;
utf8_convert_ret r;
@@ -269,13 +274,14 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
char *fileurl;
gint handle;
- source_data = content_get_source_data(bw->current_content,
+ source_data = content_get_source_data(bw->current_content,
&source_size);
r = utf8_from_enc(source_data,
html_get_encoding(bw->current_content),
source_size,
- &ndata);
+ &ndata,
+ &ndata_len);
if (r == UTF8_CONVERT_NOMEM) {
warn_user("NoMemory",0);
return;
@@ -328,66 +334,33 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
free(fileurl);
}
-static void nsgtk_source_file_save(GtkWindow *parent, const char *filename,
- const char *data)
+static void nsgtk_source_file_save(GtkWindow *parent, const char *filename,
+ const char *data, size_t data_size)
{
FILE *f;
- bool auth = true;
- char temp[255];
- GtkWidget *notif, *label;
-
- if (!(access(filename, F_OK))) {
- GtkWidget *confd = gtk_dialog_new_with_buttons(
- messages_get("gtkOverwriteTitle"),
- parent,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_OK,
- GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_REJECT,
- NULL);
- const char *format = messages_get("gtkOverwrite");
- int len = strlen(filename) + strlen(format) + SLEN("\n\n") + 1;
- char warn[len];
- auth = false;
-
- warn[0] = '\n';
- snprintf(warn + 1, len - 2, format, filename);
- len = strlen(warn);
- warn[len - 1] = '\n';
- warn[len] = '\0';
-
- label = gtk_label_new(warn);
- gtk_container_add(GTK_CONTAINER(nsgtk_dialog_get_content_area(GTK_DIALOG(confd))),
- label);
- gtk_widget_show(label);
- if (gtk_dialog_run(GTK_DIALOG(confd)) == GTK_RESPONSE_ACCEPT) {
- auth = true;
- }
- gtk_widget_destroy(confd);
- }
+ GtkWidget *notif;
+ GtkWidget *label;
- if (auth) {
- f = fopen(filename, "w+");
- fprintf(f, "%s", data);
+ f = fopen(filename, "w+");
+ if (f != NULL) {
+ fwrite(data, data_size, 1, f);
fclose(f);
- snprintf(temp, sizeof(temp), "\n %s"
- " \n",
- messages_get("gtkSaveConfirm"));
- } else {
- snprintf(temp, sizeof(temp), "\n %s"
- " \n",
- messages_get("gtkSaveCancelled"));
+ return;
}
-
- notif = gtk_dialog_new_with_buttons(temp,
- parent, GTK_DIALOG_MODAL, GTK_STOCK_OK,
- GTK_RESPONSE_NONE, NULL);
+
+ /* inform user of faliure */
+ notif = gtk_dialog_new_with_buttons(messages_get("gtkSaveFailedTitle"),
+ parent,
+ GTK_DIALOG_MODAL, GTK_STOCK_OK,
+ GTK_RESPONSE_NONE, NULL);
+
g_signal_connect_swapped(notif, "response",
- G_CALLBACK(gtk_widget_destroy), notif);
- label = gtk_label_new(temp);
+ G_CALLBACK(gtk_widget_destroy), notif);
+
+ label = gtk_label_new(messages_get("gtkSaveFailed"));
gtk_container_add(GTK_CONTAINER(nsgtk_dialog_get_content_area(GTK_DIALOG(notif))), label);
gtk_widget_show_all(notif);
+
}
@@ -395,12 +368,12 @@ gboolean nsgtk_on_source_save_as_activate(GtkMenuItem *widget, gpointer g)
{
struct nsgtk_source_window *nsg = (struct nsgtk_source_window *) g;
GtkWidget *fc = gtk_file_chooser_dialog_new(
- messages_get("gtkSourceSave"),
+ messages_get("gtkSourceSave"),
nsg->sourcewindow,
- GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE,
+ GTK_STOCK_SAVE,
GTK_RESPONSE_ACCEPT,
NULL);
char *filename;
@@ -419,9 +392,12 @@ gboolean nsgtk_on_source_save_as_activate(GtkMenuItem *widget, gpointer g)
free(filename);
+ gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(fc),
+ TRUE);
+
if (gtk_dialog_run(GTK_DIALOG(fc)) == GTK_RESPONSE_ACCEPT) {
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc));
- nsgtk_source_file_save(nsg->sourcewindow, filename, nsg->data);
+ nsgtk_source_file_save(nsg->sourcewindow, filename, nsg->data, nsg->data_len);
g_free(filename);
}
@@ -443,7 +419,7 @@ gboolean nsgtk_on_source_close_activate( GtkMenuItem *widget, gpointer g)
struct nsgtk_source_window *nsg = (struct nsgtk_source_window *) g;
gtk_widget_destroy(GTK_WIDGET(nsg->sourcewindow));
-
+
return TRUE;
}
@@ -472,7 +448,7 @@ gboolean nsgtk_on_source_copy_activate(GtkMenuItem *widget, gpointer g)
struct nsgtk_source_window *nsg = (struct nsgtk_source_window *) g;
GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(nsg->gv));
- gtk_text_buffer_copy_clipboard(buf,
+ gtk_text_buffer_copy_clipboard(buf,
gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
return TRUE;
@@ -515,11 +491,11 @@ static void nsgtk_source_update_zoomlevel(gpointer g)
GtkTextIter start, end;
- gtk_text_buffer_get_bounds(GTK_TEXT_BUFFER(buf),
+ gtk_text_buffer_get_bounds(GTK_TEXT_BUFFER(buf),
&start, &end);
- gtk_text_buffer_remove_all_tags(GTK_TEXT_BUFFER(buf),
+ gtk_text_buffer_remove_all_tags(GTK_TEXT_BUFFER(buf),
&start, &end);
- gtk_text_buffer_apply_tag(GTK_TEXT_BUFFER(buf),
+ gtk_text_buffer_apply_tag(GTK_TEXT_BUFFER(buf),
GTK_TEXT_TAG(tag), &start, &end);
}
nsg = nsg->next;
@@ -561,4 +537,3 @@ gboolean nsgtk_on_source_about_activate(GtkMenuItem *widget, gpointer g)
return TRUE;
}
-
diff --git a/riscos/ucstables.c b/riscos/ucstables.c
index 0a57022..970caf1 100644
--- a/riscos/ucstables.c
+++ b/riscos/ucstables.c
@@ -618,7 +618,7 @@ utf8_convert_ret utf8_from_local_encoding(const char *string, size_t len,
/* 0 length has a special meaning to utf8_from_enc */
if (off - prev_off > 0) {
err = utf8_from_enc(string + prev_off, enc,
- off - prev_off, &temp);
+ off - prev_off, &temp, NULL);
if (err != UTF8_CONVERT_OK) {
assert(err != UTF8_CONVERT_BADENC);
LOG(("utf8_from_enc failed"));
@@ -660,7 +660,7 @@ utf8_convert_ret utf8_from_local_encoding(const char *string, size_t len,
* NB. 0 length has a special meaning to utf8_from_enc */
if (prev_off < len) {
err = utf8_from_enc(string + prev_off, enc, len - prev_off,
- &temp);
+ &temp, NULL);
if (err != UTF8_CONVERT_OK) {
assert(err != UTF8_CONVERT_BADENC);
LOG(("utf8_from_enc failed"));
diff --git a/utils/container.c b/utils/container.c
index 26d4745..97f1d7e 100644
--- a/utils/container.c
+++ b/utils/container.c
@@ -80,11 +80,18 @@ struct container_ctx {
inline static size_t container_filelen(FILE *fd)
{
- long o = ftell(fd);
+ long o;
long a;
+ o = ftell(fd);
+ if (o == -1) {
+ LOG(("Could not get current stream position"));
+ return 0;
+ }
+
fseek(fd, 0, SEEK_END);
a = ftell(fd);
+
fseek(fd, o, SEEK_SET);
if (a == -1) {
LOG(("could not ascertain size of file in theme container; omitting"));
diff --git a/utils/utf8.c b/utils/utf8.c
index 127ffe6..8e9587d 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -33,9 +33,6 @@
#include "utils/log.h"
#include "utils/utf8.h"
-static utf8_convert_ret utf8_convert(const char *string, size_t len,
- const char *from, const char *to, char **result);
-
/**
* Convert a UTF-8 multibyte sequence into a single UCS4 character
*
@@ -217,35 +214,6 @@ void utf8_finalise(void)
utf8_clear_cd_cache();
}
-/**
- * Convert a UTF8 string into the named encoding
- *
- * \param string The NULL-terminated string to convert
- * \param encname The encoding name (suitable for passing to iconv)
- * \param len Length of input string to consider (in bytes), or 0
- * \param result Pointer to location to store result (allocated on heap)
- * \return Appropriate utf8_convert_ret value
- */
-utf8_convert_ret utf8_to_enc(const char *string, const char *encname,
- size_t len, char **result)
-{
- return utf8_convert(string, len, "UTF-8", encname, result);
-}
-
-/**
- * Convert a string in the named encoding into a UTF-8 string
- *
- * \param string The NULL-terminated string to convert
- * \param encname The encoding name (suitable for passing to iconv)
- * \param len Length of input string to consider (in bytes), or 0
- * \param result Pointer to location to store result (allocated on heap)
- * \return Appropriate utf8_convert_ret value
- */
-utf8_convert_ret utf8_from_enc(const char *string, const char *encname,
- size_t len, char **result)
-{
- return utf8_convert(string, len, encname, "UTF-8", result);
-}
/**
* Convert a string from one encoding to another
@@ -254,11 +222,13 @@ utf8_convert_ret utf8_from_enc(const char *string, const char *encname,
* \param len Length of input string to consider (in bytes), or 0
* \param from The encoding name to convert from
* \param to The encoding name to convert to
- * \param result Pointer to location in which to store result
+ * \param result Pointer to location in which to store result.
+ * \param result_len Pointer to location in which to store result length.
* \return Appropriate utf8_convert_ret value
*/
-utf8_convert_ret utf8_convert(const char *string, size_t len,
- const char *from, const char *to, char **result)
+static utf8_convert_ret utf8_convert(const char *string, size_t len,
+ const char *from, const char *to,
+ char **result, size_t *result_len)
{
iconv_t cd;
char *temp, *out, *in;
@@ -356,9 +326,43 @@ utf8_convert_ret utf8_convert(const char *string, size_t len,
* converted to UTF-32 */
memset((*result) + (out - temp), 0, 4);
+ if (result_len != NULL) {
+ *result_len = (out - temp);
+ }
+
return UTF8_CONVERT_OK;
}
+/**
+ * Convert a UTF8 string into the named encoding
+ *
+ * \param string The NULL-terminated string to convert
+ * \param encname The encoding name (suitable for passing to iconv)
+ * \param len Length of input string to consider (in bytes), or 0
+ * \param result Pointer to location to store result (allocated on heap)
+ * \return Appropriate utf8_convert_ret value
+ */
+utf8_convert_ret utf8_to_enc(const char *string, const char *encname,
+ size_t len, char **result)
+{
+ return utf8_convert(string, len, "UTF-8", encname, result, NULL);
+}
+
+/**
+ * Convert a string in the named encoding into a UTF-8 string
+ *
+ * \param string The NULL-terminated string to convert
+ * \param encname The encoding name (suitable for passing to iconv)
+ * \param len Length of input string to consider (in bytes), or 0
+ * \param result Pointer to location to store result (allocated on heap)
+ * \return Appropriate utf8_convert_ret value
+ */
+utf8_convert_ret utf8_from_enc(const char *string, const char *encname,
+ size_t len, char **result, size_t *result_len)
+{
+ return utf8_convert(string, len, encname, "UTF-8", result, result_len);
+}
+
static utf8_convert_ret utf8_convert_html_chunk(iconv_t cd,
const char *chunk, size_t inlen,
char **out, size_t *outlen)
diff --git a/utils/utf8.h b/utils/utf8.h
index eb043c2..68d42d3 100644
--- a/utils/utf8.h
+++ b/utils/utf8.h
@@ -47,7 +47,7 @@ size_t utf8_next(const char *s, size_t l, size_t o);
utf8_convert_ret utf8_to_enc(const char *string, const char *encname,
size_t len, char **result);
utf8_convert_ret utf8_from_enc(const char *string, const char *encname,
- size_t len, char **result);
+ size_t len, char **result, size_t *result_len);
utf8_convert_ret utf8_to_html(const char *string, const char *encname,
size_t len, char **result);
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-680-g1d326a8
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/1d326a8a1c83f5dd7e139...
...commit http://git.netsurf-browser.org/netsurf.git/commit/1d326a8a1c83f5dd7e1390d...
...tree http://git.netsurf-browser.org/netsurf.git/tree/1d326a8a1c83f5dd7e1390d1b...
The branch, master has been updated
via 1d326a8a1c83f5dd7e1390d1b806138981f56574 (commit)
from 88838d51bb77e1f4dd7da9621f5f34c90f753f4d (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=1d326a8a1c83f5dd7e1...
commit 1d326a8a1c83f5dd7e1390d1b806138981f56574
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix leak of frame element name.
diff --git a/render/box_construct.c b/render/box_construct.c
index 37a8702..cc30d89 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -2223,14 +2223,17 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
err = dom_node_get_next_sibling(c,
&next);
if (err != DOM_NO_ERR) {
+ dom_string_unref(name);
dom_node_unref(c);
return false;
}
+ dom_string_unref(name);
dom_node_unref(c);
c = next;
} else {
/* Got a FRAME or FRAMESET element */
+ dom_string_unref(name);
break;
}
}
-----------------------------------------------------------------------
Summary of changes:
render/box_construct.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/render/box_construct.c b/render/box_construct.c
index 37a8702..cc30d89 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -2223,14 +2223,17 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
err = dom_node_get_next_sibling(c,
&next);
if (err != DOM_NO_ERR) {
+ dom_string_unref(name);
dom_node_unref(c);
return false;
}
+ dom_string_unref(name);
dom_node_unref(c);
c = next;
} else {
/* Got a FRAME or FRAMESET element */
+ dom_string_unref(name);
break;
}
}
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-679-g88838d5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/88838d51bb77e1f4dd7da...
...commit http://git.netsurf-browser.org/netsurf.git/commit/88838d51bb77e1f4dd7da96...
...tree http://git.netsurf-browser.org/netsurf.git/tree/88838d51bb77e1f4dd7da9621...
The branch, master has been updated
via 88838d51bb77e1f4dd7da9621f5f34c90f753f4d (commit)
via 88ca82dea256be57b59a9ea536311b68a5580b12 (commit)
from 2962faed63f4d4520ff34045859420b96b67d5ae (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=88838d51bb77e1f4dd7...
commit 88838d51bb77e1f4dd7da9621f5f34c90f753f4d
Merge: 88ca82d 2962fae
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Merge branch 'master' of git://git.netsurf-browser.org/netsurf
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=88ca82dea256be57b59...
commit 88ca82dea256be57b59a9ea536311b68a5580b12
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix leak of box scrollbars.
diff --git a/render/box.c b/render/box.c
index 1f2c9fe..e955b43 100644
--- a/render/box.c
+++ b/render/box.c
@@ -79,6 +79,8 @@ void *box_style_alloc(void *ptr, size_t len, void *pw)
*/
static int box_talloc_destructor(struct box *b)
{
+ struct html_scrollbar_data *data;
+
if ((b->flags & STYLE_OWNED) && b->style != NULL) {
css_computed_style_destroy(b->style);
b->style = NULL;
@@ -100,6 +102,18 @@ static int box_talloc_destructor(struct box *b)
dom_node_unref(b->node);
}
+ if (b->scroll_x != NULL) {
+ data = scrollbar_get_data(b->scroll_x);
+ scrollbar_destroy(b->scroll_x);
+ free(data);
+ }
+
+ if (b->scroll_y != NULL) {
+ data = scrollbar_get_data(b->scroll_y);
+ scrollbar_destroy(b->scroll_y);
+ free(data);
+ }
+
return 0;
}
-----------------------------------------------------------------------
Summary of changes:
render/box.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/render/box.c b/render/box.c
index 1f2c9fe..e955b43 100644
--- a/render/box.c
+++ b/render/box.c
@@ -79,6 +79,8 @@ void *box_style_alloc(void *ptr, size_t len, void *pw)
*/
static int box_talloc_destructor(struct box *b)
{
+ struct html_scrollbar_data *data;
+
if ((b->flags & STYLE_OWNED) && b->style != NULL) {
css_computed_style_destroy(b->style);
b->style = NULL;
@@ -100,6 +102,18 @@ static int box_talloc_destructor(struct box *b)
dom_node_unref(b->node);
}
+ if (b->scroll_x != NULL) {
+ data = scrollbar_get_data(b->scroll_x);
+ scrollbar_destroy(b->scroll_x);
+ free(data);
+ }
+
+ if (b->scroll_y != NULL) {
+ data = scrollbar_get_data(b->scroll_y);
+ scrollbar_destroy(b->scroll_y);
+ free(data);
+ }
+
return 0;
}
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-677-g2962fae
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/2962faed63f4d4520ff34...
...commit http://git.netsurf-browser.org/netsurf.git/commit/2962faed63f4d4520ff3404...
...tree http://git.netsurf-browser.org/netsurf.git/tree/2962faed63f4d4520ff340458...
The branch, master has been updated
via 2962faed63f4d4520ff34045859420b96b67d5ae (commit)
from 1cf0125f2dc49363f6fd94e8462bbdcbbd5e8669 (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=2962faed63f4d4520ff...
commit 2962faed63f4d4520ff34045859420b96b67d5ae
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
fix gtk title setting to cope with null titles coverity 1109897
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 80b6dea..3d86975 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -2162,25 +2162,45 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
return g;
}
+/** set the title in the window
+ *
+ * @param gw The gui window to set title on
+ * @param title The title to set (may be NULL)
+ */
void gui_window_set_title(struct gui_window *gw, const char *title)
{
- static char suffix[] = " - NetSurf";
- char nt[strlen(title) + strlen(suffix) + 1];
struct gtk_scaffolding *gs = nsgtk_get_scaffold(gw);
+ int title_len;
+ char *newtitle;
- nsgtk_tab_set_title(gw, title);
-
- if (gs->top_level == gw) {
- if (title == NULL || title[0] == '\0') {
+ if ((title == NULL) || (title[0] == '\0')) {
+ if (gs->top_level != gw) {
gtk_window_set_title(gs->window, "NetSurf");
- } else {
- strcpy(nt, title);
- strcat(nt, suffix);
- gtk_window_set_title(gs->window, nt);
}
+ return;
+ }
+
+ nsgtk_tab_set_title(gw, title);
+
+ if (gs->top_level != gw) {
+ /* not top level window so do not set window title */
+ return;
+ }
+
+ title_len = strlen(title) + SLEN(" - NetSurf") + 1;
+ newtitle = malloc(title_len);
+ if (newtitle == NULL) {
+ return;
}
+
+ snprintf(newtitle, title_len, "%s - NetSurf", title);
+
+ gtk_window_set_title(gs->window, newtitle);
+
+ free(newtitle);
}
+
void gui_window_set_url(struct gui_window *_g, const char *url)
{
struct gtk_scaffolding *g = nsgtk_get_scaffold(_g);
diff --git a/gtk/tabs.c b/gtk/tabs.c
index c5ef6fe..62a864e 100644
--- a/gtk/tabs.c
+++ b/gtk/tabs.c
@@ -334,8 +334,8 @@ void nsgtk_tab_set_title(struct gui_window *g, const char *title)
{
GtkWidget *label;
GtkWidget *tab;
- tab = nsgtk_window_get_tab(g);
+ tab = nsgtk_window_get_tab(g);
if (tab == NULL) {
return;
}
@@ -343,7 +343,6 @@ void nsgtk_tab_set_title(struct gui_window *g, const char *title)
label = g_object_get_data(G_OBJECT(tab), "label");
gtk_label_set_text(GTK_LABEL(label), title);
gtk_widget_set_tooltip_text(tab, title);
-
}
/* exported interface documented in gtk/tabs.h */
diff --git a/gtk/tabs.h b/gtk/tabs.h
index 959799e..caa683e 100644
--- a/gtk/tabs.h
+++ b/gtk/tabs.h
@@ -23,6 +23,15 @@ struct gui_window;
void nsgtk_tab_init(struct gtk_scaffolding *gs);
void nsgtk_tab_add(struct gui_window *window, GtkWidget *tab_contents, bool background);
+
+/** set the tab title
+ *
+ * The tab title will be set to the parameter
+ *
+ * @note currently only called from gui_window_set_title()
+ * @param g the gui window to set tab title for.
+ * @param title The title text which may not be NULL.
+ */
void nsgtk_tab_set_title(struct gui_window *g, const char *title);
void nsgtk_tab_options_changed(GtkNotebook *notebook);
nserror nsgtk_tab_close_current(GtkNotebook *notebook);
-----------------------------------------------------------------------
Summary of changes:
gtk/scaffolding.c | 40 ++++++++++++++++++++++++++++++----------
gtk/tabs.c | 3 +--
gtk/tabs.h | 9 +++++++++
3 files changed, 40 insertions(+), 12 deletions(-)
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 80b6dea..3d86975 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -2162,25 +2162,45 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
return g;
}
+/** set the title in the window
+ *
+ * @param gw The gui window to set title on
+ * @param title The title to set (may be NULL)
+ */
void gui_window_set_title(struct gui_window *gw, const char *title)
{
- static char suffix[] = " - NetSurf";
- char nt[strlen(title) + strlen(suffix) + 1];
struct gtk_scaffolding *gs = nsgtk_get_scaffold(gw);
+ int title_len;
+ char *newtitle;
- nsgtk_tab_set_title(gw, title);
-
- if (gs->top_level == gw) {
- if (title == NULL || title[0] == '\0') {
+ if ((title == NULL) || (title[0] == '\0')) {
+ if (gs->top_level != gw) {
gtk_window_set_title(gs->window, "NetSurf");
- } else {
- strcpy(nt, title);
- strcat(nt, suffix);
- gtk_window_set_title(gs->window, nt);
}
+ return;
+ }
+
+ nsgtk_tab_set_title(gw, title);
+
+ if (gs->top_level != gw) {
+ /* not top level window so do not set window title */
+ return;
+ }
+
+ title_len = strlen(title) + SLEN(" - NetSurf") + 1;
+ newtitle = malloc(title_len);
+ if (newtitle == NULL) {
+ return;
}
+
+ snprintf(newtitle, title_len, "%s - NetSurf", title);
+
+ gtk_window_set_title(gs->window, newtitle);
+
+ free(newtitle);
}
+
void gui_window_set_url(struct gui_window *_g, const char *url)
{
struct gtk_scaffolding *g = nsgtk_get_scaffold(_g);
diff --git a/gtk/tabs.c b/gtk/tabs.c
index c5ef6fe..62a864e 100644
--- a/gtk/tabs.c
+++ b/gtk/tabs.c
@@ -334,8 +334,8 @@ void nsgtk_tab_set_title(struct gui_window *g, const char *title)
{
GtkWidget *label;
GtkWidget *tab;
- tab = nsgtk_window_get_tab(g);
+ tab = nsgtk_window_get_tab(g);
if (tab == NULL) {
return;
}
@@ -343,7 +343,6 @@ void nsgtk_tab_set_title(struct gui_window *g, const char *title)
label = g_object_get_data(G_OBJECT(tab), "label");
gtk_label_set_text(GTK_LABEL(label), title);
gtk_widget_set_tooltip_text(tab, title);
-
}
/* exported interface documented in gtk/tabs.h */
diff --git a/gtk/tabs.h b/gtk/tabs.h
index 959799e..caa683e 100644
--- a/gtk/tabs.h
+++ b/gtk/tabs.h
@@ -23,6 +23,15 @@ struct gui_window;
void nsgtk_tab_init(struct gtk_scaffolding *gs);
void nsgtk_tab_add(struct gui_window *window, GtkWidget *tab_contents, bool background);
+
+/** set the tab title
+ *
+ * The tab title will be set to the parameter
+ *
+ * @note currently only called from gui_window_set_title()
+ * @param g the gui window to set tab title for.
+ * @param title The title text which may not be NULL.
+ */
void nsgtk_tab_set_title(struct gui_window *g, const char *title);
void nsgtk_tab_options_changed(GtkNotebook *notebook);
nserror nsgtk_tab_close_current(GtkNotebook *notebook);
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-676-g1cf0125
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/1cf0125f2dc49363f6fd9...
...commit http://git.netsurf-browser.org/netsurf.git/commit/1cf0125f2dc49363f6fd94e...
...tree http://git.netsurf-browser.org/netsurf.git/tree/1cf0125f2dc49363f6fd94e84...
The branch, master has been updated
via 1cf0125f2dc49363f6fd94e8462bbdcbbd5e8669 (commit)
from 88bd4e2ee2ea4c3af29c67b071406c957f9ba111 (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=1cf0125f2dc49363f6f...
commit 1cf0125f2dc49363f6fd94e8462bbdcbbd5e8669
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix leaks of colour attribute values. (Such as LINK, VLINK, TEXT, and COLOR attribute values.)
diff --git a/css/select.c b/css/select.c
index 23666e1..6c67c2e 100644
--- a/css/select.c
+++ b/css/select.c
@@ -2776,12 +2776,14 @@ node_presentational_hint_color(nscss_select_ctx *ctx,
if (!nscss_parse_colour((const char *)dom_string_data(color),
&hint->data.color)) {
+ dom_string_unref(color);
dom_string_unref(node_name);
return CSS_PROPERTY_NOT_SET;
}
hint->status = CSS_COLOR_COLOR;
+ dom_string_unref(color);
dom_string_unref(node_name);
return CSS_OK;
-----------------------------------------------------------------------
Summary of changes:
css/select.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/css/select.c b/css/select.c
index 23666e1..6c67c2e 100644
--- a/css/select.c
+++ b/css/select.c
@@ -2776,12 +2776,14 @@ node_presentational_hint_color(nscss_select_ctx *ctx,
if (!nscss_parse_colour((const char *)dom_string_data(color),
&hint->data.color)) {
+ dom_string_unref(color);
dom_string_unref(node_name);
return CSS_PROPERTY_NOT_SET;
}
hint->status = CSS_COLOR_COLOR;
+ dom_string_unref(color);
dom_string_unref(node_name);
return CSS_OK;
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-675-g88bd4e2
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/88bd4e2ee2ea4c3af29c6...
...commit http://git.netsurf-browser.org/netsurf.git/commit/88bd4e2ee2ea4c3af29c67b...
...tree http://git.netsurf-browser.org/netsurf.git/tree/88bd4e2ee2ea4c3af29c67b07...
The branch, master has been updated
via 88bd4e2ee2ea4c3af29c67b071406c957f9ba111 (commit)
via 2e4c1cf950eb8198eeaa49757bf44dc0a0817c4e (commit)
via 2cd2846122644071ae07acff1ec52f459848d0fe (commit)
from a921a007e626bb9a96b3c81d161bbdd8d2af7ad6 (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=88bd4e2ee2ea4c3af29...
commit 88bd4e2ee2ea4c3af29c67b071406c957f9ba111
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
fix resource leak coverity 1109883
diff --git a/gtk/dialogs/source.c b/gtk/dialogs/source.c
index ef4e36e..4499cca 100644
--- a/gtk/dialogs/source.c
+++ b/gtk/dialogs/source.c
@@ -254,6 +254,9 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
}
+/**
+ * create a new tab with page source
+ */
void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
{
const char *source_data;
@@ -261,15 +264,18 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
char *ndata = 0;
nsurl *url;
nserror error;
+ utf8_convert_ret r;
+ gchar *filename;
+ char *fileurl;
+ gint handle;
source_data = content_get_source_data(bw->current_content,
- &source_size);
+ &source_size);
- utf8_convert_ret r = utf8_from_enc(
- source_data,
- html_get_encoding(bw->current_content),
- source_size,
- &ndata);
+ r = utf8_from_enc(source_data,
+ html_get_encoding(bw->current_content),
+ source_size,
+ &ndata);
if (r == UTF8_CONVERT_NOMEM) {
warn_user("NoMemory",0);
return;
@@ -277,20 +283,22 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
warn_user("EncNotRec",0);
return;
}
- gchar *filename;
- char *fileurl;
- gint handle = g_file_open_tmp("nsgtksourceXXXXXX", &filename, NULL);
+
+ handle = g_file_open_tmp("nsgtksourceXXXXXX", &filename, NULL);
if ((handle == -1) || (filename == NULL)) {
warn_user(messages_get("gtkSourceTabError"), 0);
+ free(ndata);
return;
}
close (handle); /* in case it was binary mode */
+
FILE *f = fopen(filename, "w");
if (f == NULL) {
warn_user(messages_get("gtkSourceTabError"), 0);
g_free(filename);
return;
}
+
fprintf(f, "%s", ndata);
fclose(f);
free(ndata);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=2e4c1cf950eb8198eea...
commit 2e4c1cf950eb8198eeaa49757bf44dc0a0817c4e
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
fix resource leak coverity 1109884
diff --git a/gtk/toolbar.c b/gtk/toolbar.c
index 7cc20aa..d543ca5 100644
--- a/gtk/toolbar.c
+++ b/gtk/toolbar.c
@@ -206,6 +206,7 @@ void nsgtk_toolbar_window_open(nsgtk_scaffolding *g)
g_error_free (error);
warn_user(messages_get("NoMemory"), 0);
nsgtk_toolbar_cancel_clicked(NULL, g);
+ free(theme);
return;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=2cd2846122644071ae0...
commit 2cd2846122644071ae07acff1ec52f459848d0fe
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
fix coverity 1109906 uninitialised pointer read
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index fdc3cc7..80b6dea 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -612,7 +612,7 @@ MULTIHANDLER(newwindow)
nserror nsgtk_scaffolding_new_tab(struct gui_window *gw)
{
struct browser_window *bw = nsgtk_get_browser_window(gw);
- nsurl *url;
+ nsurl *url = NULL;
nserror error;
if (!nsoption_bool(new_blank)) {
-----------------------------------------------------------------------
Summary of changes:
gtk/dialogs/source.c | 26 +++++++++++++++++---------
gtk/scaffolding.c | 2 +-
gtk/toolbar.c | 1 +
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/gtk/dialogs/source.c b/gtk/dialogs/source.c
index ef4e36e..4499cca 100644
--- a/gtk/dialogs/source.c
+++ b/gtk/dialogs/source.c
@@ -254,6 +254,9 @@ void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
}
+/**
+ * create a new tab with page source
+ */
void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
{
const char *source_data;
@@ -261,15 +264,18 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
char *ndata = 0;
nsurl *url;
nserror error;
+ utf8_convert_ret r;
+ gchar *filename;
+ char *fileurl;
+ gint handle;
source_data = content_get_source_data(bw->current_content,
- &source_size);
+ &source_size);
- utf8_convert_ret r = utf8_from_enc(
- source_data,
- html_get_encoding(bw->current_content),
- source_size,
- &ndata);
+ r = utf8_from_enc(source_data,
+ html_get_encoding(bw->current_content),
+ source_size,
+ &ndata);
if (r == UTF8_CONVERT_NOMEM) {
warn_user("NoMemory",0);
return;
@@ -277,20 +283,22 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
warn_user("EncNotRec",0);
return;
}
- gchar *filename;
- char *fileurl;
- gint handle = g_file_open_tmp("nsgtksourceXXXXXX", &filename, NULL);
+
+ handle = g_file_open_tmp("nsgtksourceXXXXXX", &filename, NULL);
if ((handle == -1) || (filename == NULL)) {
warn_user(messages_get("gtkSourceTabError"), 0);
+ free(ndata);
return;
}
close (handle); /* in case it was binary mode */
+
FILE *f = fopen(filename, "w");
if (f == NULL) {
warn_user(messages_get("gtkSourceTabError"), 0);
g_free(filename);
return;
}
+
fprintf(f, "%s", ndata);
fclose(f);
free(ndata);
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index fdc3cc7..80b6dea 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -612,7 +612,7 @@ MULTIHANDLER(newwindow)
nserror nsgtk_scaffolding_new_tab(struct gui_window *gw)
{
struct browser_window *bw = nsgtk_get_browser_window(gw);
- nsurl *url;
+ nsurl *url = NULL;
nserror error;
if (!nsoption_bool(new_blank)) {
diff --git a/gtk/toolbar.c b/gtk/toolbar.c
index 7cc20aa..d543ca5 100644
--- a/gtk/toolbar.c
+++ b/gtk/toolbar.c
@@ -206,6 +206,7 @@ void nsgtk_toolbar_window_open(nsgtk_scaffolding *g)
g_error_free (error);
warn_user(messages_get("NoMemory"), 0);
nsgtk_toolbar_cancel_clicked(NULL, g);
+ free(theme);
return;
}
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-672-ga921a00
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/a921a007e626bb9a96b3c...
...commit http://git.netsurf-browser.org/netsurf.git/commit/a921a007e626bb9a96b3c81...
...tree http://git.netsurf-browser.org/netsurf.git/tree/a921a007e626bb9a96b3c81d1...
The branch, master has been updated
via a921a007e626bb9a96b3c81d161bbdd8d2af7ad6 (commit)
from 0d03a342d93599bac661b90938a0478268881eda (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=a921a007e626bb9a96b...
commit a921a007e626bb9a96b3c81d161bbdd8d2af7ad6
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix leak of cellpadding attribute value.
diff --git a/css/select.c b/css/select.c
index 0f1962b..23666e1 100644
--- a/css/select.c
+++ b/css/select.c
@@ -2014,6 +2014,7 @@ node_presentational_hint_padding_trbl(nscss_select_ctx *ctx,
dom_string *name;
dom_exception exc;
dom_string *cellpadding = NULL;
+ css_error result = CSS_PROPERTY_NOT_SET;
exc = dom_node_get_node_name(node, &name);
if (exc != DOM_NO_ERR)
@@ -2049,20 +2050,18 @@ node_presentational_hint_padding_trbl(nscss_select_ctx *ctx,
}
dom_string_unref(name);
-
- if (cellpadding == NULL)
- return CSS_PROPERTY_NOT_SET;
- if (parse_dimension(dom_string_data(cellpadding), false,
- &hint->data.length.value,
- &hint->data.length.unit)) {
- hint->status = CSS_PADDING_SET;
- } else {
+ if (cellpadding != NULL) {
+ if (parse_dimension(dom_string_data(cellpadding), false,
+ &hint->data.length.value,
+ &hint->data.length.unit)) {
+ hint->status = CSS_PADDING_SET;
+ result = CSS_OK;
+ }
dom_string_unref(cellpadding);
- return CSS_PROPERTY_NOT_SET;
}
- return CSS_OK;
+ return result;
}
static css_error
-----------------------------------------------------------------------
Summary of changes:
css/select.c | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/css/select.c b/css/select.c
index 0f1962b..23666e1 100644
--- a/css/select.c
+++ b/css/select.c
@@ -2014,6 +2014,7 @@ node_presentational_hint_padding_trbl(nscss_select_ctx *ctx,
dom_string *name;
dom_exception exc;
dom_string *cellpadding = NULL;
+ css_error result = CSS_PROPERTY_NOT_SET;
exc = dom_node_get_node_name(node, &name);
if (exc != DOM_NO_ERR)
@@ -2049,20 +2050,18 @@ node_presentational_hint_padding_trbl(nscss_select_ctx *ctx,
}
dom_string_unref(name);
-
- if (cellpadding == NULL)
- return CSS_PROPERTY_NOT_SET;
- if (parse_dimension(dom_string_data(cellpadding), false,
- &hint->data.length.value,
- &hint->data.length.unit)) {
- hint->status = CSS_PADDING_SET;
- } else {
+ if (cellpadding != NULL) {
+ if (parse_dimension(dom_string_data(cellpadding), false,
+ &hint->data.length.value,
+ &hint->data.length.unit)) {
+ hint->status = CSS_PADDING_SET;
+ result = CSS_OK;
+ }
dom_string_unref(cellpadding);
- return CSS_PROPERTY_NOT_SET;
}
- return CSS_OK;
+ return result;
}
static css_error
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-671-g0d03a34
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/0d03a342d93599bac661b...
...commit http://git.netsurf-browser.org/netsurf.git/commit/0d03a342d93599bac661b90...
...tree http://git.netsurf-browser.org/netsurf.git/tree/0d03a342d93599bac661b9093...
The branch, master has been updated
via 0d03a342d93599bac661b90938a0478268881eda (commit)
from 0e4a60572955e5a9f8beb237b7dcb086e6d07847 (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=0d03a342d93599bac66...
commit 0d03a342d93599bac661b90938a0478268881eda
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Clean up cached fetch handles.
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index f812090..1dfc446 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -319,6 +319,8 @@ void fetch_curl_finalise(lwc_string *scheme)
h = curl_handle_ring;
RING_REMOVE(curl_handle_ring, h);
lwc_string_unref(h->host);
+ curl_easy_cleanup(h->handle);
+ free(h);
}
}
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/curl.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index f812090..1dfc446 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -319,6 +319,8 @@ void fetch_curl_finalise(lwc_string *scheme)
h = curl_handle_ring;
RING_REMOVE(curl_handle_ring, h);
lwc_string_unref(h->host);
+ curl_easy_cleanup(h->handle);
+ free(h);
}
}
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-670-g0e4a605
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/0e4a60572955e5a9f8beb...
...commit http://git.netsurf-browser.org/netsurf.git/commit/0e4a60572955e5a9f8beb23...
...tree http://git.netsurf-browser.org/netsurf.git/tree/0e4a60572955e5a9f8beb237b...
The branch, master has been updated
via 0e4a60572955e5a9f8beb237b7dcb086e6d07847 (commit)
from 0c44eb081e584353596b36f85357459e07881ae6 (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=0e4a60572955e5a9f8b...
commit 0e4a60572955e5a9f8beb237b7dcb086e6d07847
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Remove unnecessary strlen.
diff --git a/utils/filepath.c b/utils/filepath.c
index 7f11def..d088777 100644
--- a/utils/filepath.c
+++ b/utils/filepath.c
@@ -221,7 +221,7 @@ expand_path(const char *path, int pathlen)
memcpy(exp, path, pathlen);
exp[pathlen] = 0;
- explen = strlen(exp);
+ explen = pathlen;
while (exp[cloop] != 0) {
if ((exp[cloop] == '$') &&
-----------------------------------------------------------------------
Summary of changes:
utils/filepath.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/utils/filepath.c b/utils/filepath.c
index 7f11def..d088777 100644
--- a/utils/filepath.c
+++ b/utils/filepath.c
@@ -221,7 +221,7 @@ expand_path(const char *path, int pathlen)
memcpy(exp, path, pathlen);
exp[pathlen] = 0;
- explen = strlen(exp);
+ explen = pathlen;
while (exp[cloop] != 0) {
if ((exp[cloop] == '$') &&
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-669-g0c44eb0
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/0c44eb081e584353596b3...
...commit http://git.netsurf-browser.org/netsurf.git/commit/0c44eb081e584353596b36f...
...tree http://git.netsurf-browser.org/netsurf.git/tree/0c44eb081e584353596b36f85...
The branch, master has been updated
via 0c44eb081e584353596b36f85357459e07881ae6 (commit)
from 26cecc9f95e55f33b4cb95e9439c718b9caf29d8 (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=0c44eb081e584353596...
commit 0c44eb081e584353596b36f85357459e07881ae6
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Free string vector correctly.
diff --git a/utils/filepath.c b/utils/filepath.c
index f0aa195..7f11def 100644
--- a/utils/filepath.c
+++ b/utils/filepath.c
@@ -310,6 +310,10 @@ filepath_path_to_strvec(const char *path)
/* exported interface documented in filepath.h */
void filepath_free_strvec(char **pathv)
{
- free(pathv[0]);
+ int p = 0;
+
+ while (pathv[p] != NULL) {
+ free(pathv[p++]);
+ }
free(pathv);
}
-----------------------------------------------------------------------
Summary of changes:
utils/filepath.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/utils/filepath.c b/utils/filepath.c
index f0aa195..7f11def 100644
--- a/utils/filepath.c
+++ b/utils/filepath.c
@@ -310,6 +310,10 @@ filepath_path_to_strvec(const char *path)
/* exported interface documented in filepath.h */
void filepath_free_strvec(char **pathv)
{
- free(pathv[0]);
+ int p = 0;
+
+ while (pathv[p] != NULL) {
+ free(pathv[p++]);
+ }
free(pathv);
}
--
NetSurf Browser
9 years, 11 months