Revision: 4654 http://geany.svn.sourceforge.net/geany/?rev=4654&view=rev Author: eht16 Date: 2010-02-07 18:37:25 +0000 (Sun, 07 Feb 2010)
Log Message: ----------- Fix possible endless loop when trying to detect the encoding of non-text files (patch by Alexey Antipov, thanks).
Modified Paths: -------------- trunk/ChangeLog trunk/src/encodings.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-02-07 18:24:45 UTC (rev 4653) +++ trunk/ChangeLog 2010-02-07 18:37:25 UTC (rev 4654) @@ -5,6 +5,9 @@ Unref the new files toolbar menu when freeing templates as it was done before but unref it *after* the menu has been removed from the GeanyMenuButtonAction. + * src/encodings.c: + Fix possible endless loop when trying to detect the encoding of + non-text files (patch by Alexey Antipov, thanks).
2010-02-06 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/encodings.c =================================================================== --- trunk/src/encodings.c 2010-02-07 18:24:45 UTC (rev 4653) +++ trunk/src/encodings.c 2010-02-07 18:37:25 UTC (rev 4654) @@ -550,13 +550,17 @@ /* First check for preferred charset, if specified */ preferred_charset = file_prefs.default_open_encoding;
- if (preferred_charset == encodings[GEANY_ENCODING_NONE].idx || preferred_charset < 0 || preferred_charset >= GEANY_ENCODINGS_MAX) + if (preferred_charset == encodings[GEANY_ENCODING_NONE].idx || + preferred_charset < 0 || + preferred_charset >= GEANY_ENCODINGS_MAX) + { preferred_charset = -1; + }
/* -1 means "Preferred charset" */ for (i = -1; i < GEANY_ENCODINGS_MAX; i++) { - if (G_UNLIKELY(i == encodings[GEANY_ENCODING_NONE].idx) || G_UNLIKELY(i == -2)) + if (G_UNLIKELY(i == encodings[GEANY_ENCODING_NONE].idx)) continue;
if (i == -1) @@ -565,7 +569,6 @@ { charset = encodings[preferred_charset].charset; geany_debug("Preferred charset: %s", charset); - i = -2; } else continue; @@ -574,13 +577,11 @@ { check_regex = FALSE; charset = regex_charset; - i = -2; } else if (check_locale) { check_locale = FALSE; charset = locale_charset; - i = -2; } else charset = encodings[i].charset;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.