less warnings compiling with emscripten

This commit is contained in:
UnknownShadow200 2020-10-02 01:04:29 +10:00
parent 73a68dca39
commit 01c7f1a08f
3 changed files with 11 additions and 6 deletions

View File

@ -154,8 +154,10 @@ static const char base64_table[64] = {
'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'
};
int Convert_ToBase64(const cc_uint8* src, int len, char* dst) {
int Convert_ToBase64(const void* data, int len, char* dst) {
const cc_uint8* src = (const cc_uint8*)data;
char* beg = dst;
/* 3 bytes to 4 chars */
for (; len >= 3; len -= 3, src += 3) {
*dst++ = base64_table[ (src[0] >> 2)];

View File

@ -48,7 +48,7 @@ CC_NOINLINE cc_bool Utils_ParseIP(const String* ip, cc_uint8* data);
/* Converts blocks of 3 bytes into 4 ASCII characters. (pads if needed) */
/* Returns the number of ASCII characters written. */
/* NOTE: You MUST ensure that dst is appropriately sized. */
int Convert_ToBase64(const cc_uint8* src, int len, char* dst);
int Convert_ToBase64(const void* data, int len, char* dst);
/* Converts blocks of 4 ASCII characters into 3 bytes. */
/* Returns the number of bytes written. */
/* NOTE: You MUST ensure that dst is appropriately sized. */

View File

@ -3379,10 +3379,12 @@ static void* clipboard_obj;
EMSCRIPTEN_KEEPALIVE void Window_GotClipboardText(char* src) {
String str; char strBuffer[512];
int len;
if (!clipboard_func) return;
String_InitArray(str, strBuffer);
String_AppendUtf8(&str, src, String_CalcLen(src, 2048));
len = String_CalcLen(src, 2048);
String_AppendUtf8(&str, (const cc_uint8*)src, len);
clipboard_func(&str, clipboard_obj);
clipboard_func = NULL;
@ -3489,11 +3491,12 @@ void Window_DrawFramebuffer(Rect2D r) { }
void Window_FreeFramebuffer(struct Bitmap* bmp) { }
EMSCRIPTEN_KEEPALIVE void Window_OnTextChanged(const char* src) {
char buffer[800];
String str;
String str; char buffer[800];
int len;
String_InitArray(str, buffer);
String_AppendUtf8(&str, src, String_CalcLen(src, 800));
len = String_CalcLen(src, 800);
String_AppendUtf8(&str, (const cc_uint8*)src, len);
Event_RaiseString(&InputEvents.TextChanged, &str);
}