Bug 823921 - Fixed GCC warnings r=paul
authorJacek Caban <jacek@codeweavers.com>
Wed, 26 Dec 2012 11:27:28 +0100
changeset 126138 9059edd199b27f8afb49e09c2e43658fdc503015
parent 126136 0b0b040b16d8a1a3ba3192834dcd78a5c243cc8f
child 126139 411313b5cd9d294080deccf87db2abf9a854f564
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)
reviewerspaul
bugs823921
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 823921 - Fixed GCC warnings r=paul
content/media/wmf/WMFByteStream.cpp
content/media/wmf/WMFByteStream.h
content/media/wmf/WMFDecoder.cpp
content/media/wmf/WMFReader.cpp
content/media/wmf/WMFUtils.cpp
--- a/content/media/wmf/WMFByteStream.cpp
+++ b/content/media/wmf/WMFByteStream.cpp
@@ -30,19 +30,19 @@ DoGetInterface(IUnknown* aUnknown, void*
     return E_POINTER;
   *aInterface = aUnknown;
   aUnknown->AddRef();
   return S_OK;
 }
 
 WMFByteStream::WMFByteStream(MediaResource* aResource)
   : mWorkQueueId(MFASYNC_CALLBACK_QUEUE_UNDEFINED),
+    mResource(aResource),
     mReentrantMonitor("WMFByteStream"),
