diff --git a/psycopg/libpq_support.c b/psycopg/libpq_support.c index 160c8491..6c0b5f8e 100644 --- a/psycopg/libpq_support.c +++ b/psycopg/libpq_support.c @@ -46,15 +46,15 @@ * backend code. The protocol always uses integer timestamps, regardless of * server setting. */ -pg_int64 +int64_t feGetCurrentTimestamp(void) { - pg_int64 result; + int64_t result; struct timeval tp; gettimeofday(&tp, NULL); - result = (pg_int64) tp.tv_sec - + result = (int64_t) tp.tv_sec - ((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY); result = (result * USECS_PER_SEC) + tp.tv_usec; @@ -66,17 +66,17 @@ feGetCurrentTimestamp(void) * Converts an int64 to network byte order. */ void -fe_sendint64(pg_int64 i, char *buf) +fe_sendint64(int64_t i, char *buf) { - uint32 n32; + uint32_t n32; /* High order half first, since we're doing MSB-first */ - n32 = (uint32) (i >> 32); + n32 = (uint32_t) (i >> 32); n32 = htonl(n32); memcpy(&buf[0], &n32, 4); /* Now the low order half */ - n32 = (uint32) i; + n32 = (uint32_t) i; n32 = htonl(n32); memcpy(&buf[4], &n32, 4); } @@ -84,12 +84,12 @@ fe_sendint64(pg_int64 i, char *buf) /* * Converts an int64 from network byte order to native format. */ -pg_int64 +int64_t fe_recvint64(char *buf) { - pg_int64 result; - uint32 h32; - uint32 l32; + int64_t result; + uint32_t h32; + uint32_t l32; memcpy(&h32, buf, 4); memcpy(&l32, buf + 4, 4); diff --git a/psycopg/libpq_support.h b/psycopg/libpq_support.h index e57fae99..c8f10665 100644 --- a/psycopg/libpq_support.h +++ b/psycopg/libpq_support.h @@ -29,11 +29,10 @@ /* type and constant definitions from internal postgres include */ typedef unsigned PG_INT64_TYPE XLogRecPtr; -typedef uint32_t uint32; /* have to use lowercase %x, as PyString_FromFormat can't do %X */ #define XLOGFMTSTR "%x/%x" -#define XLOGFMTARGS(x) ((uint32)((x) >> 32)), ((uint32)((x) & 0xFFFFFFFF)) +#define XLOGFMTARGS(x) ((uint32_t)((x) >> 32)), ((uint32_t)((x) & 0xFFFFFFFF)) /* Julian-date equivalents of Day 0 in Unix and Postgres reckoning */ #define UNIX_EPOCH_JDATE 2440588 /* == date2j(1970, 1, 1) */ @@ -42,8 +41,8 @@ typedef uint32_t uint32; #define SECS_PER_DAY 86400 #define USECS_PER_SEC 1000000LL -HIDDEN pg_int64 feGetCurrentTimestamp(void); -HIDDEN void fe_sendint64(pg_int64 i, char *buf); -HIDDEN pg_int64 fe_recvint64(char *buf); +HIDDEN int64_t feGetCurrentTimestamp(void); +HIDDEN void fe_sendint64(int64_t i, char *buf); +HIDDEN int64_t fe_recvint64(char *buf); #endif /* !defined(PSYCOPG_LIBPQ_SUPPORT_H) */ diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c index 220ae246..d7283d0c 100644 --- a/psycopg/pqpath.c +++ b/psycopg/pqpath.c @@ -1555,7 +1555,7 @@ pq_read_replication_message(replicationCursorObject *repl, replicationMessageObj char *buffer = NULL; int len, data_size, consumed, hdr, reply; XLogRecPtr data_start, wal_end; - pg_int64 send_time; + int64_t send_time; PyObject *str = NULL, *result = NULL; int ret = -1; diff --git a/psycopg/replication_message.h b/psycopg/replication_message.h index 201b9fb4..b4d93d67 100644 --- a/psycopg/replication_message.h +++ b/psycopg/replication_message.h @@ -45,7 +45,7 @@ struct replicationMessageObject { int data_size; XLogRecPtr data_start; XLogRecPtr wal_end; - pg_int64 send_time; + int64_t send_time; }; RAISES_NEG int psyco_replmsg_datetime_init(void);