Remove in_addr_t type

This commit is contained in:
Ludvig Strigeus 2018-12-10 23:13:54 +01:00
parent aec9415e44
commit 583b01847d
4 changed files with 5 additions and 11 deletions

View file

@ -7,7 +7,6 @@
#include "build_config.h"
#include "tunsafe_config.h"
typedef uint8_t byte;
typedef uint8_t uint8;
typedef uint16_t uint16;
@ -17,8 +16,7 @@ typedef int64_t int64;
typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;
typedef unsigned int in_addr_t;
typedef unsigned int uint;
#define CTASTR2(pre,post) pre ## post
#define CTASTR(pre,post) CTASTR2(pre,post)

View file

@ -123,7 +123,7 @@ void StopTunsafeBackend(UpdateIconWhy why) {
}
}
const char *print_ip(char buf[kSizeOfAddress], in_addr_t ip) {
const char *print_ip(char buf[kSizeOfAddress], uint32 ip) {
snprintf(buf, kSizeOfAddress, "%d.%d.%d.%d", (ip >> 24) & 0xff, (ip >> 16) & 0xff, (ip >> 8) & 0xff, (ip >> 0) & 0xff);
return buf;
}

View file

@ -100,8 +100,8 @@ static const unsigned char d[] = {
66,66,66,66,66,66
};
bool base64_decode(uint8 *in, size_t inLen, uint8 *out, size_t *outLen) {
uint8 *end = in + inLen;
bool base64_decode(const uint8 *in, size_t inLen, uint8 *out, size_t *outLen) {
const uint8 *end = in + inLen;
uint8 iter = 0;
uint32_t buf = 0;
size_t len = 0;
@ -168,10 +168,6 @@ int RunCommand(const char *fmt, ...) {
tmp += buf;
} else if (c == '%') {
tmp += '%';
} else if (c == 'A') {
struct in_addr in;
in.s_addr = htonl(va_arg(va, in_addr_t));
tmp += inet_ntoa(in);
}
} else if (c == ' ' || c == 0) {
ZERO:

2
util.h
View file

@ -4,7 +4,7 @@
#include "tunsafe_types.h"
char *base64_encode(const uint8 *input, size_t length, char *output, size_t output_size, size_t *actual_size);
bool base64_decode(uint8 *in, size_t inLen, uint8 *out, size_t *outLen);
bool base64_decode(const uint8 *in, size_t inLen, uint8 *out, size_t *outLen);
bool IsOnlyZeros(const uint8 *data, size_t data_size);
int RunCommand(const char *fmt, ...);