Skip to content

Commit

Permalink
Use LONG_PTR, DWORD_PTR etc. for x64 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
beholdnec committed Jun 23, 2022
1 parent cc176d1 commit e71d519
Show file tree
Hide file tree
Showing 22 changed files with 129 additions and 101 deletions.
2 changes: 1 addition & 1 deletion inc/portf.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bool FPortGetFniOpen(FNI *pfni, LPTSTR lpstrFilter, LPTSTR lpstrTitle, FNI *pfni
bool FPortGetFniSave(FNI *pfni, LPTSTR lpstrFilter, LPTSTR lpstrTitle, LPTSTR lpstrDefExt, PSTN pstnDefFileName,
ulong grfPrevType, CNO cnoWave);

UINT CALLBACK OpenHookProc(HWND hWnd, UINT msg, UINT wParam, LONG lParam);
UINT_PTR CALLBACK OpenHookProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
void OpenPreview(HWND hwnd, PGNV pgnvOff, RCS *prcsPreview);
void RepaintPortfolio(HWND hwndCustom);

Expand Down
3 changes: 2 additions & 1 deletion inc/srec.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class SREC : public SREC_PAR

bool _FOpenRecord();
bool _FCloseRecord();
static void _WaveInProc(HWAVEIN hwi, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
static void CALLBACK _WaveInProc(HWAVEIN hwi, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1,
DWORD_PTR dwParam2);

protected:
bool _FInit(long csampSec, long cchan, long cbSample, ulong dtsMax);
Expand Down
18 changes: 13 additions & 5 deletions kauai/src/appbwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,17 +436,18 @@ bool APPB::_FFrameWndProc(HWND hwnd, uint wm, WPARAM wParam, LPARAM lw, long *pl

pmmi = (MINMAXINFO *)lw;

*plwRet = DefFrameProc(hwnd, vwig.hwndClient, wm, wParam, (long)pmmi);
*plwRet = DefFrameProc(hwnd, vwig.hwndClient, wm, wParam, (LPARAM)pmmi);
dypFrame = GetSystemMetrics(SM_CYFRAME);
dypScreen = GetSystemMetrics(SM_CYSCREEN);
dypExtra = 0;

FGetProp(kpridFullScreen, &lw);
if (lw)
long fullscreen = 0;
FGetProp(kpridFullScreen, &fullscreen);
if (fullscreen)
dypExtra = GetSystemMetrics(SM_CYCAPTION);
pmmi->ptMaxPosition.y = -dypFrame - dypExtra;
pmmi->ptMaxSize.y = pmmi->ptMaxTrackSize.y = dypScreen + 2 * dypFrame + dypExtra;
_FCommonWndProc(hwnd, wm, wParam, (long)pmmi, &lw);
_FCommonWndProc(hwnd, wm, wParam, (LPARAM)pmmi, &fullscreen);
}
return fTrue;

Expand Down Expand Up @@ -803,7 +804,7 @@ STN *_rgpstn[3];
/***************************************************************************
Dialog proc for assert.
***************************************************************************/
BOOL CALLBACK _FDlgAssert(HWND hdlg, UINT msg, WPARAM w, LPARAM lw)
INT_PTR CALLBACK _FDlgAssert(HWND hdlg, UINT msg, WPARAM w, LPARAM lw)
{
switch (msg)
{
Expand Down Expand Up @@ -874,6 +875,7 @@ bool APPB::FAssertProcApp(PSZS pszsFile, long lwLine, PSZS pszsMsg, void *pv, lo
stn1 = PszLit("Some Header file");
stn0.FFormatSz(psz, &stn1, lwLine, &stn2);

#ifdef IN_80386
// call stack - follow the EBP chain....
__asm { mov plw,ebp }
for (ilw = 0; ilw < kclwChain; ilw++)
Expand All @@ -889,6 +891,12 @@ bool APPB::FAssertProcApp(PSZS pszsFile, long lwLine, PSZS pszsMsg, void *pv, lo
plw = (long *)*plw;
}
}
#else
for (ilw = 0; ilw < kclwChain; ilw++)
{
rglw[ilw] = 0;
}
#endif // !IN_80386

for (cact = 0; cact < 2; cact++)
{
Expand Down
7 changes: 7 additions & 0 deletions kauai/src/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ void *BASE::operator new(size_t cb)
long *plw;
long ilw;

#ifdef IN_80386
__asm { mov plw,ebp }
for (ilw = 0; ilw < kclwStackDoi; ilw++)
{
Expand All @@ -241,6 +242,12 @@ void *BASE::operator new(size_t cb)
plw = (long *)*plw;
}
}
#else
for (ilw = 0; ilw < kclwStackDoi; ilw++)
{
pdoi->rglwStack[ilw] = 0;
}
#endif // !IN_80386
#endif // WIN

// update statistics
Expand Down
2 changes: 1 addition & 1 deletion kauai/src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifdef WIN
inline void Debugger(void)
{
__asm { int 3 }
DebugBreak();
}
#endif // WIN

Expand Down
2 changes: 1 addition & 1 deletion kauai/src/dlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DLG : public DLG_PAR
void *_pv;

#ifdef WIN
friend BOOL CALLBACK _FDlgCore(HWND hdlg, UINT msg, WPARAM w, LPARAM lw);
friend INT_PTR CALLBACK _FDlgCore(HWND hdlg, UINT msg, WPARAM w, LPARAM lw);
#endif // WIN

DLG(long rid);
Expand Down
10 changes: 5 additions & 5 deletions kauai/src/dlgwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ bool DLG::_FInit(void)
for (csit = dtm.cdit, idit = 0; csit > 0; csit--)
{
// align to dword
if ((long)psw & 2)
if ((LONG_PTR)psw & 2)
psw++;

// get and skip the ditm
Expand Down Expand Up @@ -238,7 +238,7 @@ bool DLG::_FInit(void)
/***************************************************************************
Windows dialog proc.
***************************************************************************/
BOOL CALLBACK _FDlgCore(HWND hdlg, UINT msg, WPARAM w, LPARAM lw)
INT_PTR CALLBACK _FDlgCore(HWND hdlg, UINT msg, WPARAM w, LPARAM lw)
{
PDLG pdlg;
DIT dit;
Expand Down Expand Up @@ -272,7 +272,7 @@ BOOL CALLBACK _FDlgCore(HWND hdlg, UINT msg, WPARAM w, LPARAM lw)
goto LFail;

// create a timer so we can do idle processing
if (SetTimer(hdlg, (uint)hdlg, 10, pvNil) == 0)
if (SetTimer(hdlg, (UINT_PTR)hdlg, 10, pvNil) == 0)
goto LFail;

// create a container gob and attach the hdlg
Expand Down Expand Up @@ -361,7 +361,7 @@ BOOL CALLBACK _FDlgCore(HWND hdlg, UINT msg, WPARAM w, LPARAM lw)

// remove the pdlg property and kill the timer
RemoveProp(hdlg, _szDlgProp);
KillTimer(hdlg, (uint)hdlg);
KillTimer(hdlg, (UINT_PTR)hdlg);

EndDialog(hdlg, idit);
return fTrue;
Expand All @@ -384,7 +384,7 @@ long DLG::IditDo(long iditFocus)

dlgi.pdlg = this;
dlgi.iditFocus = iditFocus;
idit = DialogBoxParam(vwig.hinst, MIR(_rid), vwig.hwndApp, &_FDlgCore, (long)&dlgi);
idit = DialogBoxParam(vwig.hinst, MIR(_rid), vwig.hwndApp, &_FDlgCore, (LONG_PTR)&dlgi);

return idit;
}
Expand Down
6 changes: 3 additions & 3 deletions kauai/src/gobmac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ HWND GOB::_HwndNewMdi(PSTZ pstzTitle)

hwnd = (HWND)NewCWindow(pvNil, &rcs, (byte *)pstzTitle, fTrue, documentProc, GrafPtr(-1), fTrue, 0);
if (hNil != hwnd && pvNil != vpmubCur)
vpmubCur->FAddListCid(cidChooseWnd, (long)hwnd, pstzTitle);
vpmubCur->FAddListCid(cidChooseWnd, (LONG_PTR)hwnd, pstzTitle);
return hwnd;
}

Expand All @@ -133,7 +133,7 @@ HWND GOB::_HwndNewMdi(PSTZ pstzTitle)
void GOB::_DestroyHwnd(HWND hwnd)
{
if (pvNil != vpmubCur)
vpmubCur->FRemoveListCid(cidChooseWnd, (long)hwnd);
vpmubCur->FRemoveListCid(cidChooseWnd, (LONG_PTR)hwnd);
DisposeWindow((PPRT)hwnd);
}

Expand Down Expand Up @@ -241,7 +241,7 @@ void GOB::SetHwndName(PSTZ pstz)
}
if (pvNil != vpmubCur)
{
vpmubCur->FChangeListCid(cidChooseWnd, (long)_hwnd, pvNil, (long)_hwnd, pstz);
vpmubCur->FChangeListCid(cidChooseWnd, (LONG_PTR)_hwnd, pvNil, (LONG_PTR)_hwnd, pstz);
}
SetWTitle(&_hwnd->port, (byte *)pstz);
}
Expand Down
2 changes: 1 addition & 1 deletion kauai/src/gobwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ HWND GOB::_HwndNewMdi(PSTN pstnTitle)
hwnd = CreateMDIWindow(PszLit("MDI"), pstnTitle->Psz(), lwStyle, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, vwig.hwndClient, vwig.hinst, 0L);
if (hNil != hwnd && pvNil != vpmubCur)
vpmubCur->FAddListCid(cidChooseWnd, (long)hwnd, pstnTitle);
vpmubCur->FAddListCid(cidChooseWnd, (LONG_PTR)hwnd, pstnTitle);
return hwnd;
}

Expand Down
46 changes: 23 additions & 23 deletions kauai/src/mdev2pri.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ struct MH
byte *lpData;
DWORD dwBufferLength;
DWORD dwBytesRecorded;
DWORD dwUser;
DWORD_PTR dwUser;
DWORD dwFlags;
MH *lpNext;
DWORD reserved;
DWORD_PTR reserved;
DWORD dwOffset;
DWORD dwReserved[8];
DWORD_PTR dwReserved[4];
};
typedef MH *PMH;

