Bug 826613 - Enable FAIL_ON_WARNINGS on MSVC in image/. r=joe
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 05 Jan 2013 12:55:23 +0900
changeset 126822 80418f0fc73d9617499f9e9856420fd27a2771f8
parent 126821 06a834b786cf0b18205b0c00260df7beb01aa8e7
child 126823 becfdb6e3719c62f7b9bd13949e15515c2420249
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoe
bugs826613
milestone20.0a1
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
Bug 826613 - Enable FAIL_ON_WARNINGS on MSVC in image/. r=joe
content/svg/content/src/SVGPreserveAspectRatio.h
image/build/Makefile.in
image/src/BMPFileHeaders.h
image/src/ImageFactory.h
image/src/Makefile.in
image/src/RasterImage.cpp
image/src/imgRequest.cpp
image/src/imgStatusTracker.cpp
media/libjpeg/jmorecfg.h
--- a/content/svg/content/src/SVGPreserveAspectRatio.h
+++ b/content/svg/content/src/SVGPreserveAspectRatio.h
@@ -33,18 +33,18 @@ static const unsigned short SVG_MEETORSL
 namespace mozilla {
 class SVGAnimatedPreserveAspectRatio;
 
 class SVGPreserveAspectRatio
 {
   friend class SVGAnimatedPreserveAspectRatio;
 public:
   SVGPreserveAspectRatio(uint16_t aAlign, uint16_t aMeetOrSlice, bool aDefer = false)
-    : mAlign(aAlign)
-    , mMeetOrSlice(aMeetOrSlice)
+    : mAlign(static_cast<uint8_t>(aAlign))
+    , mMeetOrSlice(static_cast<uint8_t>(aMeetOrSlice))
     , mDefer(aDefer)
   {}
 
   bool operator==(const SVGPreserveAspectRatio& aOther) const;
 
   explicit SVGPreserveAspectRatio()
     : mAlign(0)
     , mMeetOrSlice(0)
--- a/image/build/Makefile.in
+++ b/image/build/Makefile.in
@@ -12,19 +12,17 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= imglib2
 LIBRARY_NAME	= imglib2
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 MODULE_NAME	= nsImageLib2Module
 GRE_MODULE	= 1
 LIBXUL_LIBRARY = 1
-ifndef _MSC_VER
 FAIL_ON_WARNINGS = 1
-endif # !_MSC_VER
 
 CPPSRCS = \
 		nsImageModule.cpp \
 		$(NULL)
 
 LOCAL_INCLUDES	= \
 		-I. \
 		-I$(srcdir)/../src \
--- a/image/src/BMPFileHeaders.h
+++ b/image/src/BMPFileHeaders.h
@@ -30,18 +30,20 @@ namespace mozilla {
 #define OS2_BIH_LENGTH 12 // This is the real BIH size (as contained in the bihsize field of BMPFILEHEADER)
 #define WIN_V3_BIH_LENGTH 40 // This is the real BIH size (as contained in the bihsize field of BMPFILEHEADER)
 #define WIN_V5_BIH_LENGTH 124 // This is the real BIH size (as contained in the bihsize field of BMPFILEHEADER)
 
 #define OS2_HEADER_LENGTH (BFH_INTERNAL_LENGTH + OS2_INTERNAL_BIH_LENGTH)
 #define WIN_V3_HEADER_LENGTH (BFH_INTERNAL_LENGTH + WIN_V3_INTERNAL_BIH_LENGTH)
 #define WIN_V5_HEADER_LENGTH (BFH_INTERNAL_LENGTH + WIN_V5_INTERNAL_BIH_LENGTH)
 
+#ifndef LCS_sRGB
 #define LCS_sRGB 0x73524742
-    
+#endif
+
     struct xyz {
       int32_t x, y, z;
     };
 
     struct xyzTriple {
       xyz r, g, b;
     };
 
--- a/image/src/ImageFactory.h
+++ b/image/src/ImageFactory.h
@@ -12,18 +12,19 @@
 
 #include "Image.h"
 
 namespace mozilla {
 namespace image {
 
 extern const char* SVG_MIMETYPE;
 
-struct ImageFactory
+class ImageFactory
 {
+public:
   /**
    * Creates a new image with the given properties.
    *
    * @param aRequest       The associated request.
    * @param aStatusTracker A status tracker for the image to use.
    * @param aMimeType      The mimetype of the image.
    * @param aURI           The URI of the image.
    * @param aIsMultiPart   Whether the image is part of a multipart request.
--- a/image/src/Makefile.in
+++ b/image/src/Makefile.in
@@ -11,19 +11,17 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= imglib2
 LIBRARY_NAME	= imglib2_s
 FORCE_STATIC_LIB = 1
 MODULE_NAME	= nsImageLib2Module
 GRE_MODULE	= 1
 LIBXUL_LIBRARY  = 1
-ifndef _MSC_VER
 FAIL_ON_WARNINGS = 1
-endif # !_MSC_VER
 
 
 EXPORTS		=  imgLoader.h \
 		   imgRequest.h \
 		   imgRequestProxy.h \
 		   $(NULL)
 
 CPPSRCS		= \
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -145,18 +145,19 @@ DiscardingEnabled()
     inited = true;
 
     enabled = (PR_GetEnv("MOZ_DISABLE_IMAGE_DISCARD") == nullptr);
   }
 
   return enabled;
 }
 
-struct ScaleRequest
+class ScaleRequest
 {
+public:
   ScaleRequest(RasterImage* aImage, const gfxSize& aScale, imgFrame* aSrcFrame)
     : scale(aScale)
     , dstLocked(false)
     , done(false)
     , stopped(false)
   {
     MOZ_ASSERT(!aSrcFrame->GetIsPaletted());
     MOZ_ASSERT(aScale.width > 0 && aScale.height > 0);
@@ -359,17 +360,26 @@ RasterImage::RasterImage(imgStatusTracke
                          nsIURI* aURI /* = nullptr */) :
   ImageResource(aStatusTracker, aURI), // invoke superclass's constructor
   mSize(0,0),
   mFrameDecodeFlags(DECODE_FLAGS_DEFAULT),
   mAnim(nullptr),
   mLoopCount(-1),
   mLockCount(0),
   mDecoder(nullptr),
+// We know DecodeRequest won't touch members of RasterImage
+// until this constructor completes
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4355)
+#endif
   mDecodeRequest(this),
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
   mBytesDecoded(0),
   mDecodeCount(0),
 #ifdef DEBUG
   mFramesNotified(0),
 #endif
   mHasSize(false),
   mDecodeOnDraw(false),
   mMultipart(false),
@@ -837,20 +847,22 @@ RasterImage::GetCurrentImgFrameEndTime()
   TimeStamp currentFrameTime = mAnim->currentAnimationFrameTime;
   int64_t timeout = currentFrame->GetTimeout();
 
   if (timeout < 0) {
     // We need to return a sentinel value in this case, because our logic
     // doesn't work correctly if we have a negative timeout value. The reason
     // this positive infinity was chosen was because it works with the loop in
     // RequestRefresh() above.
-    return TimeStamp() + TimeDuration::FromMilliseconds(UINT64_MAX);
+    return TimeStamp() +
+           TimeDuration::FromMilliseconds(static_cast<double>(UINT64_MAX));
   }
 
-  TimeDuration durationOfTimeout = TimeDuration::FromMilliseconds(timeout);
+  TimeDuration durationOfTimeout =
+    TimeDuration::FromMilliseconds(static_cast<double>(timeout));
   TimeStamp currentFrameEndTime = currentFrameTime + durationOfTimeout;
 
   return currentFrameEndTime;
 }
 
 imgFrame*
 RasterImage::GetCurrentImgFrame()
 {
--- a/image/src/imgRequest.cpp
+++ b/image/src/imgRequest.cpp
@@ -762,17 +762,18 @@ imgRequest::OnDataAvailable(nsIRequest *
         }
       }
 
       LOG_MSG_WITH_PARAM(GetImgLog(), "imgRequest::OnDataAvailable", "content type", mContentType.get());
 
       // Now we can create a new image to hold the data. If we don't have a decoder
       // for this mimetype we'll find out about it here.
       mImage = ImageFactory::CreateImage(aRequest, mStatusTracker, mContentType,
-                                         mURI, mIsMultiPartChannel, mInnerWindowId);
+                                         mURI, mIsMultiPartChannel,
+                                         static_cast<uint32_t>(mInnerWindowId));
 
       // Release our copy of the status tracker since the image owns it now.
       mStatusTracker = nullptr;
 
       // Notify listeners that we have an image.
       // XXX(seth): The name of this notification method is pretty misleading.
       GetStatusTracker().OnDataAvailable();
 
--- a/image/src/imgStatusTracker.cpp
+++ b/image/src/imgStatusTracker.cpp
@@ -181,23 +181,24 @@ private:
   imgStatusTracker* mTracker;
 };
 
 
 // imgStatusTracker methods
 
 imgStatusTracker::imgStatusTracker(Image* aImage)
   : mImage(aImage),
-    mTrackerObserver(new imgStatusTrackerObserver(this)),
     mState(0),
     mImageStatus(imgIRequest::STATUS_NONE),
     mIsMultipart(false),
     mHadLastPart(false),
     mBlockingOnload(false)
-{}
+{
+  mTrackerObserver = new imgStatusTrackerObserver(this);
+}
 
 imgStatusTracker::imgStatusTracker(const imgStatusTracker& aOther)
   : mImage(aOther.mImage),
     mState(aOther.mState),
     mImageStatus(aOther.mImageStatus),
     mIsMultipart(aOther.mIsMultipart),
     mHadLastPart(aOther.mHadLastPart),
     mBlockingOnload(aOther.mBlockingOnload)
--- a/media/libjpeg/jmorecfg.h
+++ b/media/libjpeg/jmorecfg.h
@@ -191,18 +191,21 @@ typedef unsigned int JDIMENSION;
 
 /* Here is the pseudo-keyword for declaring pointers that must be "far"
  * on 80x86 machines.  Most of the specialized coding for 80x86 is handled
  * by just saying "FAR *" where such a pointer is needed.  In a few places
  * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
  */
 
 #ifdef NEED_FAR_POINTERS
+#ifndef FAR
 #define FAR  far
+#endif
 #else
+#undef FAR
 #define FAR
 #endif
 
 
 /*
  * On a few systems, type boolean and/or its values FALSE, TRUE may appear
  * in standard header files.  Or you may have conflicts with application-
  * specific header files that you want to include together with these files.