Revision: 5946 http://geany.svn.sourceforge.net/geany/?rev=5946&view=rev Author: ntrel Date: 2011-09-22 15:53:14 +0000 (Thu, 22 Sep 2011) Log Message: ----------- Fix \0 char in format string - save as dialog filter bug.
Modified Paths: -------------- trunk/ChangeLog trunk/src/win32.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-09-22 12:05:05 UTC (rev 5945) +++ trunk/ChangeLog 2011-09-22 15:53:14 UTC (rev 5946) @@ -2,6 +2,8 @@
* src/stash.c, src/keyfile.c, src/keyfile.h, src/ui_utils.c: Add configuration_add_various_pref_group(). + * src/win32.c: + Fix \0 char in format string - save as dialog filter bug.
2011-09-20 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/win32.c =================================================================== --- trunk/src/win32.c 2011-09-22 12:05:05 UTC (rev 5945) +++ trunk/src/win32.c 2011-09-22 15:53:14 UTC (rev 5946) @@ -121,11 +121,8 @@
/* replace all "\t"s by \0 */ len = strlen(string); - for (i = 0; i < len; i++) - { - if (string[i] == '\t') - string[i] = '\0'; - } + g_strdelimit(string, "\t", '\0'); + g_assert(string[len - 1] == 0x0); MultiByteToWideChar(CP_UTF8, 0, string, len, title, sizeof(title)); g_free(string);
@@ -140,9 +137,11 @@ gchar *filter;
/* create meta file filter "All files" */ - filter = g_strdup_printf("%s\0*\0", _("All files")); + filter = g_strdup_printf("%s\t*\t", _("All files"));
- len = strlen(_("All files")) + 3; + len = strlen(filter); + g_strdelimit(filter, "\t", '\0'); + g_assert(filter[len - 1] == 0x0); MultiByteToWideChar(CP_UTF8, 0, filter, len, title, sizeof(title)); g_free(filter);
@@ -153,7 +152,7 @@ static wchar_t *get_filters(gboolean project_files) { gchar *string; - gint i, len; + gint len; static wchar_t title[1024];
if (project_files) @@ -171,10 +170,8 @@
/* replace all "\t"s by \0 */ len = strlen(string); - for (i = 0; i < len; i++) - { - if (string[i] == '\t') string[i] = '\0'; - } + g_strdelimit(string, "\t", '\0'); + g_assert(string[len - 1] == 0x0); MultiByteToWideChar(CP_UTF8, 0, string, len, title, sizeof(title)); g_free(string);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.