What is assignment makes pointer from integer without a cast
Posted: Wed Dec 07, 2016 4:40 am
I am putting a lot of functions into my OS (i recently added farpeekl, outb, inb, lidt and kbdhandler).
However, in my keyboard handler, a warning occurs (-Wextra and -Wall):
This is to set the key to the translated scancode-key result.
Here's my kbdus and kbdhandler function, inb and terminal_writestring are exactly as shown in the OSDev wikia. (headers not included):
It worked fine with putchar but i am switching to writestring since instead of putting the first letter and continuing it filled the screen with whatever the keyboard was sending, which is not what i want.
How do i fix this? I can't seem to find a solution on the internet.
However, in my keyboard handler, a warning occurs (-Wextra and -Wall):
Code: Select all
kernel.c: In function 'kbdhandler':
kernel.c:199:6: warning: assignment makes pointer from integer without a cast [enabled by default]
key = kbdus[scancode];
^
Here's my kbdus and kbdhandler function, inb and terminal_writestring are exactly as shown in the OSDev wikia. (headers not included):
Code: Select all
unsigned char kbdus[128] =
{
0, 27, '1', '2', '3', '4', '5', '6', '7', '8', /* 9 */
'9', '0', '-', '=', '\b', /* Backspace */
'\t', /* Tab */
'q', 'w', 'e', 'r', /* 19 */
't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', /* Enter key */
0, /* 29 - Control */
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', /* 39 */
'\'', '`', 0, /* Left shift */
'\\', 'z', 'x', 'c', 'v', 'b', 'n', /* 49 */
'm', ',', '.', '/', 0, /* Right shift */
'*',
0, /* Alt */
' ', /* Space bar */
0, /* Caps lock */
0, /* 59 - F1 key ... > */
0, 0, 0, 0, 0, 0, 0, 0,
0, /* < ... F10 */
0, /* 69 - Num lock*/
0, /* Scroll Lock */
0, /* Home key */
0, /* Up Arrow */
0, /* Page Up */
'-',
0, /* Left Arrow */
0,
0, /* Right Arrow */
'+',
0, /* 79 - End key*/
0, /* Down Arrow */
0, /* Page Down */
0, /* Insert Key */
0, /* Delete Key */
0, 0, 0,
0, /* F11 Key */
0, /* F12 Key */
0, /* All other keys are undefined */
};
void kbdhandler()
{
unsigned char scancode;
const char *key;
scancode = inb(0x60);
key = kbdus[scancode];
terminal_writestring(key);
}
How do i fix this? I can't seem to find a solution on the internet.