Bug 970429 - Don't allow using INITGUID in unified sources. r=Ehsan
authorJacek Caban <jacek@codeweavers.com>
Wed, 12 Feb 2014 10:59:05 +0100
changeset 186585 d6473daed318e48d4b2205e6ef986064f72c1426
parent 186584 58ce2022d43b7b06d132c9198637b7e4eccc2635
child 186586 58a6e689c4724cd025e3a52661c10ad28e92cb93
push idunknown
push userunknown
push dateunknown
reviewersEhsan
bugs970429
milestone30.0a1
Bug 970429 - Don't allow using INITGUID in unified sources. r=Ehsan
content/media/directshow/AudioSinkInputPin.cpp
content/media/directshow/moz.build
content/media/wmf/WMF.h
content/media/wmf/WMFUtils.cpp
content/media/wmf/moz.build
gfx/2d/DrawTargetD2D1.cpp
gfx/2d/RadialGradientEffectD2D1.cpp
gfx/2d/gfx2d.vcxproj
gfx/2d/moz.build
gfx/layers/moz.build
media/webrtc/moz.build
python/mozbuild/mozbuild/backend/recursivemake.py
toolkit/components/downloads/nsDownloadScanner.h
uriloader/exthandler/win/nsOSHelperAppService.h
widget/windows/nsToolkit.cpp
--- a/content/media/directshow/AudioSinkInputPin.cpp
+++ b/content/media/directshow/AudioSinkInputPin.cpp
@@ -4,17 +4,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AudioSinkInputPin.h"
 #include "AudioSinkFilter.h"
 #include "SampleSink.h"
 #include "prlog.h"
 
