Project

General

Profile

Bug #1094 » liborchestrator-fix-1094.patch

Proposed fix for the above issues - Guido Berhörster, 2011-06-08 12:30 PM

View differences:

usr/src/lib/liborchestrator/locale.c
79 79
	char	*lang_name;
80 80
	char	*lang_code;
81 81
} chinese_values[] = {
82
	{"zh", SIMPLIFIED_CHINESE, "sc"},
83
	{"zh.GBK", SIMPLIFIED_CHINESE, "sc"},
84
	{"zh.UTF-8", SIMPLIFIED_CHINESE, "sc"},
85
	{"zh_CN", SIMPLIFIED_CHINESE, "sc"},
86
	{"zh_CN.GB18030", SIMPLIFIED_CHINESE, "sc"},
87
	{"zh_CN.UTF-8", SIMPLIFIED_CHINESE, "sc"},
88
	{"zh_HK", TRADITIONAL_CHINESE, "tc"},
89
	{"zh_HK.BIG5HK", TRADITIONAL_CHINESE, "tc"},
90
	{"zh_HK.UTF-8", TRADITIONAL_CHINESE, "tc"},
91
	{"zh_TW", TRADITIONAL_CHINESE, "tc"},
92
	{"zh_TW.BIG5", TRADITIONAL_CHINESE, "tc"},
93
	{"zh_TW.UTF-8", TRADITIONAL_CHINESE, "tc"}
82
	{"zh_CN", SIMPLIFIED_CHINESE, "sc"}
83
	{"zh_HK", TRADITIONAL_CHINESE, "tc"}
84
	{"zh_MO", TRADITIONAL_CHINESE, "tc"}
85
	{"zh_SG", TRADITIONAL_CHINESE, "tc"}
86
	{"zh_TW", TRADITIONAL_CHINESE, "tc"}
87
	{NULL, NULL, NULL}
94 88
};
95 89

  
96 90

  
91

  
97 92
static int 	add_lang_to_list(char ***list, char *locale, int *k, int j);
98 93
static void 	add_locale_entry_to_lang(lang_info_t *lp, char *locale,
99 94
    char *region, boolean_t is_default);
......
643 638
	locale_info_t	*lp = NULL;
644 639
	char		**trans_lang = NULL;
645 640
	char		*tmp_lang = NULL;
641
	char		*tmp_lang_name = NULL;
646 642
	char		*tmp_locale = NULL;
647 643
	char		*code = NULL;
648 644
	char		*desc = NULL;
......
654 650
	 * Chinese or Simplified Chinese. Everything else is a locale.
655 651
	 */
656 652
	if (strncmp(lang, "zh", 2) == 0) {
657
		tmp_lang = strdup(dgettext(TEXT_DOMAIN,
658
		    substitute_chinese_language(lang, &code)));
653
		tmp_lang_name = substitute_chinese_language(lang, &code);
654
		if (tmp_lang_name != NULL)
655
		{
656
			tmp_lang = strdup(dgettext(TEXT_DOMAIN, tmp_lang_name));
657
			free(tmp_lang_name);
658
		}
659 659
		if (locale == NULL)
660 660
			tmp_locale = strdup(dgettext(TEXT_DOMAIN, lang));
661 661
	}
......
776 776
get_lang_entry(char *lang_name, lang_info_t *search_list)
777 777
{
778 778
	lang_info_t 	*list = NULL;
779
	char		*tmp_lang = NULL;
780 779
	char		*code = NULL;
781 780
	boolean_t	found = B_FALSE;
782 781

  
......
787 786
	 */
788 787

  
789 788
	if (strncmp(lang_name, "zh", 2) == 0)  {
790
		tmp_lang = strdup(dgettext(TEXT_DOMAIN,
791
		    substitute_chinese_language(lang_name, &code)));
789
		(void)substitute_chinese_language(lang_name, &code);
792 790
	}
793 791

  
794 792
	for (list = search_list; list != NULL; list = list->next) {
......
805 803
		}
806 804
	}
807 805

  
808
	free(tmp_lang);
809 806
	free(code);
810 807

  
811 808
	if (!found)
(1-1/2)