X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffg_spaceball_mswin.c;h=f9bad2482d9e7b92c23f4afed22e59f563992c4b;hb=f92518b68600fb6c724efe74179ff3beebb80833;hp=ba2ccf08caeeac5b6f048fe564c28794686c62dc;hpb=f008a928eaa4b6f595b987d2f86f82a5cc3224e7;p=freeglut diff --git a/src/mswin/fg_spaceball_mswin.c b/src/mswin/fg_spaceball_mswin.c index ba2ccf0..f9bad24 100644 --- a/src/mswin/fg_spaceball_mswin.c +++ b/src/mswin/fg_spaceball_mswin.c @@ -10,7 +10,7 @@ * Copyright (c) 2014 Jinrong Xie. All Rights Reserved. * Written by Jinrong Xie * Modification date: Wed Dec 24, 2014 - + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation @@ -30,13 +30,14 @@ */ /* - * Modified by Jinrong Xie (stonexjr@gmail.com) 12/24/2014 + * Modified by Jinrong Xie 12/24/2014 * for Space Navigator support on Windows. * This code is enhanced by at least supporting 3Dconnexion's * six degree of freedom navigator. */ #include +#include #include "../fg_internal.h" enum { @@ -53,7 +54,7 @@ RAWINPUTDEVICE __fgSpaceball = { 0x01, 0x08, 0x00, 0x00 }; void fgPlatformInitializeSpaceball(void) { HWND hwnd; - sball_initialized = 1; + sball_initialized = 1; if (!fgStructure.CurrentWindow) { sball_initialized = 0; @@ -121,7 +122,7 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam) if (res == -1) return; - rawInputBuffer = (BYTE*)malloc(size); + rawInputBuffer = malloc(size * sizeof *rawInputBuffer); pRawInput = (PRAWINPUT)rawInputBuffer; res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER)); @@ -188,4 +189,4 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam) __fgSpaceKeystate = dwKeystate; } } -} \ No newline at end of file +}