fix build for clang6; code shared with emulators/desmume

This commit is contained in:
naddy 2018-04-15 20:52:34 +00:00
parent 1a8c280f89
commit 747105e359

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-src_utils_xstring_cpp,v 1.1 2018/04/15 20:52:34 naddy Exp $
Index: src/utils/xstring.cpp
--- src/utils/xstring.cpp.orig
+++ src/utils/xstring.cpp
@@ -231,8 +231,8 @@ std::string BytesToString(const void* data, int len)
{
Base64Table[ input[0] >> 2 ],
Base64Table[ ((input[0] & 0x03) << 4) | (input[1] >> 4) ],
- n<2 ? '=' : Base64Table[ ((input[1] & 0x0F) << 2) | (input[2] >> 6) ],
- n<3 ? '=' : Base64Table[ input[2] & 0x3F ]
+ (unsigned char)(n<2 ? '=' : Base64Table[ ((input[1] & 0x0F) << 2) | (input[2] >> 6) ]),
+ (unsigned char)(n<3 ? '=' : Base64Table[ input[2] & 0x3F ])
};
ret.append(output, output+4);
}
@@ -296,9 +296,9 @@ bool StringToBytes(const std::string& str, void* data,
}
unsigned char outpacket[3] =
{
- (converted[0] << 2) | (converted[1] >> 4),
- (converted[1] << 4) | (converted[2] >> 2),
- (converted[2] << 6) | (converted[3])
+ (unsigned char)((converted[0] << 2) | (converted[1] >> 4)),
+ (unsigned char)((converted[1] << 4) | (converted[2] >> 2)),
+ (unsigned char)((converted[2] << 6) | (converted[3]))
};
int outlen = (input[2] == '=') ? 1 : (input[3] == '=' ? 2 : 3);
if(outlen > len) outlen = len;