Bug 715045 - Remove old vc support code. r=jimm
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Thu, 05 Jan 2012 16:52:22 +0900
changeset 85078 2c1e788aea4eae6e68f325d95e9b5f626e2239fd
parent 85077 590333161e6f014f67fc61b096e86aa6a851a186
child 85079 dd994bf80fc0ab805e336bf94699ad19e7d6a798
push idunknown
push userunknown
push dateunknown
reviewersjimm
bugs715045
milestone12.0a1
Bug 715045 - Remove old vc support code. r=jimm
netwerk/protocol/file/nsFileProtocolHandler.cpp
widget/windows/nsScreenManagerWin.cpp
widget/windows/nsScreenManagerWin.h
widget/windows/nsScreenWin.cpp
widget/windows/nsScreenWin.h
xpcom/base/nscore.h
xpcom/io/nsLinebreakConverter.cpp
xpcom/io/nsLocalFileWin.h
--- a/netwerk/protocol/file/nsFileProtocolHandler.cpp
+++ b/netwerk/protocol/file/nsFileProtocolHandler.cpp
@@ -91,20 +91,16 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(nsFileProt
 
 //-----------------------------------------------------------------------------
 // nsIProtocolHandler methods:
 
 #if defined(XP_WIN)
 NS_IMETHODIMP
 nsFileProtocolHandler::ReadURLFile(nsIFile* aFile, nsIURI** aURI)
 {
-// IUniformResourceLocator isn't supported by VC5 (bless its little heart)
-#if _MSC_VER < 1200
-    return NS_ERROR_NOT_AVAILABLE;
-#else
     nsAutoString path;
     nsresult rv = aFile->GetPath(path);
     if (NS_FAILED(rv))
         return rv;
 
     if (path.Length() < 4)
         return NS_ERROR_NOT_AVAILABLE;
     if (!StringTail(path, 4).LowerCaseEqualsLiteral(".url"))
@@ -134,18 +130,16 @@ nsFileProtocolHandler::ReadURLFile(nsIFi
                     CoTaskMemFree(lpTemp);
                 }
             }
             urlFile->Release();
         }
         urlLink->Release();
     }
     return rv;
