int b64decode(const char *src, char *dst, int length) {
int i;
uint32_t triplet = 0;
- unsigned char *udst = dst;
+ unsigned char *udst = (unsigned char *)dst;
for(i = 0; i < length / 3 * 4 && src[i]; i++) {
triplet |= charb64decode(src[i]) << (6 * (i & 3));
int b64encode(const char *src, char *dst, int length) {
uint32_t triplet;
- const unsigned char *usrc = src;
+ const unsigned char *usrc = (unsigned char *)src;
int si = length / 3 * 3;
int di = length / 3 * 4;
#endif
const char *winerror(int err) {
- static char buf[1024], *newline;
+ static char buf[1024], *ptr;
+
+ ptr = buf + sprintf(buf, "(%d) ", err);
if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, sizeof(buf), NULL)) {
+ NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), ptr, sizeof(buf) - (ptr - buf), NULL)) {
strncpy(buf, "(unable to format errormessage)", sizeof(buf));
};
- if((newline = strchr(buf, '\r')))
- *newline = '\0';
+ if((ptr = strchr(buf, '\r')))
+ *ptr = '\0';
return buf;
}