From 8673404817c9c6aa281991f1ca8a2111be350034 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Thu, 1 Nov 2007 21:02:28 +0000 Subject: [PATCH] use standard int types --- include/bouncer.h | 12 ++++++------ include/mbuf.h | 24 ++++++++++++------------ include/md5.h | 16 ++++++++-------- include/objects.h | 4 ++-- include/pktbuf.h | 12 ++++++------ include/sbuf.h | 2 +- include/system.h | 5 ----- include/util.h | 2 +- src/admin.c | 8 ++++---- src/client.c | 6 +++--- src/md5.c | 28 ++++++++++++++-------------- src/objects.c | 6 +++--- src/pktbuf.c | 24 ++++++++++++------------ src/proto.c | 16 ++++++++-------- src/sbuf.c | 6 +++--- src/stats.c | 2 +- src/takeover.c | 6 +++--- src/util.c | 6 +++--- src/varcache.c | 4 ++-- 19 files changed, 92 insertions(+), 97 deletions(-) diff --git a/include/bouncer.h b/include/bouncer.h index d3c9b08..8b45326 100644 --- a/include/bouncer.h +++ b/include/bouncer.h @@ -123,9 +123,9 @@ struct PgAddr { }; struct PgStats { - uint64 request_count; - uint64 server_bytes; - uint64 client_bytes; + uint64_t request_count; + uint64_t server_bytes; + uint64_t client_bytes; usec_t query_time; /* total req time in us */ }; @@ -162,7 +162,7 @@ struct PgPool { PgStats older_stats; /* database info to be sent to client */ - uint8 welcome_msg[256]; + uint8_t welcome_msg[256]; unsigned welcome_msg_len; VarCache orig_vars; @@ -200,7 +200,7 @@ struct PgDatabase { unsigned db_paused:1; /* key/val pairs (without user) for startup msg to be sent to server */ - uint8 startup_params[256]; + uint8_t startup_params[256]; unsigned startup_params_len; /* if not NULL, the user/psw is forced */ @@ -244,7 +244,7 @@ struct PgSocket { usec_t query_start; /* query start moment */ char salt[4]; - uint8 cancel_key[BACKENDKEY_LEN]; + uint8_t cancel_key[BACKENDKEY_LEN]; PgUser * auth_user; PgAddr remote_addr; PgAddr local_addr; diff --git a/include/mbuf.h b/include/mbuf.h index bc18540..036d1d5 100644 --- a/include/mbuf.h +++ b/include/mbuf.h @@ -27,12 +27,12 @@ typedef struct MBuf MBuf; struct MBuf { - const uint8 *data; - const uint8 *end; - const uint8 *pos; + const uint8_t *data; + const uint8_t *end; + const uint8_t *pos; }; -static inline void mbuf_init(MBuf *buf, const uint8 *ptr, int len) +static inline void mbuf_init(MBuf *buf, const uint8_t *ptr, int len) { if (len < 0) fatal("fuckup"); @@ -40,7 +40,7 @@ static inline void mbuf_init(MBuf *buf, const uint8 *ptr, int len) buf->end = ptr + len; } -static inline uint8 mbuf_get_char(MBuf *buf) +static inline uint8_t mbuf_get_char(MBuf *buf) { if (buf->pos + 1 > buf->end) fatal("buffer overflow"); @@ -57,9 +57,9 @@ static inline unsigned mbuf_get_uint16(MBuf *buf) return val; } -static inline unsigned mbuf_get_uint32(MBuf *buf) +static inline uint32_t mbuf_get_uint32(MBuf *buf) { - unsigned val; + uint32_t val; if (buf->pos + 4 > buf->end) fatal("buffer overflow"); val = *buf->pos++; @@ -69,17 +69,17 @@ static inline unsigned mbuf_get_uint32(MBuf *buf) return val; } -static inline unsigned mbuf_get_uint64(MBuf *buf) +static inline uint64_t mbuf_get_uint64(MBuf *buf) { - uint64 i1, i2; + uint64_t i1, i2; i1 = mbuf_get_uint32(buf); i2 = mbuf_get_uint32(buf); return (i1 << 32) | i2; } -static inline const uint8 * mbuf_get_bytes(MBuf *buf, unsigned len) +static inline const uint8_t * mbuf_get_bytes(MBuf *buf, unsigned len) { - const uint8 *res = buf->pos; + const uint8_t *res = buf->pos; if (buf->pos + len > buf->end) fatal("buffer overflow"); buf->pos += len; @@ -99,7 +99,7 @@ static inline unsigned mbuf_size(const MBuf *buf) static inline const char * mbuf_get_string(MBuf *buf) { const char *res = (const char *)buf->pos; - const uint8 *nul = memchr(res, 0, mbuf_avail(buf)); + const uint8_t *nul = memchr(res, 0, mbuf_avail(buf)); if (!nul) return NULL; buf->pos = nul + 1; diff --git a/include/md5.h b/include/md5.h index 58fa491..089e171 100644 --- a/include/md5.h +++ b/include/md5.h @@ -40,8 +40,8 @@ typedef struct { union { - uint32 md5_state32[4]; - uint8 md5_state8[16]; + uint32_t md5_state32[4]; + uint8_t md5_state8[16]; } md5_st; #define md5_sta md5_st.md5_state32[0] @@ -52,20 +52,20 @@ typedef struct union { - uint64 md5_count64; - uint8 md5_count8[8]; + uint64_t md5_count64; + uint8_t md5_count8[8]; } md5_count; #define md5_n md5_count.md5_count64 #define md5_n8 md5_count.md5_count8 - unsigned int md5_i; - uint8 md5_buf[MD5_BUFLEN]; + unsigned md5_i; + uint8_t md5_buf[MD5_BUFLEN]; } md5_ctxt; extern void md5_init(md5_ctxt *); -extern void md5_loop(md5_ctxt *, const uint8 *, unsigned int); +extern void md5_loop(md5_ctxt *, const uint8_t *, unsigned int); extern void md5_pad(md5_ctxt *); -extern void md5_result(uint8 *, md5_ctxt *); +extern void md5_result(uint8_t *, md5_ctxt *); /* compatibility with OpenSSL */ #define MD5_CTX md5_ctxt diff --git a/include/objects.h b/include/objects.h index 9119000..3a69750 100644 --- a/include/objects.h +++ b/include/objects.h @@ -44,9 +44,9 @@ void forward_cancel_request(PgSocket *server); void launch_new_connection(PgPool *pool); -bool use_client_socket(int fd, PgAddr *addr, const char *dbname, const char *username, uint64 ckey, int oldfd, int linkfd, +bool use_client_socket(int fd, PgAddr *addr, const char *dbname, const char *username, uint64_t ckey, int oldfd, int linkfd, const char *client_end, const char *std_string, const char *datestyle, const char *timezone); -bool use_server_socket(int fd, PgAddr *addr, const char *dbname, const char *username, uint64 ckey, int oldfd, int linkfd, +bool use_server_socket(int fd, PgAddr *addr, const char *dbname, const char *username, uint64_t ckey, int oldfd, int linkfd, const char *client_end, const char *std_string, const char *datestyle, const char *timezone); void pause_client(PgSocket *client); diff --git a/include/pktbuf.h b/include/pktbuf.h index 057f119..4bd3310 100644 --- a/include/pktbuf.h +++ b/include/pktbuf.h @@ -22,7 +22,7 @@ typedef struct PktBuf PktBuf; struct PktBuf { - uint8 *buf; + uint8_t *buf; int buf_len; int write_pos; int pktlen_pos; @@ -39,7 +39,7 @@ struct PktBuf { * pktbuf creation */ PktBuf *pktbuf_dynamic(int start_len); -void pktbuf_static(PktBuf *buf, uint8 *data, int len); +void pktbuf_static(PktBuf *buf, uint8_t *data, int len); /* * sending @@ -52,9 +52,9 @@ void pktbuf_send_queued(PktBuf *buf, PgSocket *sk); */ void pktbuf_start_packet(PktBuf *buf, int type); void pktbuf_put_char(PktBuf *buf, char val); -void pktbuf_put_uint16(PktBuf *buf, uint16 val); -void pktbuf_put_uint32(PktBuf *buf, uint32 val); -void pktbuf_put_uint64(PktBuf *buf, uint64 val); +void pktbuf_put_uint16(PktBuf *buf, uint16_t val); +void pktbuf_put_uint32(PktBuf *buf, uint32_t val); +void pktbuf_put_uint64(PktBuf *buf, uint64_t val); void pktbuf_put_string(PktBuf *buf, const char *str); void pktbuf_put_bytes(PktBuf *buf, const void *data, int len); void pktbuf_finish_packet(PktBuf *buf); @@ -111,7 +111,7 @@ void pktbuf_write_DataRow(PktBuf *buf, const char *tupdesc, ...); */ #define SEND_wrap(buflen, pktfn, res, sk, args...) do { \ - uint8 _data[buflen]; PktBuf _buf; \ + uint8_t _data[buflen]; PktBuf _buf; \ pktbuf_static(&_buf, _data, sizeof(_data)); \ pktfn(&_buf, ## args); \ res = pktbuf_send_immidiate(&_buf, sk); \ diff --git a/include/sbuf.h b/include/sbuf.h index 1d57b5b..86d49fb 100644 --- a/include/sbuf.h +++ b/include/sbuf.h @@ -63,7 +63,7 @@ struct SBuf { unsigned is_unix:1; /* is it unix socket */ unsigned wait_send:1; /* debug var, otherwise useless */ - uint8 buf[0]; + uint8_t buf[0]; }; #define sbuf_socket(sbuf) ((sbuf)->sock) diff --git a/include/system.h b/include/system.h index ac2689b..5088936 100644 --- a/include/system.h +++ b/include/system.h @@ -86,11 +86,6 @@ typedef enum { false=0, true=1 } bool; -typedef uint8_t uint8; -typedef uint16_t uint16; -typedef uint32_t uint32; -typedef uint64_t uint64; - /* * PostgreSQL type OIDs for resultsets. */ diff --git a/include/util.h b/include/util.h index b7af4ca..c087aff 100644 --- a/include/util.h +++ b/include/util.h @@ -94,7 +94,7 @@ int safe_sendmsg(int fd, const struct msghdr *msg, int flags); #define isMD5(passwd) (memcmp(passwd, "md5", 3) == 0 \ && strlen(passwd) == MD5_PASSWD_LEN) bool pg_md5_encrypt(const char *part1, const char *part2, size_t p2len, char *dest); -bool get_random_bytes(uint8 *dest, int len); +bool get_random_bytes(uint8_t *dest, int len); void socket_set_nonblocking(int fd, int val); void tune_socket(int sock, bool is_unix); diff --git a/src/admin.c b/src/admin.c index 715604d..e8e0a92 100644 --- a/src/admin.c +++ b/src/admin.c @@ -124,7 +124,7 @@ void admin_flush(PgSocket *admin, PktBuf *buf, const char *desc) bool admin_ready(PgSocket *admin, const char *desc) { PktBuf buf; - uint8 tmp[512]; + uint8_t tmp[512]; pktbuf_static(&buf, tmp, sizeof(tmp)); pktbuf_write_CommandComplete(&buf, desc); pktbuf_write_ReadyForQuery(&buf); @@ -152,7 +152,7 @@ static bool send_one_fd(PgSocket *admin, int fd, const char *task, const char *user, const char *db, const char *addr, int port, - uint64 ckey, int link, + uint64_t ckey, int link, const char *client_enc, const char *std_strings, const char *datestyle, @@ -162,8 +162,8 @@ static bool send_one_fd(PgSocket *admin, struct cmsghdr *cmsg; int res; struct iovec iovec; - uint8 pktbuf[1024]; - uint8 cntbuf[CMSG_SPACE(sizeof(int))]; + uint8_t pktbuf[1024]; + uint8_t cntbuf[CMSG_SPACE(sizeof(int))]; iovec.iov_base = pktbuf; BUILD_DataRow(res, pktbuf, sizeof(pktbuf), "issssiqissss", diff --git a/src/client.c b/src/client.c index c3263eb..44adc1c 100644 --- a/src/client.c +++ b/src/client.c @@ -157,10 +157,10 @@ static const char valid_crypt_salt[] = static bool send_client_authreq(PgSocket *client) { - uint8 saltlen = 0; + uint8_t saltlen = 0; int res; int auth = cf_auth_type; - uint8 randbuf[2]; + uint8_t randbuf[2]; if (auth == AUTH_CRYPT) { saltlen = 2; @@ -253,7 +253,7 @@ static bool handle_client_startup(PgSocket *client, PktHdr *pkt) break; case PKT_CANCEL: if (mbuf_avail(&pkt->data) == BACKENDKEY_LEN) { - const uint8 *key = mbuf_get_bytes(&pkt->data, BACKENDKEY_LEN); + const uint8_t *key = mbuf_get_bytes(&pkt->data, BACKENDKEY_LEN); memcpy(client->cancel_key, key, BACKENDKEY_LEN); accept_cancel_request(client); } else diff --git a/src/md5.c b/src/md5.c index c52e340..085c1fe 100644 --- a/src/md5.c +++ b/src/md5.c @@ -103,7 +103,7 @@ do { \ #define MD5_D0 0x10325476 /* Integer part of 4294967296 times abs(sin(i)), where i is in radians. */ -static const uint32 T[65] = { +static const uint32_t T[65] = { 0, 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, @@ -126,7 +126,7 @@ static const uint32 T[65] = { 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391, }; -static const uint8 md5_paddat[MD5_BUFLEN] = { +static const uint8_t md5_paddat[MD5_BUFLEN] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -137,7 +137,7 @@ static const uint8 md5_paddat[MD5_BUFLEN] = { 0, 0, 0, 0, 0, 0, 0, 0, }; -static void md5_calc(uint8 *, md5_ctxt *); +static void md5_calc(uint8_t *, md5_ctxt *); void md5_init(md5_ctxt * ctxt) @@ -152,7 +152,7 @@ md5_init(md5_ctxt * ctxt) } void -md5_loop(md5_ctxt * ctxt, const uint8 *input, unsigned len) +md5_loop(md5_ctxt * ctxt, const uint8_t *input, unsigned len) { unsigned int gap, i; @@ -166,7 +166,7 @@ md5_loop(md5_ctxt * ctxt, const uint8 *input, unsigned len) md5_calc(ctxt->md5_buf, ctxt); for (i = gap; i + MD5_BUFLEN <= len; i += MD5_BUFLEN) - md5_calc((uint8 *) (input + i), ctxt); + md5_calc((uint8_t *) (input + i), ctxt); ctxt->md5_i = len - i; memmove(ctxt->md5_buf, input + i, ctxt->md5_i); @@ -218,7 +218,7 @@ md5_pad(md5_ctxt * ctxt) } void -md5_result(uint8 *digest, md5_ctxt * ctxt) +md5_result(uint8_t *digest, md5_ctxt * ctxt) { /* 4 byte words */ #if BYTE_ORDER == LITTLE_ENDIAN @@ -245,24 +245,24 @@ md5_result(uint8 *digest, md5_ctxt * ctxt) } #if BYTE_ORDER == BIG_ENDIAN -static uint32 X[16]; +static uint32_t X[16]; #endif static void -md5_calc(uint8 *b64, md5_ctxt * ctxt) +md5_calc(uint8_t *b64, md5_ctxt * ctxt) { - uint32 A = ctxt->md5_sta; - uint32 B = ctxt->md5_stb; - uint32 C = ctxt->md5_stc; - uint32 D = ctxt->md5_std; + uint32_t A = ctxt->md5_sta; + uint32_t B = ctxt->md5_stb; + uint32_t C = ctxt->md5_stc; + uint32_t D = ctxt->md5_std; #if BYTE_ORDER == LITTLE_ENDIAN - uint32 *X = (uint32 *) b64; + uint32_t *X = (uint32_t *) b64; #endif #if BYTE_ORDER == BIG_ENDIAN /* 4 byte words */ /* what a brute force but fast! */ - uint8 *y = (uint8 *) X; + uint8_t *y = (uint8_t *) X; y[0] = b64[3]; y[1] = b64[2]; diff --git a/src/objects.c b/src/objects.c index 17c3282..472797a 100644 --- a/src/objects.c +++ b/src/objects.c @@ -583,7 +583,7 @@ void disconnect_server(PgSocket *server, bool notify, const char *reason) { PgPool *pool = server->pool; PgSocket *client = server->link; - static const uint8 pkt_term[] = {'X', 0,0,0,4}; + static const uint8_t pkt_term[] = {'X', 0,0,0,4}; int send_term = 1; if (cf_log_disconnections) @@ -861,7 +861,7 @@ void forward_cancel_request(PgSocket *server) bool use_client_socket(int fd, PgAddr *addr, const char *dbname, const char *username, - uint64 ckey, int oldfd, int linkfd, + uint64_t ckey, int oldfd, int linkfd, const char *client_enc, const char *std_string, const char *datestyle, const char *timezone) { @@ -894,7 +894,7 @@ bool use_client_socket(int fd, PgAddr *addr, bool use_server_socket(int fd, PgAddr *addr, const char *dbname, const char *username, - uint64 ckey, int oldfd, int linkfd, + uint64_t ckey, int oldfd, int linkfd, const char *client_enc, const char *std_string, const char *datestyle, const char *timezone) { diff --git a/src/pktbuf.c b/src/pktbuf.c index 8ed635c..7d7207d 100644 --- a/src/pktbuf.c +++ b/src/pktbuf.c @@ -56,7 +56,7 @@ PktBuf *pktbuf_dynamic(int start_len) return buf; } -void pktbuf_static(PktBuf *buf, uint8 *data, int len) +void pktbuf_static(PktBuf *buf, uint8_t *data, int len) { memset(buf, 0, sizeof(*buf)); buf->buf = data; @@ -67,7 +67,7 @@ void pktbuf_static(PktBuf *buf, uint8 *data, int len) bool pktbuf_send_immidiate(PktBuf *buf, PgSocket *sk) { int fd = sbuf_socket(&sk->sbuf); - uint8 *pos = buf->buf + buf->send_pos; + uint8_t *pos = buf->buf + buf->send_pos; int amount = buf->write_pos - buf->send_pos; int res; @@ -166,7 +166,7 @@ void pktbuf_put_char(PktBuf *buf, char val) buf->buf[buf->write_pos++] = val; } -void pktbuf_put_uint16(PktBuf *buf, uint16 val) +void pktbuf_put_uint16(PktBuf *buf, uint16_t val) { make_room(buf, 4); if (buf->failed) @@ -176,9 +176,9 @@ void pktbuf_put_uint16(PktBuf *buf, uint16 val) buf->buf[buf->write_pos++] = val & 255; } -void pktbuf_put_uint32(PktBuf *buf, uint32 val) +void pktbuf_put_uint32(PktBuf *buf, uint32_t val) { - uint8 *pos; + uint8_t *pos; make_room(buf, 4); if (buf->failed) @@ -192,10 +192,10 @@ void pktbuf_put_uint32(PktBuf *buf, uint32 val) buf->write_pos += 4; } -void pktbuf_put_uint64(PktBuf *buf, uint64 val) +void pktbuf_put_uint64(PktBuf *buf, uint64_t val) { pktbuf_put_uint32(buf, val >> 32); - pktbuf_put_uint32(buf, (uint32)val); + pktbuf_put_uint32(buf, (uint32_t)val); } void pktbuf_put_bytes(PktBuf *buf, const void *data, int len) @@ -236,7 +236,7 @@ void pktbuf_start_packet(PktBuf *buf, int type) void pktbuf_finish_packet(PktBuf *buf) { - uint8 *pos; + uint8_t *pos; unsigned len; if (buf->failed) @@ -265,7 +265,7 @@ void pktbuf_write_generic(PktBuf *buf, int type, const char *pktdesc, ...) va_list ap; int len; const char *adesc = pktdesc; - uint8 *bin; + uint8_t *bin; pktbuf_start_packet(buf, type); @@ -282,13 +282,13 @@ void pktbuf_write_generic(PktBuf *buf, int type, const char *pktdesc, ...) pktbuf_put_uint32(buf, va_arg(ap, int)); break; case 'q': - pktbuf_put_uint64(buf, va_arg(ap, uint64)); + pktbuf_put_uint64(buf, va_arg(ap, uint64_t)); break; case 's': pktbuf_put_string(buf, va_arg(ap, char *)); break; case 'b': - bin = va_arg(ap, uint8 *); + bin = va_arg(ap, uint8_t *); len = va_arg(ap, int); pktbuf_put_bytes(buf, bin, len); break; @@ -379,7 +379,7 @@ void pktbuf_write_DataRow(PktBuf *buf, const char *tupdesc, ...) sprintf(tmp, "%d", va_arg(ap, int)); val = tmp; } else if (tupdesc[i] == 'q') { - sprintf(tmp, "%llu", (unsigned long long)va_arg(ap, uint64)); + sprintf(tmp, "%llu", (unsigned long long)va_arg(ap, uint64_t)); val = tmp; } else if (tupdesc[i] == 's') { val = va_arg(ap, char *); diff --git a/src/proto.c b/src/proto.c index fe0c53e..e79d602 100644 --- a/src/proto.c +++ b/src/proto.c @@ -100,7 +100,7 @@ bool get_header(MBuf *data, PktHdr *pkt) bool send_pooler_error(PgSocket *client, bool send_ready, const char *msg) { - uint8 tmpbuf[512]; + uint8_t tmpbuf[512]; PktBuf buf; if (cf_log_pooler_errors) @@ -178,7 +178,7 @@ void finish_welcome_msg(PgSocket *server) bool welcome_client(PgSocket *client) { int res; - uint8 buf[1024]; + uint8_t buf[1024]; PktBuf msg; PgPool *pool = client->pool; @@ -223,7 +223,7 @@ static bool login_clear_psw(PgSocket *server) return send_password(server, server->pool->user->passwd); } -static bool login_crypt_psw(PgSocket *server, const uint8 *salt) +static bool login_crypt_psw(PgSocket *server, const uint8_t *salt) { char saltbuf[3]; const char *enc; @@ -235,7 +235,7 @@ static bool login_crypt_psw(PgSocket *server, const uint8 *salt) return send_password(server, enc); } -static bool login_md5_psw(PgSocket *server, const uint8 *salt) +static bool login_md5_psw(PgSocket *server, const uint8_t *salt) { char txt[MD5_PASSWD_LEN + 1], *src; PgUser *user = server->pool->user; @@ -255,7 +255,7 @@ static bool login_md5_psw(PgSocket *server, const uint8 *salt) bool answer_authreq(PgSocket *server, PktHdr *pkt) { unsigned cmd; - const uint8 *salt; + const uint8_t *salt; bool res = false; /* authreq body must contain 32bit cmd */ @@ -304,7 +304,7 @@ bool send_startup_packet(PgSocket *server) PgDatabase *db = server->pool->db; const char *username = server->pool->user->name; PktBuf pkt; - uint8 buf[512]; + uint8_t buf[512]; pktbuf_static(&pkt, buf, sizeof(buf)); pktbuf_write_StartupMessage(&pkt, username, @@ -320,7 +320,7 @@ int scan_text_result(MBuf *pkt, const char *tupdesc, ...) unsigned ncol, i, asked; va_list ap; int *int_p; - uint64 *long_p; + uint64_t *long_p; char **str_p; asked = strlen(tupdesc); @@ -344,7 +344,7 @@ int scan_text_result(MBuf *pkt, const char *tupdesc, ...) *int_p = atoi(val); break; case 'q': - long_p = va_arg(ap, uint64 *); + long_p = va_arg(ap, uint64_t *); *long_p = atoll(val); break; case 's': diff --git a/src/sbuf.c b/src/sbuf.c index 8959592..9670609 100644 --- a/src/sbuf.c +++ b/src/sbuf.c @@ -271,7 +271,7 @@ void sbuf_prepare_skip(SBuf *sbuf, int amount) static bool sbuf_call_proto(SBuf *sbuf, int event) { MBuf mbuf; - uint8 *pos = sbuf->buf + sbuf->pkt_pos; + uint8_t *pos = sbuf->buf + sbuf->pkt_pos; int avail = sbuf->recv_pos - sbuf->pkt_pos; bool res; @@ -333,7 +333,7 @@ static void sbuf_queue_send(SBuf *sbuf) static bool sbuf_send_pending(SBuf *sbuf) { int res, avail; - uint8 *pos; + uint8_t *pos; AssertActive(sbuf); Assert(sbuf->dst || !sbuf->send_remain); @@ -464,7 +464,7 @@ static void sbuf_try_resync(SBuf *sbuf) static bool sbuf_actual_recv(SBuf *sbuf, int len) { int got; - uint8 *pos; + uint8_t *pos; AssertActive(sbuf); Assert(len > 0); diff --git a/src/stats.c b/src/stats.c index 737c42f..34827d3 100644 --- a/src/stats.c +++ b/src/stats.c @@ -39,7 +39,7 @@ static void stat_add(PgStats *total, PgStats *stat) static void calc_average(PgStats *avg, PgStats *cur, PgStats *old) { - uint64 qcount; + uint64_t qcount; usec_t dur = get_cached_time() - old_stamp; reset_stats(avg); diff --git a/src/takeover.c b/src/takeover.c index 551ecb6..5c2be82 100644 --- a/src/takeover.c +++ b/src/takeover.c @@ -47,7 +47,7 @@ static bool takeover_load_fd(MBuf *pkt, const struct cmsghdr *cmsg) char *client_enc, *std_string, *datestyle, *timezone; int oldfd, port, linkfd; int got; - uint64 ckey; + uint64_t ckey; PgAddr addr; memset(&addr, 0, sizeof(addr)); @@ -232,8 +232,8 @@ static void takeover_parse_data(PgSocket *bouncer, static void takeover_recv_cb(int sock, short flags, void *arg) { PgSocket *bouncer = arg; - uint8 data_buf[2048]; - uint8 cnt_buf[128]; + uint8_t data_buf[2048]; + uint8_t cnt_buf[128]; struct msghdr msg; struct iovec io; int res; diff --git a/src/util.c b/src/util.c index d8fd88d..851c50e 100644 --- a/src/util.c +++ b/src/util.c @@ -315,7 +315,7 @@ load_error: * PostgreSQL MD5 hashing. */ -static void hash2hex(const uint8 *hash, char *dst) +static void hash2hex(const uint8_t *hash, char *dst) { int i; static const char hextbl [] = "0123456789abcdef"; @@ -331,7 +331,7 @@ bool pg_md5_encrypt(const char *part1, char *dest) { MD5_CTX ctx; - uint8 hash[MD5_DIGEST_LENGTH]; + uint8_t hash[MD5_DIGEST_LENGTH]; MD5_Init(&ctx); MD5_Update(&ctx, part1, strlen(part1)); @@ -345,7 +345,7 @@ bool pg_md5_encrypt(const char *part1, } /* wrapped for getting random bytes */ -bool get_random_bytes(uint8 *dest, int len) +bool get_random_bytes(uint8_t *dest, int len) { int i; for (i = 0; i < len; i++) diff --git a/src/varcache.c b/src/varcache.c index 6276d82..b359351 100644 --- a/src/varcache.c +++ b/src/varcache.c @@ -132,11 +132,11 @@ static int apply_var(PktBuf *pkt, const char *key, bool varcache_apply(PgSocket *server, PgSocket *client, bool *changes_p) { PktBuf pkt; - uint8 buf[1024]; + uint8_t buf[1024]; int changes = 0; const char *cval, *sval; const struct var_lookup *lk; - uint8 *debug_sql; + uint8_t *debug_sql; bool std_quote = is_std_quote(&server->vars); pktbuf_static(&pkt, buf, sizeof(buf)); -- 2.39.5