@@ -99,8 +99,7 @@ pg_euc2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
99
99
* to |= * from ++ ;
100
100
len -= 2 ;
101
101
}
102
- else
103
- /* must be ASCII */
102
+ else /* must be ASCII */
104
103
{
105
104
* to = * from ++ ;
106
105
len -- ;
@@ -340,7 +339,7 @@ pg_euctw_dsplen(const unsigned char *s)
340
339
}
341
340
342
341
/*
343
- * Convert pg_wchar to EUC_* encoding.
342
+ * Convert pg_wchar to EUC_* encoding.
344
343
* caller must allocate enough space for "to", including a trailing zero!
345
344
* len: length of from.
346
345
* "from" not necessarily null terminated.
@@ -353,23 +352,23 @@ pg_wchar2euc_with_len(const pg_wchar *from, unsigned char *to, int len)
353
352
while (len > 0 && * from )
354
353
{
355
354
unsigned char c ;
356
-
357
- if ((c = * from >> 24 ))
355
+
356
+ if ((c = ( * from >> 24 ) ))
358
357
{
359
358
* to ++ = c ;
360
359
* to ++ = (* from >> 16 ) & 0xff ;
361
360
* to ++ = (* from >> 8 ) & 0xff ;
362
361
* to ++ = * from & 0xff ;
363
362
cnt += 4 ;
364
363
}
365
- else if ((c = * from >> 16 ))
364
+ else if ((c = ( * from >> 16 ) ))
366
365
{
367
366
* to ++ = c ;
368
367
* to ++ = (* from >> 8 ) & 0xff ;
369
368
* to ++ = * from & 0xff ;
370
369
cnt += 3 ;
371
370
}
372
- else if ((c = * from >> 8 ))
371
+ else if ((c = ( * from >> 8 ) ))
373
372
{
374
373
* to ++ = c ;
375
374
* to ++ = * from & 0xff ;
@@ -379,7 +378,7 @@ pg_wchar2euc_with_len(const pg_wchar *from, unsigned char *to, int len)
379
378
{
380
379
* to ++ = * from ;
381
380
cnt ++ ;
382
- }
381
+ }
383
382
from ++ ;
384
383
len -- ;
385
384
}
@@ -516,7 +515,7 @@ pg_wchar2utf_with_len(const pg_wchar *from, unsigned char *to, int len)
516
515
while (len > 0 && * from )
517
516
{
518
517
int char_len ;
519
-
518
+
520
519
unicode_to_utf8 (* from , to );
521
520
char_len = pg_utf_mblen (to );
522
521
cnt += char_len ;
@@ -803,10 +802,11 @@ static int
803
802
pg_wchar2mule_with_len (const pg_wchar * from , unsigned char * to , int len )
804
803
{
805
804
int cnt = 0 ;
806
- unsigned char lb ;
807
805
808
806
while (len > 0 && * from )
809
807
{
808
+ unsigned char lb ;
809
+
810
810
lb = (* from >> 16 ) & 0xff ;
811
811
if (IS_LC1 (lb ))
812
812
{
@@ -853,7 +853,7 @@ pg_wchar2mule_with_len(const pg_wchar *from, unsigned char *to, int len)
853
853
}
854
854
else
855
855
{
856
- * to ++ = lb ;
856
+ * to ++ = * from & 0xff ;
857
857
cnt += 1 ;
858
858
}
859
859
from ++ ;
0 commit comments