[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r11483 - trunk/subversion/libsvn_subr

From: Branko ─îibej <brane_at_xbc.nu>
Date: 2004-10-19 18:43:26 CEST

jszakmeister@tigris.org wrote:

>Author: jszakmeister
>Date: Tue Oct 19 08:42:11 2004
>New Revision: 11483
>
>Modified:
> trunk/subversion/libsvn_subr/cmdline.c
>Log:
>Fix Issue #2091: svnadmin error on Win98: Can't convert module path to
>UTF-8.
>
>* subversion/subversion/libsvn_subr/cmdline.c
> (svn_cmdline_init): if GetModuleFileNameW() fails, then fall back to the
> ANSI character version and convert it to Unicode. This prevents
> ucs_path being passed uninitialized to apr_conv_ucs2_to_utf8().
>
>
>
>Modified: trunk/subversion/libsvn_subr/cmdline.c
>Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/libsvn_subr/cmdline.c?view=diff&rev=11483&p1=trunk/subversion/libsvn_subr/cmdline.c&r1=11482&p2=trunk/subversion/libsvn_subr/cmdline.c&r2=11483
>==============================================================================
>--- trunk/subversion/libsvn_subr/cmdline.c (original)
>+++ trunk/subversion/libsvn_subr/cmdline.c Tue Oct 19 08:42:11 2004
>@@ -43,6 +43,8 @@
> that should be fine for now, but a better solution must be found in
> combination with issue #850. */
> #include "arch/win32/apr_arch_utf8.h"
>+
>+#include <mbctype.h>
> #endif
>
> #define SVN_UTF_CONTOU_XLATE_HANDLE "svn-utf-contou-xlate-handle"
>@@ -173,7 +175,15 @@
> apr_pool_create (&pool, 0);
> /* get exe name - our locale info will be in '../share/locale' */
> inwords = sizeof (ucs2_path) / sizeof(ucs2_path[0]);
>- GetModuleFileNameW (0, ucs2_path, inwords);
>+ if (! GetModuleFileNameW (0, ucs2_path, inwords))
>+ {
>+ CHAR ansi_path[MAX_PATH];
>+ GetModuleFileNameA (0, ansi_path, sizeof (ansi_path));
>+ MultiByteToWideChar (_getmbcp (), MB_PRECOMPOSED, ansi_path,
>+ lstrlenA (ansi_path), ucs2_path,
>+ sizeof (ucs2_path) / sizeof (ucs2_path[0]));
>
>
I'd just use svn_utf_cstring_to_utf8 here, and do the wide char to UTF8
conversion only for strings returned from the W variant of this function.

>+ }
>+
> inwords = lstrlenW (ucs2_path);
> outbytes = outlength = 3 * (inwords + 1);
> utf8_path = apr_palloc (pool, outlength);
>
>
So this part would only happen if GetModuleFileNameW returned something
valid.

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 19 18:43:35 2004

This is an archived mail posted to the Subversion Dev mailing list.