X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fi18n.c;h=fe749dff181cda0b6144010f74c171d97870a49a;hb=b078357653b9eebbba49a088c81c3dd935b58698;hp=55b2d67fab0665a9605254964daf73c51bc7a7ba;hpb=55c55aa33d0f90d1b3b58f8b33b3fc54062c553e;p=pspp diff --git a/src/libpspp/i18n.c b/src/libpspp/i18n.c index 55b2d67fab..fe749dff18 100644 --- a/src/libpspp/i18n.c +++ b/src/libpspp/i18n.c @@ -120,7 +120,7 @@ create_iconv (const char* tocode, const char* fromcode) free (soutbuf); iconv_close (bconv); } - + hmapx_insert (&map, converter, hash); return converter; @@ -242,7 +242,7 @@ try_recode (struct converter *cvtr, char fallbackchar, for (i = 0 ; i < null_bytes ; ++i) *out++ = '\0'; - + return out - 1 - out_; } @@ -264,10 +264,10 @@ recode_string_pool (const char *to, const char *from, { struct substring out; - if ( text == NULL ) + if (text == NULL) return NULL; - if ( length == -1 ) + if (length == -1) length = strlen (text); out = recode_substring_pool (to, from, ss_buffer (text, length), pool); @@ -563,7 +563,7 @@ recode_substring_pool__ (const char *to, const char *from, conv = create_iconv (to, from); - if ( NULL == conv ) + if (NULL == conv) { if (fallbackchar) { @@ -667,7 +667,7 @@ set_default_encoding (const char *enc) /* Attempts to set the encoding from a locale name - returns true if successfull. + returns true if successful. This function does not (should not!) alter the current locale. */ bool @@ -685,7 +685,7 @@ set_encoding_from_locale (const char *loc) loc_encoding = xstrdup (locale_charset ()); - if ( 0 == strcmp (loc_encoding, c_encoding)) + if (0 == strcmp (loc_encoding, c_encoding)) { ok = false; } @@ -737,7 +737,7 @@ valid_encoding (const char *enc) { iconv_t conv = iconv_open (UTF8, enc); - if ( conv == (iconv_t) -1) + if (conv == (iconv_t) -1) return false; iconv_close (conv); @@ -747,7 +747,7 @@ valid_encoding (const char *enc) /* Return the system local's idea of the - decimal seperator character */ + decimal separator character */ char get_system_decimal (void) { @@ -952,6 +952,12 @@ utf8_to_lower (const char *s) { return utf8_casemap (s, u8_tolower); } + +char * +utf8_to_title (const char *s) +{ + return utf8_casemap (s, u8_totitle); +} bool get_encoding_info (struct encoding_info *e, const char *name)