Skip to content

Commit 583b018

Browse files
committed
Remove in_addr_t type
1 parent aec9415 commit 583b018

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

tunsafe_types.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "build_config.h"
88
#include "tunsafe_config.h"
99

10-
1110
typedef uint8_t byte;
1211
typedef uint8_t uint8;
1312
typedef uint16_t uint16;
@@ -17,8 +16,7 @@ typedef int64_t int64;
1716
typedef int8_t int8;
1817
typedef int16_t int16;
1918
typedef int32_t int32;
20-
21-
typedef unsigned int in_addr_t;
19+
typedef unsigned int uint;
2220

2321
#define CTASTR2(pre,post) pre ## post
2422
#define CTASTR(pre,post) CTASTR2(pre,post)

tunsafe_win32.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void StopTunsafeBackend(UpdateIconWhy why) {
123123
}
124124
}
125125

126-
const char *print_ip(char buf[kSizeOfAddress], in_addr_t ip) {
126+
const char *print_ip(char buf[kSizeOfAddress], uint32 ip) {
127127
snprintf(buf, kSizeOfAddress, "%d.%d.%d.%d", (ip >> 24) & 0xff, (ip >> 16) & 0xff, (ip >> 8) & 0xff, (ip >> 0) & 0xff);
128128
return buf;
129129
}

util.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ static const unsigned char d[] = {
100100
66,66,66,66,66,66
101101
};
102102

103-
bool base64_decode(uint8 *in, size_t inLen, uint8 *out, size_t *outLen) {
104-
uint8 *end = in + inLen;
103+
bool base64_decode(const uint8 *in, size_t inLen, uint8 *out, size_t *outLen) {
104+
const uint8 *end = in + inLen;
105105
uint8 iter = 0;
106106
uint32_t buf = 0;
107107
size_t len = 0;
@@ -168,10 +168,6 @@ int RunCommand(const char *fmt, ...) {
168168
tmp += buf;
169169
} else if (c == '%') {
170170
tmp += '%';
171-
} else if (c == 'A') {
172-
struct in_addr in;
173-
in.s_addr = htonl(va_arg(va, in_addr_t));
174-
tmp += inet_ntoa(in);
175171
}
176172
} else if (c == ' ' || c == 0) {
177173
ZERO:

util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "tunsafe_types.h"
55

66
char *base64_encode(const uint8 *input, size_t length, char *output, size_t output_size, size_t *actual_size);
7-
bool base64_decode(uint8 *in, size_t inLen, uint8 *out, size_t *outLen);
7+
bool base64_decode(const uint8 *in, size_t inLen, uint8 *out, size_t *outLen);
88
bool IsOnlyZeros(const uint8 *data, size_t data_size);
99

1010
int RunCommand(const char *fmt, ...);

0 commit comments

Comments
 (0)