-
-#endif //_MSC_VER < 1200
 }
 
 #elif defined(XP_OS2)
 NS_IMETHODIMP
 nsFileProtocolHandler::ReadURLFile(nsIFile* aFile, nsIURI** aURI)
 {
     nsresult rv;
 
--- a/widget/windows/nsScreenManagerWin.cpp
+++ b/widget/windows/nsScreenManagerWin.cpp
@@ -30,26 +30,16 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-//
-// We have to do this in order to have access to the multiple-monitor
-// APIs that are only defined when WINVER is >= 0x0500. Don't worry,
-// these won't actually be called unless they are present.
-//
-#undef WINVER
-#define WINVER 0x0500
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
-
 #include "nsScreenManagerWin.h"
 #include "nsScreenWin.h"
 
 
 BOOL CALLBACK CountMonitors ( HMONITOR, HDC, LPRECT, LPARAM ioCount ) ;
 
 nsScreenManagerWin :: nsScreenManagerWin ( )
   : mNumberOfScreens(0)
@@ -73,32 +63,32 @@ NS_IMPL_ISUPPORTS1(nsScreenManagerWin, n
 // CreateNewScreenObject
 //
 // Utility routine. Creates a new screen object from the given device handle
 //
 // NOTE: For this "single-monitor" impl, we just always return the cached primary
 //        screen. This should change when a multi-monitor impl is done.
 //
 nsIScreen* 
-nsScreenManagerWin :: CreateNewScreenObject ( void* inScreen )
+nsScreenManagerWin :: CreateNewScreenObject ( HMONITOR inScreen )
 {
   nsIScreen* retScreen = nsnull;
   
   // look through our screen list, hoping to find it. If it's not there,
   // add it and return the new one.
   for ( unsigned i = 0; i < mScreenList.Length(); ++i ) {
     ScreenListItem& curr = mScreenList[i];
     if ( inScreen == curr.mMon ) {
       NS_IF_ADDREF(retScreen = curr.mScreen.get());
       return retScreen;
     }
   } // for each screen.
  
   retScreen = new nsScreenWin(inScreen);
-  mScreenList.AppendElement ( ScreenListItem ( (HMONITOR)inScreen, retScreen ) );
+  mScreenList.AppendElement ( ScreenListItem ( inScreen, retScreen ) );
 
   NS_IF_ADDREF(retScreen);
   return retScreen;
 }
 
 
 //
 // ScreenForRect 
@@ -115,17 +105,17 @@ nsScreenManagerWin :: ScreenForRect ( PR
   if ( !(inWidth || inHeight) ) {
     NS_WARNING ( "trying to find screen for sizeless window, using primary monitor" );
     *outScreen = CreateNewScreenObject ( nsnull );    // addrefs
     return NS_OK;
   }
 
   RECT globalWindowBounds = { inLeft, inTop, inLeft + inWidth, inTop + inHeight };
 
-  void* genScreen = ::MonitorFromRect( &globalWindowBounds, MONITOR_DEFAULTTOPRIMARY );
+  HMONITOR genScreen = ::MonitorFromRect( &globalWindowBounds, MONITOR_DEFAULTTOPRIMARY );
 
   *outScreen = CreateNewScreenObject ( genScreen );    // addrefs
   
   return NS_OK;
     
 } // ScreenForRect
 
 
--- a/widget/windows/nsScreenManagerWin.h
+++ b/widget/windows/nsScreenManagerWin.h
@@ -64,17 +64,17 @@ public:
   nsScreenManagerWin ( );
   ~nsScreenManagerWin();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSISCREENMANAGER
 
 private:
 
-  nsIScreen* CreateNewScreenObject ( void* inScreen ) ;
+  nsIScreen* CreateNewScreenObject ( HMONITOR inScreen ) ;
 
   PRUint32 mNumberOfScreens;
 
     // cache the screens to avoid the memory allocations
   nsAutoTArray<ScreenListItem, 8> mScreenList;
 
 };
 
--- a/widget/windows/nsScreenWin.cpp
+++ b/widget/windows/nsScreenWin.cpp
@@ -30,30 +30,20 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-//
-// We have to do this in order to have access to the multiple-monitor
-// APIs that are only defined when WINVER is >= 0x0500. Don't worry,
-// these won't actually be called unless they are present.
-//
-#undef WINVER
-#define WINVER 0x0500
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
-
 #include "nsScreenWin.h"
 
 
-nsScreenWin :: nsScreenWin ( void* inScreen )
+nsScreenWin :: nsScreenWin ( HMONITOR inScreen )
   : mScreen(inScreen)
 {
 #ifdef DEBUG
   HDC hDCScreen = ::GetDC(nsnull);
   NS_ASSERTION(hDCScreen,"GetDC Failure");
   NS_ASSERTION ( ::GetDeviceCaps(hDCScreen, TECHNOLOGY) == DT_RASDISPLAY, "Not a display screen");
   ::ReleaseDC(nsnull,hDCScreen);
 #endif
@@ -69,29 +59,27 @@ nsScreenWin :: ~nsScreenWin()
   // nothing to see here.
 }
 
 
 NS_IMETHODIMP
 nsScreenWin :: GetRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight)
 {
   BOOL success = FALSE;
-#if _MSC_VER >= 1200
   if ( mScreen ) {
     MONITORINFO info;
     info.cbSize = sizeof(MONITORINFO);
-    success = ::GetMonitorInfoW( (HMONITOR)mScreen, &info );
+    success = ::GetMonitorInfoW( mScreen, &info );
     if ( success ) {
       *outLeft = info.rcMonitor.left;
       *outTop = info.rcMonitor.top;
       *outWidth = info.rcMonitor.right - info.rcMonitor.left;
       *outHeight = info.rcMonitor.bottom - info.rcMonitor.top;
     }
   }
-#endif
   if (!success) {
      HDC hDCScreen = ::GetDC(nsnull);
      NS_ASSERTION(hDCScreen,"GetDC Failure");
     
      *outTop = *outLeft = 0;
      *outWidth = ::GetDeviceCaps(hDCScreen, HORZRES);
      *outHeight = ::GetDeviceCaps(hDCScreen, VERTRES); 
      
@@ -102,29 +90,27 @@ nsScreenWin :: GetRect(PRInt32 *outLeft,
 } // GetRect
 
 
 NS_IMETHODIMP
 nsScreenWin :: GetAvailRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight)
 {
   BOOL success = FALSE;
 
-#if _MSC_VER >= 1200
   if ( mScreen ) {
     MONITORINFO info;
     info.cbSize = sizeof(MONITORINFO);
-    success = ::GetMonitorInfoW( (HMONITOR)mScreen, &info );
+    success = ::GetMonitorInfoW( mScreen, &info );
     if ( success ) {
       *outLeft = info.rcWork.left;
       *outTop = info.rcWork.top;
       *outWidth = info.rcWork.right - info.rcWork.left;
       *outHeight = info.rcWork.bottom - info.rcWork.top;
     }
   }
-#endif
   if (!success) {
     RECT workArea;
     ::SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
     *outLeft = workArea.left;
     *outTop = workArea.top;
     *outWidth = workArea.right - workArea.left;
     *outHeight = workArea.bottom - workArea.top;
   }
--- a/widget/windows/nsScreenWin.h
+++ b/widget/windows/nsScreenWin.h
@@ -41,22 +41,22 @@
 #include <windows.h>
 #include "nsBaseScreen.h"
 
 //------------------------------------------------------------------------
 
 class nsScreenWin : public nsBaseScreen
 {
 public:
-  nsScreenWin ( void* inScreen );
+  nsScreenWin ( HMONITOR inScreen );
   ~nsScreenWin();
 
   NS_IMETHOD GetRect(PRInt32* aLeft, PRInt32* aTop, PRInt32* aWidth, PRInt32* aHeight);
   NS_IMETHOD GetAvailRect(PRInt32* aLeft, PRInt32* aTop, PRInt32* aWidth, PRInt32* aHeight);
   NS_IMETHOD GetPixelDepth(PRInt32* aPixelDepth);
   NS_IMETHOD GetColorDepth(PRInt32* aColorDepth);
 
 private:
 
-  void* mScreen;                    // a |HMONITOR|, can't use this type in header file though.
+  HMONITOR mScreen;
 };
 
 #endif  // nsScreenWin_h___ 
--- a/xpcom/base/nscore.h
+++ b/xpcom/base/nscore.h
@@ -239,17 +239,17 @@ typedef size_t(*nsMallocSizeOfFun)(const
   ret (NS_STDCALL class::*name) args
 #endif
 
 /**
  * Deprecated declarations.
  */
 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
 # define MOZ_DEPRECATED __attribute__((deprecated))
-#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
+#elif defined(_MSC_VER)
 # define MOZ_DEPRECATED __declspec(deprecated)
 #else
 # define MOZ_DEPRECATED
 #endif
 
 /**
  * Generic API modifiers which return the standard XPCOM nsresult type
  */
@@ -325,17 +325,17 @@ typedef size_t(*nsMallocSizeOfFun)(const
  * xpidl can determine that the interface can't contain a constructor.
  * This results in some space savings and possible runtime savings -
  * see bug 49416.  We undefine it first, as xpidl-generated headers
  * define it for IDL uses that don't include this file.
  */
 #ifdef NS_NO_VTABLE
 #undef NS_NO_VTABLE
 #endif
-#if defined(_MSC_VER) && _MSC_VER >= 1100
+#if defined(_MSC_VER)
 #define NS_NO_VTABLE __declspec(novtable)
 #else
 #define NS_NO_VTABLE
 #endif
 
 
 /**
  * Generic XPCOM result data type
@@ -368,17 +368,17 @@ typedef PRUint32 nsrefcnt;
 
 
 #include "nsError.h"
 
 /* ------------------------------------------------------------------------ */
 /* Casting macros for hiding C++ features from older compilers */
 
   /* under VC++ (Windows), we don't have autoconf yet */
-#if defined(_MSC_VER) && (_MSC_VER>=1100)
+#if defined(_MSC_VER)
   #define HAVE_CPP_2BYTE_WCHAR_T
 #endif
 
 #ifndef __PRUNICHAR__
 #define __PRUNICHAR__
   /* For now, don't use wchar_t on Unix because it breaks the Netscape
    * commercial build.  When this is fixed there will be no need for the
    * |reinterpret_cast| in nsLiteralString.h either.
--- a/xpcom/io/nsLinebreakConverter.cpp
+++ b/xpcom/io/nsLinebreakConverter.cpp
@@ -36,24 +36,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsLinebreakConverter.h"
 
 #include "nsMemory.h"
 #include "nsCRT.h"
 
 
-#if defined(XP_WIN) && defined(_MSC_VER) && (_MSC_VER <= 1100)
-#define LOSER_CHAR_CAST(t)       (char *)(t)
-#define LOSER_UNICHAR_CAST(t)    (PRUnichar *)(t)
-#else
-#define LOSER_CHAR_CAST(t)       (t)
-#define LOSER_UNICHAR_CAST(t)    (t)
-#endif
-
 /*----------------------------------------------------------------------------
 	GetLinebreakString 
 	
 	Could make this inline
 ----------------------------------------------------------------------------*/
 static const char* GetLinebreakString(nsLinebreakConverter::ELinebreakType aBreakType)
 {
   static const char* const sLinebreaks[] = {
@@ -337,19 +329,19 @@ char* nsLinebreakConverter::ConvertLineB
   NS_ASSERTION(aDestBreaks != eLinebreakAny &&
                aSrcBreaks != eLinebreakSpace, "Invalid parameter");
   if (!aSrc) return nsnull;
   
   PRInt32 sourceLen = (aSrcLen == kIgnoreLen) ? strlen(aSrc) + 1 : aSrcLen;
 
   char* resultString;
   if (aSrcBreaks == eLinebreakAny)
-    resultString = ConvertUnknownBreaks(LOSER_CHAR_CAST(aSrc), sourceLen, GetLinebreakString(aDestBreaks));
+    resultString = ConvertUnknownBreaks(aSrc, sourceLen, GetLinebreakString(aDestBreaks));
   else
-    resultString = ConvertBreaks(LOSER_CHAR_CAST(aSrc), sourceLen, GetLinebreakString(aSrcBreaks), GetLinebreakString(aDestBreaks));
+    resultString = ConvertBreaks(aSrc, sourceLen, GetLinebreakString(aSrcBreaks), GetLinebreakString(aDestBreaks));
   
   if (outLen)
     *outLen = sourceLen;
   return resultString;
 }
 
 
 /*----------------------------------------------------------------------------
@@ -408,19 +400,19 @@ PRUnichar* nsLinebreakConverter::Convert
   NS_ASSERTION(aDestBreaks != eLinebreakAny &&
                aSrcBreaks != eLinebreakSpace, "Invalid parameter");
   if (!aSrc) return nsnull;
   
   PRInt32 bufLen = (aSrcLen == kIgnoreLen) ? nsCRT::strlen(aSrc) + 1 : aSrcLen;
 
   PRUnichar* resultString;
   if (aSrcBreaks == eLinebreakAny)
-    resultString = ConvertUnknownBreaks(LOSER_UNICHAR_CAST(aSrc), bufLen, GetLinebreakString(aDestBreaks));
+    resultString = ConvertUnknownBreaks(aSrc, bufLen, GetLinebreakString(aDestBreaks));
   else
-    resultString = ConvertBreaks(LOSER_UNICHAR_CAST(aSrc), bufLen, GetLinebreakString(aSrcBreaks), GetLinebreakString(aDestBreaks));
+    resultString = ConvertBreaks(aSrc, bufLen, GetLinebreakString(aSrcBreaks), GetLinebreakString(aDestBreaks));
   
   if (outLen)
     *outLen = bufLen;
   return resultString;
 }
 
 
 /*----------------------------------------------------------------------------
--- a/xpcom/io/nsLocalFileWin.h
+++ b/xpcom/io/nsLocalFileWin.h
@@ -47,23 +47,16 @@
 #include "nsCRT.h"
 #include "nsIFile.h"
 #include "nsIFactory.h"
 #include "nsILocalFileWin.h"
 #include "nsIHashable.h"
 #include "nsIClassInfoImpl.h"
 
 #include "windows.h"
-
-// For older version (<6.0) of the VC Compiler
-#if (_MSC_VER == 1100)
-#include <objbase.h>
-DEFINE_OLEGUID(IID_IPersistFile, 0x0000010BL, 0, 0);
-#endif
-
 #include "shlobj.h"
 
 #include <sys/stat.h>
 
 typedef LPITEMIDLIST (WINAPI *ILCreateFromPathWPtr)(PCWSTR);
 typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsPtr)(PCIDLIST_ABSOLUTE, UINT, 
                                                         PCUITEMID_CHILD_ARRAY,
                                                         DWORD);