Expand Down Expand Up @@ -171,10 +171,10 @@ class MSMIX : public MSMIX_PAR
void _WaitForBuffers(void);
void _SubmitBuffers(ulong tsCur);

static void _MidiProc(ulong luUser, void *pvData, ulong luData);
static void _MidiProc(ULONG_PTR luUser, void *pvData, ULONG_PTR luData);
void _Notify(void *pvData, PMDWS pmdws);

static ulong __stdcall _ThreadProc(void *pv);
static DWORD WINAPI _ThreadProc(void *pv);
ulong _LuThread(void);

public:
Expand Down Expand Up @@ -202,7 +202,7 @@ class MSMIX : public MSMIX_PAR
/***************************************************************************
The midi stream interface.
***************************************************************************/
typedef void (*PFNMIDI)(ulong luUser, void *pvData, ulong luData);
typedef void (*PFNMIDI)(ULONG_PTR luUser, void *pvData, ULONG_PTR luData);

typedef class MISI *PMISI;
#define MISI_PAR BASE
Expand All @@ -212,17 +212,17 @@ class MISI : public MISI_PAR
RTCLASS_DEC

protected:
HMS _hms; // the midi stream handle
PFNMIDI _pfnCall; // call back function
ulong _luUser; // user data to send back
HMS _hms; // the midi stream handle
PFNMIDI _pfnCall; // call back function
ULONG_PTR _luUser; // user data to send back

