Skip to content

Commit

Permalink
Fix some compiler warnings
Browse files Browse the repository at this point in the history
Fix compiler warnings about comparing signed with unsigned integers.
  • Loading branch information
Rainer-Keller committed Oct 10, 2024
1 parent 4de2220 commit 8791318
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/hdlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ ssize_t hdlc_find_frame(const uint8_t *buffer, size_t bufsize, off_t *start)
int s = -1, e = -1;

// Look for frame start
for (int i = *start; i < bufsize; i++) {
for (size_t i = *start; i < bufsize; i++) {
if (buffer[i] == 0x7e) { // Flag Sequence
s = i + 1;
break;
Expand All @@ -213,7 +213,7 @@ ssize_t hdlc_find_frame(const uint8_t *buffer, size_t bufsize, off_t *start)
s++;

// Look for frame end
for (int i = s; i < bufsize; i++) {
for (size_t i = s; i < bufsize; i++) {
if (buffer[i] == 0x7e) { // Flag Sequence
e = i;
break;
Expand Down
2 changes: 1 addition & 1 deletion src/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ int ipv4_restore_routes(struct tunnel *tunnel)

static inline char *replace_char(char *str, char find, char replace)
{
for (int i = 0; i < strlen(str); i++)
for (size_t i = 0; i < strlen(str); i++)
if (str[i] == find)
str[i] = replace;
return str;
Expand Down
4 changes: 2 additions & 2 deletions src/tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ static int tcp_connect(struct tunnel *tunnel)
const char *response = NULL;

memset(&(request), 0, sizeof(request));
for (int j = 0; response == NULL; j++) {
for (unsigned int j = 0; response == NULL; j++) {
if (j >= ARRAY_SIZE(request) - 1) {
log_error("Proxy response is unexpectedly large and cannot fit in the %lu-bytes buffer.\n",
ARRAY_SIZE(request));
Expand Down Expand Up @@ -819,7 +819,7 @@ static int tcp_connect(struct tunnel *tunnel)
};
const char *eol = NULL;

for (int i = 0; (i < ARRAY_SIZE(HTTP_EOL)) &&
for (unsigned int i = 0; (i < ARRAY_SIZE(HTTP_EOL)) &&
(eol == NULL); i++)
eol = strstr(response, HTTP_EOL[i]);
response = eol;
Expand Down
2 changes: 1 addition & 1 deletion src/userinput.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ void read_password(const char *pinentry, const char *hint,
{
int masked = 0;
struct termios oldt, newt;
int i;
size_t i;

if (pinentry && *pinentry) {
pinentry_read_password(pinentry, hint, prompt, pass, len);
Expand Down

0 comments on commit 8791318

Please sign in to comment.