Revision: 377 Author: eht16 Date: 2006-05-30 08:29:21 -0700 (Tue, 30 May 2006) ViewCVS: http://svn.sourceforge.net/geany/?rev=377&view=rev
Log Message: ----------- Fixed a wrong(non ISO-C) array size allocation, improved utils_replace_tabs()
Modified Paths: -------------- trunk/ChangeLog trunk/src/utils.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-05-30 15:28:13 UTC (rev 376) +++ trunk/ChangeLog 2006-05-30 15:29:21 UTC (rev 377) @@ -1,14 +1,25 @@ +2006-05-30 Enrico Troeger enrico.troeger@uvena.de + + * src/dialogs.c, src/main.c: + Removed unneeded function dialogs_show_fifo_error(), fixed small + memory leak in dialogs_show_question() + * src/utils.c: Fixed a wrong(non ISO-C) array size allocation, + improved utils_replace_tabs(). + * src/keybindings.c: Added shortcut for Replace Tabs by Space, + extend usage of GEANY_ADD_ACCEL macro. + + 2006-05-29 Enrico Troeger enrico.troeger@uvena.de
- * src/about.c: added Jacek Wolszczak and Frank Lanitz to the credits + * src/about.c: Added Jacek Wolszczak and Frank Lanitz to the credits.
2006-05-28 Enrico Troeger enrico.troeger@uvena.de
- * configure.in, po/po.po: added Polish translation contributed by - Jacek Wolszczak - * src/dialogs.c, src/utils.c: made recent files menu item insensitive - when the list is empty + * configure.in, po/pl.po: Added Polish translation contributed by + Jacek Wolszczak. + * src/dialogs.c, src/utils.c: Made recent files menu item insensitive + when the list is empty.
2006-05-26 Nick Treleaven nick.treleaven@btinternet.com
Modified: trunk/src/utils.c =================================================================== --- trunk/src/utils.c 2006-05-30 15:28:13 UTC (rev 376) +++ trunk/src/utils.c 2006-05-30 15:29:21 UTC (rev 377) @@ -92,6 +92,7 @@ /* updates the status bar */ void utils_update_statusbar(gint idx, gint pos) { + // currently text need in German and C locale about 150 chars gchar *text = (gchar*) g_malloc0(250); gchar *cur_tag; guint line, col; @@ -1473,21 +1474,30 @@ { gint i, len, j = 0, tabs_amount = 0; gint tab_w = sci_get_tab_width(doc_list[idx].sci); - /// TODO Warnung: ISO-C90 verbietet Feld »replacement« variabler Größe - gchar *data, replacement[tab_w + 1]; + gchar *data, *replacement; gchar *text;
+ replacement = g_malloc(tab_w + 1); + // get the text len = sci_get_length(doc_list[idx].sci) + 1; data = g_malloc(len); sci_get_text(doc_list[idx].sci, len, data);
// prepare the spaces with the width of a tab - for (i = 0; i < tab_w; i++) replacement[i] = 32; - replacement[tab_w] = 0; + for (i = 0; i < tab_w; i++) replacement[i] = ' '; + replacement[tab_w] = '\0';
for (i = 0; i < len; i++) if (data[i] == 9) tabs_amount++;
+ // if there are no tabs, just return and leave the content untouched + if (tabs_amount == 0) + { + g_free(data); + g_free(replacement); + return; + } + text = g_malloc(len + (tabs_amount * (tab_w - 1)));
for (i = 0; i < len; i++) @@ -1509,6 +1519,7 @@
g_free(data); g_free(text); + g_free(replacement); }
/* GList of strings operations */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.