// system volume level - to be saved and restored. The volume we set
// is always relative to this
tribool _tBogusDriver; // to indicate whether midiOutGetVolume really works
ulong _luVolSys;
long _vlmBase; // our current volume relative to _luVolSys.

MISI(PFNMIDI pfn, ulong luUser);
MISI(PFNMIDI pfn, ULONG_PTR luUser);

virtual bool _FOpen(void) = 0;
virtual bool _FClose(void) = 0;
Expand All @@ -239,7 +239,7 @@ class MISI : public MISI_PAR
virtual bool FActive(void);
virtual bool FActivate(bool fActivate);

virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ulong luData) = 0;
virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ULONG_PTR luData) = 0;
virtual void StopPlaying(void) = 0;
};

Expand Down Expand Up @@ -273,7 +273,7 @@ class WMS : public WMS_PAR
void *pvData;
long cb;
long cactPlay;
ulong luData;
ULONG_PTR luData;
long ibNext;

MH rgmh[kcmhMsir];
Expand All @@ -296,7 +296,7 @@ class WMS : public WMS_PAR
bool _fDone : 1; // tells the aux thread to terminate

MMRESULT(WINAPI *_pfnOpen)
(HMS *phms, LPUINT puDeviceID, DWORD cMidi, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen);
(HMS *phms, LPUINT puDeviceID, DWORD cMidi, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
MMRESULT(WINAPI *_pfnClose)(HMS hms);
MMRESULT(WINAPI *_pfnProperty)(HMS hms, LPBYTE lpb, DWORD dwProperty);
MMRESULT(WINAPI *_pfnPosition)(HMS hms, LPMMTIME lpmmt, UINT cbmmt);
Expand All @@ -305,7 +305,7 @@ class WMS : public WMS_PAR
MMRESULT(WINAPI *_pfnRestart)(HMS hms);
MMRESULT(WINAPI *_pfnStop)(HMS hms);

WMS(PFNMIDI pfn, ulong luUser);
WMS(PFNMIDI pfn, ULONG_PTR luUser);
bool _FInit(void);

virtual bool _FOpen(void);
Expand All @@ -316,22 +316,22 @@ class WMS : public WMS_PAR
long _CmhSubmitBuffers(void);
void _ResetStream(void);

static void __stdcall _MidiProc(HMS hms, ulong msg, ulong luUser, ulong lu1, ulong lu2);
static void CALLBACK _MidiProc(HMS hms, ulong msg, DWORD_PTR luUser, DWORD_PTR lu1, DWORD_PTR lu2);
void _Notify(HMS hms, PMH pmh);

static ulong __stdcall _ThreadProc(void *pv);
static DWORD WINAPI _ThreadProc(void *pv);
ulong _LuThread(void);

public:
static PWMS PwmsNew(PFNMIDI pfn, ulong luUser);
static PWMS PwmsNew(PFNMIDI pfn, ULONG_PTR luUser);
~WMS(void);

#ifdef STREAM_BUG
virtual bool FActive(void);
virtual bool FActivate(bool fActivate);
#endif // STREAM_BUG

virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ulong luData);
virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ULONG_PTR luData);
virtual void StopPlaying(void);
};

