This is a re-submit of the patch I sent on May 23. My diff wasn't in diff -u format. I have modified it now so that it is. This patch is against the wine-20020509 snapshot. include/winnt.h: - Fixed the LARGE_INTEGER and ULARGE_INTEGER unions for big endian. server/trace.c: - Removed crash from dump_uints dlls/ntdll/time.c: - Removed alignment problem in RtlSecondsSince19?0ToTime graphics/x11drv/palette.c: - Icon colours on 256 colour display were wrong. - Caused by using 0 in X11DRV_PALETTE_XPixelToPalette to represent free colour - index 0 originally mapped to pixel 1 - X11DRV_PALETTE_FillDefaultColors mapped index 50 to pixel 1, and hence pixel 1 was now mapped to 50 instead of 0. - Replaced 0's with -1's Gregg Mattinson Co-op Developer Sun Microsystems of Canada
*** include/,winnt.h Sat May 4 14:37:08 2002 --- include/winnt.h Fri May 17 13:11:48 2002 *************** *** 3601,3608 **** --- 3601,3613 ---- typedef union _LARGE_INTEGER { struct { + #ifdef WORDS_BIGENDIAN + LONG HighPart; DWORD LowPart; + #else + DWORD LowPart; LONG HighPart; + #endif } DUMMYSTRUCTNAME; LONGLONG QuadPart; } LARGE_INTEGER, *LPLARGE_INTEGER, *PLARGE_INTEGER; *************** *** 3609,3616 **** --- 3614,3626 ---- typedef union _ULARGE_INTEGER { struct { + #ifdef WORDS_BIGENDIAN + DWORD HighPart; DWORD LowPart; + #else + DWORD LowPart; DWORD HighPart; + #endif } DUMMYSTRUCTNAME; ULONGLONG QuadPart; } ULARGE_INTEGER, *LPULARGE_INTEGER, *PULARGE_INTEGER; *** server/,trace.c Thu May 23 10:42:47 2002 --- server/trace.c Wed May 15 13:45:54 2002 *************** *** 47,57 **** --- 47,64 ---- static void dump_uints( const int *ptr, int len ) { fputc( '{', stderr ); - while (len > 0) + if (!ptr) { - fprintf( stderr, "%08x", *ptr++ ); - if (--len) fputc( ',', stderr ); + fprintf( stderr, "dump_uints error: ptr is NULL" ); } + else + { + while (len > 0) + { + fprintf( stderr, "%08x", *ptr++ ); + if (--len) fputc( ',', stderr ); + } + } fputc( '}', stderr ); } *** dlls/ntdll/,time.c Thu May 23 10:53:22 2002 --- dlls/ntdll/time.c Thu May 23 10:56:16 2002 *************** *** 231,237 **** --- 231,243 ---- void WINAPI RtlSecondsSince1970ToTime( DWORD time, FILETIME *res ) { LONGLONG secs = time + SECS_1601_TO_1970; + #ifdef ALLOW_UNALIGNED_ACCESS ((LARGE_INTEGER *)res)->QuadPart = RtlExtendedIntegerMultiply( secs, 10000000 ); + #else + secs = RtlExtendedIntegerMultiply( secs, 10000000 ); + res->dwLowDateTime = ((LARGE_INTEGER*)&secs)->DUMMYSTRUCTNAME.LowPart; + res->dwHighDateTime = ((LARGE_INTEGER*)&secs)->DUMMYSTRUCTNAME.HighPart; + #endif } /****************************************************************************** *************** *** 240,246 **** --- 246,258 ---- void WINAPI RtlSecondsSince1980ToTime( DWORD time, FILETIME *res ) { LONGLONG secs = time + SECS_1601_to_1980; + #ifdef ALLOW_UNALIGNED_ACCESS ((LARGE_INTEGER *)res)->QuadPart = RtlExtendedIntegerMultiply( secs, 10000000 ); + #else + secs = RtlExtendedIntegerMultiply( secs, 10000000 ); + res->dwLowDateTime = ((LARGE_INTEGER*)&secs)->DUMMYSTRUCTNAME.LowPart; + res->dwHighDateTime = ((LARGE_INTEGER*)&secs)->DUMMYSTRUCTNAME.HighPart; + #endif } /****************************************************************************** *** graphics/x11drv/,palette.c Thu May 2 17:49:50 2002 --- graphics/x11drv/palette.c Thu May 23 11:00:37 2002 *************** *** 93,98 **** --- 93,99 ---- /**********************************************************************/ #define NB_COLORCUBE_START_INDEX 63 + #define NB_PALETTE_EMPTY_VALUE -1 /* Maps entry in the system palette to X pixel value */ int *X11DRV_PALETTE_PaletteToXPixel = NULL; *************** *** 571,576 **** --- 572,579 ---- ERR("Out of memory: XPixelToPalette!\n"); return FALSE; } + for( i = 0; i < 256; i++ ) + X11DRV_PALETTE_XPixelToPalette[i] = NB_PALETTE_EMPTY_VALUE; } /* for hicolor visuals PaletteToPixel mapping is used to skip *************** *** 587,593 **** --- 590,596 ---- { if( i >= COLOR_gapStart && i <= COLOR_gapEnd ) { - X11DRV_PALETTE_PaletteToXPixel[i] = 0; + X11DRV_PALETTE_PaletteToXPixel[i] = NB_PALETTE_EMPTY_VALUE; COLOR_sysPal[i].peFlags = 0; /* mark as unused */ continue; } *************** *** 691,697 **** max = COLOR_max - (256 - (COLOR_gapEnd - COLOR_gapStart)); for ( i = 0, idx = COLOR_gapStart; i < 256 && idx <= COLOR_gapEnd; i++ ) - if( X11DRV_PALETTE_XPixelToPalette[i] == 0 ) + if( X11DRV_PALETTE_XPixelToPalette[i] == NB_PALETTE_EMPTY_VALUE ) { xc.pixel = i;