Revision: 5494 http://geany.svn.sourceforge.net/geany/?rev=5494&view=rev Author: ntrel Date: 2010-12-22 13:18:26 +0000 (Wed, 22 Dec 2010)
Log Message: ----------- Fix detecting non-lowercase self-closing tags e.g. <BR> (#2226117).
Modified Paths: -------------- branches/unstable/ChangeLog branches/unstable/src/utils.c
Modified: branches/unstable/ChangeLog =================================================================== --- branches/unstable/ChangeLog 2010-12-22 12:49:56 UTC (rev 5493) +++ branches/unstable/ChangeLog 2010-12-22 13:18:26 UTC (rev 5494) @@ -1,3 +1,9 @@ +2010-12-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/utils.c: + Fix detecting non-lowercase self-closing tags e.g. <BR> (#2226117). + + 2010-12-03 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* scintilla/gtk/ScintillaGTK.cxx:
Modified: branches/unstable/src/utils.c =================================================================== --- branches/unstable/src/utils.c 2010-12-22 12:49:56 UTC (rev 5493) +++ branches/unstable/src/utils.c 2010-12-22 13:18:26 UTC (rev 5494) @@ -336,19 +336,29 @@ }
-/* Returns true if specified tag doesn't usually contain any content and can be left unclosed */ +/* Returns true if tag_name is a self-closing tag */ gboolean utils_is_short_html_tag(const gchar *tag_name) { - return utils_str_equal(tag_name, "br") - || utils_str_equal(tag_name, "hr") - || utils_str_equal(tag_name, "img") - || utils_str_equal(tag_name, "base") - || utils_str_equal(tag_name, "basefont") /* < or not < */ - || utils_str_equal(tag_name, "frame") - || utils_str_equal(tag_name, "input") - || utils_str_equal(tag_name, "link") - || utils_str_equal(tag_name, "area") - || utils_str_equal(tag_name, "meta"); + const gchar names[][20] = { + "area", + "base", + "basefont", /* < or not < */ + "br", + "frame", + "hr", + "img", + "input", + "link", + "meta" + }; + + if (tag_name) + { + if (bsearch(tag_name, names, G_N_ELEMENTS(names), 20, + (GCompareFunc)g_ascii_strcasecmp)) + return TRUE; + } + return FALSE; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.