Portability fixes.

This commit is contained in:
Alexandre Julliard 2003-04-01 00:12:50 +00:00
parent c45bbad3d6
commit 06a8c1203f
5 changed files with 23 additions and 29 deletions

View file

@ -24,7 +24,6 @@
#include <string.h>
#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 );
}

View file

@ -26,6 +26,7 @@
# include <sys/time.h>
#endif
#include <stdlib.h>
#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);
}

View file

@ -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)

View file

@ -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

View file

@ -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 ); }