Merging backout. a=orange
authorKyle Huey <me@kylehuey.com>
Sun, 22 Aug 2010 10:14:24 -0400
changeset 51216 7cc686f3317387f0f80b5f8d5f29949dc795dec9
parent 51215 3542b2bfa001604d2e0cbda82e8d588bb4e1331e (current diff)
parent 51214 b16afb30b4473957c7bd9efec27b3b3a9d29176e (diff)
child 51217 799fe4c45fe728d97d7a7688a3c8a4acc57e7c2c
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersorange
milestone2.0b5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merging backout. a=orange
js/src/config/autoconf.mk.in
--- a/gfx/thebes/gfxWindowsSurface.h
+++ b/gfx/thebes/gfxWindowsSurface.h
@@ -45,17 +45,17 @@
 
 class gfxContext;
 
 class THEBES_API gfxWindowsSurface : public gfxASurface {
 public:
     enum {
         FLAG_TAKE_DC = (1 << 0),
         FLAG_FOR_PRINTING = (1 << 1),
-        FLAG_IS_TRANSPARENT = (1 << 2),
+        FLAG_IS_TRANSPARENT = (1 << 2)
     };
 
     gfxWindowsSurface(HWND wnd, PRUint32 flags = 0);
     gfxWindowsSurface(HDC dc, PRUint32 flags = 0);
 
     // Create a DIB surface
     gfxWindowsSurface(const gfxIntSize& size,
                       gfxImageFormat imageFormat = ImageFormatRGB24);
--- a/js/src/config/autoconf.mk.in
+++ b/js/src/config/autoconf.mk.in
@@ -72,17 +72,16 @@ DIST		= $(DEPTH)/$(TOP_DIST)
 endif
 
 MOZ_JS_LIBS		   = @MOZ_JS_LIBS@
 
 MOZ_SYNC_BUILD_FILES = @MOZ_SYNC_BUILD_FILES@
 
 MOZ_DEBUG	= @MOZ_DEBUG@
 MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
-MOZ_PROFILE_MODULES = @MOZ_PROFILE_MODULES@
 MOZ_DEBUG_ENABLE_DEFS		= @MOZ_DEBUG_ENABLE_DEFS@
 MOZ_DEBUG_DISABLE_DEFS	= @MOZ_DEBUG_DISABLE_DEFS@
 MOZ_DEBUG_FLAGS	= @MOZ_DEBUG_FLAGS@
 MOZ_DEBUG_LDFLAGS=@MOZ_DEBUG_LDFLAGS@
 MOZ_EXTENSIONS  = @MOZ_EXTENSIONS@
 MOZ_IMG_DECODERS= @MOZ_IMG_DECODERS@
 MOZ_IMG_ENCODERS= @MOZ_IMG_ENCODERS@
 MOZ_JSDEBUGGER  = @MOZ_JSDEBUGGER@
--- a/toolkit/components/remote/nsQtRemoteService.cpp
+++ b/toolkit/components/remote/nsQtRemoteService.cpp
@@ -95,16 +95,19 @@ NS_IMPL_ISUPPORTS2(nsQtRemoteService,
 nsQtRemoteService::nsQtRemoteService():
 mServerWindow(0)
 {
 }
 
 NS_IMETHODIMP
 nsQtRemoteService::Startup(const char* aAppName, const char* aProfileName)
 {
+#if (MOZ_PLATFORM_MAEMO == 5)
+  return NS_ERROR_NOT_IMPLEMENTED;
+#endif
   if (mServerWindow) return NS_ERROR_ALREADY_INITIALIZED;
   NS_ASSERTION(aAppName, "Don't pass a null appname!");
 
   XRemoteBaseStartup(aAppName,aProfileName);
 
   //Create window, which is not shown.
   mServerWindow = new MozQRemoteEventHandlerWidget(*this);
 
--- a/widget/src/qt/mozqwidget.h
+++ b/widget/src/qt/mozqwidget.h
@@ -3,16 +3,18 @@
 
 #include <QtGui/QApplication>
 #include <QtGui/QGraphicsView>
 #include <QtGui/QGraphicsWidget>
 
 #ifdef MOZ_ENABLE_MEEGOTOUCH
 #include <QtGui/QGraphicsSceneResizeEvent>
 #include <MSceneWindow>
+#include <QTimer>
+#include <mstatusbar.h>
 #endif
 
 #include "nsIWidget.h"
 #include "prenv.h"
 
 class QEvent;
 class QPixmap;
 class QWidget;
@@ -181,36 +183,76 @@ protected:
 private:
     MozQGraphicsViewEvents mEventHandler;
     MozQWidget* mTopLevelWidget;
 };
 
 #ifdef MOZ_ENABLE_MEEGOTOUCH
 class MozMSceneWindow : public MSceneWindow
 {
+    Q_OBJECT
 public:
     MozMSceneWindow(MozQWidget* aTopLevel)
      : MSceneWindow(aTopLevel->parentItem())
      , mTopLevelWidget(aTopLevel)
+     , mStatusBar(nsnull)
     {
         mTopLevelWidget->setParentItem(this);
+        mTopLevelWidget->installEventFilter(this);
+        mStatusBar = new MStatusBar();
+        mStatusBar->appear();
+        connect(mStatusBar, SIGNAL(appeared()), this, SLOT(CheckTopLevelSize()));
+        connect(mStatusBar, SIGNAL(disappeared()), this, SLOT(CheckTopLevelSize()));
     }
 
 protected:
     virtual void resizeEvent(QGraphicsSceneResizeEvent* aEvent) {
+        mCurrentSize = aEvent->newSize();
+        MSceneWindow::resizeEvent(aEvent);
+        CheckTopLevelSize();
+    }
+
+    virtual bool eventFilter(QObject* watched, QEvent* e)
+    {
+        if (e->type() == QEvent::GraphicsSceneResize ||
+            e->type() == QEvent::GraphicsSceneMove) {
+
+            //Do this in next event loop, or we are in recursion!
+            QTimer::singleShot(0, this, SLOT(CheckTopLevelSize()));
+        }
+
+        //false == let event processing continue
+        return false;
+    }
+
+private slots:
+    void CheckTopLevelSize() {
         if (mTopLevelWidget) {
-            // transfer new size to graphics widget
-            mTopLevelWidget->setGeometry(0.0, 0.0,
-                static_cast<qreal>(aEvent->newSize().width()),
-                static_cast<qreal>(aEvent->newSize().height()));
+            qreal xpos = 0;
+            qreal ypos = 0;
+            qreal width = mCurrentSize.width();
+            qreal height = mCurrentSize.height();
+
+            //If statusbar is visible, move toplevel widget down
+            if (mStatusBar->isVisible()) {
+                ypos = mStatusBar->size().height();
+                height -= ypos;
+            }
+
+            // transfer new size to graphics widget if changed
+            QRectF r = mTopLevelWidget->geometry();
+            if (r != QRectF(xpos, ypos, width, height))
+                mTopLevelWidget->setGeometry(xpos, ypos, width, height);
         }
-        MSceneWindow::resizeEvent(aEvent);
     }
+
 private:
     MozQWidget* mTopLevelWidget;
+    MStatusBar* mStatusBar;
+    QSizeF mCurrentSize;
 };
 
 /**
     This is a helper class to synchronize the MWindow window with
     its contained QGraphicsWidget for things like resizing and closing
     by the user.
 */
 class MozMGraphicsView : public MWindow
--- a/widget/src/qt/nsWindow.cpp
+++ b/widget/src/qt/nsWindow.cpp
@@ -669,17 +669,17 @@ nsWindow::Update()
 
 // Returns the graphics view widget for this nsWindow by iterating
 // the chain of parents until a toplevel window with a view/scene is found.
 // (This function always returns something or asserts if the precondition
 // is not met)
 QWidget* nsWindow::GetViewWidget()
 {
     NS_ASSERTION(mWidget, "Calling GetViewWidget without mWidget created");
-    if (!mWidget || !mWidget->scene())
+    if (!mWidget || !mWidget->scene() || !mWidget->scene()->views().size())
         return nsnull;
 
     NS_ASSERTION(mWidget->scene()->views().size() == 1, "Not exactly one view for our scene!");
     return mWidget->scene()->views()[0];
 }
 
 void*
 nsWindow::GetNativeData(PRUint32 aDataType)
@@ -1733,19 +1733,24 @@ nsWindow::SetWindowClass(const nsAString
 void
 nsWindow::NativeResize(PRInt32 aWidth, PRInt32 aHeight, PRBool  aRepaint)
 {
     LOG(("nsWindow::NativeResize [%p] %d %d\n", (void *)this,
          aWidth, aHeight));
 
     mNeedsResize = PR_FALSE;
 
-    if (mIsTopLevel) {
-      GetViewWidget()->resize( aWidth, aHeight);
+#ifndef MOZ_ENABLE_MEEGOTOUCH
+    if (mIsTopLevel && XRE_GetProcessType() == GeckoProcessType_Default) {
+        QWidget *widget = GetViewWidget();
+        NS_ENSURE_TRUE(widget,);
+        widget->resize(aWidth, aHeight);
     }
+#endif
+
     mWidget->resize( aWidth, aHeight);
 
     if (aRepaint)
         mWidget->update();
 }
 
 void
 nsWindow::NativeResize(PRInt32 aX, PRInt32 aY,
@@ -1753,22 +1758,26 @@ nsWindow::NativeResize(PRInt32 aX, PRInt
                        PRBool  aRepaint)
 {
     LOG(("nsWindow::NativeResize [%p] %d %d %d %d\n", (void *)this,
          aX, aY, aWidth, aHeight));
 
     mNeedsResize = PR_FALSE;
     mNeedsMove = PR_FALSE;
 
+#ifndef MOZ_ENABLE_MEEGOTOUCH
     if (mIsTopLevel) {
-#ifdef MOZ_ENABLE_MEEGOTOUCH
-      if (XRE_GetProcessType() != GeckoProcessType_Default)
+        if (XRE_GetProcessType() == GeckoProcessType_Default) {
+            QWidget *widget = GetViewWidget();
+            NS_ENSURE_TRUE(widget,);
+            widget->setGeometry(aX, aY, aWidth, aHeight);
+        }
+    }
 #endif
-      GetViewWidget()->setGeometry(aX, aY, aWidth, aHeight);
-    }
+
     mWidget->setGeometry(aX, aY, aWidth, aHeight);
 
     if (aRepaint)
         mWidget->update();
 }
 
 void
 nsWindow::NativeShow(PRBool aAction)
--- a/widget/src/windows/KeyboardLayout.cpp
+++ b/widget/src/windows/KeyboardLayout.cpp
@@ -389,17 +389,17 @@ KeyboardLayout::LoadLayout(HKL aLayout)
 
   for (shiftState = 0; shiftState < 16; shiftState++) {
     SetShiftState(kbdState, shiftState);
     for (PRUint32 virtualKey = 0; virtualKey < 256; virtualKey++) {
       PRInt32 vki = GetKeyIndex(virtualKey);
       if (vki < 0) {
         continue;
       }
-      NS_ASSERTION(vki < NS_ARRAY_LENGTH(mVirtualKeys), "invalid index");
+      NS_ASSERTION(PRUint32(vki) < NS_ARRAY_LENGTH(mVirtualKeys), "invalid index");
       PRUnichar uniChars[5];
       PRInt32 ret =
         ::ToUnicodeEx(virtualKey, 0, kbdState, (LPWSTR)uniChars,
                       NS_ARRAY_LENGTH(uniChars), 0, mKeyboardLayout);
       // dead-key
       if (ret < 0) {
         shiftStatesWithDeadKeys |= (1 << shiftState);
         // Repeat dead-key to deactivate it and get its character
--- a/widget/src/windows/nsClipboard.cpp
+++ b/widget/src/windows/nsClipboard.cpp
@@ -686,17 +686,17 @@ nsClipboard :: FindPlatformHTML ( IDataO
 
   if ( outData && *outData ) {
     // CF_HTML is UTF8, not unicode. We also can't rely on it being null-terminated
     // so we have to check the CF_HTML header for the correct length. The length we return
     // is the bytecount from the beginning of the data to the end, without
     // the null termination. Because it's UTF8, we're guaranteed the header is ascii (yay!).
     float vers = 0.0;
     PRUint32 startOfData = 0;
-    sscanf((char*)*outData, "Version:%f\nStartHTML:%d\nEndHTML:%d", &vers, &startOfData, outDataLen);
+    sscanf((char*)*outData, "Version:%f\nStartHTML:%u\nEndHTML:%u", &vers, &startOfData, outDataLen);
     NS_ASSERTION(startOfData && *outDataLen, "Couldn't parse CF_HTML description header");
  
     if ( *outDataLen )
       dataFound = PR_TRUE;
   }
 
   return dataFound;
 }
--- a/widget/src/windows/nsDataObj.cpp
+++ b/widget/src/windows/nsDataObj.cpp
@@ -343,17 +343,17 @@ HRESULT nsDataObj::CreateStream(IStream 
     pStream->Release();
     return E_FAIL;
   }
   *outStream = pStream;
 
   return S_OK;
 }
 
-EXTERN_C GUID CDECL CLSID_nsDataObj =
+static GUID CLSID_nsDataObj =
 	{ 0x1bba7640, 0xdf52, 0x11cf, { 0x82, 0x7b, 0, 0xa0, 0x24, 0x3a, 0xe5, 0x05 } };
 
 /* 
  * deliberately not using MAX_PATH. This is because on platforms < XP
  * a file created with a long filename may be mishandled by the shell
  * resulting in it not being able to be deleted or moved. 
  * See bug 250392 for more details.
  */
@@ -1305,17 +1305,16 @@ HRESULT nsDataObj::GetText(const nsACStr
 
 //-----------------------------------------------------
 HRESULT nsDataObj::GetFile(FORMATETC& aFE, STGMEDIUM& aSTG)
 {
   PRUint32 dfInx = 0;
   ULONG count;
   FORMATETC fe;
   m_enumFE->Reset();
-  PRBool found = PR_FALSE;
   while (NOERROR == m_enumFE->Next(1, &fe, &count)
     && dfInx < mDataFlavors.Length()) {
       if (mDataFlavors[dfInx].EqualsLiteral(kNativeImageMime))
         return DropImage(aFE, aSTG);
       if (mDataFlavors[dfInx].EqualsLiteral(kFileMime))
         return DropFile(aFE, aSTG);
       if (mDataFlavors[dfInx].EqualsLiteral(kFilePromiseMime))
         return DropTempFile(aFE, aSTG);
@@ -1525,18 +1524,16 @@ HRESULT nsDataObj::DropImage(FORMATETC& 
 
   return S_OK;
 }
 
 HRESULT nsDataObj::DropTempFile(FORMATETC& aFE, STGMEDIUM& aSTG)
 {
   nsresult rv;
   if (!mCachedTempFile) {
-    PRUint32 len = 0;
-
     // Tempfile will need a temporary location.      
     nsCOMPtr<nsIFile> dropFile;
     rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(dropFile));
     if (!dropFile)
       return E_FAIL;
 
     // Filename must be random
     nsCString filename;
--- a/widget/src/windows/nsDeviceContextSpecWin.cpp
+++ b/widget/src/windows/nsDeviceContextSpecWin.cpp
@@ -784,17 +784,17 @@ nsDeviceContextSpecWin::SetPrintSettings
   BOOL doingNumCopies   = aDevMode->dmFields & DM_COPIES;
   BOOL doingOrientation = aDevMode->dmFields & DM_ORIENTATION;
   BOOL doingPaperSize   = aDevMode->dmFields & DM_PAPERSIZE;
   BOOL doingPaperLength = aDevMode->dmFields & DM_PAPERLENGTH;
   BOOL doingPaperWidth  = aDevMode->dmFields & DM_PAPERWIDTH;
 
   if (doingOrientation) {
     PRInt32 orientation  = aDevMode->dmOrientation == DMORIENT_PORTRAIT?
-      nsIPrintSettings::kPortraitOrientation:nsIPrintSettings::kLandscapeOrientation;
+      PRInt32(nsIPrintSettings::kPortraitOrientation):nsIPrintSettings::kLandscapeOrientation;
     aPrintSettings->SetOrientation(orientation);
   }
 
   // Setup Number of Copies
   if (doingNumCopies) {
     aPrintSettings->SetNumCopies(PRInt32(aDevMode->dmCopies));
   }
 
@@ -808,29 +808,31 @@ nsDeviceContextSpecWin::SetPrintSettings
     }
   }
 
   if (doingPaperSize) {
     aPrintSettings->SetPaperSizeType(nsIPrintSettings::kPaperSizeNativeData);
     aPrintSettings->SetPaperData(aDevMode->dmPaperSize);
     for (PRInt32 i=0;i<kNumPaperSizes;i++) {
       if (kPaperSizes[i].mPaperSize == aDevMode->dmPaperSize) {
-        aPrintSettings->SetPaperSizeUnit(kPaperSizes[i].mIsInches?nsIPrintSettings::kPaperSizeInches:nsIPrintSettings::kPaperSizeMillimeters);
+        aPrintSettings->SetPaperSizeUnit(kPaperSizes[i].mIsInches
+          ?PRInt16(nsIPrintSettings::kPaperSizeInches):nsIPrintSettings::kPaperSizeMillimeters);
         break;
       }
     }
 
   } else if (doingPaperLength && doingPaperWidth) {
     PRBool found = PR_FALSE;
     for (PRInt32 i=0;i<kNumPaperSizes;i++) {
       if (kPaperSizes[i].mPaperSize == aDevMode->dmPaperSize) {
         aPrintSettings->SetPaperSizeType(nsIPrintSettings::kPaperSizeDefined);
         aPrintSettings->SetPaperWidth(kPaperSizes[i].mWidth);
         aPrintSettings->SetPaperHeight(kPaperSizes[i].mHeight);
-        aPrintSettings->SetPaperSizeUnit(kPaperSizes[i].mIsInches?nsIPrintSettings::kPaperSizeInches:nsIPrintSettings::kPaperSizeMillimeters);
+        aPrintSettings->SetPaperSizeUnit(kPaperSizes[i].mIsInches
+          ?PRInt16(nsIPrintSettings::kPaperSizeInches):nsIPrintSettings::kPaperSizeMillimeters);
         found = PR_TRUE;
         break;
       }
     }
     if (!found) {
       return NS_ERROR_FAILURE;
     }
   } else {
@@ -1014,17 +1016,17 @@ GlobalPrinters::GetDefaultPrinterName(ns
                                    szDefaultPrinterName,
                                    NS_ARRAY_LENGTH(szDefaultPrinterName));
   if (status > 0) {
     WCHAR comma = ',';
     LPWSTR sPtr = szDefaultPrinterName;
     while (*sPtr != comma && *sPtr != 0) 
       sPtr++;
     if (*sPtr == comma) {
-      *sPtr = NULL;
+      *sPtr = 0;
     }
     aDefaultPrinterName = szDefaultPrinterName;
   } else {
     aDefaultPrinterName = EmptyString();
   }
 
   PR_PL(("DEFAULT PRINTER [%s]\n", aDefaultPrinterName.get()));
 #else
--- a/widget/src/windows/nsIMM32Handler.cpp
+++ b/widget/src/windows/nsIMM32Handler.cpp
@@ -313,18 +313,18 @@ nsIMM32Handler::CommitComposition(nsWind
      gIMM32Handler && gIMM32Handler->mComposingWindow ?
        IsComposingOnOurEditor() ? " (composing on editor)" :
                                   " (composing on plug-in)" : ""));
   if (!aForce && !IsComposingWindow(aWindow)) {
     return;
   }
   nsIMEContext IMEContext(aWindow->GetWindowHandle());
   if (IMEContext.IsValid()) {
-    ::ImmNotifyIME(IMEContext.get(), NI_COMPOSITIONSTR, CPS_COMPLETE, NULL);
-    ::ImmNotifyIME(IMEContext.get(), NI_COMPOSITIONSTR, CPS_CANCEL, NULL);
+    ::ImmNotifyIME(IMEContext.get(), NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
+    ::ImmNotifyIME(IMEContext.get(), NI_COMPOSITIONSTR, CPS_CANCEL, 0);
   }
 }
 
 /* static */ void
 nsIMM32Handler::CancelComposition(nsWindow* aWindow, PRBool aForce)
 {
   PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
     ("IMM32: CancelComposition, aForce=%s, aWindow=%p, hWnd=%08x, mComposingWindow=%p%s\n",
@@ -334,17 +334,17 @@ nsIMM32Handler::CancelComposition(nsWind
      gIMM32Handler && gIMM32Handler->mComposingWindow ?
        IsComposingOnOurEditor() ? " (composing on editor)" :
                                   " (composing on plug-in)" : ""));
   if (!aForce && !IsComposingWindow(aWindow)) {
     return;
   }
   nsIMEContext IMEContext(aWindow->GetWindowHandle());
   if (IMEContext.IsValid()) {
-    ::ImmNotifyIME(IMEContext.get(), NI_COMPOSITIONSTR, CPS_CANCEL, NULL);
+    ::ImmNotifyIME(IMEContext.get(), NI_COMPOSITIONSTR, CPS_CANCEL, 0);
   }
 }
 
 /* static */ PRBool
 nsIMM32Handler::ProcessInputLangChangeMessage(nsWindow* aWindow,
                                               WPARAM wParam,
                                               LPARAM lParam,
                                               LRESULT *aRetValue,
@@ -986,18 +986,17 @@ nsIMM32Handler::OnIMESetContextOnPlugin(
     if (gIMM32Handler->CommitCompositionOnPreviousWindow(aWindow)) {
       CancelComposition(aWindow);
     }
   }
 
   // Dispatch message to the plug-in.
   // XXX When a windowless plug-in gets focus, we should send
   //     WM_IME_SETCONTEXT
-  PRBool handled =
-    aWindow->DispatchPluginEvent(WM_IME_SETCONTEXT, wParam, lParam, PR_FALSE);
+  aWindow->DispatchPluginEvent(WM_IME_SETCONTEXT, wParam, lParam, PR_FALSE);
 
   // We should send WM_IME_SETCONTEXT to the DefWndProc here.  It shouldn't
   // be received on ancestor windows, see OnIMESetContext() for the detail.
   *aResult = ::DefWindowProc(aWindow->GetWindowHandle(),
                              WM_IME_SETCONTEXT, wParam, lParam);
 
   // Don't synchronously dispatch the pending events when we receive
   // WM_IME_SETCONTEXT because we get it during plugin destruction.
@@ -1041,28 +1040,28 @@ nsIMM32Handler::HandleStartComposition(n
                                        const nsIMEContext &aIMEContext)
 {
   NS_PRECONDITION(!mIsComposing,
     "HandleStartComposition is called but mIsComposing is TRUE");
   NS_PRECONDITION(!aWindow->PluginHasFocus(),
     "HandleStartComposition should not be called when a plug-in has focus");
 
   nsQueryContentEvent selection(PR_TRUE, NS_QUERY_SELECTED_TEXT, aWindow);
-  aWindow->InitEvent(selection, &nsIntPoint(0, 0));
+  nsIntPoint point(0, 0);
+  aWindow->InitEvent(selection, &point);
   aWindow->DispatchWindowEvent(&selection);
   if (!selection.mSucceeded) {
     PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
       ("IMM32: HandleStartComposition, FAILED (NS_QUERY_SELECTED_TEXT)\n"));
     return;
   }
 
   mCompositionStart = selection.mReply.mOffset;
 
   nsCompositionEvent event(PR_TRUE, NS_COMPOSITION_START, aWindow);
-  nsIntPoint point(0, 0);
   aWindow->InitEvent(event, &point);
   aWindow->DispatchWindowEvent(&event);
 
   SetIMERelatedWindowsPos(aWindow, aIMEContext);
 
   mIsComposing = PR_TRUE;
   mComposingWindow = aWindow;
 
--- a/widget/src/windows/nsImageClipboard.cpp
+++ b/widget/src/windows/nsImageClipboard.cpp
@@ -140,17 +140,16 @@ nsImageToClipboard::CalcSpanLength(PRUin
 // CreateFromImage
 //
 // Do the work to setup the bitmap header and copy the bits out of the
 // image. 
 //
 nsresult
 nsImageToClipboard::CreateFromImage ( imgIContainer* inImage, HANDLE* outBitmap )
 {
-    nsresult result = NS_OK;
     *outBitmap = nsnull;
 
     nsRefPtr<gfxImageSurface> frame;
     nsresult rv = inImage->CopyFrame(imgIContainer::FRAME_CURRENT,
                                      imgIContainer::FLAG_SYNC_DECODE,
                                      getter_AddRefs(frame));
     if (NS_FAILED(rv))
       return rv;
--- a/widget/src/windows/nsLookAndFeel.cpp
+++ b/widget/src/windows/nsLookAndFeel.cpp
@@ -528,17 +528,17 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(c
             LPCWSTR defThemes[] = {
               L"luna.msstyles",
               L"aero.msstyles"
             };
 
             LPWSTR curTheme = wcsrchr(themeFileName, L'\\');
             curTheme = curTheme ? curTheme + 1 : themeFileName;
 
-            for (int i = 0; i < NS_ARRAY_LENGTH(defThemes); ++i) {
+            for (unsigned i = 0; i < NS_ARRAY_LENGTH(defThemes); ++i) {
               if (!lstrcmpiW(curTheme, defThemes[i])) {
                 aMetric = 1;
               }
             }
           } else {
             res = NS_ERROR_NOT_IMPLEMENTED;
           }
         }
@@ -725,14 +725,16 @@ NS_IMETHODIMP nsLookAndFeel::GetNavSize(
     case eMetricSize_TextField:
       aSize.width  = kTextFieldWidths[aFontID][aFontSize-1];
       aSize.height = kTextFieldHeights[aFontID][aFontSize-1];
       break;
     case eMetricSize_TextArea:
       aSize.width  = kTextAreaWidths[aFontID][aFontSize-1];
       aSize.height = kTextAreaHeights[aFontID][aFontSize-1];
       break;
+    default:
+      break;
   } //switch
 
   return NS_OK;
 
 }
 #endif
--- a/widget/src/windows/nsNativeDragSource.cpp
+++ b/widget/src/windows/nsNativeDragSource.cpp
@@ -40,18 +40,18 @@
 #include "nsISupportsImpl.h"
 #include "nsString.h"
 
 /*
  * class nsNativeDragSource
  */
 nsNativeDragSource::nsNativeDragSource(nsIDOMDataTransfer* aDataTransfer) :
   m_cRef(0),
-  mUserCancelled(PR_FALSE),
-  m_hCursor(nsnull)
+  m_hCursor(nsnull),
+  mUserCancelled(PR_FALSE)
 {
   mDataTransfer = do_QueryInterface(aDataTransfer);
 }
 
 nsNativeDragSource::~nsNativeDragSource()
 {
 }
 
--- a/widget/src/windows/nsNativeDragTarget.cpp
+++ b/widget/src/windows/nsNativeDragTarget.cpp
@@ -56,17 +56,17 @@ static NS_DEFINE_IID(kIDragServiceIID, N
 
 // This is cached for Leave notification
 static POINTL gDragLastPoint;
 
 /*
  * class nsNativeDragTarget
  */
 nsNativeDragTarget::nsNativeDragTarget(nsIWidget * aWnd)
-  : m_cRef(0), mWindow(aWnd), mCanMove(PR_TRUE), mTookOwnRef(PR_FALSE),
+  : m_cRef(0), mCanMove(PR_TRUE), mTookOwnRef(PR_FALSE), mWindow(aWnd),
   mDropTargetHelper(nsnull)
 {
   mHWnd = (HWND)mWindow->GetNativeData(NS_NATIVE_WINDOW);
 
   /*
    * Create/Get the DragService that we have implemented
    */
   CallGetService(kCDragServiceCID, &mDragService);
--- a/widget/src/windows/nsNativeThemeWin.cpp
+++ b/widget/src/windows/nsNativeThemeWin.cpp
@@ -185,24 +185,16 @@ nsNativeThemeWin::nsNativeThemeWin() {
   // static widget style variables (e.g. sButtonBorderSize) should be 
   // reinitialized here.
 }
 
 nsNativeThemeWin::~nsNativeThemeWin() {
   nsUXThemeData::Invalidate();
 }
 
-static void GetNativeRect(const nsIntRect& aSrc, RECT& aDst)
-{
-  aDst.top = aSrc.y;
-  aDst.bottom = aSrc.y + aSrc.height;
-  aDst.left = aSrc.x;
-  aDst.right = aSrc.x + aSrc.width;
-}
-
 static PRBool IsTopLevelMenu(nsIFrame *aFrame)
 {
   PRBool isTopLevel(PR_FALSE);
   nsIMenuFrame *menuFrame = do_QueryFrame(aFrame);
   if (menuFrame) {
     isTopLevel = menuFrame->IsOnMenuBar();
   }
   return isTopLevel;
@@ -1327,18 +1319,18 @@ RENDER_AGAIN:
   // If part is negative, the element wishes us to not render a themed
   // background, instead opting to be drawn specially below.
   else if (part >= 0) {
     nsUXThemeData::drawThemeBG(theme, hdc, part, state, &widgetRect, &clipRect);
   }
 
   // Draw focus rectangles for XP HTML checkboxes and radio buttons
   // XXX it'd be nice to draw these outside of the frame
-  if ((aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO) &&
-      aFrame->GetContent()->IsHTML() ||
+  if (((aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO) &&
+        aFrame->GetContent()->IsHTML()) ||
       aWidgetType == NS_THEME_SCALE_HORIZONTAL ||
       aWidgetType == NS_THEME_SCALE_VERTICAL) {
       PRInt32 contentState;
       contentState = GetContentState(aFrame, aWidgetType);  
 
       if (contentState & NS_EVENT_STATE_FOCUS) {
         POINT vpOrg;
         HPEN hPen = nsnull;
@@ -3205,17 +3197,17 @@ RENDER_AGAIN:
       rect.top += offset;
       rect.left += offset;
       rect.right -= offset;
       rect.bottom -= 1;
 
       // if enabled, draw a gradient titlebar background, otherwise
       // fill with a solid color.
       BOOL bFlag = TRUE;
-      SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &bFlag, NULL);
+      SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &bFlag, 0);
       if (!bFlag) {
         if (state == mozilla::widget::themeconst::FS_ACTIVE)
           FillRect(hdc, &rect, (HBRUSH)(COLOR_ACTIVECAPTION+1));
         else
           FillRect(hdc, &rect, (HBRUSH)(COLOR_INACTIVECAPTION+1));
       } else {
         DWORD startColor, endColor;
         if (state == mozilla::widget::themeconst::FS_ACTIVE) {
--- a/widget/src/windows/nsScreenManagerWin.cpp
+++ b/widget/src/windows/nsScreenManagerWin.cpp
@@ -79,17 +79,17 @@ NS_IMPL_ISUPPORTS1(nsScreenManagerWin, n
 //
 nsIScreen* 
 nsScreenManagerWin :: CreateNewScreenObject ( void* 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 ( int i = 0; i < mScreenList.Length(); ++i ) {
+  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);
--- a/widget/src/windows/nsSound.cpp
+++ b/widget/src/windows/nsSound.cpp
@@ -51,23 +51,23 @@
 #include "nsNetUtil.h"
 #include "nsCRT.h"
 
 #include "nsNativeCharsetUtils.h"
 
 class nsSoundPlayer: public nsRunnable {
 public:
   nsSoundPlayer(nsISound *aSound, const wchar_t* aSoundName) :
-    mSound(aSound), mSoundName(aSoundName)
+    mSoundName(aSoundName), mSound(aSound)
   {
     Init();
   }
 
   nsSoundPlayer(nsISound *aSound, const nsAString& aSoundName) :
-    mSound(aSound), mSoundName(aSoundName)
+    mSoundName(aSoundName), mSound(aSound)
   {
     Init();
   }
 
   NS_DECL_NSIRUNNABLE
 
 protected:
   nsString mSoundName;
--- a/widget/src/windows/nsTextStore.cpp
+++ b/widget/src/windows/nsTextStore.cpp
@@ -288,17 +288,17 @@ nsTextStore::GetSelection(ULONG ulIndex,
                           ULONG ulCount,
                           TS_SELECTION_ACP *pSelection,
                           ULONG *pcFetched)
 {
   NS_ENSURE_TRUE(TS_LF_READ == (mLock & TS_LF_READ), TS_E_NOLOCK);
   NS_ENSURE_TRUE(ulCount && pSelection && pcFetched, E_INVALIDARG);
 
   *pcFetched = 0;
-  NS_ENSURE_TRUE(TS_DEFAULT_SELECTION == ulIndex || 0 == ulIndex,
+  NS_ENSURE_TRUE((ULONG)TS_DEFAULT_SELECTION == ulIndex || 0 == ulIndex,
                  TS_E_NOSELECTION);
   if (mCompositionView) {
     // Emulate selection during compositions
     *pSelection = mCompositionSelection;
   } else {
     // Construct and initialize an event to get selection info
     nsQueryContentEvent event(PR_TRUE, NS_QUERY_SELECTED_TEXT, mWindow);
     mWindow->InitEvent(event);
@@ -571,19 +571,19 @@ IsSameTextEvent(const nsTextEvent* aEven
   NS_PRECONDITION(aEvent1 || aEvent2, "both events are null");
   NS_PRECONDITION(aEvent2 && (aEvent1 != aEvent2),
                   "both events are same instance");
 
   return (aEvent1 && aEvent2 &&
           aEvent1->rangeCount == aEvent2->rangeCount &&
           aEvent1->theText == aEvent2->theText &&
           (aEvent1->rangeCount == 0 ||
-           (aEvent1->rangeArray && aEvent2->rangeArray) &&
+           ((aEvent1->rangeArray && aEvent2->rangeArray) &&
            !memcmp(aEvent1->rangeArray, aEvent2->rangeArray,
-                   sizeof(nsTextRange) * aEvent1->rangeCount)));
+                   sizeof(nsTextRange) * aEvent1->rangeCount))));
 }
 
 HRESULT
 nsTextStore::UpdateCompositionExtent(ITfRange* aRangeNew)
 {
   NS_ENSURE_TRUE(mCompositionView, E_FAIL);
 
   HRESULT hr;
@@ -594,17 +594,17 @@ nsTextStore::UpdateCompositionExtent(ITf
     NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
   }
 
   // Get starting offset of the composition
   LONG compStart = 0, compLength = 0;
   hr = GetRangeExtent(composingRange, &compStart, &compLength);
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
   if (mCompositionStart != compStart ||
-      mCompositionString.Length() != compLength) {
+      mCompositionString.Length() != (ULONG)compLength) {
     // If the queried composition length is different from the length
     // of our composition string, OnUpdateComposition is being called
     // because a part of the original composition was committed.
     // Reflect that by committing existing composition and starting
     // a new one. OnEndComposition followed by OnStartComposition
     // will accomplish this automagically.
     OnEndComposition(pComposition);
     OnStartCompositionInternal(pComposition, composingRange, PR_TRUE);
@@ -767,18 +767,18 @@ nsTextStore::SendTextEventForComposition
   // change the range style to undefined.
   if (mCompositionSelection.acpStart != mCompositionSelection.acpEnd &&
       textRanges.Length() == 1) {
     nsTextRange& range = textRanges[0];
     LONG start = PR_MIN(mCompositionSelection.acpStart,
                         mCompositionSelection.acpEnd);
     LONG end = PR_MAX(mCompositionSelection.acpStart,
                       mCompositionSelection.acpEnd);
-    if (range.mStartOffset == start - mCompositionStart &&
-        range.mEndOffset == end - mCompositionStart &&
+    if ((LONG)range.mStartOffset == start - mCompositionStart &&
+        (LONG)range.mEndOffset == end - mCompositionStart &&
         range.mRangeStyle.IsNoChangeStyle()) {
       range.mRangeStyle.Clear();
       // The looks of selected type is better than others.
       range.mRangeType = NS_TEXTRANGE_SELECTEDRAWTEXT;
     }
   }
 
   // The caret position has to be collapsed.
@@ -868,17 +868,17 @@ nsTextStore::GetText(LONG acpStart,
   NS_ENSURE_TRUE(pcchPlainOut && (pchPlain || prgRunInfo) &&
                  (!cchPlainReq == !pchPlain) &&
                  (!ulRunInfoReq == !prgRunInfo), E_INVALIDARG);
   NS_ENSURE_TRUE(0 <= acpStart && -1 <= acpEnd &&
                  (-1 == acpEnd || acpStart <= acpEnd), TS_E_INVALIDPOS);
 
   // Making sure to NULL-terminate string just to be on the safe side
   *pcchPlainOut = 0;
-  if (pchPlain && cchPlainReq) *pchPlain = NULL;
+  if (pchPlain && cchPlainReq) *pchPlain = 0;
   if (pulRunInfoOut) *pulRunInfoOut = 0;
   if (pacpNext) *pacpNext = acpStart;
   if (prgRunInfo && ulRunInfoReq) {
     prgRunInfo->uCount = 0;
     prgRunInfo->type = TS_RT_PLAIN;
   }
   PRUint32 length = -1 == acpEnd ? PR_UINT32_MAX : PRUint32(acpEnd - acpStart);
   if (cchPlainReq && cchPlainReq - 1 < length) {
@@ -921,17 +921,17 @@ nsTextStore::GetText(LONG acpStart,
     }
     NS_ENSURE_TRUE(-1 == acpEnd || event.mReply.mString.Length() == length,
                    TS_E_INVALIDPOS);
     length = PR_MIN(length, event.mReply.mString.Length());
 
     if (pchPlain && cchPlainReq) {
       memcpy(pchPlain, event.mReply.mString.BeginReading(),
              length * sizeof(*pchPlain));
-      pchPlain[length] = NULL;
+      pchPlain[length] = 0;
       *pcchPlainOut = length;
     }
     if (prgRunInfo && ulRunInfoReq) {
       prgRunInfo->uCount = length;
       prgRunInfo->type = TS_RT_PLAIN;
       if (pulRunInfoOut) *pulRunInfoOut = 1;
     }
     if (pacpNext) *pacpNext = acpStart + length;
@@ -1462,17 +1462,17 @@ nsTextStore::OnTextChangeInternal(PRUint
                                   PRUint32 aOldEnd,
                                   PRUint32 aNewEnd)
 {
   if (!mLock && mSink && 0 != (mSinkMask & TS_AS_TEXT_CHANGE)) {
     mTextChange.acpStart = PR_MIN(mTextChange.acpStart, LONG(aStart));
     mTextChange.acpOldEnd = PR_MAX(mTextChange.acpOldEnd, LONG(aOldEnd));
     mTextChange.acpNewEnd = PR_MAX(mTextChange.acpNewEnd, LONG(aNewEnd));
     ::PostMessageW(mWindow->GetWindowHandle(),
-                   WM_USER_TSF_TEXTCHANGE, 0, NULL);
+                   WM_USER_TSF_TEXTCHANGE, 0, 0);
   }
   return NS_OK;
 }
 
 void
 nsTextStore::OnTextChangeMsgInternal(void)
 {
   if (!mLock && mSink && 0 != (mSinkMask & TS_AS_TEXT_CHANGE) &&
--- a/widget/src/windows/nsToolkit.cpp
+++ b/widget/src/windows/nsToolkit.cpp
@@ -533,17 +533,17 @@ void MouseTrailer::TimerProc(nsITimer* a
     POINT mp;
     DWORD pos = ::GetMessagePos();
     mp.x = GET_X_LPARAM(pos);
     mp.y = GET_Y_LPARAM(pos);
     HWND mouseWnd = ::WindowFromPoint(mp);
     if (mtrailer->mMouseTrailerWindow != mouseWnd) {
 #ifndef WINCE
       // Notify someone that a mouse exit happened.
-      PostMessage(mtrailer->mMouseTrailerWindow, WM_MOUSELEAVE, NULL, NULL);
+      PostMessage(mtrailer->mMouseTrailerWindow, WM_MOUSELEAVE, 0, 0);
 #endif
 
       // we are out of this window, destroy timer
       mtrailer->DestroyTimer();
       mtrailer->mMouseTrailerWindow = nsnull;
     }
   } else {
     mtrailer->DestroyTimer();
--- a/widget/src/windows/nsUXThemeConstants.h
+++ b/widget/src/windows/nsUXThemeConstants.h
@@ -265,25 +265,25 @@ enum {
   WP_CAPTIONSIZINGTEMPLATE = 30,
   WP_SMALLCAPTIONSIZINGTEMPLATE = 31,
   WP_FRAMELEFTSIZINGTEMPLATE = 32,
   WP_SMALLFRAMELEFTSIZINGTEMPLATE = 33,
   WP_FRAMERIGHTSIZINGTEMPLATE = 34,
   WP_SMALLFRAMERIGHTSIZINGTEMPLATE = 35,
   WP_FRAMEBOTTOMSIZINGTEMPLATE = 36,
   WP_SMALLFRAMEBOTTOMSIZINGTEMPLATE = 37,
-  WP_FRAME = 38,
+  WP_FRAME = 38
 };
 
 enum FRAMESTATES {
   FS_ACTIVE = 1,
-  FS_INACTIVE = 2,
+  FS_INACTIVE = 2
 };
 
 enum {
   BS_NORMAL = 1,
   BS_HOT = 2,
   BS_PUSHED = 3,
   BS_DISABLED = 4,
-  BS_INACTIVE = 5, /* undocumented, inactive caption button */
+  BS_INACTIVE = 5 /* undocumented, inactive caption button */
 };
 
 }}} // mozilla::widget::themeconst
--- a/widget/src/windows/nsWinGesture.cpp
+++ b/widget/src/windows/nsWinGesture.cpp
@@ -67,20 +67,20 @@ nsWinGesture::UpdatePanningFeedbackPtr n
 nsWinGesture::RegisterTouchWindowPtr nsWinGesture::registerTouchWindow = nsnull;
 nsWinGesture::UnregisterTouchWindowPtr nsWinGesture::unregisterTouchWindow = nsnull;
 nsWinGesture::GetTouchInputInfoPtr nsWinGesture::getTouchInputInfo = nsnull;
 nsWinGesture::CloseTouchInputHandlePtr nsWinGesture::closeTouchInputHandle = nsnull;
 
 static PRBool gEnableSingleFingerPanEvents = PR_FALSE;
 
 nsWinGesture::nsWinGesture() :
+  mPanActive(PR_FALSE),
   mFeedbackActive(PR_FALSE),
   mXAxisFeedback(PR_FALSE),
   mYAxisFeedback(PR_FALSE),
-  mPanActive(PR_FALSE),
   mPanInertiaActive(PR_FALSE)
 {
   (void)InitLibrary();
   mPixelScrollOverflow = 0;
 }
 
 /* Load and shutdown */
 
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -1331,26 +1331,26 @@ void nsWindow::SetThemeRegion()
  * Used to register the native window to receive touch events
  *
  **************************************************************/
 
 NS_METHOD nsWindow::RegisterTouchWindow() {
   mTouchWindow = PR_TRUE;
 #ifndef WINCE
   mGesture.RegisterTouchWindow(mWnd);
-  ::EnumChildWindows(mWnd, nsWindow::RegisterTouchForDescendants, NULL);
+  ::EnumChildWindows(mWnd, nsWindow::RegisterTouchForDescendants, 0);
 #endif
   return NS_OK;
 }
 
 NS_METHOD nsWindow::UnregisterTouchWindow() {
   mTouchWindow = PR_FALSE;
 #ifndef WINCE
   mGesture.UnregisterTouchWindow(mWnd);
-  ::EnumChildWindows(mWnd, nsWindow::UnregisterTouchForDescendants, NULL);
+  ::EnumChildWindows(mWnd, nsWindow::UnregisterTouchForDescendants, 0);
 #endif
   return NS_OK;
 }
 
 #ifndef WINCE
 BOOL CALLBACK nsWindow::RegisterTouchForDescendants(HWND aWnd, LPARAM aMsg) {
   nsWindow* win = GetNSWindowPtr(aWnd);
   if (win)
@@ -3296,17 +3296,17 @@ nsWindow::OnDefaultButtonLoaded(const ns
 
 NS_IMETHODIMP
 nsWindow::OverrideSystemMouseScrollSpeed(PRInt32 aOriginalDelta,
                                          PRBool aIsHorizontal,
                                          PRInt32 &aOverriddenDelta)
 {
   // The default vertical and horizontal scrolling speed is 3, this is defined
   // on the document of SystemParametersInfo in MSDN.
-  const PRInt32 kSystemDefaultScrollingSpeed = 3;
+  const PRUint32 kSystemDefaultScrollingSpeed = 3;
 
   PRInt32 absOriginDelta = PR_ABS(aOriginalDelta);
 
   // Compute the simple overridden speed.
   PRInt32 absComputedOverriddenDelta;
   nsresult rv =
     nsBaseWidget::OverrideSystemMouseScrollSpeed(absOriginDelta, aIsHorizontal,
                                                  absComputedOverriddenDelta);
@@ -3652,17 +3652,17 @@ void nsWindow::DispatchPendingEvents()
   if (::GetQueueStatus(QS_PAINT)) {
     // Find the top level window.
     HWND topWnd = GetTopLevelHWND(mWnd);
 
     // Dispatch pending paints for all topWnd's descendant windows.
     // Note: EnumChildWindows enumerates all descendant windows not just
     // it's children.
 #if !defined(WINCE)
-    ::EnumChildWindows(topWnd, nsWindow::DispatchStarvedPaints, NULL);
+    ::EnumChildWindows(topWnd, nsWindow::DispatchStarvedPaints, 0);
 #else
     nsWindowCE::EnumChildWindows(topWnd, nsWindow::DispatchStarvedPaints, NULL);
 #endif
   }
 }
 
 // Deal with plugin events
 PRBool nsWindow::DispatchPluginEvent(const MSG &aMsg)
@@ -4211,38 +4211,44 @@ nsWindow::IPCWindowProcHandler(UINT& msg
  *
  * SECTION: Wind proc.
  *
  * The main Windows event procedures and associated
  * message processing methods.
  *
  **************************************************************/
 
+#ifdef _MSC_VER
 static int ReportException(EXCEPTION_POINTERS *aExceptionInfo)
 {
 #ifdef MOZ_CRASHREPORTER
   nsCOMPtr<nsICrashReporter> cr =
     do_GetService("@mozilla.org/toolkit/crash-reporter;1");
   if (cr)
     cr->WriteMinidumpForException(aExceptionInfo);
 #endif
   return EXCEPTION_EXECUTE_HANDLER;
 }
+#endif
 
 // The WndProc procedure for all nsWindows in this toolkit. This merely catches
 // exceptions and passes the real work to WindowProcInternal. See bug 587406
 // and http://msdn.microsoft.com/en-us/library/ms633573%28VS.85%29.aspx
 LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
+#ifdef _MSC_VER
   __try {
     return WindowProcInternal(hWnd, msg, wParam, lParam);
   }
   __except(ReportException(GetExceptionInformation())) {
     ::TerminateProcess(::GetCurrentProcess(), 253);
   }
+#else
+  return WindowProcInternal(hWnd, msg, wParam, lParam);
+#endif
 }
 
 LRESULT CALLBACK nsWindow::WindowProcInternal(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
   NS_TIME_FUNCTION_MIN_FMT(5.0, "%s (line %d) (hWnd: %p, msg: %p, wParam: %p, lParam: %p",
                            MOZ_FUNCTION_NAME, __LINE__, hWnd, msg,
                            wParam, lParam);
 
@@ -4362,17 +4368,16 @@ PRBool nsWindow::ProcessMessage(UINT msg
   if (PluginHasFocus()) {
     PRBool callDefaultWndProc;
     MSG nativeMsg = InitMSG(msg, wParam, lParam);
     if (ProcessMessageForPlugin(nativeMsg, aRetValue, callDefaultWndProc)) {
       return mWnd ? !callDefaultWndProc : PR_TRUE;
     }
   }
 
-  static UINT vkKeyCached = 0; // caches VK code fon WM_KEYDOWN
   PRBool result = PR_FALSE;    // call the default nsWindow proc
   *aRetValue = 0;
 
   static PRBool getWheelInfo = PR_TRUE;
 
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
   // Glass hit testing w/custom transparent margins
   LRESULT dwmHitResult;
@@ -4968,17 +4973,17 @@ PRBool nsWindow::ProcessMessage(UINT msg
 
           sJustGotActivate = PR_TRUE;
           nsMouseEvent event(PR_TRUE, NS_MOUSE_ACTIVATE, this,
                              nsMouseEvent::eReal);
           InitEvent(event);
 
           event.acceptActivation = PR_TRUE;
   
-          PRBool result = DispatchWindowEvent(&event);
+          DispatchWindowEvent(&event);
 #ifndef WINCE
           if (event.acceptActivation)
             *aRetValue = MA_ACTIVATE;
           else
             *aRetValue = MA_NOACTIVATE;
 
           if (sSwitchKeyboardLayout && mLastKeyboardLayout)
             ActivateKeyboardLayout(mLastKeyboardLayout, 0);
@@ -5107,18 +5112,20 @@ PRBool nsWindow::ProcessMessage(UINT msg
       result = OnInputLangChange((HKL)lParam);
       break;
 #endif // WINCE
 
     case WM_DESTROYCLIPBOARD:
     {
       nsIClipboard* clipboard;
       nsresult rv = CallGetService(kCClipboardCID, &clipboard);
-      clipboard->EmptyClipboard(nsIClipboard::kGlobalClipboard);
-      NS_RELEASE(clipboard);
+      if(NS_SUCCEEDED(rv)) {
+        clipboard->EmptyClipboard(nsIClipboard::kGlobalClipboard);
+        NS_RELEASE(clipboard);
+      }
     }
     break;
 
 #ifdef ACCESSIBILITY
     case WM_GETOBJECT:
     {
       *aRetValue = 0;
       if (lParam == OBJID_CLIENT) { // oleacc.dll will be loaded dynamically
@@ -6188,17 +6195,17 @@ PRBool nsWindow::OnGesture(WPARAM wParam
 
 #if !defined(WINCE)
 PRUint16 nsWindow::GetMouseInputSource()
 {
   PRUint16 inputSource = nsIDOMNSMouseEvent::MOZ_SOURCE_MOUSE;
   LPARAM lParamExtraInfo = ::GetMessageExtraInfo();
   if ((lParamExtraInfo & TABLET_INK_SIGNATURE) == TABLET_INK_CHECK) {
     inputSource = (lParamExtraInfo & TABLET_INK_TOUCH) ?
-                  nsIDOMNSMouseEvent::MOZ_SOURCE_TOUCH : nsIDOMNSMouseEvent::MOZ_SOURCE_PEN;
+                  PRUint16(nsIDOMNSMouseEvent::MOZ_SOURCE_TOUCH) : nsIDOMNSMouseEvent::MOZ_SOURCE_PEN;
   }
   return inputSource;
 }
 #endif
 /*
  * OnMouseWheel - mouse wheele event processing. This was originally embedded
  * within the message case block. If returning true result should be returned
  * immediately (no more processing).
@@ -7070,17 +7077,17 @@ PRBool nsWindow::HandleScrollingPlugins(
     // Logitech (Logicool) mouse driver (confirmed with 4.82.11 and MX-1100)
     // always sets 0 to the lParam of WM_MOUSEHWHEEL.  The driver SENDs one
     // message at first time, this time, ::GetMessagePos works fine.
     // Then, we will return 0 (0 means we process it) to the message. Then, the
     // driver will POST the same messages continuously during the wheel tilted.
     // But ::GetMessagePos API always returns (0, 0), even if the actual mouse
     // cursor isn't 0,0.  Therefore, we cannot trust the result of
     // ::GetMessagePos API if the sender is the driver.
-    if (!sMayBeUsingLogitechMouse && aLParam == 0 && aLParam != dwPoints &&
+    if (!sMayBeUsingLogitechMouse && aLParam == 0 && (DWORD)aLParam != dwPoints &&
         ::InSendMessage()) {
       sMayBeUsingLogitechMouse = PR_TRUE;
     } else if (sMayBeUsingLogitechMouse && aLParam != 0 && ::InSendMessage()) {
       // The user has changed the mouse from Logitech's to another one (e.g.,
       // the user has changed to the touchpad of the notebook.
       sMayBeUsingLogitechMouse = PR_FALSE;
     }
     // If the WM_MOUSEHWHEEL comes from Logitech's mouse driver, and the
@@ -8160,16 +8167,18 @@ nsWindow* nsWindow::GetTopLevelWindow(PR
   nsWindow* curWindow = this;
 
   while (PR_TRUE) {
     if (aStopOnDialogOrPopup) {
       switch (curWindow->mWindowType) {
         case eWindowType_dialog:
         case eWindowType_popup:
           return curWindow;
+        default:
+          break;
       }
     }
 
     // Retrieve the top level parent or owner window
     nsWindow* parentWindow = curWindow->GetParentWindow(PR_TRUE);
 
     if (!parentWindow)
       return curWindow;
@@ -8273,17 +8282,17 @@ void nsWindow::InitTrackPointHack()
       case 0:
         break;
       // 1 means hack enabled
       case 1:
         sTrackPointHack = true;
         break;
       // -1 means autodetect
       case -1:
-        for(int i = 0; i < NS_ARRAY_LENGTH(wstrKeys); i++) {
+        for(unsigned i = 0; i < NS_ARRAY_LENGTH(wstrKeys); i++) {
           HKEY hKey;
           lResult = ::RegOpenKeyExW(HKEY_CURRENT_USER, (LPCWSTR)&wstrKeys[i],
                                     0, KEY_READ, &hKey);
           ::RegCloseKey(hKey);
           if(lResult == ERROR_SUCCESS) {
             // If we detected a registry key belonging to a TrackPoint driver
             // Turn on the hack
             sTrackPointHack = true;
--- a/widget/src/windows/nsWindowDbg.cpp
+++ b/widget/src/windows/nsWindowDbg.cpp
@@ -491,22 +491,22 @@ nsresult HeapDump(UINT msg, WPARAM wPara
 }
 
 #endif // defined(HEAP_DUMP_EVENT)
 
 #ifdef DEBUG
 void DDError(const char *msg, HRESULT hr)
 {
   /*XXX make nicer */
-  fprintf(stderr, "direct draw error %s: 0x%08x\n", msg, hr);
+  fprintf(stderr, "direct draw error %s: 0x%08lx\n", msg, hr);
 }
 #endif
 
 #ifdef DEBUG_VK
 PRBool is_vk_down(int vk)
 {
    SHORT st = GetKeyState(vk);
 #ifdef DEBUG
    printf("is_vk_down vk=%x st=%x\n",vk, st);
 #endif
    return (st < 0);
 }
-#endif
\ No newline at end of file
+#endif
--- a/widget/src/windows/nsWindowGfx.cpp
+++ b/widget/src/windows/nsWindowGfx.cpp
@@ -480,19 +480,19 @@ PRBool nsWindow::OnPaint(HDC aDC, PRUint
             // create a new sub-surface that aliases this one
             RECT winrect;
             GetClientRect(mWnd, &winrect);
             MapWindowPoints(mWnd, NULL, (LPPOINT)&winrect, 2);
 
             targetSurfaceDDraw = new gfxDDrawSurface(gpDDSurf.get(), winrect);
             targetSurface = targetSurfaceDDraw;
           }
-#endif
 
 DDRAW_FAILED:
+#endif
           nsRefPtr<gfxImageSurface> targetSurfaceImage;
           if (!targetSurface &&
               (IsRenderMode(gfxWindowsPlatform::RENDER_IMAGE_STRETCH32) ||
                IsRenderMode(gfxWindowsPlatform::RENDER_IMAGE_STRETCH24)))
           {
             gfxIntSize surfaceSize(ps.rcPaint.right - ps.rcPaint.left,
                                    ps.rcPaint.bottom - ps.rcPaint.top);
 
@@ -756,18 +756,16 @@ DDRAW_FAILED:
 }
 
 nsresult nsWindowGfx::CreateIcon(imgIContainer *aContainer,
                                   PRBool aIsCursor,
                                   PRUint32 aHotspotX,
                                   PRUint32 aHotspotY,
                                   HICON *aIcon) {
 
-  nsresult rv;
-
   // Get the image data
   nsRefPtr<gfxImageSurface> frame;
   aContainer->CopyFrame(imgIContainer::FRAME_CURRENT,
                         imgIContainer::FLAG_SYNC_DECODE,
                         getter_AddRefs(frame));
   if (!frame)
     return NS_ERROR_NOT_AVAILABLE;
 
--- a/widget/src/xpwidgets/nsPrintSettingsImpl.h
+++ b/widget/src/xpwidgets/nsPrintSettingsImpl.h
@@ -57,17 +57,17 @@ class nsPrintSettings : public nsIPrintS
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPRINTSETTINGS
 
   nsPrintSettings();
   nsPrintSettings(const nsPrintSettings& aPS);
   virtual ~nsPrintSettings();
 
-  virtual nsPrintSettings& operator=(const nsPrintSettings& rhs);
+  nsPrintSettings& operator=(const nsPrintSettings& rhs);
 
 protected:
   // May be implemented by the platform-specific derived class                       
   virtual nsresult _Clone(nsIPrintSettings **_retval);
   virtual nsresult _Assign(nsIPrintSettings *aPS);
   
   typedef enum {
     eHeader,