X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Funicase%2Fulc-casexfrm.c;h=b3badab1451073f8b4f914e90d41dedddb7ab66a;hb=7422b7ede18016dea87d207cbb7535428afba3ec;hp=00009f8b03b1dff0d2902af25d30f9e7b90b8793;hpb=0cd58ed61ba28249f1b9029a697d5f5d9287adae;p=gnulib.git diff --git a/lib/unicase/ulc-casexfrm.c b/lib/unicase/ulc-casexfrm.c index 00009f8b0..b3badab14 100644 --- a/lib/unicase/ulc-casexfrm.c +++ b/lib/unicase/ulc-casexfrm.c @@ -1,5 +1,5 @@ /* Locale dependent transformation for case insensitive comparison of strings. - 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,8 +27,8 @@ char * ulc_casexfrm (const char *s, size_t n, const char *iso639_language, - uninorm_t nf, - char *resultbuf, size_t *lengthp) + uninorm_t nf, + char *resultbuf, size_t *lengthp) { uint8_t convbuf[2048 / sizeof (uint8_t)]; uint8_t *conv; @@ -36,24 +36,25 @@ ulc_casexfrm (const char *s, size_t n, const char *iso639_language, char *result; /* Convert the string to UTF-8. */ - conv = convbuf; conv_length = sizeof (convbuf) / sizeof (uint8_t); - if (u8_conv_from_encoding (locale_charset (), iconveh_error, s, n, NULL, - &conv, &conv_length) < 0) + conv = + u8_conv_from_encoding (locale_charset (), iconveh_error, s, n, NULL, + convbuf, &conv_length); + if (conv == NULL) /* errno is set here. */ return NULL; /* Case-fold and normalize. */ result = u8_casexfrm (conv, conv_length, iso639_language, nf, - resultbuf, lengthp); + resultbuf, lengthp); if (result == NULL) { if (conv != convbuf) - { - int saved_errno = errno; - free (conv); - errno = saved_errno; - } + { + int saved_errno = errno; + free (conv); + errno = saved_errno; + } return NULL; }