1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Windows: Fixed some build errors and warnings when using Clang in Visual Studio

This commit is contained in:
ed 2020-02-06 11:15:21 +00:00
parent 4446764fa9
commit 5bda9de977
15 changed files with 65 additions and 73 deletions

View file

@ -514,7 +514,6 @@ private:
IDirectSoundBuffer* pOutputBuffer;
DWORD writeOffset;
int totalBytesPerBuffer, bytesPerBuffer;
unsigned int lastPlayCursor;
bool firstPlayTime;
int64 lastPlayTime, ticksPerBuffer;
@ -1215,13 +1214,13 @@ public:
initialiseDSoundFunctions();
}
void scanForDevices()
void scanForDevices() override
{
hasScanned = true;
deviceList.scan();
}
StringArray getDeviceNames (bool wantInputNames) const
StringArray getDeviceNames (bool wantInputNames) const override
{
jassert (hasScanned); // need to call scanForDevices() before doing this
@ -1229,13 +1228,13 @@ public:
: deviceList.outputDeviceNames;
}
int getDefaultDeviceIndex (bool /*forInput*/) const
int getDefaultDeviceIndex (bool /*forInput*/) const override
{
jassert (hasScanned); // need to call scanForDevices() before doing this
return 0;
}
int getIndexOfDevice (AudioIODevice* device, bool asInput) const
int getIndexOfDevice (AudioIODevice* device, bool asInput) const override
{
jassert (hasScanned); // need to call scanForDevices() before doing this
@ -1246,10 +1245,10 @@ public:
return -1;
}
bool hasSeparateInputsAndOutputs() const { return true; }
bool hasSeparateInputsAndOutputs() const override { return true; }
AudioIODevice* createDevice (const String& outputDeviceName,
const String& inputDeviceName)
const String& inputDeviceName) override
{
jassert (hasScanned); // need to call scanForDevices() before doing this

View file

@ -1445,7 +1445,7 @@ public:
}
//==============================================================================
void scanForDevices()
void scanForDevices() override
{
hasScanned = true;
@ -1458,7 +1458,7 @@ public:
outputDeviceIds, inputDeviceIds);
}
StringArray getDeviceNames (bool wantInputNames) const
StringArray getDeviceNames (bool wantInputNames) const override
{
jassert (hasScanned); // need to call scanForDevices() before doing this
@ -1466,13 +1466,13 @@ public:
: outputDeviceNames;
}
int getDefaultDeviceIndex (bool /*forInput*/) const
int getDefaultDeviceIndex (bool /*forInput*/) const override
{
jassert (hasScanned); // need to call scanForDevices() before doing this
return 0;
}
int getIndexOfDevice (AudioIODevice* device, bool asInput) const
int getIndexOfDevice (AudioIODevice* device, bool asInput) const override
{
jassert (hasScanned); // need to call scanForDevices() before doing this
@ -1483,10 +1483,10 @@ public:
return -1;
}
bool hasSeparateInputsAndOutputs() const { return true; }
bool hasSeparateInputsAndOutputs() const override { return true; }
AudioIODevice* createDevice (const String& outputDeviceName,
const String& inputDeviceName)
const String& inputDeviceName) override
{
jassert (hasScanned); // need to call scanForDevices() before doing this

View file

@ -145,7 +145,7 @@ static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
/* Optimized code path for x86_64 builds. Uses SSE2 intrinsics. This can be
done safely because all x86_64 CPUs supports SSE2. */
#if (! JUCE_PROJUCER_LIVE_BUILD) && ((defined(_MSC_VER) && defined(_WIN64)) || (defined(__GNUC__) && defined (__x86_64__)))
#if ! JUCE_PROJUCER_LIVE_BUILD && ((JUCE_MSVC && JUCE_64BIT) || (JUCE_GCC && defined (__x86_64__)))
# define VORBIS_FPU_CONTROL
typedef ogg_int16_t vorbis_fpu_control;

View file

@ -48,7 +48,11 @@
#if JUCE_WINDOWS
#include <ctime>
#if ! JUCE_MINGW
#if JUCE_MINGW
#include <ws2spi.h>
#include <cstdio>
#include <locale.h>
#else
#pragma warning (push)
#pragma warning (disable: 4091)
#include <Dbghelp.h>
@ -59,12 +63,6 @@
#endif
#endif
#if JUCE_MINGW
#include <ws2spi.h>
#include <cstdio>
#include <locale.h>
#endif
#else
#if JUCE_LINUX || JUCE_ANDROID
#include <sys/types.h>

View file

@ -107,7 +107,7 @@
//==============================================================================
/** Config: JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
In a Visual C++ build, this can be used to stop the required system libs being
In a Windows build, this can be used to stop the required system libs being
automatically added to the link stage.
*/
#ifndef JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES

View file

@ -176,7 +176,7 @@
#pragma warning (4: 4511 4512 4100)
#endif
#if JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#if ! JUCE_MINGW && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#pragma comment (lib, "kernel32.lib")
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "wininet.lib")

