X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/223d09f6b523aac674ef9b72a883dfa8d37c5d4e..ab93a576f47003ad05b1378ead108474b65b611c:/src/msw/curico.cpp diff --git a/src/msw/curico.cpp b/src/msw/curico.cpp index e3ee90176f..34b895da03 100644 --- a/src/msw/curico.cpp +++ b/src/msw/curico.cpp @@ -24,10 +24,8 @@ #include #endif -#ifndef __TWIN32__ -#if defined (__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS) -#include "wx/msw/gnuwin32/extra.h" -#endif +#ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" #endif #include "wx/wxchar.h" @@ -90,7 +88,7 @@ HICON CursorToIcon( wxChar *szFileName, HINSTANCE hInst, int *W, int *H) HANDLE ReadIcon( wxChar *szFileName, int *W, int *H) { ICONFILEHEADER iconFileHead; // ICON file header structure ICONFILERES iconFileRes; // ICON file resource - WORD cbHead, + UINT cbHead, cbRes, cbBits; // Used for reading in file int hFile; // File handle @@ -101,7 +99,7 @@ HANDLE ReadIcon( wxChar *szFileName, int *W, int *H) nDirEntries = 0; // Open and read the .ICO file header and the first ICONFILERES - hFile = _lopen( wxFNCONV(szFileName), OF_READ); + hFile = _lopen( wxConvertWX2MB(szFileName), OF_READ); cbHead = _lread( hFile, (LPSTR)&iconFileHead, sizeof(ICONFILEHEADER)); cbRes = _lread( hFile, (LPSTR)&iconFileRes, sizeof(ICONFILERES)); ++nDirEntries; @@ -113,7 +111,7 @@ HANDLE ReadIcon( wxChar *szFileName, int *W, int *H) return (HANDLE) NULL; // inserted by P.S. - while( ((unsigned)nDirEntries < iconFileHead.wResourceCount) && + while( (nDirEntries < iconFileHead.wResourceCount) && ((iconFileRes.bWidth != nWidth) || (iconFileRes.bHeight != nHeight))) { cbRes = _lread( hFile, (LPSTR )&iconFileRes, sizeof( ICONFILERES)); @@ -177,7 +175,7 @@ HANDLE ReadIcon( wxChar *szFileName, int *W, int *H) //* bitmaps. So, no need to convert the AND bitmask. * //* 7) Since a DIB is stored upside down, flip the monochrome AND bits* //* by scanlines. * -//* 8) Use the XOR and AND bits and create an icon with CreateIcon. * +//* 8) Use the XOR and AND bits and create an icon with CreateIcon. * //***************************************************************************** HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst) @@ -255,8 +253,8 @@ HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst) szFlip[(k - 1) - j] = *(DWORD FAR *)lpANDbits; // 8) Use the XOR and AND bits and create an icon with CreateIcon. - hIcon = CreateIcon( hInst, bmpXor.bmWidth, bmpXor.bmHeight, bmpXor.bmPlanes, - bmpXor.bmBitsPixel, (const BYTE *)szFlip, (const BYTE *)lpXorDDB); + hIcon = CreateIcon( hInst, bmpXor.bmWidth, bmpXor.bmHeight, (BYTE)bmpXor.bmPlanes, + (BYTE)bmpXor.bmBitsPixel, (const BYTE *)szFlip, (const BYTE *)lpXorDDB); // Clean up before exiting. DeleteObject( hbmXor); @@ -337,7 +335,7 @@ HCURSOR IconToCursor( wxChar *szFileName, HINSTANCE hInst, int XHot, int YHot, HANDLE ReadCur( wxChar *szFileName, LPPOINT lpptHotSpot, int *W, int *H) { CURFILEHEADER curFileHead; // CURSOR file header structure CURFILERES curFileRes; // CURSOR file resource - WORD cbHead, + UINT cbHead, cbRes, cbBits; // Used for reading in file LPBITMAPINFO lpDIB; // Pointer to DIB memory @@ -348,7 +346,7 @@ HANDLE ReadCur( wxChar *szFileName, LPPOINT lpptHotSpot, int *W, int *H) nDirEntries = 0; // Open and read the .ICO file header and the first ICONFILERES - hFile = _lopen( wxFNCONV(szFileName), OF_READ); + hFile = _lopen( wxConvertWX2MB(szFileName), OF_READ); cbHead = _lread( hFile, (LPSTR )&curFileHead, sizeof( CURFILEHEADER)); cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES)); ++nDirEntries; @@ -361,7 +359,7 @@ HANDLE ReadCur( wxChar *szFileName, LPPOINT lpptHotSpot, int *W, int *H) return (HANDLE) NULL; // following added by P.S. - while( ((unsigned)nDirEntries < curFileHead.wResourceCount) && + while( (nDirEntries < curFileHead.wResourceCount) && ((curFileRes.bWidth != nWidth) || (curFileRes.bHeight != nHeight))) { cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES)); @@ -646,9 +644,9 @@ WORD PaletteSize( LPSTR pv) NumColors = DIBNumColors((LPSTR )lpbi); if(lpbi->biSize == sizeof( BITMAPCOREHEADER)) // OS/2 style DIBs - return NumColors * sizeof( RGBTRIPLE); + return (WORD)(NumColors * sizeof( RGBTRIPLE)); else - return NumColors * sizeof( RGBQUAD); + return (WORD)(NumColors * sizeof( RGBQUAD)); } //***************************************************************************** @@ -674,7 +672,7 @@ WORD DIBNumColors ( LPSTR pv) // is in biClrUsed, whereas in the BITMAPCORE - style headers, it // is dependent on the bits per pixel ( = 2 raised to the power of // bits/pixel). - + if(lpbi->biSize != sizeof( BITMAPCOREHEADER)) { if(lpbi->biClrUsed != 0) @@ -845,7 +843,7 @@ HCURSOR MakeCursorFromBitmap(HINSTANCE hInst, HBITMAP hBitmap, POINT *pPoint) /* * This doesn't work: just gives us a grey square. Ideas, anyone? */ - + HICON MakeIconFromBitmap(HINSTANCE hInst, HBITMAP hBitmap) { HDC hDCColor, hDCMono;