diff --git a/neo/d3xp/gamesys/TypeInfo.cpp b/neo/d3xp/gamesys/TypeInfo.cpp index 2742c68b..aab6c465 100644 --- a/neo/d3xp/gamesys/TypeInfo.cpp +++ b/neo/d3xp/gamesys/TypeInfo.cpp @@ -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; } diff --git a/neo/game/gamesys/TypeInfo.cpp b/neo/game/gamesys/TypeInfo.cpp index 2742c68b..40f55e84 100644 --- a/neo/game/gamesys/TypeInfo.cpp +++ b/neo/game/gamesys/TypeInfo.cpp @@ -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; } diff --git a/neo/tools/common/PropertyGrid.cpp b/neo/tools/common/PropertyGrid.cpp index f2b9f660..a846c998 100644 --- a/neo/tools/common/PropertyGrid.cpp +++ b/neo/tools/common/PropertyGrid.cpp @@ -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; diff --git a/neo/tools/guied/GEApp.cpp b/neo/tools/guied/GEApp.cpp index 5a3ca1cf..9aae4020 100644 --- a/neo/tools/guied/GEApp.cpp +++ b/neo/tools/guied/GEApp.cpp @@ -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;; } diff --git a/neo/tools/guied/GEWindowWrapper.cpp b/neo/tools/guied/GEWindowWrapper.cpp index 9f113389..3cd485f3 100644 --- a/neo/tools/guied/GEWindowWrapper.cpp +++ b/neo/tools/guied/GEWindowWrapper.cpp @@ -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! } /* diff --git a/neo/tools/guied/GEWorkspace.cpp b/neo/tools/guied/GEWorkspace.cpp index 3f197680..0a4ece06 100644 --- a/neo/tools/guied/GEWorkspace.cpp +++ b/neo/tools/guied/GEWorkspace.cpp @@ -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 ) ); } } diff --git a/neo/tools/guied/GEWorkspaceFile.cpp b/neo/tools/guied/GEWorkspaceFile.cpp index 937dc84a..ef68fe6f 100644 --- a/neo/tools/guied/GEWorkspaceFile.cpp +++ b/neo/tools/guied/GEWorkspaceFile.cpp @@ -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; } diff --git a/neo/tools/radiant/EntityListDlg.cpp b/neo/tools/radiant/EntityListDlg.cpp index 91d87208..ea40f552 100644 --- a/neo/tools/radiant/EntityListDlg.cpp +++ b/neo/tools/radiant/EntityListDlg.cpp @@ -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(pEntity)); + m_lstEntity.SetItem(nParent, 1, LVIF_TEXT, pEntity->epairs.GetKeyVal(i)->GetValue(), 0, 0, 0, (LPARAM)(pEntity)); } } } diff --git a/neo/tools/radiant/MapInfo.cpp b/neo/tools/radiant/MapInfo.cpp index dca3d3c5..3703646c 100644 --- a/neo/tools/radiant/MapInfo.cpp +++ b/neo/tools/radiant/MapInfo.cpp @@ -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(nValue));