Re: [PATCH] libghttp and locale != C
- From: Vlad Harchev <hvv hippo ru>
- To: gnome-devel-list gnome org
- Subject: Re: [PATCH] libghttp and locale != C
- Date: Wed, 25 Apr 2001 19:03:17 +0500 (SAMST)
On Wed, 25 Apr 2001, Drazen Kacar wrote:
>
> Christian Marillat wrote:
>
> > Here is a patch to solve a problem with http headers if locale are different
> > than C.
> >
> > Christian
> >
> > if (a_conn->proxy_host)
> > {
> > + char *old_locale = strdup (setlocale (LC_NUMERIC, NULL));
> > + setlocale (LC_NUMERIC, "C");
> > l_request_len = sprintf(l_request,
> > "%s %s HTTP/%01.1f\r\n",
> > http_req_type_char[a_req->type],
> > a_req->full_uri,
> > a_req->http_ver);
> > + setlocale (LC_NUMERIC, old_locale);
> > + free (old_locale);
>
> [...]
>
> Hm. If that library could be used by multithreaded programs (and I don't
> see why not), then you can't call setlocale() in it, because it might
> change locale for some unrelated thread and cause the same type of bug
> you're trying to fix.
Then we should store integer and fractional part as two integers and print
them as "%d.%d". libghttp should work under any locale anyway.
Best regards,
-Vlad
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]