projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prevent sptps_test from sending overly large UDP packets.
[tinc]
/
src
/
utils.c
diff --git
a/src/utils.c
b/src/utils.c
index
364ae43
..
c9f3085
100644
(file)
--- a/
src/utils.c
+++ b/
src/utils.c
@@
-53,9
+53,9
@@
static int charhex2bin(char c) {
}
}
}
}
-
int hex2bin(const char *src, void *vdst, in
t length) {
+
size_t hex2bin(const char *src, void *vdst, size_
t length) {
char *dst = vdst;
char *dst = vdst;
-
in
t i;
+
size_
t i;
for(i = 0; i < length && isxdigit(src[i * 2]) && isxdigit(src[i * 2 + 1]); i++) {
dst[i] = charhex2bin(src[i * 2]) * 16 + charhex2bin(src[i * 2 + 1]);
for(i = 0; i < length && isxdigit(src[i * 2]) && isxdigit(src[i * 2 + 1]); i++) {
dst[i] = charhex2bin(src[i * 2]) * 16 + charhex2bin(src[i * 2 + 1]);
@@
-64,10
+64,10
@@
int hex2bin(const char *src, void *vdst, int length) {
return i;
}
return i;
}
-
int bin2hex(const void *vsrc, char *dst, in
t length) {
+
size_t bin2hex(const void *vsrc, char *dst, size_
t length) {
const char *src = vsrc;
const char *src = vsrc;
- for(
int i = length - 1; i >= 0; i--
) {
+ for(
size_t i = length; i-- > 0;
) {
dst[i * 2 + 1] = hexadecimals[(unsigned char) src[i] & 15];
dst[i * 2] = hexadecimals[(unsigned char) src[i] >> 4];
}
dst[i * 2 + 1] = hexadecimals[(unsigned char) src[i] & 15];
dst[i * 2] = hexadecimals[(unsigned char) src[i] >> 4];
}
@@
-76,8
+76,8
@@
int bin2hex(const void *vsrc, char *dst, int length) {
return length * 2;
}
return length * 2;
}
-
int b64decode(const char *src, void *dst, in
t length) {
-
in
t i;
+
size_t b64decode(const char *src, void *dst, size_
t length) {
+
size_
t i;
uint32_t triplet = 0;
unsigned char *udst = (unsigned char *)dst;
uint32_t triplet = 0;
unsigned char *udst = (unsigned char *)dst;
@@
-116,11
+116,11
@@
int b64decode(const char *src, void *dst, int length) {
}
}
}
}
-static
int b64encode_internal(const void *src, char *dst, in
t length, const char *alphabet) {
+static
size_t b64encode_internal(const void *src, char *dst, size_
t length, const char *alphabet) {
uint32_t triplet;
const unsigned char *usrc = (unsigned char *)src;
uint32_t triplet;
const unsigned char *usrc = (unsigned char *)src;
-
in
t si = length / 3 * 3;
-
in
t di = length / 3 * 4;
+
size_
t si = length / 3 * 3;
+
size_
t di = length / 3 * 4;
switch(length % 3) {
case 2:
switch(length % 3) {
case 2:
@@
-165,19
+165,15
@@
static int b64encode_internal(const void *src, char *dst, int length, const char
return length;
}
return length;
}
-
int b64encode(const void *src, char *dst, in
t length) {
+
size_t b64encode(const void *src, char *dst, size_
t length) {
return b64encode_internal(src, dst, length, base64_original);
}
return b64encode_internal(src, dst, length, base64_original);
}
-
int b64encode_urlsafe(const void *src, char *dst, in
t length) {
+
size_t b64encode_urlsafe(const void *src, char *dst, size_
t length) {
return b64encode_internal(src, dst, length, base64_urlsafe);
}
return b64encode_internal(src, dst, length, base64_urlsafe);
}
-#if defined(HAVE_MINGW) || defined(HAVE_CYGWIN)
-#ifdef HAVE_CYGWIN
-#include <w32api/windows.h>
-#endif
-
+#ifdef HAVE_MINGW
const char *winerror(int err) {
static char buf[1024], *ptr;
const char *winerror(int err) {
static char buf[1024], *ptr;