Fix: explicit typecasting

This commit is contained in:
xamidev
2024-09-10 21:11:41 +02:00
parent bf0228d3ac
commit 64ccec0866
9 changed files with 22 additions and 12 deletions

View File

@@ -0,0 +1,8 @@
Subfolder support!
I am making a bit of scurity improvements but clearly it has no meaing here.
The real meanng is the tellin of the Genesis; a true work of art. So many
cool stuff here!! Look, there are functions, comands, bits and bytes, conditions,
and lgorithms. What a fantastic world! But after all it stays formless and empty.
1:5:1 1:1:1 7:8:1 1:7:3 1:4:3 2:1:2

View File

@@ -36,9 +36,9 @@ void gdt_install()
gdt_set_gate(2, 0, 0xFFFFFFFF, 0x92, 0xCF);
// Ring 3
gdt_set_gate(3, 0, 0xFFFFFFFF, 0xFA, 0xCF);
gdt_set_gate(4, 0, 0xFFFFFFFF, 0xF2, 0xCF);
//gdt_set_gate(3, 0, 0xFFFFFFFF, 0xFA, 0xCF);
//gdt_set_gate(4, 0, 0xFFFFFFFF, 0xF2, 0xCF);
gdt_flush();
printf("[kernel] GDT gates set (ring 0 and 3), gdt=0x%x\n", &gdt);
printf("[kernel] GDT gates set (ring 0), gdt=0x%x\n", (unsigned int)&gdt);
}

View File

@@ -30,5 +30,5 @@ void idt_install()
memset(&idt, 0, sizeof(struct idt_entry)*256);
idt_load();
printf("[kernel] loaded IDT at idt=0x%x\n", &idt);
printf("[kernel] loaded IDT at idt=0x%x\n", (unsigned int)&idt);
}

View File

@@ -82,7 +82,7 @@ void ls_initrd(uint8_t* initrd, int verbose)
{
printf("%s\n", header->filename);
} else {
printf("%7d\t%c\t %s\n", header->size, header->typeflag, header->filename);
printf("%7d\t%c\t %s\n", (int)header->size, header->typeflag, header->filename);
}
uint32_t size = tar_parse_size(header->size);

View File

@@ -65,12 +65,12 @@ void kmain(multiboot2_info *mb_info)
}
printf("[kernel] multiboot2 info at 0x%x, size=%u\n", mb_info, mb_info->total_size);
printf("[kernel] framebuffer discovered at 0x%x\n", fb_info->framebuffer_addr);
printf("[kernel] framebuffer discovered at 0x%x\n", (unsigned int)fb_info->framebuffer_addr);
printf("[kernel] fb0: width=%u, height=%u, pitch=%u, bpp=%u\n", fb_info->framebuffer_width, fb_info->framebuffer_height, fb_info->framebuffer_pitch, fb_info->framebuffer_bpp);
if (mmap_tag) // memmap debug print
{
printf("[kernel] found memory map tag by multiboot2\n");
puts("[kernel] found memory map tag by multiboot2\n");
struct multiboot_mmap_entry *mmap = mmap_tag->entries;
while ((uint8_t*) mmap < tags + mmap_tag->size)
@@ -115,7 +115,7 @@ void kmain(multiboot2_info *mb_info)
init_alloc();
void* ptr1 = malloc(256);
void* ptr2 = malloc(512);
printf("[debug] malloc test ptr1=0x%x, ptr2=0x%x\n", ptr1, ptr2);
printf("[debug] malloc test ptr1=0x%x, ptr2=0x%x\n", (unsigned int)ptr1, (unsigned int)ptr2);
free(ptr1); free(ptr2);
timer_install();

View File

@@ -6,6 +6,8 @@
#ifndef STRING_H
#define STRING_H
#include "../kernel/system.h"
int strlen(const char* str);
int strcmp(const char* str1, const char* str2);
char* strtok(char* str, const char* delimiter);

View File

@@ -62,7 +62,7 @@ void display_bmp(uint32_t* fb, int pitch, int bpp, uint8_t* initrd, const char*
int height = bmp_info->biHeight;
int pixel_offset = bmp_header->bfOffBits;
printf("%d-bit BMP, width: %d, height: %d, pixel offset: %d\n", bmp_info->biBitCount, bmp_info->biWidth, bmp_info->biHeight, bmp_header->bfOffBits);
printf("%d-bit BMP, width: %d, height: %d, pixel offset: %d\n", bmp_info->biBitCount, bmp_info->biWidth, bmp_info->biHeight, (int)bmp_header->bfOffBits);
erase_cursor();
uint8_t* pixel_data = (uint8_t*)(buffer + pixel_offset);

View File

@@ -129,7 +129,7 @@ void placing_ally_ships(grid_t* grid[SIZE][SIZE])
do
{
printf("Ship %d\n------\n", i);
printf("Ship %d\n------\n", (int)i);
puts("X coord: ");
char input_buffer[BUFFER_SIZE];
get_input(input_buffer, BUFFER_SIZE);
@@ -179,7 +179,7 @@ void show_enemy_battlefield(grid_t* grid[SIZE][SIZE])
for (size_t i=0; i<SIZE; i++)
{
printf("%d ", i);
printf("%d ", (int)i);
for (size_t j=0; j<SIZE; j++)
{
char roleChar = 0;

View File

@@ -33,7 +33,7 @@ void program_primes(int argc, char* argv[])
{
if (isPrime(x) && x != 3301)
{
printf("%d ", x);
printf("%d ", (int)x);
} else if(x == 3301)
{
colorputs("3301 ", red, black);