[PATCH 1/4] hhctrl.ocx: Add HTML to Unicode decoding capability (try 3).

Jacek Caban jacek at codeweavers.com
Wed Jun 13 03:34:26 CDT 2012


Hi Erich,

On 06/12/12 19:03, Erich E. Hoover wrote:
> Real Name:
>     Erich Hoover
>
> Description:
>     This patch adds the ability in HTML Help to convert HTML encoded
> characters (e.g. ê) into the Unicode character equivalent.  This
> feature is needed by the table of contents and the index for
> displaying international characters in some CHM files.  With this
> version of the patch the decoding is done manually by parsing the HTML
> characters instead of using the web browser control, the search is a
> now a binary search, and some additional cleanup.  It is important to
> note that HTML Help only supports characters within the ANSI code
> pages, so support for multi-byte characters is not necessary.  Many
> apologizes to Jacek Caban for missing some of his comments in his
> original reply.
>
> Changelog:
>     hhctrl.ocx: Add HTML to Unicode decoding capability.

The patch looks much better. There is one remaining problem:

+ int pos = sizeof(html_encoded_symbols)/sizeof(html_encoded_symbols[0]);
+ float step = pos/2;
+ int dir = +1;
+
+ do
+ {
+ const char *encoded_symbol;
+
+ pos += -dir*ceil(step);

Using float here is definitely not needed, esp. that you always use
ceil() on it. You've made it more complicated than it really is. See [1]
for an example. Also feel free to send linear search with FIXME comment.
That's fine for the first iteration patch.

Jacek


[1]
http://source.winehq.org/git/wine.git/blob/HEAD:/dlls/mshtml/dispex.c#l709



More information about the wine-devel mailing list