mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-22 20:51:20 +00:00
Fix most (according to warnings) remaining 64bit issues in tool code
rvGEWindowWrapper is still TODO - it's not as straightforward, because it insists on storing a pointer in an idWinVar (using idWinInt), but there is no idWinVar type for pointers
This commit is contained in:
parent
bd37c3f91a
commit
5dc9b69374
9 changed files with 47 additions and 27 deletions
|
@ -569,10 +569,18 @@ int idTypeInfoTools::WriteVariable_r( const void *varPtr, const char *varName, c
|
|||
return typeSize;
|
||||
}
|
||||
|
||||
#if D3_SIZEOFPTR == 4
|
||||
const uintptr_t uninitPtr = (uintptr_t)0xcdcdcdcdUL;
|
||||
#elif D3_SIZEOFPTR == 8
|
||||
const uintptr_t uninitPtr = (uintptr_t)0xcdcdcdcdcdcdcdcdULL;
|
||||
#else
|
||||
#error "Unexpected pointer size"
|
||||
#endif
|
||||
|
||||
// if this is a pointer
|
||||
isPointer = 0;
|
||||
for ( i = typeString.Length(); i > 0 && typeString[i - 1] == '*'; i -= 2 ) {
|
||||
if ( varPtr == (void *)0xcdcdcdcd || ( varPtr != NULL && *((unsigned int *)varPtr) == 0xcdcdcdcd ) ) {
|
||||
if ( varPtr == (void*)uninitPtr || ( varPtr != NULL && *((unsigned int *)varPtr) == 0xcdcdcdcd ) ) {
|
||||
common->Warning( "%s%s::%s%s references uninitialized memory", prefix, scope, varName, "" );
|
||||
return typeSize;
|
||||
}
|
||||
|
|
|
@ -570,9 +570,18 @@ int idTypeInfoTools::WriteVariable_r( const void *varPtr, const char *varName, c
|
|||
}
|
||||
|
||||
// if this is a pointer
|
||||
|
||||
#if D3_SIZEOFPTR == 4
|
||||
const uintptr_t uninitPtr = (uintptr_t)0xcdcdcdcdUL;
|
||||
#elif D3_SIZEOFPTR == 8
|
||||
const uintptr_t uninitPtr = (uintptr_t)0xcdcdcdcdcdcdcdcdULL;
|
||||
#else
|
||||
#error "Unexpected pointer size"
|
||||
#endif
|
||||
|
||||
isPointer = 0;
|
||||
for ( i = typeString.Length(); i > 0 && typeString[i - 1] == '*'; i -= 2 ) {
|
||||
if ( varPtr == (void *)0xcdcdcdcd || ( varPtr != NULL && *((unsigned int *)varPtr) == 0xcdcdcdcd ) ) {
|
||||
if ( varPtr == (void*)uninitPtr || ( varPtr != NULL && *((unsigned int *)varPtr) == 0xcdcdcdcd ) ) {
|
||||
common->Warning( "%s%s::%s%s references uninitialized memory", prefix, scope, varName, "" );
|
||||
return typeSize;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,8 @@ bool rvPropertyGrid::Create ( HWND parent, int id, int style )
|
|||
mStyle = style;
|
||||
|
||||
// Create the List view
|
||||
mWindow = CreateWindowEx ( 0, "LISTBOX", "", WS_VSCROLL|WS_CHILD|WS_VISIBLE|LBS_OWNERDRAWFIXED|LBS_NOINTEGRALHEIGHT|LBS_NOTIFY, 0, 0, 0, 0, parent, (HMENU)id, win32.hInstance, 0 );
|
||||
const HMENU hmenuID = (HMENU)(intptr_t)id; // DG: apparently an int ID (instead of a handle/pointer) can be valid here, depending on window style
|
||||
mWindow = CreateWindowEx ( 0, "LISTBOX", "", WS_VSCROLL|WS_CHILD|WS_VISIBLE|LBS_OWNERDRAWFIXED|LBS_NOINTEGRALHEIGHT|LBS_NOTIFY, 0, 0, 0, 0, parent, hmenuID, win32.hInstance, 0 );
|
||||
mListWndProc = (WNDPROC)GetWindowLongPtr ( mWindow, GWLP_WNDPROC );
|
||||
SetWindowLongPtr ( mWindow, GWLP_USERDATA, (LONG_PTR)this );
|
||||
SetWindowLongPtr ( mWindow, GWLP_WNDPROC, (LONG_PTR)WndProc );
|
||||
|
@ -198,7 +199,7 @@ void rvPropertyGrid::FinishEdit ( void )
|
|||
nmpg.mName = item->mName;
|
||||
nmpg.mValue = value;
|
||||
|
||||
if ( !SendMessage ( GetParent ( mWindow ), WM_NOTIFY, 0, (LONG)&nmpg ) )
|
||||
if ( !SendMessage ( GetParent ( mWindow ), WM_NOTIFY, 0, (LPARAM)&nmpg ) )
|
||||
{
|
||||
mState = STATE_EDIT;
|
||||
SetFocus ( mEdit );
|
||||
|
@ -281,7 +282,7 @@ int rvPropertyGrid::AddItem ( const char* name, const char* value, EItemType typ
|
|||
|
||||
insert = SendMessage(mWindow,LB_GETCOUNT,0,0) - ((mStyle&PGS_ALLOWINSERT)?1:0);
|
||||
|
||||
return SendMessage ( mWindow, LB_INSERTSTRING, insert, (LONG)item );
|
||||
return SendMessage ( mWindow, LB_INSERTSTRING, insert, (LPARAM)item );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -330,7 +331,7 @@ void rvPropertyGrid::RemoveAllItems ( void )
|
|||
item = new rvPropertyGridItem;
|
||||
item->mName = "";
|
||||
item->mValue = "";
|
||||
SendMessage ( mWindow, LB_ADDSTRING, 0, (LONG)item );
|
||||
SendMessage ( mWindow, LB_ADDSTRING, 0, (LPARAM)item );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +463,7 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L
|
|||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
if ( lParam == (long)grid->mEdit )
|
||||
if ( lParam == (LPARAM)grid->mEdit )
|
||||
{
|
||||
if ( HIWORD(wParam) == EN_KILLFOCUS )
|
||||
{
|
||||
|
@ -545,7 +546,7 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L
|
|||
ScreenToClient ( hWnd, &point );
|
||||
if ( point.x >= grid->mSplitter - 2 && point.x <= grid->mSplitter + 2 )
|
||||
{
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_SIZEWE)));
|
||||
SetCursor ( LoadCursor ( NULL, IDC_SIZEWE));
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -572,10 +572,10 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam )
|
|||
break;
|
||||
|
||||
case ID_GUIED_TOOLS_RELOADMATERIALS:
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_WAIT) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_WAIT ) );
|
||||
cmdSystem->BufferCommandText( CMD_EXEC_NOW, "reloadImages\n" );
|
||||
cmdSystem->BufferCommandText( CMD_EXEC_NOW, "reloadMaterials\n" );
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_ARROW ) );
|
||||
break;
|
||||
|
||||
case ID_GUIED_EDIT_COPY:
|
||||
|
@ -1191,7 +1191,7 @@ bool rvGEApp::OpenFile ( const char* filename )
|
|||
}
|
||||
}
|
||||
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_WAIT ) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_WAIT ) );
|
||||
|
||||
// Setup the default error.
|
||||
error = va("Failed to parse '%s'", filename );
|
||||
|
@ -1224,7 +1224,7 @@ bool rvGEApp::OpenFile ( const char* filename )
|
|||
MessageBox ( error, MB_OK|MB_ICONERROR );
|
||||
}
|
||||
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW ) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_ARROW ) );
|
||||
|
||||
return result;;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ rvGEWindowWrapper::rvGEWindowWrapper( idWindow *window,EWindowType type ) {
|
|||
|
||||
// Attach the wrapper to the window by adding a defined variable
|
||||
// with the wrappers pointer stuffed into an integer
|
||||
// FIXME: WTF is this about?!
|
||||
idWinInt *var = new idWinInt();
|
||||
int x = (int)this;
|
||||
*var = x;
|
||||
|
@ -90,6 +91,7 @@ rvGEWindowWrapper * rvGEWindowWrapper::GetWrapper( idWindow *window ) {
|
|||
idWinInt *var;
|
||||
var = dynamic_cast< idWinInt*>(window->GetWinVarByName("guied_wrapper"));
|
||||
return var ? ((rvGEWindowWrapper *) (int) (*var)) : NULL;
|
||||
// FIXME: this won't work!
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -580,31 +580,31 @@ void rvGEWorkspace::UpdateCursor ( rvGESelectionMgr::EHitTest type )
|
|||
switch ( type )
|
||||
{
|
||||
case rvGESelectionMgr::HT_SELECT:
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_ARROW ) );
|
||||
break;
|
||||
|
||||
case rvGESelectionMgr::HT_MOVE:
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_SIZEALL) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_SIZEALL ) );
|
||||
break;
|
||||
|
||||
case rvGESelectionMgr::HT_SIZE_LEFT:
|
||||
case rvGESelectionMgr::HT_SIZE_RIGHT:
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_SIZEWE ) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_SIZEWE ) );
|
||||
break;
|
||||
|
||||
case rvGESelectionMgr::HT_SIZE_TOP:
|
||||
case rvGESelectionMgr::HT_SIZE_BOTTOM:
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_SIZENS ) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_SIZENS ) );
|
||||
break;
|
||||
|
||||
case rvGESelectionMgr::HT_SIZE_TOPRIGHT:
|
||||
case rvGESelectionMgr::HT_SIZE_BOTTOMLEFT:
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_SIZENESW ) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_SIZENESW ) );
|
||||
break;
|
||||
|
||||
case rvGESelectionMgr::HT_SIZE_BOTTOMRIGHT:
|
||||
case rvGESelectionMgr::HT_SIZE_TOPLEFT:
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_SIZENWSE ) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_SIZENWSE ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ void rvGEWorkspace::UpdateCursor ( float x, float y )
|
|||
}
|
||||
else
|
||||
{
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW ) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_ARROW ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ bool rvGEWorkspace::SaveFile ( const char* filename )
|
|||
idFile* file;
|
||||
idWindow* window;
|
||||
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_WAIT ) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_WAIT ) );
|
||||
|
||||
mFilename = filename;
|
||||
|
||||
|
@ -61,7 +61,7 @@ bool rvGEWorkspace::SaveFile ( const char* filename )
|
|||
file = fileSystem->OpenFileWrite(tempfile);
|
||||
if ( !file )
|
||||
{
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW ) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_ARROW ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ bool rvGEWorkspace::SaveFile ( const char* filename )
|
|||
if ( !CopyFile ( ospath, filename, FALSE ) )
|
||||
{
|
||||
DeleteFile ( ospath );
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW ) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_ARROW ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ bool rvGEWorkspace::SaveFile ( const char* filename )
|
|||
mNew = false;
|
||||
UpdateTitle ( );
|
||||
|
||||
SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW ) ) );
|
||||
SetCursor ( LoadCursor ( NULL, IDC_ARROW ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ void CEntityListDlg::OnLbnSelchangeListEntities()
|
|||
int count = pEntity->epairs.GetNumKeyVals();
|
||||
for (int i = 0; i < count; i++) {
|
||||
int nParent = m_lstEntity.InsertItem(0, pEntity->epairs.GetKeyVal(i)->GetKey());
|
||||
m_lstEntity.SetItem(nParent, 1, LVIF_TEXT, pEntity->epairs.GetKeyVal(i)->GetValue(), 0, 0, 0, reinterpret_cast<DWORD>(pEntity));
|
||||
m_lstEntity.SetItem(nParent, 1, LVIF_TEXT, pEntity->epairs.GetKeyVal(i)->GetValue(), 0, 0, 0, (LPARAM)(pEntity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,9 +91,9 @@ BOOL CMapInfo::OnInitDialog()
|
|||
|
||||
CMapStringToPtr mapEntity;
|
||||
|
||||
int nValue = 0;
|
||||
for (entity_t* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next)
|
||||
{
|
||||
intptr_t nValue = 0;
|
||||
for (entity_t* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next)
|
||||
{
|
||||
m_nTotalEntities++;
|
||||
nValue = 0;
|
||||
mapEntity.Lookup(pEntity->eclass->name, reinterpret_cast<void*&>(nValue));
|
||||
|
|
Loading…
Reference in a new issue