Changeset 627


Ignore:
Timestamp:
Aug 22, 1999, 6:46:58 PM (26 years ago)
Author:
dengert
Message:

removed annoying warning.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/user32/new/loadres.cpp

    r618 r627  
    1 /* $Id: loadres.cpp,v 1.9 1999-08-22 11:10:34 sandervl Exp $ */
     1/* $Id: loadres.cpp,v 1.10 1999-08-22 16:46:58 dengert Exp $ */
    22
    33/*
     
    99 *
    1010 * Copyright 1993 Alexandre Julliard
    11  *           1998 Huw D M Davies
     11 *           1998 Huw D M Davies
    1212 *
    1313 * Project Odin Software License can be found in LICENSE.TXT
     
    2929 Win32Resource *winres;
    3030 LPWSTR  resstring;
    31  int    resstrlen = 0;
     31 int    resstrlen = 0;
    3232
    3333    winres = (Win32Resource *)FindResourceA(hinst, (LPSTR)wID, RT_STRINGA);
     
    3636        return 0;
    3737    }
    38    
     38
    3939    resstring = (LPWSTR)winres->lockResource();
    4040    if(resstring) {
     
    5656 Win32Resource *winres;
    5757 LPWSTR resstring;
    58  int    resstrlen = 0;
     58 int    resstrlen = 0;
    5959
    6060    winres = (Win32Resource *)FindResourceW(hinst, (LPWSTR)wID, RT_STRINGW);
     
    6363        return 0;
    6464    }
    65    
     65
    6666    resstring = (LPWSTR)winres->lockResource();
    6767    if(resstring) {
     
    8181{
    8282 Win32Resource *winres;
    83  HICON          hIcon;
     83 HICON          hIcon;
    8484
    8585    hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon);
    8686    if(hIcon == 0) {//not a system icon
    87         winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_ICONA);
    88         if(winres == 0) {
    89                 winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_GROUP_ICONA);
    90         }
    91         if(winres) {
     87        winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_ICONA);
     88        if(winres == 0) {
     89                winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_GROUP_ICONA);
     90        }
     91        if(winres) {
    9292                hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
    9393                delete winres;
    94         }
     94        }
    9595    }
    9696    dprintf(("LoadIconA (%X) returned %x\n", hinst, hIcon));
     
    103103{
    104104 Win32Resource *winres;
    105  HICON          hIcon;
     105 HICON          hIcon;
    106106
    107107    hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon);
    108108    if(hIcon == 0) {//not a system icon
    109         winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_ICONW);
    110         if(winres == 0) {
    111                 winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_GROUP_ICONW);
    112         }
    113         if(winres) {
     109        winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_ICONW);
     110        if(winres == 0) {
     111                winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_GROUP_ICONW);
     112        }
     113        if(winres) {
    114114                hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
    115115                delete winres;
    116         }
     116        }
    117117    }
    118118    dprintf(("LoadIconW (%X) returned %x\n", hinst, hIcon));
     
    125125{
    126126 Win32Resource *winres;
    127  HCURSOR        hCursor;
     127 HCURSOR        hCursor;
    128128
    129129    hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor);
    130130    if(hCursor == 0) {//not a system pointer
    131         winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_CURSORA);
    132         if(winres == 0) {
    133                 winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_GROUP_CURSORA);
    134         }
    135         if(winres) {
     131        winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_CURSORA);
     132        if(winres == 0) {
     133                winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_GROUP_CURSORA);
     134        }
     135        if(winres) {
    136136                hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
    137137                delete winres;
    138         }
     138        }
    139139    }
    140140    dprintf(("LoadCursorA (%X) returned %x\n", hinst, hCursor));
     
    147147{
    148148 Win32Resource *winres;
    149  HCURSOR        hCursor;
     149 HCURSOR        hCursor;
    150150
    151151    hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor);
    152152    if(hCursor == 0) {//not a system pointer
    153         winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_CURSORW);
    154         if(winres == 0) {
    155                 winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_GROUP_CURSORW);
    156         }
    157         if(winres) {
     153        winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_CURSORW);
     154        if(winres == 0) {
     155                winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_GROUP_CURSORW);
     156        }
     157        if(winres) {
    158158                hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
    159159                delete winres;
    160         }
     160        }
    161161    }
    162162    dprintf(("LoadCursorW (%X) returned %x\n", hinst, hCursor));
     
    170170   switch(*id)
    171171   {
    172         case OBM_UPARROW_W:
    173         case OBM_DNARROW_W:
    174         case OBM_RGARROW_W:
    175         case OBM_LFARROW_W:
    176         case OBM_RESTORE_W:
    177         case OBM_RESTORED_W:
    178         case OBM_UPARROWD_W:
    179         case OBM_DNARROWD_W:
    180         case OBM_RGARROWD_W:
    181         case OBM_LFARROWD_W:
    182         case OBM_OLD_UPARROW_W:
    183         case OBM_OLD_DNARROW_W:
    184         case OBM_OLD_RGARROW_W:
    185         case OBM_OLD_LFARROW_W:
    186         case OBM_CHECK_W:
    187         case OBM_CHECKBOXES_W:
    188         case OBM_BTNCORNERS_W:
    189         case OBM_COMBO_W:
    190         case OBM_REDUCE_W:
    191         case OBM_REDUCED_W:
    192         case OBM_ZOOM_W:
    193         case OBM_ZOOMD_W:
    194         case OBM_SIZE_W:
    195         case OBM_CLOSE_W:
    196         case OBM_MNARROW_W:
    197         case OBM_UPARROWI_W:
    198         case OBM_DNARROWI_W:
    199         case OBM_RGARROWI_W:
    200         case OBM_LFARROWI_W:
     172        case OBM_UPARROW_W:
     173        case OBM_DNARROW_W:
     174        case OBM_RGARROW_W:
     175        case OBM_LFARROW_W:
     176        case OBM_RESTORE_W:
     177        case OBM_RESTORED_W:
     178        case OBM_UPARROWD_W:
     179        case OBM_DNARROWD_W:
     180        case OBM_RGARROWD_W:
     181        case OBM_LFARROWD_W:
     182        case OBM_OLD_UPARROW_W:
     183        case OBM_OLD_DNARROW_W:
     184        case OBM_OLD_RGARROW_W:
     185        case OBM_OLD_LFARROW_W:
     186        case OBM_CHECK_W:
     187        case OBM_CHECKBOXES_W:
     188        case OBM_BTNCORNERS_W:
     189        case OBM_COMBO_W:
     190        case OBM_REDUCE_W:
     191        case OBM_REDUCED_W:
     192        case OBM_ZOOM_W:
     193        case OBM_ZOOMD_W:
     194        case OBM_SIZE_W:
     195        case OBM_CLOSE_W:
     196        case OBM_MNARROW_W:
     197        case OBM_UPARROWI_W:
     198        case OBM_DNARROWI_W:
     199        case OBM_RGARROWI_W:
     200        case OBM_LFARROWI_W:
    201201                return TRUE;
    202202
    203203        //TODO: Not supported by Open32. Replacement may not be accurate
    204         case OBM_OLD_CLOSE_W:
     204        case OBM_OLD_CLOSE_W:
    205205                *id = OBM_CLOSE_W;
    206206                return TRUE;
    207207
    208         case OBM_BTSIZE_W:
     208        case OBM_BTSIZE_W:
    209209                *id = OBM_SIZE_W;
    210210                return TRUE;
    211211
    212         case OBM_OLD_REDUCE_W:
     212        case OBM_OLD_REDUCE_W:
    213213                *id = OBM_REDUCE_W;
    214214                return TRUE;
    215215
    216         case OBM_OLD_ZOOM_W:
     216        case OBM_OLD_ZOOM_W:
    217217                *id = OBM_ZOOM_W;
    218218                return TRUE;
    219219
    220         case OBM_OLD_RESTORE_W:
     220        case OBM_OLD_RESTORE_W:
    221221                *id = OBM_RESTORE_W;
    222222                return TRUE;
    223223
    224         default:
     224        default:
    225225                return FALSE;
    226226   }
     
    229229//NOTE: LR_CREATEDIBSECTION flag doesn't work (crash in GDI32)!
    230230//******************************************************************************
    231 HANDLE LoadBitmapA(HINSTANCE hinst, LPCSTR lpszName, int cxDesired, int cyDesired, 
    232                    UINT fuLoad)
     231HANDLE LoadBitmapA(HINSTANCE hinst, LPCSTR lpszName, int cxDesired, int cyDesired,
     232                   UINT fuLoad)
    233233{
    234234    HBITMAP hbitmap = 0;
     
    249249    else
    250250    {
    251         if (!(ptr = (char *)VIRTUAL_MapFileA( lpszName ))) return 0;
    252         info = (BITMAPINFO *)(ptr + sizeof(BITMAPFILEHEADER));
     251        if (!(ptr = (char *)VIRTUAL_MapFileA( lpszName ))) return 0;
     252        info = (BITMAPINFO *)(ptr + sizeof(BITMAPFILEHEADER));
    253253    }
    254254
    255255    //TODO: This has to be removed once pe2lx stores win32 resources!!!
    256     if (info->bmiHeader.biSize != sizeof(BITMAPCOREHEADER) && 
    257         info->bmiHeader.biSize != sizeof(BITMAPINFOHEADER))
     256    if (info->bmiHeader.biSize != sizeof(BITMAPCOREHEADER) &&
     257        info->bmiHeader.biSize != sizeof(BITMAPINFOHEADER))
    258258    {//assume it contains a file header first
    259         info = (BITMAPINFO *)((char *)info + sizeof(BITMAPFILEHEADER));
     259        info = (BITMAPINFO *)((char *)info + sizeof(BITMAPFILEHEADER));
    260260    }
    261261
    262262    size = DIB_BitmapInfoSize(info, DIB_RGB_COLORS);
    263     if ((hFix = GlobalAlloc(0, size))) fix_info = (BITMAPINFO *)GlobalLock(hFix);
     263    if ((hFix = GlobalAlloc(0, size)) != NULL) fix_info = (BITMAPINFO *)GlobalLock(hFix);
    264264    if (fix_info) {
    265265      BYTE pix;
     
    269269      DIB_FixColorsToLoadflags(fix_info, fuLoad, pix);
    270270      if ((hdc = GetDC(0)) != 0) {
    271         char *bits = (char *)info + size;
     271        char *bits = (char *)info + size;
    272272        if (fuLoad & LR_CREATEDIBSECTION) {
    273           DIBSECTION dib;
     273          DIBSECTION dib;
    274274          hbitmap = CreateDIBSection(hdc, fix_info, DIB_RGB_COLORS, NULL, 0, 0);
    275           GetObjectA(hbitmap, sizeof(DIBSECTION), &dib);
    276           SetDIBits(hdc, hbitmap, 0, dib.dsBm.bmHeight, bits, info,
    277                     DIB_RGB_COLORS);
    278         }
    279         else {
    280           hbitmap = CreateDIBitmap( hdc, &fix_info->bmiHeader, CBM_INIT,
    281                                       bits, fix_info, DIB_RGB_COLORS );
    282         }
    283         ReleaseDC( 0, hdc );
     275          GetObjectA(hbitmap, sizeof(DIBSECTION), &dib);
     276          SetDIBits(hdc, hbitmap, 0, dib.dsBm.bmHeight, bits, info,
     277                    DIB_RGB_COLORS);
     278        }
     279        else {
     280          hbitmap = CreateDIBitmap( hdc, &fix_info->bmiHeader, CBM_INIT,
     281                                      bits, fix_info, DIB_RGB_COLORS );
     282        }
     283        ReleaseDC( 0, hdc );
    284284      }
    285285      GlobalUnlock(hFix);
     
    303303  }
    304304  dprintf(("LoadBitmapA returned %08xh\n", hBitmap));
    305  
     305
    306306  return(hBitmap);
    307307}
     
    317317  }
    318318  else {
    319         if(HIWORD(lpszBitmap) != 0) {
     319        if(HIWORD(lpszBitmap) != 0) {
    320320                 lpszBitmap = (LPWSTR)UnicodeToAsciiString((LPWSTR)lpszBitmap);
    321         }
     321        }
    322322        hBitmap = LoadBitmapA(hinst, (LPSTR)lpszBitmap, 0, 0, 0);
    323323  }
     
    327327
    328328  dprintf(("LoadBitmapW returned %08xh\n", hBitmap));
    329  
     329
    330330  return(hBitmap);
    331331}
     
    335335//******************************************************************************
    336336HANDLE WIN32API LoadImageA(HINSTANCE hinst, LPCSTR lpszName, UINT uType,
    337                            int cxDesired, int cyDesired, UINT fuLoad)
     337                           int cxDesired, int cyDesired, UINT fuLoad)
    338338{
    339339 HANDLE hRet = 0;
     
    342342
    343343  if (fuLoad & LR_DEFAULTSIZE) {
    344         if (uType == IMAGE_ICON) {
     344        if (uType == IMAGE_ICON) {
    345345            if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXICON);
    346346            if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYICON);
    347         } 
     347        }
    348348        else if (uType == IMAGE_CURSOR) {
    349             if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
     349            if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
    350350            if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYCURSOR);
    351351        }
     
    381381
    382382  if (fuLoad & LR_DEFAULTSIZE) {
    383         if (uType == IMAGE_ICON) {
     383        if (uType == IMAGE_ICON) {
    384384            if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXICON);
    385385            if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYICON);
    386         } 
     386        }
    387387        else if (uType == IMAGE_CURSOR) {
    388             if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
     388            if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
    389389            if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYCURSOR);
    390390        }
Note: See TracChangeset for help on using the changeset viewer.