Ust cleaning up
[tpg/acess2.git] / Modules / Display / VESA / main.c
index 9b3de8d..ff9e514 100644 (file)
@@ -16,7 +16,7 @@
 // === CONSTANTS ===\r
 #define        FLAG_LFB        0x1\r
 #define VESA_DEFAULT_FRAMEBUFFER       (KERNEL_BASE|0xA0000)\r
-#define BLINKING_CURSOR        0\r
+#define BLINKING_CURSOR        1\r
 #if BLINKING_CURSOR\r
 # define VESA_CURSOR_PERIOD    1000\r
 #endif\r
@@ -253,12 +253,17 @@ Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
                        );\r
                \r
                // Sanity Check\r
+               if( Offset > (Uint64)(heightInChars*widthInChars) ) {\r
+                       LEAVE('i', 0);\r
+                       return 0;\r
+               }\r
                if(y >= heightInChars) {\r
                        LEAVE('i', 0);\r
                        return 0;\r
                }\r
                \r
-               if( Offset + Length > heightInChars*widthInChars ) {\r
+               \r
+               if( (int)Offset + (int)Length > heightInChars*widthInChars ) {\r
                        Log_Debug("VESA", "%i + %i > %i*%i (%i)",\r
                                (int)Offset, (int)Length, heightInChars, widthInChars, heightInChars*widthInChars);\r
                        Length = heightInChars*widthInChars - Offset;\r
@@ -270,7 +275,7 @@ Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
                \r
                LOG("dest = %p", dest);\r
                \r
-               for( i = 0; i < Length; i++ )\r
+               for( i = 0; i < (int)Length; i++ )\r
                {\r
                        VT_Font_Render(\r
                                chars->Ch,\r
@@ -362,7 +367,7 @@ int Vesa_Ioctl(tVFS_Node *Node, int ID, void *Data)
        \r
        case VIDEO_IOCTL_SETCURSOR:     // Set cursor position\r
                #if !BLINKING_CURSOR\r
-               if(giVesaCursorX > 0 && giVesaCursorY)\r
+               if(giVesaCursorX > 0)\r
                        Vesa_FlipCursor(Node);\r
                #endif\r
                giVesaCursorX = ((tVideo_IOCtl_Pos*)Data)->x;\r
@@ -513,7 +518,7 @@ void Vesa_FlipCursor(void *Arg)
        \r
        // Sanity 1\r
        if(giVesaCursorX < 0 || giVesaCursorY < 0\r
-       || y*pitch + x + giVT_CharHeight*pitch > gpVesaCurMode->fbSize/4) {\r
+       || y*pitch + x + giVT_CharHeight*pitch > (int)gpVesaCurMode->fbSize/4) {\r
                Debug("Cursor OOB (%i,%i)", x, y);\r
                giVesaCursorTimer = -1;\r
                return;\r

UCC git Repository :: git.ucc.asn.au