X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Funicase%2Fulc-casecmp.c;h=5be3083ad617b8e0b94fc02b857eb9d72d9f013e;hb=7422b7ede18016dea87d207cbb7535428afba3ec;hp=b337ee2f6a54bba0130d8783c85e173101ebad7a;hpb=80ae500d4237e39ce2c63aea80b2a34e5887ce90;p=gnulib.git diff --git a/lib/unicase/ulc-casecmp.c b/lib/unicase/ulc-casecmp.c index b337ee2f6..5be3083ad 100644 --- a/lib/unicase/ulc-casecmp.c +++ b/lib/unicase/ulc-casecmp.c @@ -1,5 +1,5 @@ /* Case and normalization 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 @@ -30,8 +30,8 @@ static uint8_t * ulc_u8_casefold (const char *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) { uint8_t convbuf[2048 / sizeof (uint8_t)]; uint8_t *conv; @@ -39,24 +39,25 @@ ulc_u8_casefold (const char *s, size_t n, const char *iso639_language, uint8_t *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_casefold (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; } @@ -69,5 +70,5 @@ ulc_u8_casefold (const char *s, size_t n, const char *iso639_language, #define UNIT uint8_t #define SRC_UNIT char #define U_CASEFOLD ulc_u8_casefold -#define U_CMP u8_cmp +#define U_CMP2 u8_cmp2 #include "u-casecmp.h"