Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed multiple warnings. #582

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ node_modules
/*.tgz
args.txt
/other/benchs/hlc

.vscode/
2 changes: 1 addition & 1 deletion include/pcre/pcre_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -4493,7 +4493,7 @@ dynamically as we process the pattern. */
/* PCRE_UTF[16|32] have the same value as PCRE_UTF8. */
BOOL utf = (options & PCRE_UTF8) != 0;
#ifndef COMPILE_PCRE32
pcre_uchar utf_chars[6];
pcre_uchar utf_chars[6] = {};
#endif
#else
BOOL utf = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion libs/mysql/my_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ MYSQL *mysql_real_connect( MYSQL *m, const char *host, const char *user, const c
myp_close(m);
save_error(m,p);
return NULL;
}
}
m->infos.server_version = strdup(myp_read_string(p));
m->infos.thread_id = myp_read_int(p);
myp_read(p,scramble_buf,8);
Expand Down
4 changes: 2 additions & 2 deletions libs/mysql/mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ static CONV convert_type( enum enum_field_types t, int flags, unsigned int lengt
case FIELD_TYPE_DECIMAL:
case FIELD_TYPE_FLOAT:
case FIELD_TYPE_DOUBLE:
case 246: // 5.0 MYSQL_NEW_DECIMAL
case FIELD_TYPE_NEWDECIMAL:
return CONV_FLOAT;
case 245: // JSON
case FIELD_TYPE_JSON:
return CONV_JSON;
case FIELD_TYPE_BLOB:
case FIELD_TYPE_TINY_BLOB:
Expand Down
1 change: 1 addition & 0 deletions libs/mysql/mysql.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ typedef enum enum_field_types {
FIELD_TYPE_NEWDATE = 0x0E,
FIELD_TYPE_VARCHAR = 0x0F,
FIELD_TYPE_BIT = 0x10,
FIELD_TYPE_JSON = 0xF5,
FIELD_TYPE_NEWDECIMAL = 0xF6,
FIELD_TYPE_ENUM = 0xF7,
FIELD_TYPE_SET = 0xF8,
Expand Down
2 changes: 1 addition & 1 deletion libs/mysql/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void psock_close( PSOCK s ) {
int psock_send( PSOCK s, const char *buf, int size ) {
int ret;
POSIX_LABEL(send_again);
ret = send(s,buf,size,MSG_NOSIGNAL);
ret = (int)send(s,buf,size,MSG_NOSIGNAL);
if( ret == SOCKET_ERROR ) {
HANDLE_EINTR(send_again);
return block_error();
Expand Down
8 changes: 4 additions & 4 deletions libs/sdl/sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ HL_PRIM void HL_NAME(set_window_grab)(SDL_Window* window, bool grabbed) {
}

HL_PRIM bool HL_NAME(get_window_grab)(SDL_Window* window) {
SDL_GetWindowGrab(window);
return SDL_GetWindowGrab(window);
}

HL_PRIM const char *HL_NAME(detect_keyboard_layout)() {
Expand Down Expand Up @@ -831,9 +831,9 @@ HL_PRIM char* HL_NAME(get_clipboard_text)() {
char* chr = SDL_GetClipboardText();
if (chr == NULL)
return NULL;
vbyte* bytes = hl_copy_bytes(chr, (int) strlen(chr) + 1);
vbyte* bytes = hl_copy_bytes((vbyte*)chr, (int) strlen(chr) + 1);
SDL_free(chr);
return bytes;
return (char*)bytes;
}

HL_PRIM varray* HL_NAME(get_displays)() {
Expand All @@ -851,7 +851,7 @@ HL_PRIM varray* HL_NAME(get_displays)() {
hl_dyn_seti(obj, hl_hash_utf8("top"), &hlt_i32, rect.y);
hl_dyn_seti(obj, hl_hash_utf8("handle"), &hlt_i32, i);
const char *name = SDL_GetDisplayName(i);
hl_dyn_setp(obj, hl_hash_utf8("name"), &hlt_bytes, hl_copy_bytes(name, (int) strlen(name)+1));
hl_dyn_setp(obj, hl_hash_utf8("name"), &hlt_bytes, hl_copy_bytes((const vbyte*)name, (int) strlen(name)+1));
hl_aptr(arr, vdynamic*)[i] = obj;
}
return arr;
Expand Down
2 changes: 1 addition & 1 deletion libs/sqlite/sqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ HL_PRIM sqlite_result *HL_NAME(request)(sqlite_database *db, vbyte *sql ) {
r->finalize = HL_NAME(finalize_result);
r->db = NULL;

if( sqlite3_prepare16_v2(db->db, sql, -1, &r->r, &tl) != SQLITE_OK ) {
if( sqlite3_prepare16_v2(db->db, sql, -1, &r->r, (const void **)&tl) != SQLITE_OK ) {
HL_NAME(error)(db->db, false);
}

Expand Down
6 changes: 4 additions & 2 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ static void gc_mark() {
hl_thread_info *t = gc_threads.threads[i];
cur_mark_stack = mark_stack;
gc_mark_stack(t->stack_cur,t->stack_top);
gc_mark_stack(&t->gc_regs,(void**)&t->gc_regs + (sizeof(jmp_buf) / sizeof(void*) - 1));
gc_mark_stack(&t->gc_regs,(void**)&t->gc_regs + (sizeof(jmp_buf) / (sizeof(void*)) - 1));
gc_mark_stack(&t->extra_stack_data,(void**)&t->extra_stack_data + t->extra_stack_size);
mark_stack = cur_mark_stack;
}
Expand Down Expand Up @@ -878,7 +878,9 @@ void hl_free( hl_alloc *a ) {
size = (int)(b->p + b->size - ((unsigned char*)b));
prev = (int_val)b;
free(b);
b = n;
if (n) {
b = n;
}
Aurel300 marked this conversation as resolved.
Show resolved Hide resolved
}
// check if our allocator was not part of the last free block
if( (int_val)a < prev || (int_val)a > prev+size )
Expand Down
2 changes: 1 addition & 1 deletion src/std/bytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ HL_PRIM vbyte *hl_bytes_from_address( int low, int high ) {
i64.high = high;
return *(vbyte**)&i64;
# else
return (vbyte*)low;
return (vbyte*)(long)low;
# endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/std/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ HL_API void *hl_debug_read_register( int pid, int thread, int reg, bool is64 ) {
void *r = get_reg(reg);
if( ((int_val)r) < 0 ) {
// peek FP ptr
char *addr = (char*)ptrace(PTRACE_PEEKUSER,thread,get_reg(-1),0);
vbyte *addr = (vbyte*)ptrace(PTRACE_PEEKUSER,thread,get_reg(-1),0);
void *out = NULL;
hl_debug_read(pid, addr + (-((int_val)r)-1), (vbyte*)&out, sizeof(void*));
return out;
Expand Down
2 changes: 1 addition & 1 deletion src/std/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ HL_PRIM void hl_tls_set( hl_tls *l, void *v ) {
_tls_set(l, store);
} else {
if( !v ) {
free(store);
hl_remove_root(store);
free(store);
_tls_set(l, NULL);
return;
}
Expand Down
6 changes: 4 additions & 2 deletions src/std/ucs2.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ double utod( const uchar *str, uchar **end ) {
}
buf[i] = 0;
result = strtod(buf,&bend);
*end = str + (bend - buf);
uchar *new_str = ustrdup(str);
*end = new_str + (bend - buf);
return result;
}

Expand All @@ -101,7 +102,8 @@ int utoi( const uchar *str, uchar **end ) {
}
buf[i] = 0;
result = strtol(buf,&bend,10);
*end = str + (bend - buf);
uchar *strcpy = ustrdup(str);
vitimiti marked this conversation as resolved.
Show resolved Hide resolved
*end = strcpy + (bend - buf);
return result;
}

Expand Down