Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed Jan 4, 2025
1 parent 4cf86ba commit 1f652a6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
7 changes: 4 additions & 3 deletions source/3_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


#include "ui_win.hpp"
#include <windowsx.h>

// --------------------------------------------------------------------------
// ----- UIW_IMAGE ----------------------------------------------------------
Expand Down Expand Up @@ -203,7 +202,7 @@ int UIW_IMAGE::LoadImageFromFile(void)
// Load the bitmap.
ZIL_UINT32 dibSize = bitmapFileHeader.bfSize - sizeof(BITMAPFILEHEADER);
ZIL_UINT32 tdibSize = dibSize;
ZIL_UINT8 *dib = (ZIL_UINT8 *)GlobalAllocPtr(GMEM_MOVEABLE, dibSize);
ZIL_UINT8 *dib = (ZIL_UINT8 *)GlobalLock(GlobalAlloc(GMEM_MOVEABLE, dibSize));
ZIL_UINT8 *tdib = dib;
for ( ; dibSize; dibSize -= tdibSize, tdib += tdibSize)
{
Expand All @@ -222,7 +221,9 @@ int UIW_IMAGE::LoadImageFromFile(void)
ReleaseDC(NULL, hDC);

// Clean up.
GlobalFreePtr(dib);
GlobalUnlock( (HGLOBAL)GlobalHandle( dib ) );
GlobalFree( (HGLOBAL)GlobalHandle( dib ) );

delete bitmapInfo;
woStatus &= ~WOS_READ_ERROR;
return (image ? TRUE : FALSE);
Expand Down
7 changes: 4 additions & 3 deletions source/9_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


#include "ui_win.hpp"
#include <windowsx.h>

// --------------------------------------------------------------------------
// ----- UIW_IMAGE ----------------------------------------------------------
Expand Down Expand Up @@ -202,7 +201,7 @@ int UIW_IMAGE::LoadImageFromFile(void)
// Load the bitmap.
ZIL_UINT32 dibSize = bitmapFileHeader.bfSize - sizeof(BITMAPFILEHEADER);
ZIL_UINT32 tdibSize = dibSize;
ZIL_UINT8 *dib = (ZIL_UINT8 *)GlobalAllocPtr(GMEM_MOVEABLE, dibSize);
ZIL_UINT8 *dib = (ZIL_UINT8 *)GlobalLock(GlobalAlloc(GMEM_MOVEABLE, dibSize));
ZIL_UINT8 *tdib = dib;
for ( ; dibSize; dibSize -= tdibSize, tdib += tdibSize)
{
Expand All @@ -221,7 +220,9 @@ int UIW_IMAGE::LoadImageFromFile(void)
ReleaseDC(NULL, hDC);

// Clean up.
GlobalFreePtr(dib);
GlobalUnlock( (HGLOBAL)GlobalHandle( dib ) );
GlobalFree( (HGLOBAL)GlobalHandle( dib ) );

delete bitmapInfo;
woStatus &= ~WOS_READ_ERROR;
return (image ? TRUE : FALSE);
Expand Down
14 changes: 5 additions & 9 deletions source/w_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
// Zinc Software Incorporated. Pleasant Grove, Utah USA

#include "ui_win.hpp"
#include <windowsx.h>

#if defined(__WATCOMC__)
#undef GlobalFreePtr
#define GlobalFreePtr(lp) (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
#endif

// --------------------------------------------------------------------------
// ----- UIW_IMAGE ----------------------------------------------------------
Expand Down Expand Up @@ -195,7 +189,7 @@ int UIW_IMAGE::LoadImageFromFile(void)
// Load the bitmap.
ZIL_UINT32 dibSize = bitmapFileHeader.bfSize - sizeof(BITMAPFILEHEADER);
ZIL_UINT32 tdibSize = dibSize;
ZIL_UINT8 huge *dib = (ZIL_UINT8 huge *)GlobalAllocPtr(GMEM_MOVEABLE, dibSize);
ZIL_UINT8 huge *dib = (ZIL_UINT8 huge *)GlobalLock(GlobalAlloc(GMEM_MOVEABLE, dibSize));
ZIL_UINT8 huge *tdib = dib;
for ( ; dibSize; dibSize -= tdibSize, tdib += tdibSize)
{
Expand All @@ -215,9 +209,11 @@ int UIW_IMAGE::LoadImageFromFile(void)

// Clean up
#if defined(__WATCOMC__)
GlobalFreePtr((unsigned)dib);
GlobalUnlock(GlobalPtrHandle((unsigned)dib));
(BOOL)GlobalFree(GlobalPtrHandle((unsigned)dib));
#else
GlobalFreePtr(dib);
GlobalUnlock(GlobalPtrHandle(dib));
(BOOL)GlobalFree(GlobalPtrHandle(dib));
#endif
delete bitmapInfo;
woStatus &= ~WOS_READ_ERROR;
Expand Down

0 comments on commit 1f652a6

Please sign in to comment.