On 7/1/07, Stefan Küng <tortoisesvn@gmail.com> wrote:
> Ivan Zhakov wrote:
> > On 7/1/07, steveking <tortoisesvn@gmail.com> wrote:
> >> Ivan Zhakov wrote:
> >>
> >> > Sorry, I was busy and I have not time to report my research results.
> >> >
> >> > My patch almost complete and I need somebody's eyes to look and
> >> > confirm that I'm on right way (or say that I'm on wrong way :)
> >> >
> >> > I used Windows MIME database to convert page name to Windows page
> >> > identifier.
> >> > And most important question is it acceptable to read Windows MIME
> >> > database directly from registry instead of using MLang API [1]? I
> >> > didn't use MLang API, because it requires
> >> > CoInitialize()/CoUninitialize().
> >>
> >> I think it would be better to use the API instead of reading the
> >> registry. Because the registry is not documented and could change any
> >> time.
> >> About CoInitialize(): we could call that in svn_utf_initialize() and
> >> call CoUninitialize in an apr cleanup handler.
> > Actually registry is documented, at least for Windows CE :)
> > I agree that using API is better, but it's not too easy. We have to
> > call CoInitalize() in each thread that using COM. Another problem that
> > we don't require user libraries to call svn_utf8_initalize().
> >
> > As workaround of problems above we can call to
> > CoInitialize()/CoUninitalize() every time in win32_open_xlate(). This
> > function get called only once for each page identifiers, so it
> > shouldn't cause performance degradation. What do you think about it?
>
> I forgot about the backward compatibility. Otherwise we could just
> document that CoInitialize() must be called for every thread.
>
> If the registry is documented, then we can of course use that. I don't
> think it will be faster than using the API since registry accesses are
> expensive too, but at least for most conversions it's not needed anyway.
>
Here is revisited patch. Major vhanges from previous version:
- Use MLang API for converting page name to page id.
- All Windows stuff moved to separate file win32_xlate.c.
[[[
Remove APR ICONV dependency on Windows and use native Windows
character conversion API (MultiByteToWideChar/WideCharToMultiByte).
* subversion/tests/libsvn_subr/utf-test.c
(test_utf_cstring_to_utf8_ex2): New test for conversion from
different codepages
to utf8.
(test_utf_cstring_from_utf8_ex2): New test for conversion to
different codepages
from utf8.
(test_funcs): Add two tests.
* subversion/libsvn_subr/utf8.c
(get_xlate_handle_node): Use svn_subr__win32_xlate_open() on Windows.
(convert_to_stringbuf): Use svn_subr__win32_convert_to_stringbuf() on Windows.
* subversion/libsvn_subr/win32_xlate.c
* subversion/libsvn_subr/win32_xlate.h
(win32_xlate_t): Structure for holding Windows xlate data.
(get_page_id_from_name): Helper for converting page name to page identifier.
(svn_subr__win32_xlate_open): Opens Windows xlate to convert one codepage to
another.
(svn_subr__win32_convert_to_string_buf): Converts string from one codepage to
another using Windows API.
]]]
--
Ivan Zhakov
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jul 2 13:07:15 2007