update comments for ksys_draw_bitmap_palette && add .vscode dir to .gitignore && fix -Wsign-conversion and some -Wcasst-qual

Yes, I use vscode.
This commit is contained in:
Егор 2024-11-17 08:53:46 +00:00
parent aff0b28356
commit 98256c25bc
2 changed files with 42 additions and 30 deletions

3
.gitignore vendored
View File

@ -7,3 +7,6 @@ ehthumbs_vista.db
### macOS ###
.DS_Store
._*
# vscode folder
.vscode/

View File

@ -24,6 +24,10 @@
#include <stdbool.h>
#ifdef __cplusplus
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
extern "C" {
#endif
@ -1075,17 +1079,21 @@ KOSAPI void _ksys_draw_line(int xs, int ys, int xe, int ye, ksys_color_t color)
KOSAPI void _ksys_draw_number(int number, int x, int y, int len, ksys_color_t color)
{
unsigned fmt;
fmt = len << 16 | 0x80000000; // no leading zeros + width
fmt = (((unsigned int) len) << 16) | 0x80000000; // no leading zeros + width
asm_inline(
"int $0x40"
:
: "a"(47), "b"(fmt), "c"(number), "d"((x << 16) | y), "S"(color));
: "a"(47),
"b"(fmt),
"c"(number),
"d"((x << 16) | y),
"S"(color));
}
KOSAPI void _ksys_draw_number_bg(unsigned number, int x, int y, int len, ksys_color_t color, ksys_color_t bg)
{
unsigned fmt;
fmt = len << 16 | 0x80000000; // no leading zeros + width
fmt = (((unsigned int) len) << 16) | 0x80000000; // no leading zeros + width
asm_inline(
"int $0x40"
:
@ -1141,7 +1149,7 @@ enum KSYS_CLIP_TYPES {
KOSAPI int _ksys_clip_num(void)
{
unsigned val;
int val;
asm_inline(
"int $0x40"
: "=a"(val)
@ -1167,7 +1175,7 @@ KOSAPI char* _ksys_clip_get(int n) // returned buffer must be freed by _ksys_fre
KOSAPI int _ksys_clip_set(int n, char* buffer)
{
unsigned val;
int val;
asm_inline(
"int $0x40"
: "=a"(val)
@ -1181,7 +1189,7 @@ KOSAPI int _ksys_clip_set(int n, char* buffer)
KOSAPI int _ksys_clip_pop()
{
unsigned val;
int val;
asm_inline(
"int $0x40"
: "=a"(val)
@ -1194,7 +1202,7 @@ KOSAPI int _ksys_clip_pop()
KOSAPI int _ksys_clip_unlock()
{
unsigned val;
int val;
asm_inline(
"int $0x40"
: "=a"(val)
@ -1224,8 +1232,8 @@ KOSAPI void ksys_draw_bitmap_palette(void* bitmap, int x, int y, int w, int h, i
{
asm_inline(
"pushl %%ebp\n\t" // save EBP register
"movl %0, %%ebp\n\t" // 0x24 - "offset" param
"int $0x40\n\t"
"movl %0, %%ebp\n\t" // mov offset to EBP register
"int $0x40\n\t" // system call
"popl %%ebp" // restore EBP register
::
"X"(offset),
@ -1613,7 +1621,7 @@ KOSAPI int _ksys_file_set_size(const char* name, uint64_t size)
f.data = NULL;
f.zero = 0;
f.path_ptr = (char*) name;
return _ksys_file(&f).status;
return (int) _ksys_file(&f).status;
}
/*========== Function 70, subfunction 5 - get information on file/folder. =====*/
@ -1636,7 +1644,7 @@ KOSAPI int _ksys_file_info(const char* name, ksys_file_info_t* info)
f.data = (void*) info;
f.zero = 0;
f.path_ptr = (char*) name;
return _ksys_file(&f).status;
return (int) _ksys_file(&f).status;
}
#define _ksys_dir_info _ksys_file_info
@ -1660,7 +1668,7 @@ KOSAPI int _ksys_exec(const char* path, char* args, bool debug)
f.args = args;
f.zero = 0;
f.path_ptr = (char*) path;
return _ksys_file(&f).status;
return (int) _ksys_file(&f).status;
}
/*========== Function 70, subfunction 8 - delete file/folder. ==========*/
@ -1674,7 +1682,7 @@ KOSAPI int _ksys_file_delete(const char* path)
f.data = NULL;
f.zero = 0;
f.path_ptr = (char*) path;
return _ksys_file(&f).status;
return (int) _ksys_file(&f).status;
}
#define _ksys_rmdir(x) _ksys_file_delete(x)
@ -1690,7 +1698,7 @@ KOSAPI int _ksys_mkdir(const char* path)
f.data = NULL;
f.zero = 0;
f.path_ptr = (char*) path;
return _ksys_file(&f).status;
return (int) _ksys_file(&f).status;
}
/*============= Function 70, subfunction 10 - rename/move. =============*/
@ -1703,7 +1711,7 @@ KOSAPI int _ksys_file_rename(const char* name, const char* new_name)
f.data_size = 0;
f.zero = 0;
f.path_ptr = (char*) name;
return _ksys_file(&f).status;
return (int) _ksys_file(&f).status;
}
#define _ksys_dir_rename _ksys_file_rename
@ -1811,6 +1819,7 @@ KOSAPI int _ksys_posix_pipe2(int pipefd[2], int flags)
#ifdef __cplusplus
}
#pragma GCC diagnostic pop
#endif
#endif // _KSYS_H_