[geany/geany] 405f77: Fix loading the default open encoding option

Colomban Wendling git-noreply at xxxxx
Sun Apr 14 14:02:33 UTC 2019


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 28 Nov 2016 11:01:14 UTC
Commit:      405f772b39f26ed5305d567700edd484dbfcfabb
             https://github.com/geany/geany/commit/405f772b39f26ed5305d567700edd484dbfcfabb

Log Message:
-----------
Fix loading the default open encoding option

This got broken by 907a79263d907fa354d3b4c6570f33047801dd84 back in
2011 as encoding names started to be compared more permissively,
leading to "none" matching the "None" encoding.

This shouldn't be too much of a problem as trying the None encoding
first should not cause any issue, but fix loading of the option anyway.

This however won't restore settings from existing configuration files
that used the previous code, as there is no way to tell whether the
user selected the None encoding voluntarily or not.


Modified Paths:
--------------
    src/keyfile.c

Modified: src/keyfile.c
4 lines changed, 3 insertions(+), 1 deletions(-)
===================================================================
@@ -826,7 +826,9 @@ static void load_dialog_prefs(GKeyFile *config)
 		"none");
 	if (tmp_string)
 	{
-		const GeanyEncoding *enc = encodings_get_from_charset(tmp_string);
+		const GeanyEncoding *enc = NULL;
+		if (strcmp(tmp_string, "none") != 0)
+			enc = encodings_get_from_charset(tmp_string);
 		if (enc != NULL)
 			file_prefs.default_open_encoding = enc->idx;
 		else



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list