X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Funicase%2Fu8-tolower.c;h=db2d61bf1e34e2dfc66b52c6b8261c80641c50b0;hb=7422b7ede18016dea87d207cbb7535428afba3ec;hp=8f8790b27c309f8e78b3d288a82e8214b274170f;hpb=395393a49ecd52595cbb10ecd7496156aefd55c4;p=gnulib.git diff --git a/lib/unicase/u8-tolower.c b/lib/unicase/u8-tolower.c index 8f8790b27..db2d61bf1 100644 --- a/lib/unicase/u8-tolower.c +++ b/lib/unicase/u8-tolower.c @@ -1,5 +1,5 @@ /* Lowercase mapping for UTF-8 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2014 Free Software Foundation, Inc. Written by Bruno Haible , 2009. This program is free software: you can redistribute it and/or modify it @@ -27,13 +27,15 @@ uint8_t * u8_tolower (const uint8_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp) + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp) { - return u8_casemap (s, n, iso639_language, - uc_tolower, offsetof (struct special_casing_rule, lower[0]), - nf, - resultbuf, lengthp); + return u8_casemap (s, n, + unicase_empty_prefix_context, unicase_empty_suffix_context, + iso639_language, + uc_tolower, offsetof (struct special_casing_rule, lower[0]), + nf, + resultbuf, lengthp); } @@ -58,28 +60,28 @@ read_file (FILE *stream) while (! feof (stream)) { if (size + BUFSIZE > alloc) - { - alloc = alloc + alloc / 2; - if (alloc < size + BUFSIZE) - alloc = size + BUFSIZE; - buf = realloc (buf, alloc); - if (buf == NULL) - { - fprintf (stderr, "out of memory\n"); - exit (1); - } - } + { + alloc = alloc + alloc / 2; + if (alloc < size + BUFSIZE) + alloc = size + BUFSIZE; + buf = realloc (buf, alloc); + if (buf == NULL) + { + fprintf (stderr, "out of memory\n"); + exit (1); + } + } count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) - { - if (ferror (stream)) - { - perror ("fread"); - exit (1); - } - } + { + if (ferror (stream)) + { + perror ("fread"); + exit (1); + } + } else - size += count; + size += count; } buf = realloc (buf, size + 1); if (buf == NULL) @@ -103,9 +105,9 @@ main (int argc, char * argv[]) int length = strlen (input); size_t output_length; uint8_t *output = - u8_tolower ((uint8_t *) input, length, uc_locale_language (), - NULL, - NULL, &output_length); + u8_tolower ((uint8_t *) input, length, uc_locale_language (), + NULL, + NULL, &output_length); fwrite (output, 1, output_length, stdout);