From 06a8c1203fdac5539b3ca4661eff506127303e6f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 1 Apr 2003 00:12:50 +0000 Subject: [PATCH] Portability fixes. --- dlls/gdi/driver.c | 21 ++++++++++----------- dlls/winedos/int1a.c | 20 ++++++++------------ dlls/winedos/vga.c | 7 +++---- include/wine/winsock16.h | 2 +- programs/winedbg/dbg.y | 2 +- 5 files changed, 23 insertions(+), 29 deletions(-) diff --git a/dlls/gdi/driver.c b/dlls/gdi/driver.c index b3a1213d635..3c58cb0dd1c 100644 --- a/dlls/gdi/driver.c +++ b/dlls/gdi/driver.c @@ -24,7 +24,6 @@ #include #include "winbase.h" #include "winreg.h" -#include "winternl.h" #include "gdi.h" #include "wine/debug.h" @@ -235,13 +234,13 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name ) HMODULE module; struct graphics_driver *driver; - RtlEnterCriticalSection( &driver_section ); + EnterCriticalSection( &driver_section ); /* display driver is a special case */ if (!strcasecmp( name, "display" )) { driver = load_display_driver(); - RtlLeaveCriticalSection( &driver_section ); + LeaveCriticalSection( &driver_section ); return &driver->funcs; } @@ -252,7 +251,7 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name ) if (driver->module == module) { driver->count++; - RtlLeaveCriticalSection( &driver_section ); + LeaveCriticalSection( &driver_section ); return &driver->funcs; } } @@ -260,19 +259,19 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name ) if (!(module = LoadLibraryA( name ))) { - RtlLeaveCriticalSection( &driver_section ); + LeaveCriticalSection( &driver_section ); return NULL; } if (!(driver = create_driver( module ))) { FreeLibrary( module ); - RtlLeaveCriticalSection( &driver_section ); + LeaveCriticalSection( &driver_section ); return NULL; } TRACE( "loaded driver %p for %s\n", driver, name ); - RtlLeaveCriticalSection( &driver_section ); + LeaveCriticalSection( &driver_section ); return &driver->funcs; } @@ -286,12 +285,12 @@ const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs ) { struct graphics_driver *driver; - RtlEnterCriticalSection( &driver_section ); + EnterCriticalSection( &driver_section ); for (driver = first_driver; driver; driver = driver->next) if (&driver->funcs == funcs) break; if (!driver) ERR( "driver not found, trouble ahead\n" ); driver->count++; - RtlLeaveCriticalSection( &driver_section ); + LeaveCriticalSection( &driver_section ); return funcs; } @@ -305,7 +304,7 @@ void DRIVER_release_driver( const DC_FUNCTIONS *funcs ) { struct graphics_driver *driver; - RtlEnterCriticalSection( &driver_section ); + EnterCriticalSection( &driver_section ); for (driver = first_driver; driver; driver = driver->next) if (&driver->funcs == funcs) break; @@ -322,7 +321,7 @@ void DRIVER_release_driver( const DC_FUNCTIONS *funcs ) FreeLibrary( driver->module ); HeapFree( GetProcessHeap(), 0, driver ); done: - RtlLeaveCriticalSection( &driver_section ); + LeaveCriticalSection( &driver_section ); } diff --git a/dlls/winedos/int1a.c b/dlls/winedos/int1a.c index 8bf012260fb..1edc7ead69c 100644 --- a/dlls/winedos/int1a.c +++ b/dlls/winedos/int1a.c @@ -26,6 +26,7 @@ # include #endif #include +#include "winternl.h" #include "miscemu.h" #include "wine/debug.h" @@ -42,19 +43,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(int); */ DWORD INT1A_GetTicksSinceMidnight(void) { - struct tm *bdtime; - struct timeval tvs; - time_t seconds; + LARGE_INTEGER time; + TIME_FIELDS tf; - /* This should give us the (approximately) correct - * 18.206 clock ticks per second since midnight. - */ - gettimeofday( &tvs, NULL ); - seconds = tvs.tv_sec; - bdtime = localtime( &seconds ); - return (((bdtime->tm_hour * 3600 + bdtime->tm_min * 60 + - bdtime->tm_sec) * 18206) / 1000) + - (tvs.tv_usec / 54927); + NtQuerySystemTime( &time ); + RtlSystemTimeToLocalTime( &time, &time ); + RtlTimeToTimeFields( &time, &tf ); + return ((tf.Hour * 3600 + tf.Minute * 60 + tf.Second) * 18206 / 1000 + + tf.Milliseconds * 1000 / 54927); } diff --git a/dlls/winedos/vga.c b/dlls/winedos/vga.c index 2725ed45bd2..f066d317b3c 100644 --- a/dlls/winedos/vga.c +++ b/dlls/winedos/vga.c @@ -518,8 +518,8 @@ void VGA_Set16Palette(char *Table) int c; if (!lpddraw) return; /* return if we're in text only mode */ - bcopy((void *)&vga_16_palette,(void *)Table,17); - /* copy the entries into the table */ + memcpy( Table, &vga_16_palette, 17 ); /* copy the entries into the table */ + for (c=0; c<17; c++) { /* 17 entries */ pal= &vga_def64_palette[(int)vga_16_palette[c]]; /* get color */ IDirectDrawPalette_SetEntries(lpddpal,0,c,1,pal); /* set entry */ @@ -532,8 +532,7 @@ void VGA_Get16Palette(char *Table) { if (!lpddraw) return; /* return if we're in text only mode */ - bcopy((void *)Table,(void *)&vga_16_palette,17); - /* copy the entries into the table */ + memcpy( &vga_16_palette, Table, 17 ); /* copy the entries into the table */ } void VGA_SetQuadPalette(RGBQUAD*color,int start,int len) diff --git a/include/wine/winsock16.h b/include/wine/winsock16.h index ceed17b23a2..216a819df88 100644 --- a/include/wine/winsock16.h +++ b/include/wine/winsock16.h @@ -27,7 +27,7 @@ typedef UINT16 SOCKET16; typedef struct { UINT16 fd_count; /* how many are SET? */ - SOCKET16 fd_array[FD_SETSIZE]; /* an array of SOCKETs */ + SOCKET16 fd_array[WS_FD_SETSIZE]; /* an array of SOCKETs */ } ws_fd_set16; /* ws_hostent16, ws_protoent16, ws_servent16, ws_netent16 diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y index a8daadce5be..bc19a0cf5f2 100644 --- a/programs/winedbg/dbg.y +++ b/programs/winedbg/dbg.y @@ -121,7 +121,7 @@ command: | tNEXTI tEOL { DEBUG_WaitNextException(DBG_CONTINUE, 1, EXEC_STEPI_OVER); } | tNEXTI tNUM tEOL { DEBUG_WaitNextException(DBG_CONTINUE, $2, EXEC_STEPI_OVER); } | tFINISH tEOL { DEBUG_WaitNextException(DBG_CONTINUE, 0, EXEC_FINISH); } - | tABORT tEOL { kill(getpid(), SIGABRT); } + | tABORT tEOL { abort(); } | tMODE tNUM tEOL { mode_command($2); } | tMODE tVM86 tEOL { DEBUG_CurrThread->dbg_mode = MODE_VM86; } | tENABLE tNUM tEOL { DEBUG_EnableBreakpoint( $2, TRUE ); }