View file

@ -23,7 +23,7 @@
namespace juce
{
#if ! JUCE_MINGW
#if JUCE_MSVC
#pragma intrinsic (__cpuid)
#pragma intrinsic (__rdtsc)
#endif
@ -41,7 +41,7 @@ void Logger::outputDebugString (const String& text)
//==============================================================================
#if JUCE_MINGW
#if JUCE_MINGW || JUCE_CLANG
static void callCPUID (int result[4], uint32 type)
{
uint32 la = result[0], lb = result[1], lc = result[2], ld = result[3];

View file

@ -48,13 +48,13 @@ namespace DirectWriteTypeLayout
return ComBaseClassHelper<IDWriteTextRenderer>::QueryInterface (refId, result);
}
JUCE_COMRESULT IsPixelSnappingDisabled (void* /*clientDrawingContext*/, BOOL* isDisabled) override
JUCE_COMRESULT IsPixelSnappingDisabled (void* /*clientDrawingContext*/, BOOL* isDisabled) noexcept override
{
*isDisabled = FALSE;
return S_OK;
}
JUCE_COMRESULT GetCurrentTransform (void*, DWRITE_MATRIX* matrix) override
JUCE_COMRESULT GetCurrentTransform (void*, DWRITE_MATRIX* matrix) noexcept override
{
matrix->m11 = 1.0f; matrix->m12 = 0.0f;
matrix->m21 = 0.0f; matrix->m22 = 1.0f;
@ -62,30 +62,30 @@ namespace DirectWriteTypeLayout
return S_OK;
}
JUCE_COMRESULT GetPixelsPerDip (void*, FLOAT* pixelsPerDip) override
JUCE_COMRESULT GetPixelsPerDip (void*, FLOAT* pixelsPerDip) noexcept override
{
*pixelsPerDip = 1.0f;
return S_OK;
}
JUCE_COMRESULT DrawUnderline (void*, FLOAT, FLOAT, DWRITE_UNDERLINE const*, IUnknown*) override
JUCE_COMRESULT DrawUnderline (void*, FLOAT, FLOAT, DWRITE_UNDERLINE const*, IUnknown*) noexcept override
{
return E_NOTIMPL;
}
JUCE_COMRESULT DrawStrikethrough (void*, FLOAT, FLOAT, DWRITE_STRIKETHROUGH const*, IUnknown*) override
JUCE_COMRESULT DrawStrikethrough (void*, FLOAT, FLOAT, DWRITE_STRIKETHROUGH const*, IUnknown*) noexcept override
{
return E_NOTIMPL;
}
JUCE_COMRESULT DrawInlineObject (void*, FLOAT, FLOAT, IDWriteInlineObject*, BOOL, BOOL, IUnknown*) override
JUCE_COMRESULT DrawInlineObject (void*, FLOAT, FLOAT, IDWriteInlineObject*, BOOL, BOOL, IUnknown*) noexcept override
{
return E_NOTIMPL;
}
JUCE_COMRESULT DrawGlyphRun (void* clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_MEASURING_MODE,
DWRITE_GLYPH_RUN const* glyphRun, DWRITE_GLYPH_RUN_DESCRIPTION const* runDescription,
IUnknown* clientDrawingEffect) override
IUnknown* clientDrawingEffect) noexcept override
{
auto layout = static_cast<TextLayout*> (clientDrawingContext);
@ -207,7 +207,7 @@ namespace DirectWriteTypeLayout
DWRITE_FONT_METRICS dwFontMetrics;
dwFontFace->GetMetrics (&dwFontMetrics);
const float totalHeight = (float) (std::abs (dwFontMetrics.ascent) + std::abs (dwFontMetrics.descent));
const float totalHeight = (float) (dwFontMetrics.ascent + dwFontMetrics.descent);
return dwFontMetrics.designUnitsPerEm / totalHeight;
}

