From ff4f811692dff679ac89bab95638d2a74f345e87 Mon Sep 17 00:00:00 2001 From: dartvader316 Date: Wed, 7 Aug 2024 14:44:12 +0300 Subject: [PATCH] fix ssize_t print format --- desync.c | 16 ++++++++-------- proxy.c | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/desync.c b/desync.c index da5cbe5..a87496a 100644 --- a/desync.c +++ b/desync.c @@ -392,12 +392,12 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize, type = IS_HTTP; } if (len && host) { - LOG(LOG_S, "host: %.*s (%ld)\n", + LOG(LOG_S, "host: %.*s (%zd)\n", len, host, host - buffer); } // modify packet if (type == IS_HTTP && dp.mod_http) { - LOG(LOG_S, "modify HTTP: n=%ld\n", n); + LOG(LOG_S, "modify HTTP: n=%zd\n", n); if (mod_http(buffer, n, dp.mod_http)) { LOG(LOG_E, "mod http error\n"); return -1; @@ -421,10 +421,10 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize, } if (!part_tls(buffer + lp, bfsize - lp, n - lp, pos - lp)) { - LOG(LOG_E, "tlsrec error: pos=%ld, n=%ld\n", pos, n); + LOG(LOG_E, "tlsrec error: pos=%ld, n=%zd\n", pos, n); break; } - LOG(LOG_S, "tlsrec: pos=%ld, n=%ld\n", pos, n); + LOG(LOG_S, "tlsrec: pos=%ld, n=%zd\n", pos, n); n += 5; lp = pos + 5; } @@ -463,7 +463,7 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize, continue; } else if (pos <= 0 || pos >= n || pos <= lp) { - LOG(LOG_E, "split cancel: pos=%ld-%ld, n=%ld\n", lp, pos, n); + LOG(LOG_E, "split cancel: pos=%ld-%ld, n=%zd\n", lp, pos, n); break; } // send part @@ -495,7 +495,7 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize, default: return -1; } - LOG(LOG_S, "split: pos=%ld-%ld (%ld), m: %s\n", lp, pos, s, demode_str[part.m]); + LOG(LOG_S, "split: pos=%ld-%ld (%zd), m: %s\n", lp, pos, s, demode_str[part.m]); if (s < 0) { if (get_e() == EAGAIN) { @@ -504,14 +504,14 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize, return -1; } else if (s != (pos - lp)) { - LOG(LOG_E, "%ld != %ld\n", s, pos - lp); + LOG(LOG_E, "%zd != %ld\n", s, pos - lp); return lp + s; } lp = pos; } // send all/rest if (lp < n) { - LOG((lp ? LOG_S : LOG_L), "send: pos=%ld-%ld\n", lp, n); + LOG((lp ? LOG_S : LOG_L), "send: pos=%ld-%zd\n", lp, n); if (send(sfd, buffer + lp, n - lp, 0) < 0) { if (get_e() == EAGAIN) { return lp; diff --git a/proxy.c b/proxy.c index 787b5fd..a321609 100644 --- a/proxy.c +++ b/proxy.c @@ -618,7 +618,7 @@ int on_tunnel(struct poolhd *pool, struct eval *val, } sn = 0; } - LOG(LOG_S, "send: %ld != %ld (fd: %d)\n", sn, n, pair->fd); + LOG(LOG_S, "send: %zd != %zd (fd: %d)\n", sn, n, pair->fd); assert(!(val->buff.size || val->buff.offset)); val->buff.size = n - sn; @@ -739,7 +739,7 @@ static inline int on_request(struct poolhd *pool, struct eval *val, return 0; } if (n < S_SIZE_MIN) { - LOG(LOG_E, "ss: request to small (%ld)\n", n); + LOG(LOG_E, "ss: request to small (%zd)\n", n); return -1; } struct s5_req *r = (struct s5_req *)buffer; @@ -781,7 +781,7 @@ static inline int on_request(struct poolhd *pool, struct eval *val, error = connect_hook(pool, val, &dst, EV_CONNECT); } else { - LOG(LOG_E, "ss: invalid version: 0x%x (%lu)\n", *buffer, n); + LOG(LOG_E, "ss: invalid version: 0x%x (%zd)\n", *buffer, n); return -1; } if (error) {