[PATCH 2 of 2] osutil.c added proper support for unicode
Adrian Buehlmann
adrian at cadifra.com
Thu Sep 4 13:56:13 CDT 2008
On 04.09.2008 18:27, Petr Kodl wrote:
> # HG changeset patch
> # User Petr Kodl<petrkodl at gmail.com>
> # Date 1220544667 14400
> # Node ID bbfc523b12ff1a813dc0e3b687e76b93985b697e
> # Parent e150128b40c0f80871799c2d8de3684d767729f2
> osutil.c added proper support for unicode
>
> diff -r e150128b40c0 -r bbfc523b12ff mercurial/osutil.c
> --- a/mercurial/osutil.c Wed Sep 03 19:52:29 2008 -0400
> +++ b/mercurial/osutil.c Thu Sep 04 12:11:07 2008 -0400
> @@ -14,6 +14,7 @@
>
> #ifdef _WIN32
> #include <windows.h>
> +#include <malloc.h> /* for _alloca */
> #else
> #include <dirent.h>
> #include <fcntl.h>
> @@ -131,113 +132,170 @@
> };
>
> #ifdef _WIN32
> -
> -static __int64 a0 = (__int64)134774L*(__int64)24L*(__int64)3600L*(__int64)1000L*(__int64)1000L*(__int64)10L;
> -static __int64 a1 = 1000*1000*10;
>
> static int to_python_time(FILETIME* ms_time)
> {
> + static __int64 a0 = (__int64)134774L*(__int64)24L*(__int64)3600L*(__int64)1000L*(__int64)1000L*(__int64)10L;
> + static __int64 a1 = 1000*1000*10;
> __int64 tmp;
> memcpy(&tmp,ms_time,sizeof(__int64));
> return (int)((tmp-a0)/a1);
> }
>
> +static int allow_unicode()
> +{
> + static int allow = -1;
> + if(allow==-1) allow = (GetVersion() < 0x80000000) ? 1 : 0; /* unicode supported for NT */
> + return allow;
> +}
> +
> static PyObject *listdir(PyObject *self, PyObject *args, PyObject *kwargs)
> {
In case this will be going to return unicode string objects, then the rest of
the mercurial sources would have to be made unicode aware.
Today it isn't, so I guess this patch would be thoroughly incompatible.
More information about the Mercurial-devel
mailing list