View file

@ -285,7 +285,7 @@ private:
{
PathGeometrySink() : ComBaseClassHelper<IDWriteGeometrySink> (0) {}
void __stdcall AddBeziers (const D2D1_BEZIER_SEGMENT* beziers, UINT beziersCount) override
void __stdcall AddBeziers (const D2D1_BEZIER_SEGMENT* beziers, UINT beziersCount) noexcept override
{
for (UINT i = 0; i < beziersCount; ++i)
path.cubicTo (convertPoint (beziers[i].point1),
@ -293,30 +293,30 @@ private:
convertPoint (beziers[i].point3));
}
void __stdcall AddLines (const D2D1_POINT_2F* points, UINT pointsCount) override
void __stdcall AddLines (const D2D1_POINT_2F* points, UINT pointsCount) noexcept override
{
for (UINT i = 0; i < pointsCount; ++i)
path.lineTo (convertPoint (points[i]));
}
void __stdcall BeginFigure (D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN) override
void __stdcall BeginFigure (D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN) noexcept override
{
path.startNewSubPath (convertPoint (startPoint));
}
void __stdcall EndFigure (D2D1_FIGURE_END figureEnd) override
void __stdcall EndFigure (D2D1_FIGURE_END figureEnd) noexcept override
{
if (figureEnd == D2D1_FIGURE_END_CLOSED)
path.closeSubPath();
}
void __stdcall SetFillMode (D2D1_FILL_MODE fillMode) override
void __stdcall SetFillMode (D2D1_FILL_MODE fillMode) noexcept override
{
path.setUsingNonZeroWinding (fillMode == D2D1_FILL_MODE_WINDING);
}
void __stdcall SetSegmentFlags (D2D1_PATH_SEGMENT) override {}
JUCE_COMRESULT Close() override { return S_OK; }
void __stdcall SetSegmentFlags (D2D1_PATH_SEGMENT) noexcept override {}
JUCE_COMRESULT Close() noexcept override { return S_OK; }
Path path;

View file

@ -71,25 +71,21 @@
#include <exdispid.h>
#endif
#if JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#if JUCE_MINGW
#include <imm.h>
#elif ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#pragma comment(lib, "vfw32.lib")
#pragma comment(lib, "imm32.lib")
#endif
#if JUCE_OPENGL
#if JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#if JUCE_OPENGL
#pragma comment(lib, "OpenGL32.Lib")
#pragma comment(lib, "GlU32.Lib")
#endif
#endif
#if JUCE_DIRECT2D && JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#pragma comment (lib, "Dwrite.lib")
#pragma comment (lib, "D2d1.lib")
#endif
#if JUCE_MINGW
#include <imm.h>
#if JUCE_DIRECT2D
#pragma comment (lib, "Dwrite.lib")
#pragma comment (lib, "D2d1.lib")
#endif
#endif
//==============================================================================

View file

@ -125,8 +125,8 @@ namespace DragAndDropHelpers
class JuceDataObject : public ComBaseClassHelper <IDataObject>
{
public:
JuceDataObject (JuceDropSource* s, const FORMATETC* f, const STGMEDIUM* m)
: dropSource (s), format (f), medium (m)
JuceDataObject (const FORMATETC* f, const STGMEDIUM* m)
: format (f), medium (m)
{
}
@ -203,7 +203,6 @@ namespace DragAndDropHelpers
JUCE_COMRESULT EnumDAdvise (IEnumSTATDATA**) { return OLE_E_ADVISENOTSUPPORTED; }
private:
JuceDropSource* const dropSource;
const FORMATETC* const format;
const STGMEDIUM* const medium;
@ -255,7 +254,7 @@ namespace DragAndDropHelpers
OleInitialize (0);
auto source = new JuceDropSource();
auto data = new JuceDataObject (source, &format, &medium);
auto data = new JuceDataObject (&format, &medium);
DWORD effect;
DoDragDrop (data, source, whatToDo, &effect);

View file

@ -2241,7 +2241,7 @@ private:
}
}
void setIcon (const Image& newIcon)
void setIcon (const Image& newIcon) override
{
if (auto hicon = IconConverters::createHICONFromImage (newIcon, TRUE, 0, 0))
{

View file

@ -153,12 +153,12 @@ private:
{
EventHandler (WebBrowserComponent& w) : ComponentMovementWatcher (&w), owner (w) {}
JUCE_COMRESULT GetTypeInfoCount (UINT*) { return E_NOTIMPL; }
JUCE_COMRESULT GetTypeInfo (UINT, LCID, ITypeInfo**) { return E_NOTIMPL; }
JUCE_COMRESULT GetIDsOfNames (REFIID, LPOLESTR*, UINT, LCID, DISPID*) { return E_NOTIMPL; }
JUCE_COMRESULT GetTypeInfoCount (UINT*) override { return E_NOTIMPL; }
JUCE_COMRESULT GetTypeInfo (UINT, LCID, ITypeInfo**) override { return E_NOTIMPL; }
JUCE_COMRESULT GetIDsOfNames (REFIID, LPOLESTR*, UINT, LCID, DISPID*) override { return E_NOTIMPL; }
JUCE_COMRESULT Invoke (DISPID dispIdMember, REFIID /*riid*/, LCID /*lcid*/, WORD /*wFlags*/, DISPPARAMS* pDispParams,
VARIANT* /*pVarResult*/, EXCEPINFO* /*pExcepInfo*/, UINT* /*puArgErr*/)
VARIANT* /*pVarResult*/, EXCEPINFO* /*pExcepInfo*/, UINT* /*puArgErr*/) override
{
if (dispIdMember == DISPID_BEFORENAVIGATE2)
{

View file

@ -48,7 +48,7 @@
#elif JUCE_WINDOWS
#include <windowsx.h>
#if JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#if ! JUCE_MINGW && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#pragma comment(lib, "OpenGL32.Lib")
#endif

View file

@ -45,24 +45,24 @@
#import <AVKit/AVKit.h>
//==============================================================================
#elif JUCE_MSVC
#elif JUCE_WINDOWS && ! JUCE_MINGW
/* If you're using the camera classes, you'll need access to a few DirectShow headers.
These files are provided in the normal Windows SDK. */
#include <dshow.h>
#include <dshowasf.h>
#include <evr.h>
#if JUCE_USE_CAMERA && JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#pragma comment (lib, "Strmiids.lib")
#pragma comment (lib, "wmvcore.lib")
#endif
#if JUCE_MEDIAFOUNDATION && JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#pragma comment (lib, "mfuuid.lib")
#endif
#if JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#if ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#pragma comment (lib, "strmiids.lib")
#if JUCE_USE_CAMERA
#pragma comment (lib, "Strmiids.lib")
#pragma comment (lib, "wmvcore.lib")
#endif
#if JUCE_MEDIAFOUNDATION
#pragma comment (lib, "mfuuid.lib")
#endif
#endif
#endif