-    mOffset(0),
-    mResource(aResource)
+    mOffset(0)
 {
   NS_ASSERTION(NS_IsMainThread(), "Must be on main thread.");
   NS_ASSERTION(mResource, "Must have a valid media resource");
 
 #ifdef PR_LOGGING
   if (!gWMFByteStreamLog) {
     gWMFByteStreamLog = PR_NewLogModule("WMFByteStream");
   }
@@ -99,21 +99,21 @@ WMFByteStream::QueryInterface(REFIID aII
   if (aIId == IID_IUnknown) {
     return DoGetInterface(static_cast<IMFByteStream*>(this), aInterface);
   }
 
   *aInterface = NULL;
   return E_NOINTERFACE;
 }
 
-NS_IMPL_THREADSAFE_ADDREF(WMFByteStream);
-NS_IMPL_THREADSAFE_RELEASE(WMFByteStream);
+NS_IMPL_THREADSAFE_ADDREF(WMFByteStream)
+NS_IMPL_THREADSAFE_RELEASE(WMFByteStream)
 
-NS_IMPL_THREADSAFE_ADDREF(WMFByteStream::AsyncReadRequestState);
-NS_IMPL_THREADSAFE_RELEASE(WMFByteStream::AsyncReadRequestState);
+NS_IMPL_THREADSAFE_ADDREF(WMFByteStream::AsyncReadRequestState)
+NS_IMPL_THREADSAFE_RELEASE(WMFByteStream::AsyncReadRequestState)
 
 // IUnknown Methods
 STDMETHODIMP
 WMFByteStream::AsyncReadRequestState::QueryInterface(REFIID aIId, void **aInterface)
 {
   LOG("WMFByteStream::AsyncReadRequestState::QueryInterface %s", GetGUIDName(aIId).get());
 
   if (aIId == IID_IUnknown) {
--- a/content/media/wmf/WMFByteStream.h
+++ b/content/media/wmf/WMFByteStream.h
@@ -6,29 +6,30 @@
 #if !defined(WMFByteStream_h_)
 #define WMFByteStream_h_
 
 #include "WMF.h"
 
 #include "nsISupportsImpl.h"
 #include "nsCOMPtr.h"
 #include "mozilla/ReentrantMonitor.h"
+#include "mozilla/Attributes.h"
 #include "nsAutoPtr.h"
 
 namespace mozilla {
 
 class MediaResource;
 
 // Wraps a MediaResource around an IMFByteStream interface, so that it can
 // be used by the IMFSourceReader. Each WMFByteStream creates a WMF Work Queue
 // on which blocking I/O is performed. The SourceReader requests reads
 // asynchronously using {Begin,End}Read(). The synchronous I/O methods aren't
 // used by the SourceReader, so they're not implemented on this class.
-class WMFByteStream : public IMFByteStream,
-                      public IMFAsyncCallback
+class WMFByteStream MOZ_FINAL : public IMFByteStream,
+                                public IMFAsyncCallback
 {
 public:
   WMFByteStream(MediaResource* aResource);
   ~WMFByteStream();
 
   nsresult Init();
   nsresult Shutdown();
 
@@ -72,17 +73,17 @@ private:
   // Id of the work queue upon which we perfrom reads. This
   // objects's Invoke() function is called on the work queue's thread,
   // and it's there that we perform blocking IO. This has value
   // MFASYNC_CALLBACK_QUEUE_UNDEFINED if the work queue hasn't been
   // created yet.
   DWORD mWorkQueueId;
 
   // Stores data regarding an async read opreation.
-  class AsyncReadRequestState : public IUnknown {
+  class AsyncReadRequestState MOZ_FINAL : public IUnknown {
   public:
     AsyncReadRequestState(int64_t aOffset, BYTE* aBuffer, ULONG aLength)
       : mOffset(aOffset),
         mBuffer(aBuffer),
         mBufferLength(aLength),
         mBytesRead(0)
     {}
 
@@ -93,17 +94,17 @@ private:
 
     int64_t mOffset;
     BYTE* mBuffer;
     ULONG mBufferLength;
     ULONG mBytesRead;
 
     // IUnknown ref counting.
     nsAutoRefCnt mRefCnt;
-    NS_DECL_OWNINGTHREAD;
+    NS_DECL_OWNINGTHREAD
   };
 
   // Resource we're wrapping. Note this object's methods are threadsafe,
   // and we only call read/seek on the work queue's thread.
   MediaResource* mResource;
 
   // Protects mOffset, which is accessed by the SourceReaders thread(s), and
   // on the work queue thread.
@@ -112,14 +113,14 @@ private:
   // Current offset of the logical read cursor. We maintain this separately
   // from the media resource's offset since a partially complete read (in Invoke())
   // would leave the resource's offset at a value unexpected by the caller,
   // since the read hadn't yet completed.
   int64_t mOffset;
 
   // IUnknown ref counting.
   nsAutoRefCnt mRefCnt;
-  NS_DECL_OWNINGTHREAD;
+  NS_DECL_OWNINGTHREAD
 };
 
 } // namespace mozilla
 
 #endif
--- a/content/media/wmf/WMFDecoder.cpp
+++ b/content/media/wmf/WMFDecoder.cpp
@@ -85,17 +85,16 @@ void
 WMFDecoder::UnloadDLLs()
 {
   wmf::UnloadDLLs();
 }
 
 bool IsWindows7OrLater()
 {
   OSVERSIONINFO versionInfo;
-  BOOL isWin7OrLater = FALSE;
   versionInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
   if (!GetVersionEx(&versionInfo)) {
     return false;
   }
   // Note: Win Vista = 6.0
   //       Win 7     = 6.1
   //       Win 8     = 6.2
   return versionInfo.dwMajorVersion > 6 ||
--- a/content/media/wmf/WMFReader.cpp
+++ b/content/media/wmf/WMFReader.cpp
@@ -47,20 +47,20 @@ WMFReader::WMFReader(MediaDecoder* aDeco
 
 WMFReader::~WMFReader()
 {
   NS_ASSERTION(NS_IsMainThread(), "Must be on main thread.");
 
   // Note: We must shutdown the byte stream before calling MFShutdown, else we
   // get assertion failures when unlocking the byte stream's work queue.
   if (mByteStream) {
-    nsresult rv = mByteStream->Shutdown();
+    DebugOnly<nsresult> rv = mByteStream->Shutdown();
     NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to shutdown WMFByteStream");
   }
-  HRESULT hr = wmf::MFShutdown();
+  DebugOnly<HRESULT> hr = wmf::MFShutdown();
   NS_ASSERTION(SUCCEEDED(hr), "MFShutdown failed");
   MOZ_COUNT_DTOR(WMFReader);
 }
 
 void
 WMFReader::OnDecodeThreadStart()
 {
   NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
--- a/content/media/wmf/WMFUtils.cpp
+++ b/content/media/wmf/WMFUtils.cpp
@@ -198,18 +198,16 @@ SourceReaderHasStream(IMFSourceReader* a
   return FAILED(hr) ? false : true;
 }
 
 namespace wmf {
 
 static bool sDLLsLoaded = false;
 static bool sFailedToLoadDlls = false;
 
-static HMODULE sMfPlatMod = NULL;
-
 struct WMFModule {
   const char* name;
   HMODULE handle;
 };
 
 static WMFModule sDLLs[] = {
   { "C:\\Windows\\system32\\mfplat.dll", NULL },
   { "C:\\Windows\\system32\\mfreadwrite.dll", NULL },