@@ -1510,8 +1510,7 @@ static const char *
1510
1510
get_th (char * num , int type )
1511
1511
{
1512
1512
int len = strlen (num ),
1513
- last ,
1514
- seclast ;
1513
+ last ;
1515
1514
1516
1515
last = * (num + (len - 1 ));
1517
1516
if (!isdigit ((unsigned char ) last ))
@@ -1523,7 +1522,7 @@ get_th(char *num, int type)
1523
1522
* All "teens" (<x>1[0-9]) get 'TH/th', while <x>[02-9][123] still get
1524
1523
* 'ST/st', 'ND/nd', 'RD/rd', respectively
1525
1524
*/
1526
- if ((len > 1 ) && (( seclast = num [len - 2 ]) == '1' ))
1525
+ if ((len > 1 ) && (num [len - 2 ] == '1' ))
1527
1526
last = 0 ;
1528
1527
1529
1528
switch (last )
@@ -4932,9 +4931,9 @@ NUM_cache(int len, NUMDesc *Num, text *pars_str, bool *shouldFree)
4932
4931
static char *
4933
4932
int_to_roman (int number )
4934
4933
{
4935
- int len = 0 ,
4936
- num = 0 ;
4937
- char * p = NULL ,
4934
+ int len ,
4935
+ num ;
4936
+ char * p ,
4938
4937
* result ,
4939
4938
numstr [12 ];
4940
4939
@@ -4950,7 +4949,7 @@ int_to_roman(int number)
4950
4949
4951
4950
for (p = numstr ; * p != '\0' ; p ++ , -- len )
4952
4951
{
4953
- num = * p - 49 ; /* 48 ascii + 1 */
4952
+ num = * p - ( '0' + 1 );
4954
4953
if (num < 0 )
4955
4954
continue ;
4956
4955
@@ -6118,7 +6117,7 @@ numeric_to_char(PG_FUNCTION_ARGS)
6118
6117
x = DatumGetNumeric (DirectFunctionCall2 (numeric_round ,
6119
6118
NumericGetDatum (value ),
6120
6119
Int32GetDatum (0 )));
6121
- numstr = orgnum =
6120
+ numstr =
6122
6121
int_to_roman (DatumGetInt32 (DirectFunctionCall1 (numeric_int4 ,
6123
6122
NumericGetDatum (x ))));
6124
6123
}
@@ -6239,7 +6238,7 @@ int4_to_char(PG_FUNCTION_ARGS)
6239
6238
* On DateType depend part (int32)
6240
6239
*/
6241
6240
if (IS_ROMAN (& Num ))
6242
- numstr = orgnum = int_to_roman (value );
6241
+ numstr = int_to_roman (value );
6243
6242
else if (IS_EEEE (& Num ))
6244
6243
{
6245
6244
/* we can do it easily because float8 won't lose any precision */
@@ -6335,7 +6334,7 @@ int8_to_char(PG_FUNCTION_ARGS)
6335
6334
if (IS_ROMAN (& Num ))
6336
6335
{
6337
6336
/* Currently don't support int8 conversion to roman... */
6338
- numstr = orgnum = int_to_roman (DatumGetInt32 (DirectFunctionCall1 (int84 , Int64GetDatum (value ))));
6337
+ numstr = int_to_roman (DatumGetInt32 (DirectFunctionCall1 (int84 , Int64GetDatum (value ))));
6339
6338
}
6340
6339
else if (IS_EEEE (& Num ))
6341
6340
{
0 commit comments