@@ -1448,24 +1448,32 @@ str_numth(char *dest, char *num, int type)
1448
1448
*****************************************************************************/
1449
1449
1450
1450
#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
+
1451
1457
static 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 )
1454
1460
{
1455
1461
UErrorCode status ;
1456
1462
int32_t len_dest ;
1457
1463
1458
1464
len_dest = len_source ; /* try first with same length */
1459
1465
* buff_dest = palloc (len_dest * sizeof (* * buff_dest ));
1460
1466
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 );
1462
1469
if (status == U_BUFFER_OVERFLOW_ERROR )
1463
1470
{
1464
1471
/* 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 ));
1467
1474
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 );
1469
1477
}
1470
1478
if (U_FAILURE (status ))
1471
1479
ereport (ERROR ,
@@ -1479,9 +1487,11 @@ u_strToTitle_default_BI(UChar *dest, int32_t destCapacity,
1479
1487
const char * locale ,
1480
1488
UErrorCode * pErrorCode )
1481
1489
{
1482
- return u_strToTitle (dest , destCapacity , src , srcLength , NULL , locale , pErrorCode );
1490
+ return u_strToTitle (dest , destCapacity , src , srcLength ,
1491
+ NULL , locale , pErrorCode );
1483
1492
}
1484
- #endif
1493
+
1494
+ #endif /* USE_ICU */
1485
1495
1486
1496
/*
1487
1497
* 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)
1548
1558
UChar * buff_conv ;
1549
1559
1550
1560
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 );
1552
1563
icu_from_uchar (& result , buff_conv , len_conv );
1553
1564
}
1554
1565
else
@@ -1666,7 +1677,8 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
1666
1677
UChar * buff_conv ;
1667
1678
1668
1679
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 );
1670
1682
icu_from_uchar (& result , buff_conv , len_conv );
1671
1683
}
1672
1684
else
@@ -1785,7 +1797,8 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
1785
1797
UChar * buff_conv ;
1786
1798
1787
1799
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 );
1789
1802
icu_from_uchar (& result , buff_conv , len_conv );
1790
1803
}
1791
1804
else
0 commit comments