mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
More zero -> nullptr fixes
This commit is contained in:
parent
132017558f
commit
359132ed55
15 changed files with 28 additions and 21 deletions
|
|
@ -24,7 +24,7 @@ class Chain : public Test
|
|||
public:
|
||||
Chain()
|
||||
{
|
||||
b2Body* ground = NULL;
|
||||
b2Body* ground = {};
|
||||
{
|
||||
b2BodyDef bd;
|
||||
ground = m_world->CreateBody(&bd);
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ public:
|
|||
auto inputSamp = 0.0f;
|
||||
|
||||
for (auto j = numInputChannels; --j >= 0;)
|
||||
if (inputChannelData[j] != 0)
|
||||
if (inputChannelData[j] != nullptr)
|
||||
inputSamp += inputChannelData[j][i];
|
||||
|
||||
recordingBuffer[recordedSampleNum] = inputSamp;
|
||||
|
|
@ -164,7 +164,7 @@ public:
|
|||
auto outputSamp = (playingSampleNum < testSound.getNumSamples()) ? playBuffer[playingSampleNum] : 0.0f;
|
||||
|
||||
for (auto j = numOutputChannels; --j >= 0;)
|
||||
if (outputChannelData[j] != 0)
|
||||
if (outputChannelData[j] != nullptr)
|
||||
outputChannelData[j][i] = outputSamp;
|
||||
|
||||
++playingSampleNum;
|
||||
|
|
@ -174,7 +174,7 @@ public:
|
|||
{
|
||||
// We need to clear the output buffers, in case they're full of junk..
|
||||
for (int i = 0; i < numOutputChannels; ++i)
|
||||
if (outputChannelData[i] != 0)
|
||||
if (outputChannelData[i] != nullptr)
|
||||
zeromem (outputChannelData[i], sizeof (float) * (size_t) numSamples);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,7 +235,8 @@ private:
|
|||
{
|
||||
AlertWindow::showOkCancelBox (AlertWindow::QuestionIcon, "This is an ok/cancel AlertWindow",
|
||||
"And this is the AlertWindow's message. Blah blah blah blah blah blah blah blah blah blah blah blah blah.",
|
||||
{}, {}, 0, ModalCallbackFunction::forComponent (alertBoxResultChosen, this));
|
||||
{}, {}, {},
|
||||
ModalCallbackFunction::forComponent (alertBoxResultChosen, this));
|
||||
}
|
||||
else if (type == calloutBoxWindow)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ private:
|
|||
{
|
||||
if (position.get() != nullptr)
|
||||
{
|
||||
glContext.extensions.glVertexAttribPointer (position->attributeID, 3, GL_FLOAT, GL_FALSE, sizeof (Vertex), 0);
|
||||
glContext.extensions.glVertexAttribPointer (position->attributeID, 3, GL_FLOAT, GL_FALSE, sizeof (Vertex), nullptr);
|
||||
glContext.extensions.glEnableVertexAttribArray (position->attributeID);
|
||||
}
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ private:
|
|||
vertexBuffer->bind();
|
||||
|
||||
glAttributes.enable (glContext);
|
||||
glDrawElements (GL_TRIANGLES, vertexBuffer->numIndices, GL_UNSIGNED_INT, 0);
|
||||
glDrawElements (GL_TRIANGLES, vertexBuffer->numIndices, GL_UNSIGNED_INT, nullptr);
|
||||
glAttributes.disable (glContext);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ struct OpenGLDemoClasses
|
|||
{
|
||||
if (position.get() != nullptr)
|
||||
{
|
||||
openGLContext.extensions.glVertexAttribPointer (position->attributeID, 3, GL_FLOAT, GL_FALSE, sizeof (Vertex), 0);
|
||||
openGLContext.extensions.glVertexAttribPointer (position->attributeID, 3, GL_FLOAT, GL_FALSE, sizeof (Vertex), nullptr);
|
||||
openGLContext.extensions.glEnableVertexAttribArray (position->attributeID);
|
||||
}
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ struct OpenGLDemoClasses
|
|||
vertexBuffer->bind();
|
||||
|
||||
attributes.enable (openGLContext);
|
||||
glDrawElements (GL_TRIANGLES, vertexBuffer->numIndices, GL_UNSIGNED_INT, 0);
|
||||
glDrawElements (GL_TRIANGLES, vertexBuffer->numIndices, GL_UNSIGNED_INT, nullptr);
|
||||
attributes.disable (openGLContext);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ struct ButtonsPage : public Component
|
|||
over.setStrokeThickness (4.0f);
|
||||
|
||||
auto* db = addToList (new DrawableButton (String (i + 5) + " points", DrawableButton::ImageAboveTextLabel));
|
||||
db->setImages (&normal, &over, 0);
|
||||
db->setImages (&normal, &over, nullptr);
|
||||
db->setClickingTogglesState (true);
|
||||
db->setRadioGroupId (23456);
|
||||
|
||||
|
|
@ -391,7 +391,7 @@ struct ButtonsPage : public Component
|
|||
{
|
||||
// create an image-on-button-shape button from the same drawables..
|
||||
auto db = addToList (new DrawableButton ("Button 3", DrawableButton::ImageOnButtonBackground));
|
||||
db->setImages (&normal, 0, 0);
|
||||
db->setImages (&normal, nullptr, nullptr);
|
||||
db->setBounds (260, 160, 110, 25);
|
||||
db->setTooltip ("This is a DrawableButton on a standard button background");
|
||||
db->onClick = popupMessageCallback;
|
||||
|
|
@ -636,7 +636,7 @@ private:
|
|||
{
|
||||
auto* drawable = new DrawableImage();
|
||||
drawable->setImage (getImageFromAssets ("juce_icon.png"));
|
||||
return new ToolbarButton (itemId, "juce!", drawable, 0);
|
||||
return new ToolbarButton (itemId, "juce!", drawable, nullptr);
|
||||
}
|
||||
case customComboBox: return new CustomToolbarComboBox (itemId);
|
||||
default: break;
|
||||
|
|
@ -671,7 +671,7 @@ private:
|
|||
}
|
||||
|
||||
auto* image = iconsFromZipFile[iconNames.indexOf (filename)]->createCopy();
|
||||
return new ToolbarButton (itemId, text, image, 0);
|
||||
return new ToolbarButton (itemId, text, image, nullptr);
|
||||
}
|
||||
|
||||
// Demonstrates how to put a custom component into a toolbar - this one contains
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ public:
|
|||
void mouseDrag (const MouseEvent& e) override
|
||||
{
|
||||
// as there's no titlebar we have to manage the dragging ourselves
|
||||
dragger.dragComponent (this, e, 0);
|
||||
dragger.dragComponent (this, e, nullptr);
|
||||
}
|
||||
|
||||
void paint (Graphics& g) override
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ private:
|
|||
parentWidth = 50.0f, parentHeight = 50.0f;
|
||||
|
||||
Colour colour;
|
||||
Thread::ThreadID threadId = 0;
|
||||
Thread::ThreadID threadId = {};
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BouncingBallComp)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ struct Program
|
|||
|
||||
//==============================================================================
|
||||
static constexpr uint32 programHeaderSize = 10;
|
||||
const uint8* programStart = 0;
|
||||
const uint8* programStart = nullptr;
|
||||
const uint32 maxProgramSize;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@
|
|||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wsign-conversion"
|
||||
#pragma clang diagnostic ignored "-Wfloat-conversion"
|
||||
#if __has_warning("-Wzero-as-null-pointer-constant")
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#endif
|
||||
#elif defined (__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@
|
|||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#if __has_warning("-Wzero-as-null-pointer-constant")
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <climits>
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ public:
|
|||
//==============================================================================
|
||||
bool OpenGLHelpers::isContextActive()
|
||||
{
|
||||
return CGLGetCurrentContext() != 0;
|
||||
return CGLGetCurrentContext() != CGLContextObj();
|
||||
}
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -1196,7 +1196,7 @@ void OpenGLContext::copyTexture (const Rectangle<int>& targetClipArea,
|
|||
extensions.glBufferData (GL_ARRAY_BUFFER, sizeof (vertices), vertices, GL_STATIC_DRAW);
|
||||
|
||||
auto index = (GLuint) program.params.positionAttribute.attributeID;
|
||||
extensions.glVertexAttribPointer (index, 2, GL_SHORT, GL_FALSE, 4, 0);
|
||||
extensions.glVertexAttribPointer (index, 2, GL_SHORT, GL_FALSE, 4, nullptr);
|
||||
extensions.glEnableVertexAttribArray (index);
|
||||
JUCE_CHECK_OPENGL_ERROR
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public:
|
|||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
JUCE_CHECK_OPENGL_ERROR
|
||||
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
JUCE_CHECK_OPENGL_ERROR
|
||||
|
||||
context.extensions.glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, 0);
|
||||
|
|
|
|||
|
|
@ -422,7 +422,7 @@ struct ShaderPrograms : public ReferenceCountedObject
|
|||
|
||||
void bindAttributes (OpenGLContext& context)
|
||||
{
|
||||
context.extensions.glVertexAttribPointer ((GLuint) positionAttribute.attributeID, 2, GL_SHORT, GL_FALSE, 8, (void*) 0);
|
||||
context.extensions.glVertexAttribPointer ((GLuint) positionAttribute.attributeID, 2, GL_SHORT, GL_FALSE, 8, nullptr);
|
||||
context.extensions.glVertexAttribPointer ((GLuint) colourAttribute.attributeID, 4, GL_UNSIGNED_BYTE, GL_TRUE, 8, (void*) 4);
|
||||
context.extensions.glEnableVertexAttribArray ((GLuint) positionAttribute.attributeID);
|
||||
context.extensions.glEnableVertexAttribArray ((GLuint) colourAttribute.attributeID);
|
||||
|
|
@ -1279,7 +1279,7 @@ struct StateHelpers
|
|||
context.extensions.glBufferSubData (GL_ARRAY_BUFFER, 0, (GLsizeiptr) ((size_t) numVertices * sizeof (VertexInfo)), vertexData);
|
||||
// NB: If you get a random crash in here and are running in a Parallels VM, it seems to be a bug in
|
||||
// their driver.. Can't find a workaround unfortunately.
|
||||
glDrawElements (GL_TRIANGLES, (numVertices * 3) / 2, GL_UNSIGNED_SHORT, 0);
|
||||
glDrawElements (GL_TRIANGLES, (numVertices * 3) / 2, GL_UNSIGNED_SHORT, nullptr);
|
||||
JUCE_CHECK_OPENGL_ERROR
|
||||
numVertices = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue