From 94bb4b7aaf0b33fb4503bf0853fae67f97823efe Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sat, 26 Jan 2013 15:06:49 +0000 Subject: [PATCH] [EXPLORER] - Use set_cpp instead of hand-coding all the parameters - Use comutil.h and link with comsupp unconditionally, since we now have them - Use STLPort-compatible filebuf constructor for TCHAR iostreams - Fix a few MSVC and GCC 4.7 errors/warnings svn path=/trunk/; revision=58224 --- reactos/base/shell/explorer/CMakeLists.txt | 22 ++++--------------- .../base/shell/explorer/desktop/desktop.cpp | 5 +++-- reactos/base/shell/explorer/desktop/desktop.h | 3 ++- reactos/base/shell/explorer/explorer.cpp | 2 +- .../base/shell/explorer/shell/webchild.cpp | 13 ----------- .../base/shell/explorer/taskbar/startmenu.cpp | 2 +- .../shell/explorer/utility/treedroptarget.h | 3 ++- reactos/base/shell/explorer/utility/utility.h | 2 +- .../base/shell/explorer/utility/xmlstorage.h | 12 ++++++++-- reactos/include/crt/comutil.h | 2 +- 10 files changed, 25 insertions(+), 41 deletions(-) diff --git a/reactos/base/shell/explorer/CMakeLists.txt b/reactos/base/shell/explorer/CMakeLists.txt index 75c86f8fca2..395ea5c5e79 100644 --- a/reactos/base/shell/explorer/CMakeLists.txt +++ b/reactos/base/shell/explorer/CMakeLists.txt @@ -1,15 +1,11 @@ add_subdirectory(notifyhook) -#NOTE : explorer doesn't follow standard c++, and so doesn't compile with stlport headers -#I'm not willing to do it if explorer_new is hanging around. -#jgardou -#set_cpp() +set_cpp() add_definitions( -DWIN32 - -D__WINDRES__ - -DUNICODE -D_UNICODE) + -D__WINDRES__) #add_pch(explorer precomp.h) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) @@ -51,20 +47,10 @@ list(APPEND SOURCE utility/shellbrowserimpl.cpp) # utility/shelltests.cpp add_executable(explorer ${SOURCE}) -set_subsystem(explorer windows) -set_entrypoint(explorer wWinMainCRTStartup) - -target_link_libraries(explorer - -lsupc++ - -lstdc++ - -lgcc - -lmingwex - -lmingw32 - wine - uuid) +target_link_libraries(explorer comsupp wine uuid) +set_module_type(explorer win32gui UNICODE) add_importlibs(explorer advapi32 gdi32 user32 ws2_32 msimg32 comctl32 ole32 oleaut32 shell32 shlwapi notifyhook msvcrt kernel32 ntdll) -set_image_base(explorer 0x00400000) add_dependencies(explorer psdk) add_cd_file(TARGET explorer DESTINATION reactos FOR all) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/explorer-cfg-template.xml DESTINATION reactos FOR all) diff --git a/reactos/base/shell/explorer/desktop/desktop.cpp b/reactos/base/shell/explorer/desktop/desktop.cpp index c00308ff00a..94733c3e8b0 100644 --- a/reactos/base/shell/explorer/desktop/desktop.cpp +++ b/reactos/base/shell/explorer/desktop/desktop.cpp @@ -235,8 +235,9 @@ void Desktops::ToggleMinimize() if (minimized.empty()) { EnumWindows(MinimizeDesktopEnumFct, (LPARAM)&minimized); } else { - for(list::const_reverse_iterator it=minimized.rbegin(); - it!=minimized.rend(); ++it) { + const list& cminimized = minimized; + for(list::const_reverse_iterator it=cminimized.rbegin(); + it!=cminimized.rend(); ++it) { ShowWindowAsync(it->first, it->second&WS_MAXIMIZE? SW_MAXIMIZE: SW_RESTORE); Sleep(20); } diff --git a/reactos/base/shell/explorer/desktop/desktop.h b/reactos/base/shell/explorer/desktop/desktop.h index 2fffb4cd9f0..060fb05b24d 100644 --- a/reactos/base/shell/explorer/desktop/desktop.h +++ b/reactos/base/shell/explorer/desktop/desktop.h @@ -141,7 +141,8 @@ public: /* [out][in] */ DWORD __RPC_FAR *pdwEffect) { TVHITTESTINFO hit; - hit.pt = (POINT&)pt; + hit.pt.x = pt.x; + hit.pt.y = pt.y; ScreenToClient(m_hTargetWnd, &hit.pt); hit.flags = TVHT_ONITEM; diff --git a/reactos/base/shell/explorer/explorer.cpp b/reactos/base/shell/explorer/explorer.cpp index 7a84b7edd2f..d402398f860 100644 --- a/reactos/base/shell/explorer/explorer.cpp +++ b/reactos/base/shell/explorer/explorer.cpp @@ -32,7 +32,7 @@ #include "resource.h" -//#include // for setlocale() +#include // for setlocale() #include diff --git a/reactos/base/shell/explorer/shell/webchild.cpp b/reactos/base/shell/explorer/shell/webchild.cpp index 036805963d9..446c3441f8f 100644 --- a/reactos/base/shell/explorer/shell/webchild.cpp +++ b/reactos/base/shell/explorer/shell/webchild.cpp @@ -33,20 +33,7 @@ #include "webchild.h" -#ifdef _MSC_VER - -#if _MSC_VER>=1300 // vtMissing for VS.Net #include -#pragma comment(lib, "comsupp") -#endif - -#else - -#ifdef __MINGW32__ // MinGW is lacking vtMissing (as of 07.02.2004) -static Variant vtMissing; -#endif - -#endif //#include diff --git a/reactos/base/shell/explorer/taskbar/startmenu.cpp b/reactos/base/shell/explorer/taskbar/startmenu.cpp index 5ec7f5db1f0..194d4544520 100644 --- a/reactos/base/shell/explorer/taskbar/startmenu.cpp +++ b/reactos/base/shell/explorer/taskbar/startmenu.cpp @@ -1874,7 +1874,7 @@ void StartMenuRoot::CloseStartMenu(int id) bool StartMenuRoot::IsStartMenuVisible() const { - return IsWindowVisible(_hwnd); + return IsWindowVisible(_hwnd) != FALSE; } void StartMenuRoot::ProcessKey(int vk) diff --git a/reactos/base/shell/explorer/utility/treedroptarget.h b/reactos/base/shell/explorer/utility/treedroptarget.h index 2e263ee4169..ca558a67ead 100644 --- a/reactos/base/shell/explorer/utility/treedroptarget.h +++ b/reactos/base/shell/explorer/utility/treedroptarget.h @@ -61,7 +61,8 @@ public: /* [out][in] */ DWORD __RPC_FAR *pdwEffect) { TVHITTESTINFO hit; - hit.pt = (POINT&)pt; + hit.pt.x = pt.x; + hit.pt.y = pt.y; ScreenToClient(m_hTargetWnd, &hit.pt); hit.flags = TVHT_ONITEM; HTREEITEM hItem = TreeView_HitTest(m_hTargetWnd,&hit); diff --git a/reactos/base/shell/explorer/utility/utility.h b/reactos/base/shell/explorer/utility/utility.h index 262505d73f3..07931b6dcb4 100644 --- a/reactos/base/shell/explorer/utility/utility.h +++ b/reactos/base/shell/explorer/utility/utility.h @@ -53,7 +53,7 @@ //#include // for alloca() #include //#include // for _MAX_DIR, ... -//#include // for sprintf() +#include // for sprintf() //#include #ifdef __cplusplus diff --git a/reactos/base/shell/explorer/utility/xmlstorage.h b/reactos/base/shell/explorer/utility/xmlstorage.h index 992acbf324b..7e8eb69101c 100644 --- a/reactos/base/shell/explorer/utility/xmlstorage.h +++ b/reactos/base/shell/explorer/utility/xmlstorage.h @@ -548,11 +548,15 @@ struct tifstream : public std::istream, FileHolder #ifdef __GNUC__ _buf(_pfile, std::ios::in) #else - _buf(_pfile) + _buf() #endif { if (!_pfile) setstate(badbit); +#ifdef _MSC_VER + else + _buf.open(fileno(_pfile)); +#endif } protected: @@ -570,11 +574,15 @@ struct tofstream : public std::ostream, FileHolder #ifdef __GNUC__ _buf(_pfile, std::ios::out) #else - _buf(_pfile) + _buf() #endif { if (!_pfile) setstate(badbit); +#ifdef _MSC_VER + else + _buf.open(fileno(_pfile)); +#endif } ~tofstream() diff --git a/reactos/include/crt/comutil.h b/reactos/include/crt/comutil.h index 9c6083004c5..036428fab98 100644 --- a/reactos/include/crt/comutil.h +++ b/reactos/include/crt/comutil.h @@ -15,7 +15,7 @@ #define _COM_MEMCPY_S(dest,destsize,src,count) memcpy(dest,src,count) /* Use of wsprintf might be impossible, if strsafe.h is included. */ -#ifndef __STDC_SECURE_LIB__ +#if !defined(__STDC_SECURE_LIB__) || defined(__REACTOS__) #define _COM_PRINTF_S_1(dest,destsize,format,arg1) wsprintf(dest,format,arg1) #elif defined(UNICODE) #define _COM_PRINTF_S_1(dest,destsize,format,arg1) swprintf_s(dest,destsize,format,arg1)