Kaydet (Commit) 58f2a195 authored tarafından Enrico Tröger's avatar Enrico Tröger

Fixed possible segfault when replacing tabs by spaces.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@695 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst a01c0eae
2006-08-11 Enrico Tröger <enrico.troeger@uvena.de>
* src/document.c:
Changed SEARCH_NOT_FOUND_TXT.
Fixed possible segfault when replacing tabs by spaces.
2006-08-09 Enrico Tröger <enrico.troeger@uvena.de> 2006-08-09 Enrico Tröger <enrico.troeger@uvena.de>
* doc/geany.docbook: * doc/geany.docbook:
......
...@@ -797,7 +797,8 @@ void document_save_file(gint idx, gboolean force) ...@@ -797,7 +797,8 @@ void document_save_file(gint idx, gboolean force)
} }
#define SEARCH_NOT_FOUND_TXT _("The match \"%s\" was not found. Wrap search around the document?") #define SEARCH_NOT_FOUND_TXT _("The document has been searched completely but the match \"%s\" \
was not found. Wrap search around the document?")
/* special search function, used from the find entry in the toolbar */ /* special search function, used from the find entry in the toolbar */
void document_find_next(gint idx, const gchar *text, gint flags, gboolean find_button, gboolean inc) void document_find_next(gint idx, const gchar *text, gint flags, gboolean find_button, gboolean inc)
...@@ -1335,7 +1336,7 @@ void document_replace_tabs(gint idx) ...@@ -1335,7 +1336,7 @@ void document_replace_tabs(gint idx)
return; return;
} }
text = g_malloc(len + (tabs_amount * (tab_w - 1))); text = g_malloc(len + (tabs_amount * (tab_w - 1)) + 1);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
...@@ -1354,7 +1355,9 @@ void document_replace_tabs(gint idx) ...@@ -1354,7 +1355,9 @@ void document_replace_tabs(gint idx)
text[j++] = data[i]; text[j++] = data[i];
} }
} }
geany_debug("tabs_amount: %d, len: %d, %d == %d", tabs_amount, len, len + (tabs_amount * (tab_w - 1)), j); text[j] = '\0';
geany_debug("Replacing Tabs: tabs_amount: %d, text len: %d, j: %d", tabs_amount, len, j);
sci_set_text(doc_list[idx].sci, text); sci_set_text(doc_list[idx].sci, text);
sci_set_current_position(doc_list[idx].sci, pos); sci_set_current_position(doc_list[idx].sci, pos);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment