SF.net SVN: geany: [2162] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Fri Jan 11 15:02:43 UTC 2008
Revision: 2162
http://geany.svn.sourceforge.net/geany/?rev=2162&view=rev
Author: eht16
Date: 2008-01-11 07:02:42 -0800 (Fri, 11 Jan 2008)
Log Message:
-----------
Fix crash while reading Scintilla styles.
Append "_export" to the exported file name when the exported file has the same extension as the source file.
Modified Paths:
--------------
trunk/ChangeLog
trunk/plugins/export.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-01-11 14:23:29 UTC (rev 2161)
+++ trunk/ChangeLog 2008-01-11 15:02:42 UTC (rev 2162)
@@ -5,6 +5,10 @@
Fix crash while reading Scintilla styles.
Add GTK's progress dialog when printing large documents which also
provides the ability to cancel a print operation.
+ * plugins/export.c:
+ Fix crash while reading Scintilla styles.
+ Append "_export" to the exported file name when the exported file has
+ the same extension as the source file.
2008-01-10 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/plugins/export.c
===================================================================
--- trunk/plugins/export.c 2008-01-11 14:23:29 UTC (rev 2161)
+++ trunk/plugins/export.c 2008-01-11 15:02:42 UTC (rev 2162)
@@ -25,6 +25,7 @@
/* Export plugin. */
#include <ctype.h>
+#include <math.h>
#include "geany.h"
#include "support.h"
@@ -210,9 +211,17 @@
{
gchar *base_name = g_path_get_basename(doc_list[idx].file_name);
gchar *short_name = utils->remove_ext_from_filename(base_name);
- gchar *file_name = g_strconcat(short_name, extension, NULL);
- gchar *locale_filename = utils->get_locale_from_utf8(doc_list[idx].file_name);
- gchar *locale_dirname = g_path_get_dirname(locale_filename);
+ gchar *file_name;
+ gchar *locale_filename;
+ gchar *locale_dirname;
+ gchar *suffix = "";
+
+ if (g_str_has_suffix(doc_list[idx].file_name, extension))
+ suffix = "_export";
+
+ file_name = g_strconcat(short_name, suffix, extension, NULL);
+ locale_filename = utils->get_locale_from_utf8(doc_list[idx].file_name);
+ locale_dirname = g_path_get_dirname(locale_filename);
// set the current name to base_name.html which probably doesn't exist yet so
// gtk_file_chooser_set_filename() can't be used and we need
// gtk_file_chooser_set_current_folder() additionally
@@ -346,9 +355,10 @@
GString *body;
GString *cmds;
GString *latex;
+ gint style_max = pow(2, scintilla->send_message(doc_list[idx].sci, SCI_GETSTYLEBITS, 0, 0));
// first read all styles from Scintilla
- for (i = 0; i <= STYLE_MAX; i++)
+ for (i = 0; i < style_max; i++)
{
styles[i][FORE] = scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETFORE, i, 0);
styles[i][BACK] = scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETBACK, i, 0);
@@ -552,9 +562,10 @@
GString *body;
GString *css;
GString *html;
+ gint style_max = pow(2, scintilla->send_message(doc_list[idx].sci, SCI_GETSTYLEBITS, 0, 0));
// first read all styles from Scintilla
- for (i = 0; i <= STYLE_MAX; i++)
+ for (i = 0; i < style_max; i++)
{
styles[i][FORE] = ROTATE_RGB(scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETFORE, i, 0));
styles[i][BACK] = ROTATE_RGB(scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETBACK, i, 0));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list