From a8037e241ce2c2a7047732cd23a40d4b5ff8fc0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sat, 12 Feb 2005 21:07:16 +0000 Subject: [PATCH] Sync to Wine-20050211 Carlos Lozano - Fix regression in Fallout game. Remi Assailly - char -> const char fixes. Robert Reif - Copy data structures one at a time using supplied size. svn path=/trunk/; revision=13515 --- reactos/lib/dinput/device.c | 2 +- reactos/lib/dinput/dinput_main.c | 2 +- reactos/lib/dinput/joystick_linux.c | 14 +++++--------- reactos/lib/dinput/mouse.c | 15 ++++++--------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/reactos/lib/dinput/device.c b/reactos/lib/dinput/device.c index 1c443da51ba..2980c3c00d1 100644 --- a/reactos/lib/dinput/device.c +++ b/reactos/lib/dinput/device.c @@ -316,7 +316,7 @@ DataFormat *create_DataFormat(const DIDATAFORMAT *wine_format, LPCDIDATAFORMAT a * instance id. */ ((asked_format->rgodf[j].dwType & 0x00FFFF00) == DIDFT_ANYINSTANCE) || - (DIDFT_GETINSTANCE(wine_format->rgodf[i].dwType) == DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType)))) { + (wine_format->rgodf[i].dwType & asked_format->rgodf[j].dwType))) { done[j] = 1; diff --git a/reactos/lib/dinput/dinput_main.c b/reactos/lib/dinput/dinput_main.c index 900b7c820a3..bd003d07e6a 100644 --- a/reactos/lib/dinput/dinput_main.c +++ b/reactos/lib/dinput/dinput_main.c @@ -198,7 +198,7 @@ HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPU return 0; } -static char *_dump_DIDEVTYPE_value(DWORD dwDevType) { +static const char *_dump_DIDEVTYPE_value(DWORD dwDevType) { switch (dwDevType) { case 0: return "All devices"; case DIDEVTYPE_MOUSE: return "DIDEVTYPE_MOUSE"; diff --git a/reactos/lib/dinput/joystick_linux.c b/reactos/lib/dinput/joystick_linux.c index 101d900e953..138ded7caf8 100644 --- a/reactos/lib/dinput/joystick_linux.c +++ b/reactos/lib/dinput/joystick_linux.c @@ -304,7 +304,7 @@ static HRESULT setup_dinput_options(JoystickImpl * device) int tokens = 0; int axis = 0; int pov = 0; - char *delim = ","; + const char *delim = ","; char * ptr; TRACE("\"%s\" = \"%s\"\n", device->name, buffer); @@ -1062,18 +1062,14 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceData( *entries = 0; nqtail = This->queue_tail; while (len) { - DWORD span = ((This->queue_head < nqtail) ? This->queue_len : This->queue_head) - nqtail; - if (span > len) - span = len; - /* Copy the buffered data into the application queue */ - memcpy(dod + *entries, This->data_queue + nqtail, span * dodsize); + memcpy((char *)dod + *entries * dodsize, This->data_queue + nqtail, dodsize); /* Advance position */ - nqtail += span; + nqtail++; if (nqtail >= This->queue_len) nqtail -= This->queue_len; - *entries += span; - len -= span; + (*entries)++; + len--; } } diff --git a/reactos/lib/dinput/mouse.c b/reactos/lib/dinput/mouse.c index 96e849bf186..2146ba03089 100644 --- a/reactos/lib/dinput/mouse.c +++ b/reactos/lib/dinput/mouse.c @@ -951,18 +951,15 @@ getmousesvalue(iface); *entries = 0; nqtail = This->queue_tail; while (len) { - DWORD span = ((This->queue_head < nqtail) ? This->queue_len : This->queue_head) - nqtail; - if (span > len) - span = len; - /* Copy the buffered data into the application queue */ - memcpy(dod + *entries, This->data_queue + nqtail, span * dodsize); + memcpy((char *)dod + *entries * dodsize, This->data_queue + nqtail, dodsize); /* Advance position */ - nqtail += span; - if (nqtail >= This->queue_len) nqtail -= This->queue_len; - *entries += span; - len -= span; + nqtail++; + if (nqtail >= This->queue_len) + nqtail -= This->queue_len; + (*entries)++; + len--; } } if (!(flags & DIGDD_PEEK))