gnunet-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GNUnet-developers] r30485


From: LRN
Subject: Re: [GNUnet-developers] r30485
Date: Thu, 31 Oct 2013 03:09:14 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Thunderbird/27.0a1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30.10.2013 22:15, address@hidden wrote:
> Author: grothoff
> Date: 2013-10-30 19:15:48 +0100 (Wed, 30 Oct 2013)
> New Revision: 30485
> 
>  /**
> - * Convert the utf-8 input string to uppercase
> - * Output needs to be allocated appropriately
> + * Convert the utf-8 input string to uppercase.
> + * Output needs to be allocated appropriately.
>   *
>   * @param input input string
>   * @param output output buffer
>   */
>  void
> -GNUNET_STRINGS_utf8_toupper(const char* input, char** output)
> +GNUNET_STRINGS_utf8_toupper(const char *input,
> +                            char *output)
>  {
>    uint8_t *tmp_in;
>    size_t len;
>  
>    tmp_in = u8_toupper ((uint8_t*)input, strlen ((char *) input),
>                         NULL, UNINORM_NFD, NULL, &len);
> -  memcpy(*output, tmp_in, len);
> -  (*output)[len] = '\0';
> -  free(tmp_in);
> +  memcpy (output, tmp_in, len);
> +  output[len] = '\0';
> +  free (tmp_in);
>  }

u8_toupper allocates its output, then you copy it into the buffer that
user provided, using the length that u8_toupper reported (not the actual
length of the buffer).

I'm not sure that this conversion always produces the output that has
the same length as the input (which is, AFAIU, what you're relying on),
not for all languages.

The docs that i've found on UNINORM_NFD do not indicate (AFAICU) that
this is some kind of special transform that guarantees the same (or
less) number of bytes in the output.

- -- 
O< ascii ribbon - stop html email! - www.asciiribbon.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)

iQEcBAEBAgAGBQJScZGZAAoJEOs4Jb6SI2CwYD0H/jcU29O/wVqszXTsD+8gEHPR
m+9DSnw+IpA0e9TWYDyhHuWsaoEptG66ogLf+IZ0XUM6N9/5RvXtMrpCfiQ7T6z8
8cdX6+I8pjiWP1SE2fLJRGGR0Ae+x/cJ9uNGgk0eUtsTPh8MzV3T9De1ANl1/PGq
HMsSjaNgC48HCf0piJk/cjcocg2iQDbeoIzmC9Qe/Hi6euJBoUyVwHoiKe8cSB7d
smA2O4aBGkI9vn1Av+LV9Dyr8lWoHn1U90I2aVT9GH76iBLx510Ol5lx2O5E/stH
w8EsEg6RCv6HlRf3rSvXrcJc/K2cocXvySuziMS0tUHY0e0byf/Qz8bWf7gBZkM=
=Dnda
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]