Thread: libpq/conv.c

libpq/conv.c

From
Tomoaki NISHIYAMA
Date:
The conversion tables are declared as "char []" not "unsigned char[]",
while they are passed to "unsigned char*".
Is there any reason to prevent declaring as "unsigned char[]"?

A patch is following my signature.
--------
Tomoaki Nishiyama e-mail:tomoaki@biol.s.u-tokyo.ac.jp        Department of Biological Sciences,
Graduate School of Science, The University of Tokyo

--- conv.orig    Thu May 27 16:00:39 1999
+++ conv.c    Mon Jun 14 16:34:03 1999
@@ -724,7 +724,7 @@static voidiso2mic(unsigned char *l, unsigned char *p, int len){
-    static char iso2koi[] = {
+    static unsigned char iso2koi[] = {        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,        0x00, 0x00, 0x00,
0x00,0x00, 0x00, 0x00, 0x00,        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
@@ -750,7 +750,7 @@static voidmic2iso(unsigned char *mic, unsigned char *p, int len){
-    static char koi2iso[] = {
+    static unsigned char koi2iso[] = {        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,        0x00, 0x00, 0x00,
0x00,0x00, 0x00, 0x00, 0x00,        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
@@ -776,7 +776,7 @@static voidwin2mic(unsigned char *l, unsigned char *p, int len){
-    static char win2koi[] = {
+    static unsigned char win2koi[] = {        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,        0x00, 0x00, 0x00,
0x00,0x00, 0x00, 0x00, 0x00,        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
@@ -802,7 +802,7 @@static voidmic2win(unsigned char *mic, unsigned char *p, int len){
-    static char koi2win[] = {
+    static unsigned char koi2win[] = {        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,        0x00, 0x00, 0x00,
0x00,0x00, 0x00, 0x00, 0x00,        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
@@ -828,7 +828,7 @@static voidalt2mic(unsigned char *l, unsigned char *p, int len){
-    static char alt2koi[] = {
+    static unsigned char alt2koi[] = {        0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,        0xe9, 0xea, 0xeb,
0xec,0xed, 0xee, 0xef, 0xf0,        0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
 
@@ -854,7 +854,7 @@static voidmic2alt(unsigned char *mic, unsigned char *p, int len){
-    static char koi2alt[] = {
+    static unsigned char koi2alt[] = {        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,        0x00, 0x00, 0x00,
0x00,0x00, 0x00, 0x00, 0x00,        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 


Re: [HACKERS] libpq/conv.c

From
Tatsuo Ishii
Date:
>The conversion tables are declared as "char []" not "unsigned char[]",
>while they are passed to "unsigned char*".
>Is there any reason to prevent declaring as "unsigned char[]"?

Sounds resonable, but it's too late for 6.5. I'm going to take care of 
it for 6.5.1...
--
Tatsuo Ishii


Re: [HACKERS] libpq/conv.c

From
Tatsuo Ishii
Date:
> The conversion tables are declared as "char []" not "unsigned char[]",
> while they are passed to "unsigned char*".
> Is there any reason to prevent declaring as "unsigned char[]"?
> 
> A patch is following my signature.

Done.
---
Tatsuo Ishii