-#include <initguid.h>
 #include <wmsdkidl.h>
 
 using namespace mozilla::media;
 
 namespace mozilla {
 
 #ifdef PR_LOGGING
 PRLogModuleInfo* GetDirectShowLog();
--- a/content/media/directshow/moz.build
+++ b/content/media/directshow/moz.build
@@ -8,25 +8,28 @@ EXPORTS += [
     'AudioSinkFilter.h',
     'AudioSinkInputPin.h',
     'DirectShowDecoder.h',
     'DirectShowReader.h',
     'DirectShowUtils.h',
 ]
 
 UNIFIED_SOURCES += [
-    'AudioSinkFilter.cpp',
     'AudioSinkInputPin.cpp',
     'DirectShowDecoder.cpp',
     'DirectShowReader.cpp',
     'DirectShowUtils.cpp',
     'SampleSink.cpp',
     'SourceFilter.cpp',
 ]
 
+SOURCES += [
+    'AudioSinkFilter.cpp',
+]
+
 # If WebRTC isn't being built, we need to compile the DirectShow base classes so that
 # they're available at link time.
 if not CONFIG['MOZ_WEBRTC']:
     SOURCES += [ '%s/%s' % (TOPSRCDIR, p) for p in [
         'media/webrtc/trunk/webrtc/modules/video_capture/windows/BaseFilter.cpp',
         'media/webrtc/trunk/webrtc/modules/video_capture/windows/BaseInputPin.cpp',
         'media/webrtc/trunk/webrtc/modules/video_capture/windows/BasePin.cpp',
         'media/webrtc/trunk/webrtc/modules/video_capture/windows/MediaType.cpp',
--- a/content/media/wmf/WMF.h
+++ b/content/media/wmf/WMF.h
@@ -24,17 +24,16 @@ which makes Windows Media Foundation una
 #include <mfidl.h>
 #include <mfreadwrite.h>
 #include <mfobjects.h>
 #include <ks.h>
 #include <stdio.h>
 #include <mferror.h>
 #include <propvarutil.h>
 #include <wmcodecdsp.h>
-#include <initguid.h>
 #include <d3d9.h>
 #include <dxva2api.h>
 #include <wmcodecdsp.h>
 #include <codecapi.h>
 
 // Some SDK versions don't define the AAC decoder CLSID.
 #ifndef CLSID_CMSAACDecMFT
 extern "C" const CLSID CLSID_CMSAACDecMFT;
--- a/content/media/wmf/WMFUtils.cpp
+++ b/content/media/wmf/WMFUtils.cpp
@@ -9,16 +9,17 @@
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/WindowsVersion.h"
 #include "prlog.h"
 #include "nsThreadUtils.h"
 #include "nsWindowsHelpers.h"
 #include "mozilla/CheckedInt.h"
 #include "VideoUtils.h"
+#include <initguid.h>
 
 #ifdef WMF_MUST_DEFINE_AAC_MFT_CLSID
 // Some SDK versions don't define the AAC decoder CLSID.
 // {32D186A7-218F-4C75-8876-DD77273A8999}
 DEFINE_GUID(CLSID_CMSAACDecMFT, 0x32D186A7, 0x218F, 0x4C75, 0x88, 0x76, 0xDD, 0x77, 0x27, 0x3A, 0x89, 0x99);
 #endif
 
 namespace mozilla {
--- a/content/media/wmf/moz.build
+++ b/content/media/wmf/moz.build
@@ -13,14 +13,17 @@ EXPORTS += [
 ]
 
 UNIFIED_SOURCES += [
     'DXVA2Manager.cpp',
     'WMFByteStream.cpp',
     'WMFDecoder.cpp',
     'WMFReader.cpp',
     'WMFSourceReaderCallback.cpp',
+]
+
+SOURCES += [
     'WMFUtils.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'gklayout'
--- a/gfx/2d/DrawTargetD2D1.cpp
+++ b/gfx/2d/DrawTargetD2D1.cpp
@@ -1,13 +1,14 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#include <initguid.h>
 #include "DrawTargetD2D1.h"
 #include "DrawTargetD2D.h"
 #include "FilterNodeSoftware.h"
 #include "GradientStopsD2D.h"
 #include "SourceSurfaceD2D1.h"
 #include "SourceSurfaceD2D.h"
 #include "RadialGradientEffectD2D1.h"
 
--- a/gfx/2d/RadialGradientEffectD2D1.cpp
+++ b/gfx/2d/RadialGradientEffectD2D1.cpp
@@ -45,21 +45,21 @@ static const PCWSTR kXmlDescription =
             <Property name='Transform' type='matrix3x2'>
               <Property name='DisplayName' type='string' value='Transform applied to the pattern'/>
             </Property>
 
         </Effect>
         );
 
 // {FB947CDA-718E-40CC-AE7B-D255830D7D14}
-DEFINE_GUID(GUID_SampleRadialGradientPS, 
-0xfb947cda, 0x718e, 0x40cc, 0xae, 0x7b, 0xd2, 0x55, 0x83, 0xd, 0x7d, 0x14);
+static const GUID GUID_SampleRadialGradientPS =
+  {0xfb947cda, 0x718e, 0x40cc, {0xae, 0x7b, 0xd2, 0x55, 0x83, 0xd, 0x7d, 0x14}};
 // {2C468128-6546-453C-8E25-F2DF0DE10A0F}
-DEFINE_GUID(GUID_SampleRadialGradientA0PS, 
-0x2c468128, 0x6546, 0x453c, 0x8e, 0x25, 0xf2, 0xdf, 0xd, 0xe1, 0xa, 0xf);
+static const GUID GUID_SampleRadialGradientA0PS =
+  {0x2c468128, 0x6546, 0x453c, {0x8e, 0x25, 0xf2, 0xdf, 0xd, 0xe1, 0xa, 0xf}};
 
 namespace mozilla {
 namespace gfx {
 
 RadialGradientEffectD2D1::RadialGradientEffectD2D1()
   : mRefCount(0)
   , mCenter1(D2D1::Vector2F(0, 0))
   , mCenter2(D2D1::Vector2F(0, 0))
--- a/gfx/2d/gfx2d.vcxproj
+++ b/gfx/2d/gfx2d.vcxproj
@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
       <Configuration>Debug</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Win32">
       <Configuration>Release</Configuration>
@@ -37,17 +37,17 @@
     <ExecutablePath>$(DXSDK_DIR)\Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
     <IncludePath>$(ProjectDir);$(IncludePath)</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <LinkIncremental>true</LinkIncremental>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
-      <PreprocessorDefinitions>INITGUID;USE_SSE2;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);GFX_LOG_DEBUG;GFX_LOG_WARNING;MFBT_STAND_ALONE;XP_WIN</PreprocessorDefinitions>
+      <PreprocessorDefinitions>USE_SSE2;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);GFX_LOG_DEBUG;GFX_LOG_WARNING;MFBT_STAND_ALONE;XP_WIN</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <Optimization>Disabled</Optimization>
     </ClCompile>
     <Link>
       <TargetMachine>MachineX86</TargetMachine>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -57,17 +57,17 @@
     </Link>
     <PreBuildEvent>
       <Command>xcopy $(ProjectDir)..\..\mfbt\*.h mozilla\ /Y</Command>
       <Message>Copying MFBT files</Message>
     </PreBuildEvent>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
-      <PreprocessorDefinitions>INITGUID;USE_SSE2;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>USE_SSE2;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <AdditionalIncludeDirectories>./</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <TargetMachine>MachineX86</TargetMachine>
       <GenerateDebugInformation>true</GenerateDebugInformation>
--- a/gfx/2d/moz.build
+++ b/gfx/2d/moz.build
@@ -47,17 +47,16 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wi
     SOURCES += [
         'DrawTargetD2D.cpp',
         'PathD2D.cpp',
         'ScaledFontDWrite.cpp',
         'SourceSurfaceD2D.cpp',
         'SourceSurfaceD2DTarget.cpp',
     ]
     DEFINES['WIN32'] = True
-    DEFINES['INITGUID'] = True
     # For Direct2D 1.1 we require WINSDK_MAXVER 0x06020000 or higher.
     if CONFIG['MOZ_ENABLE_DIRECT2D1_1']:
         SOURCES += [
             'DrawTargetD2D1.cpp',
             'FilterNodeD2D1.cpp',
             'RadialGradientEffectD2D1.cpp',
             'SourceSurfaceD2D1.cpp'
         ]
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -55,23 +55,23 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
             'd3d9/TextureD3D9.h',
         ]
         UNIFIED_SOURCES += [
             'd3d9/CanvasLayerD3D9.cpp',
             'd3d9/ColorLayerD3D9.cpp',
             'd3d9/ContainerLayerD3D9.cpp',
             'd3d9/ImageLayerD3D9.cpp',
             'd3d9/LayerManagerD3D9.cpp',
-            'd3d9/Nv3DVUtils.cpp',
             'd3d9/TextureD3D9.cpp',
             'd3d9/ThebesLayerD3D9.cpp',
         ]
         SOURCES += [
             'd3d9/CompositorD3D9.cpp',
             'd3d9/DeviceManagerD3D9.cpp',
+            'd3d9/Nv3DVUtils.cpp',
         ]
     if CONFIG['MOZ_ENABLE_D3D10_LAYER']:
         EXPORTS += [
             'd3d10/LayerManagerD3D10.h',
             'd3d10/ReadbackManagerD3D10.h',
         ]
         EXPORTS.mozilla.layers += [
             'd3d11/CompositorD3D11.h',
--- a/media/webrtc/moz.build
+++ b/media/webrtc/moz.build
@@ -24,17 +24,18 @@ webrtc_non_unified_sources = [
     'trunk/webrtc/modules/audio_processing/echo_cancellation_impl.cc',           # Because of name clash in the MapError function
     'trunk/webrtc/modules/audio_processing/echo_control_mobile_impl.cc',         # Because of name clash in the MapError function
     'trunk/webrtc/modules/audio_processing/gain_control_impl.cc',                # Because of name clash in the Handle typedef
     'trunk/webrtc/modules/audio_processing/high_pass_filter_impl.cc',            # Because of name clash in the Handle typedef
     'trunk/webrtc/modules/audio_processing/noise_suppression_impl.cc',           # Because of name clash in the Handle typedef
     'trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.mm',       # Because of name clash in the nsAutoreleasePool class
     'trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.mm',  # Because of name clash in the nsAutoreleasePool class
     'trunk/webrtc/modules/video_capture/windows/device_info_ds.cc',              # Because of the MEDIASUBTYPE_HDYC variable
-    'trunk/webrtc/modules/video_capture/windows/sink_filter_ds.cc',              # Because of the MEDIASUBTYPE_HDYC variable
+    'trunk/webrtc/modules/video_capture/windows/help_functions_ds.cc',           # Because of initguid.h
+    'trunk/webrtc/modules/video_capture/windows/sink_filter_ds.cc',              # Because of the MEDIASUBTYPE_HDYC variable and initguid.h
 ]
 
 GYP_DIRS += ['trunk']
 
 GYP_DIRS['trunk'].input = 'trunk/peerconnection.gyp'
 GYP_DIRS['trunk'].variables = gyp_vars
 GYP_DIRS['trunk'].sandbox_vars['FINAL_LIBRARY'] = 'webrtc'
 GYP_DIRS['trunk'].non_unified_sources += webrtc_non_unified_sources
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -659,16 +659,21 @@ class RecursiveMakeBackend(CommonBackend
                     '#error "%(cppfile)s uses PL_ARENA_CONST_ALIGN_MASK, '
                     'so it cannot be built in unified mode."\n'
                     '#undef PL_ARENA_CONST_ALIGN_MASK\n'
                     '#endif\n'
                     '#ifdef FORCE_PR_LOG\n'
                     '#error "%(cppfile)s forces NSPR logging, '
                     'so it cannot be built in unified mode."\n'
                     '#undef FORCE_PR_LOG\n'
+                    '#endif\n'
+                    '#ifdef INITGUID\n'
+                    '#error "%(cppfile)s defines INITGUID, '
+                    'so it cannot be built in unified mode."\n'
+                    '#undef INITGUID\n'
                     '#endif')
                 f.write('\n'.join(includeTemplate % { "cppfile": s } for
                                   s in source_filenames))
 
         if include_curdir_build_rules:
             makefile.add_statement('\n'
                 '# Make sometimes gets confused between "foo" and "$(CURDIR)/foo".\n'
                 '# Help it out by explicitly specifiying dependencies.')
--- a/toolkit/components/downloads/nsDownloadScanner.h
+++ b/toolkit/components/downloads/nsDownloadScanner.h
@@ -6,17 +6,16 @@
 /* vim: se cin sw=2 ts=2 et : */
 
 #ifndef nsDownloadScanner_h_
 #define nsDownloadScanner_h_
 
 #ifdef WIN32_LEAN_AND_MEAN
 #undef WIN32_LEAN_AND_MEAN
 #endif
-#define INITGUID
 #include <windows.h>
 #define AVVENDOR
 #include <objidl.h>
 #include <msoav.h>
 #include <shlobj.h>
 
 #include "nsAutoPtr.h"
 #include "nsThreadUtils.h"
--- a/uriloader/exthandler/win/nsOSHelperAppService.h
+++ b/uriloader/exthandler/win/nsOSHelperAppService.h
@@ -15,17 +15,16 @@
 #include "nsMIMEInfoImpl.h"
 #include "nsCOMPtr.h"
 #include <windows.h>
 
 #ifdef _WIN32_WINNT
 #undef _WIN32_WINNT
 #endif
 #define _WIN32_WINNT 0x0600
-#define INITGUID
 #include <shlobj.h>
 
 class nsMIMEInfoWin;
 
 class nsOSHelperAppService : public nsExternalHelperAppService
 {
 public:
   nsOSHelperAppService();
--- a/widget/windows/nsToolkit.cpp
+++ b/widget/windows/nsToolkit.cpp
@@ -7,17 +7,16 @@
 #include "nsAppShell.h"
 #include "nsWindow.h"
 #include "nsWidgetsCID.h"
 #include "prmon.h"
 #include "prtime.h"
 #include "nsIServiceManager.h"
 #include "nsComponentManagerUtils.h"
 #include <objbase.h>
-#include <initguid.h>
 #include "WinUtils.h"
 
 #include "nsUXThemeData.h"
 
 // unknwn.h is needed to build with WIN32_LEAN_AND_MEAN
 #include <unknwn.h>
 
 using namespace mozilla::widget;