Expand All @@ -355,7 +355,7 @@ class OMS : public OMS_PAR
long ibStart;
long cactPlay;

ulong luData;
ULONG_PTR luData;
};

MUTX _mutx;
Expand All @@ -372,21 +372,21 @@ class OMS : public OMS_PAR
PMEV _pmevLim;
ulong _tsCur;

OMS(PFNMIDI pfn, ulong luUser);
OMS(PFNMIDI pfn, ULONG_PTR luUser);
bool _FInit(void);

virtual bool _FOpen(void);
virtual bool _FClose(void);

static ulong __stdcall _ThreadProc(void *pv);
static DWORD WINAPI _ThreadProc(void *pv);
ulong _LuThread(void);
void _ReleaseBuffers(void);

public:
static POMS PomsNew(PFNMIDI pfn, ulong luUser);
static POMS PomsNew(PFNMIDI pfn, ULONG_PTR luUser);
~OMS(void);

virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ulong luData);
virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ULONG_PTR luData);
virtual void StopPlaying(void);
};

Expand Down
6 changes: 3 additions & 3 deletions kauai/src/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ class MUB : public MUB_PAR
virtual void EnqueueWcid(long wcid);
#endif // WIN

virtual bool FAddListCid(long cid, long lw0, PSTN pstn);
virtual bool FRemoveListCid(long cid, long lw0, PSTN pstn = pvNil);
virtual bool FChangeListCid(long cid, long lwOld, PSTN pstnOld, long lwNew, PSTN pstnNew);
virtual bool FAddListCid(long cid, LONG_PTR lw0, PSTN pstn);
virtual bool FRemoveListCid(long cid, LONG_PTR lw0, PSTN pstn = pvNil);
virtual bool FChangeListCid(long cid, LONG_PTR lwOld, PSTN pstnOld, LONG_PTR lwNew, PSTN pstnNew);
virtual bool FRemoveAllListCid(long cid);
};

Expand Down
4 changes: 2 additions & 2 deletions kauai/src/mididev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ class MPQUE : public MPQUE_PAR
virtual void _PauseQueue(long isndinMin);
virtual void _ResumeQueue(long isndinMin);

static ulong __stdcall _ThreadProc(void *pv);
static DWORD WINAPI _ThreadProc(void *pv);

ulong _LuThread(void);
void _DoEvent(bool fRestart, long *pdtsWait);
Expand Down Expand Up @@ -593,7 +593,7 @@ void MPQUE::_ResumeQueue(long isndinMin)
/***************************************************************************
AT: Static method. Thread function for the midi thread object.
***************************************************************************/
ulong __stdcall MPQUE::_ThreadProc(void *pv)
DWORD WINAPI MPQUE::_ThreadProc(void *pv)
{
PMPQUE pmpque = (PMPQUE)pv;

Expand Down
Loading

0 comments on commit e71d519

Please sign in to comment.