summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1998-03-15 08:09:37 +0000
committerMarc G. Fournier <scrappy@hub.org>1998-03-15 08:09:37 +0000
commite4dccfdc6e60f267c7d671163cdb3e12f3de37cb (patch)
treed37104acc243be7d65704fd24ebb0e7ccfe8c8f1 /src
parentb64a7549b4c2e459e1d64b1d5cc94f4f5998f503 (diff)
From: t-ishii@sra.co.jp
6.3 postmaster is supposed to work with pre 6.3 protocol. This is true for little endian architecture servers. But for big endian machines such as Sparc the backward compatibility function do not work. Attached are patches to fix the problem.
Diffstat (limited to 'src')
-rw-r--r--src/backend/libpq/pqcomprim.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/libpq/pqcomprim.c b/src/backend/libpq/pqcomprim.c
index 7631e1c7650..17c0a2fba5b 100644
--- a/src/backend/libpq/pqcomprim.c
+++ b/src/backend/libpq/pqcomprim.c
@@ -34,12 +34,20 @@
#else
#if BYTE_ORDER == BIG_ENDIAN
+/*
#define ntoh_s(n) (uint16)(((u_char *)&n)[1] << 8 \
| ((u_char *)&n)[0])
#define ntoh_l(n) (uint32)(((u_char *)&n)[3] << 24 \
| ((u_char *)&n)[2] << 16 \
| ((u_char *)&n)[1] << 8 \
| ((u_char *)&n)[0])
+*/
+#define ntoh_s(n) (uint16)((((uint16)n & 0x00ff) << 8) | \
+ (((uint16)n & 0xff00) >> 8))
+#define ntoh_l(n) (uint32)((((uint32)n & 0x000000ff) << 24) | \
+ (((uint32)n & 0x0000ff00) << 8) | \
+ (((uint32)n & 0x00ff0000) >> 8) | \
+ (((uint32)n & 0xff000000) >> 24))
#define hton_s(n) (ntoh_s(n))
#define hton_l(n) (ntoh_l(n))