@@ -1448,24 +1448,32 @@ str_numth(char *dest, char *num, int type)
14481448 *****************************************************************************/
14491449
14501450#ifdef USE_ICU
1451+
1452+ typedef int32_t (* ICU_Convert_Func )(UChar * dest , int32_t destCapacity ,
1453+ const UChar * src , int32_t srcLength ,
1454+ const char * locale ,
1455+ UErrorCode * pErrorCode );
1456+
14511457static int32_t
1452- icu_convert_case (int32_t ( * func )( UChar * , int32_t , const UChar * , int32_t , const char * , UErrorCode * ) ,
1453- pg_locale_t mylocale , UChar * * buff_dest , UChar * buff_source , int32_t len_source )
1458+ icu_convert_case (ICU_Convert_Func func , pg_locale_t mylocale ,
1459+ UChar * * buff_dest , UChar * buff_source , int32_t len_source )
14541460{
14551461 UErrorCode status ;
14561462 int32_t len_dest ;
14571463
14581464 len_dest = len_source ; /* try first with same length */
14591465 * buff_dest = palloc (len_dest * sizeof (* * buff_dest ));
14601466 status = U_ZERO_ERROR ;
1461- len_dest = func (* buff_dest , len_dest , buff_source , len_source , mylocale -> info .icu .locale , & status );
1467+ len_dest = func (* buff_dest , len_dest , buff_source , len_source ,
1468+ mylocale -> info .icu .locale , & status );
14621469 if (status == U_BUFFER_OVERFLOW_ERROR )
14631470 {
14641471 /* try again with adjusted length */
1465- pfree (buff_dest );
1466- buff_dest = palloc (len_dest * sizeof (* * buff_dest ));
1472+ pfree (* buff_dest );
1473+ * buff_dest = palloc (len_dest * sizeof (* * buff_dest ));
14671474 status = U_ZERO_ERROR ;
1468- len_dest = func (* buff_dest , len_dest , buff_source , len_source , mylocale -> info .icu .locale , & status );
1475+ len_dest = func (* buff_dest , len_dest , buff_source , len_source ,
1476+ mylocale -> info .icu .locale , & status );
14691477 }
14701478 if (U_FAILURE (status ))
14711479 ereport (ERROR ,
@@ -1479,9 +1487,11 @@ u_strToTitle_default_BI(UChar *dest, int32_t destCapacity,
14791487 const char * locale ,
14801488 UErrorCode * pErrorCode )
14811489{
1482- return u_strToTitle (dest , destCapacity , src , srcLength , NULL , locale , pErrorCode );
1490+ return u_strToTitle (dest , destCapacity , src , srcLength ,
1491+ NULL , locale , pErrorCode );
14831492}
1484- #endif
1493+
1494+ #endif /* USE_ICU */
14851495
14861496/*
14871497 * If the system provides the needed functions for wide-character manipulation
@@ -1548,7 +1558,8 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
15481558 UChar * buff_conv ;
15491559
15501560 len_uchar = icu_to_uchar (& buff_uchar , buff , nbytes );
1551- len_conv = icu_convert_case (u_strToLower , mylocale , & buff_conv , buff_uchar , len_uchar );
1561+ len_conv = icu_convert_case (u_strToLower , mylocale ,
1562+ & buff_conv , buff_uchar , len_uchar );
15521563 icu_from_uchar (& result , buff_conv , len_conv );
15531564 }
15541565 else
@@ -1666,7 +1677,8 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
16661677 UChar * buff_conv ;
16671678
16681679 len_uchar = icu_to_uchar (& buff_uchar , buff , nbytes );
1669- len_conv = icu_convert_case (u_strToUpper , mylocale , & buff_conv , buff_uchar , len_uchar );
1680+ len_conv = icu_convert_case (u_strToUpper , mylocale ,
1681+ & buff_conv , buff_uchar , len_uchar );
16701682 icu_from_uchar (& result , buff_conv , len_conv );
16711683 }
16721684 else
@@ -1785,7 +1797,8 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
17851797 UChar * buff_conv ;
17861798
17871799 len_uchar = icu_to_uchar (& buff_uchar , buff , nbytes );
1788- len_conv = icu_convert_case (u_strToTitle_default_BI , mylocale , & buff_conv , buff_uchar , len_uchar );
1800+ len_conv = icu_convert_case (u_strToTitle_default_BI , mylocale ,
1801+ & buff_conv , buff_uchar , len_uchar );
17891802 icu_from_uchar (& result , buff_conv , len_conv );
17901803 }
17911804 else
0 commit comments