Use nullptr

This commit is contained in:
Chris Thrasher authored and Lukas Dürrenberger committed 2024-02-19 23:30:30 +01:00
1 parent 2273672415
commit 7676dfd95e
36 files changed
+128 -130

No files matched your search

+4 -4
View File
@@ -37,7 +37,7 @@ sfMusic* sfMusic_createFromFile(const char* filename)
if (!music->This.openFromFile(filename))
{
delete music;
music = NULL;
music = nullptr;
}
return music;
@@ -51,7 +51,7 @@ sfMusic* sfMusic_createFromMemory(const void* data, size_t sizeInBytes)
if (!music->This.openFromMemory(data, sizeInBytes))
{
delete music;
music = NULL;
music = nullptr;
}
return music;
@@ -61,14 +61,14 @@ sfMusic* sfMusic_createFromMemory(const void* data, size_t sizeInBytes)
////////////////////////////////////////////////////////////
sfMusic* sfMusic_createFromStream(sfInputStream* stream)
{
CSFML_CHECK_RETURN(stream, NULL);
CSFML_CHECK_RETURN(stream, nullptr);
sfMusic* music = new sfMusic;
music->Stream = CallbackStream(stream);
if (!music->This.openFromStream(music->Stream))
{
delete music;
music = NULL;
music = nullptr;
}
return music;
+2 -2
View File
@@ -40,7 +40,7 @@ sfSound* sfSound_create(void)
////////////////////////////////////////////////////////////
sfSound* sfSound_copy(const sfSound* sound)
{
CSFML_CHECK_RETURN(sound, NULL);
CSFML_CHECK_RETURN(sound, nullptr);
return new sfSound(*sound);
}
@@ -88,7 +88,7 @@ void sfSound_setBuffer(sfSound* sound, const sfSoundBuffer* buffer)
////////////////////////////////////////////////////////////
const sfSoundBuffer* sfSound_getBuffer(const sfSound* sound)
{
CSFML_CHECK_RETURN(sound, NULL);
CSFML_CHECK_RETURN(sound, nullptr);
return sound->Buffer;
}
+7 -7
View File
@@ -39,7 +39,7 @@ sfSoundBuffer* sfSoundBuffer_createFromFile(const char* filename)
if (!buffer->This.loadFromFile(filename))
{
delete buffer;
buffer = NULL;
buffer = nullptr;
}
return buffer;
@@ -54,7 +54,7 @@ sfSoundBuffer* sfSoundBuffer_createFromMemory(const void* data, size_t sizeInByt
if (!buffer->This.loadFromMemory(data, sizeInBytes))
{
delete buffer;
buffer = NULL;
buffer = nullptr;
}
return buffer;
@@ -65,14 +65,14 @@ sfSoundBuffer* sfSoundBuffer_createFromMemory(const void* data, size_t sizeInByt
////////////////////////////////////////////////////////////
sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* stream)
{
CSFML_CHECK_RETURN(stream, NULL);
CSFML_CHECK_RETURN(stream, nullptr);
sfSoundBuffer* buffer = new sfSoundBuffer;
CallbackStream sfmlStream(stream);
if (!buffer->This.loadFromStream(sfmlStream))
{
delete buffer;
buffer = NULL;
buffer = nullptr;
}
return buffer;
@@ -87,7 +87,7 @@ sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, sfUint64
if (!buffer->This.loadFromSamples(samples, sampleCount, channelCount, sampleRate))
{
delete buffer;
buffer = NULL;
buffer = nullptr;
}
return buffer;
@@ -97,7 +97,7 @@ sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, sfUint64
////////////////////////////////////////////////////////////
sfSoundBuffer* sfSoundBuffer_copy(const sfSoundBuffer* soundBuffer)
{
CSFML_CHECK_RETURN(soundBuffer, NULL);
CSFML_CHECK_RETURN(soundBuffer, nullptr);
return new sfSoundBuffer(*soundBuffer);
}
@@ -120,7 +120,7 @@ sfBool sfSoundBuffer_saveToFile(const sfSoundBuffer* soundBuffer, const char* fi
////////////////////////////////////////////////////////////
const sfInt16* sfSoundBuffer_getSamples(const sfSoundBuffer* soundBuffer)
{
CSFML_CALL_RETURN(soundBuffer, getSamples(), NULL);
CSFML_CALL_RETURN(soundBuffer, getSamples(), nullptr);
}
+2 -2
View File
@@ -68,7 +68,7 @@ unsigned int sfSoundBufferRecorder_getSampleRate(const sfSoundBufferRecorder* so
////////////////////////////////////////////////////////////
const sfSoundBuffer* sfSoundBufferRecorder_getBuffer(const sfSoundBufferRecorder* soundBufferRecorder)
{
CSFML_CHECK_RETURN(soundBufferRecorder, NULL);
CSFML_CHECK_RETURN(soundBufferRecorder, nullptr);
soundBufferRecorder->SoundBuffer.This = soundBufferRecorder->This.getBuffer();
@@ -84,7 +84,7 @@ sfBool sfSoundBufferRecorder_setDevice(sfSoundBufferRecorder* soundBufferRecorde
////////////////////////////////////////////////////////////
const char* sfSoundBufferRecorder_getDevice(sfSoundBufferRecorder* soundBufferRecorder)
{
CSFML_CHECK_RETURN(soundBufferRecorder, NULL);
CSFML_CHECK_RETURN(soundBufferRecorder, nullptr);
soundBufferRecorder->DeviceName = soundBufferRecorder->This.getDevice();
+3 -3
View File
@@ -99,7 +99,7 @@ const char** sfSoundRecorder_getAvailableDevices(size_t* count)
if (count)
*count = cstringDevices.size();
return !cstringDevices.empty() ? &cstringDevices[0] : NULL;
return !cstringDevices.empty() ? &cstringDevices[0] : nullptr;
}
@@ -108,7 +108,7 @@ const char* sfSoundRecorder_getDefaultDevice()
{
static std::string defaultDevice = sf::SoundRecorder::getDefaultDevice();
return !defaultDevice.empty() ? defaultDevice.c_str() : NULL;
return !defaultDevice.empty() ? defaultDevice.c_str() : nullptr;
}
@@ -122,7 +122,7 @@ sfBool sfSoundRecorder_setDevice(sfSoundRecorder* soundRecorder, const char* nam
////////////////////////////////////////////////////////////
const char* sfSoundRecorder_getDevice(sfSoundRecorder* soundRecorder)
{
CSFML_CHECK_RETURN(soundRecorder, NULL);
CSFML_CHECK_RETURN(soundRecorder, nullptr);
soundRecorder->DeviceName = soundRecorder->This.getDevice();
+1 -1
View File
@@ -55,7 +55,7 @@ private :
virtual bool onGetData(Chunk& data)
{
sfSoundStreamChunk chunk = {NULL, 0};
sfSoundStreamChunk chunk = {nullptr, 0};
bool ok = (myGetDataCallback(&chunk, myUserData) == sfTrue);
data.samples = chunk.samples;
+4 -4
View File
@@ -36,7 +36,7 @@
sfCircleShape* sfCircleShape_create(void)
{
sfCircleShape* shape = new sfCircleShape;
shape->Texture = NULL;
shape->Texture = nullptr;
return shape;
}
@@ -45,7 +45,7 @@ sfCircleShape* sfCircleShape_create(void)
////////////////////////////////////////////////////////////
sfCircleShape* sfCircleShape_copy(const sfCircleShape* shape)
{
CSFML_CHECK_RETURN(shape, NULL);
CSFML_CHECK_RETURN(shape, nullptr);
return new sfCircleShape(*shape);
}
@@ -179,7 +179,7 @@ sfTransform sfCircleShape_getInverseTransform(const sfCircleShape* shape)
////////////////////////////////////////////////////////////
void sfCircleShape_setTexture(sfCircleShape* shape, const sfTexture* texture, sfBool resetRect)
{
CSFML_CALL(shape, setTexture(texture ? texture->This : NULL, resetRect == sfTrue));
CSFML_CALL(shape, setTexture(texture ? texture->This : nullptr, resetRect == sfTrue));
shape->Texture = texture;
}
@@ -215,7 +215,7 @@ void sfCircleShape_setOutlineThickness(sfCircleShape* shape, float thickness)
////////////////////////////////////////////////////////////
const sfTexture* sfCircleShape_getTexture(const sfCircleShape* shape)
{
CSFML_CHECK_RETURN(shape, NULL);
CSFML_CHECK_RETURN(shape, nullptr);
return shape->Texture;
}
+2 -2
View File
@@ -51,8 +51,8 @@ inline sf::RenderStates convertRenderStates(const sfRenderStates* states)
sfmlStates.blendMode.alphaDstFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.alphaDstFactor);
sfmlStates.blendMode.alphaEquation = static_cast<sf::BlendMode::Equation>(states->blendMode.alphaEquation);
sfmlStates.transform = convertTransform(states->transform);
sfmlStates.texture = states->texture ? states->texture->This : NULL;
sfmlStates.shader = states->shader ? &states->shader->This : NULL;
sfmlStates.texture = states->texture ? states->texture->This : nullptr;
sfmlStates.shader = states->shader ? &states->shader->This : nullptr;
}
return sfmlStates;
+3 -3
View File
@@ -42,7 +42,7 @@ sfConvexShape* sfConvexShape_create(void)
////////////////////////////////////////////////////////////
sfConvexShape* sfConvexShape_copy(const sfConvexShape* shape)
{
CSFML_CHECK_RETURN(shape, NULL);
CSFML_CHECK_RETURN(shape, nullptr);
return new sfConvexShape(*shape);
}
@@ -176,7 +176,7 @@ sfTransform sfConvexShape_getInverseTransform(const sfConvexShape* shape)
////////////////////////////////////////////////////////////
void sfConvexShape_setTexture(sfConvexShape* shape, const sfTexture* texture, sfBool resetRect)
{
CSFML_CALL(shape, setTexture(texture ? texture->This : NULL, resetRect == sfTrue));
CSFML_CALL(shape, setTexture(texture ? texture->This : nullptr, resetRect == sfTrue));
shape->Texture = texture;
}
@@ -212,7 +212,7 @@ void sfConvexShape_setOutlineThickness(sfConvexShape* shape, float thickness)
////////////////////////////////////////////////////////////
const sfTexture* sfConvexShape_getTexture(const sfConvexShape* shape)
{
CSFML_CHECK_RETURN(shape, NULL);
CSFML_CHECK_RETURN(shape, nullptr);
return shape->Texture;
}
+7 -7
View File
@@ -38,7 +38,7 @@ sfFont* sfFont_createFromFile(const char* filename)
if (!font->This.loadFromFile(filename))
{
delete font;
font = NULL;
font = nullptr;
}
return font;
@@ -52,7 +52,7 @@ sfFont* sfFont_createFromMemory(const void* data, size_t sizeInBytes)
if (!font->This.loadFromMemory(data, sizeInBytes))
{
delete font;
font = NULL;
font = nullptr;
}
return font;
@@ -62,14 +62,14 @@ sfFont* sfFont_createFromMemory(const void* data, size_t sizeInBytes)
////////////////////////////////////////////////////////////
sfFont* sfFont_createFromStream(sfInputStream* stream)
{
CSFML_CHECK_RETURN(stream, NULL);
CSFML_CHECK_RETURN(stream, nullptr);
sfFont* font = new sfFont;
font->Stream = CallbackStream(stream);
if (!font->This.loadFromStream(font->Stream))
{
delete font;
font = NULL;
font = nullptr;
}
return font;
@@ -79,7 +79,7 @@ sfFont* sfFont_createFromStream(sfInputStream* stream)
////////////////////////////////////////////////////////////
sfFont* sfFont_copy(const sfFont* font)
{
CSFML_CHECK_RETURN(font, NULL);
CSFML_CHECK_RETURN(font, nullptr);
return new sfFont(*font);
}
@@ -152,7 +152,7 @@ float sfFont_getUnderlineThickness(const sfFont* font, unsigned int characterSiz
////////////////////////////////////////////////////////////
const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize)
{
CSFML_CHECK_RETURN(font, NULL);
CSFML_CHECK_RETURN(font, nullptr);
*font->Textures[characterSize].This = font->This.getTexture(characterSize);
@@ -182,7 +182,7 @@ sfBool sfFont_isSmooth(const sfFont *font)
////////////////////////////////////////////////////////////
sfFontInfo sfFont_getInfo(const sfFont* font)
{
sfFontInfo info = {NULL};
sfFontInfo info = {nullptr};
CSFML_CHECK_RETURN(font, info);
info.family = font->This.getInfo().family.c_str();
+6 -6
View File
@@ -70,7 +70,7 @@ sfImage* sfImage_createFromFile(const char* filename)
if (!image->This.loadFromFile(filename))
{
delete image;
image = NULL;
image = nullptr;
}
return image;
@@ -85,7 +85,7 @@ sfImage* sfImage_createFromMemory(const void* data, size_t sizeInBytes)
if (!image->This.loadFromMemory(data, sizeInBytes))
{
delete image;
image = NULL;
image = nullptr;
}
return image;
@@ -95,7 +95,7 @@ sfImage* sfImage_createFromMemory(const void* data, size_t sizeInBytes)
////////////////////////////////////////////////////////////
sfImage* sfImage_createFromStream(sfInputStream* stream)
{
CSFML_CHECK_RETURN(stream, NULL);
CSFML_CHECK_RETURN(stream, nullptr);
sfImage* image = new sfImage;
@@ -103,7 +103,7 @@ sfImage* sfImage_createFromStream(sfInputStream* stream)
if (!image->This.loadFromStream(sfmlStream))
{
delete image;
image = NULL;
image = nullptr;
}
return image;
@@ -113,7 +113,7 @@ sfImage* sfImage_createFromStream(sfInputStream* stream)
////////////////////////////////////////////////////////////
sfImage* sfImage_copy(const sfImage* image)
{
CSFML_CHECK_RETURN(image, NULL);
CSFML_CHECK_RETURN(image, nullptr);
return new sfImage(*image);
}
@@ -179,7 +179,7 @@ sfColor sfImage_getPixel(const sfImage* image, unsigned int x, unsigned int y)
////////////////////////////////////////////////////////////
const sfUint8* sfImage_getPixelsPtr(const sfImage* image)
{
CSFML_CALL_RETURN(image, getPixelsPtr(), NULL);
CSFML_CALL_RETURN(image, getPixelsPtr(), nullptr);
}
+3 -3
View File
@@ -42,7 +42,7 @@ sfRectangleShape* sfRectangleShape_create(void)
////////////////////////////////////////////////////////////
sfRectangleShape* sfRectangleShape_copy(const sfRectangleShape* shape)
{
CSFML_CHECK_RETURN(shape, NULL);
CSFML_CHECK_RETURN(shape, nullptr);
return new sfRectangleShape(*shape);
}
@@ -176,7 +176,7 @@ sfTransform sfRectangleShape_getInverseTransform(const sfRectangleShape* shape)
////////////////////////////////////////////////////////////
void sfRectangleShape_setTexture(sfRectangleShape* shape, const sfTexture* texture, sfBool resetRect)
{
CSFML_CALL(shape, setTexture(texture ? texture->This : NULL, resetRect == sfTrue));
CSFML_CALL(shape, setTexture(texture ? texture->This : nullptr, resetRect == sfTrue));
shape->Texture = texture;
}
@@ -212,7 +212,7 @@ void sfRectangleShape_setOutlineThickness(sfRectangleShape* shape, float thickne
////////////////////////////////////////////////////////////
const sfTexture* sfRectangleShape_getTexture(const sfRectangleShape* shape)
{
CSFML_CHECK_RETURN(shape, NULL);
CSFML_CHECK_RETURN(shape, nullptr);
return shape->Texture;
}
+2 -3
View File
@@ -33,9 +33,8 @@ sfRenderStates sfRenderStates_default() {
sfRenderStates states = {
sfBlendAlpha,
sfTransform_Identity,
0,
0,
nullptr,
nullptr,
};
return states;
}
+3 -3
View File
@@ -139,7 +139,7 @@ void sfRenderTexture_setView(sfRenderTexture* renderTexture, const sfView* view)
////////////////////////////////////////////////////////////
const sfView* sfRenderTexture_getView(const sfRenderTexture* renderTexture)
{
CSFML_CHECK_RETURN(renderTexture, NULL);
CSFML_CHECK_RETURN(renderTexture, nullptr);
return &renderTexture->CurrentView;
}
@@ -148,7 +148,7 @@ const sfView* sfRenderTexture_getView(const sfRenderTexture* renderTexture)
////////////////////////////////////////////////////////////
const sfView* sfRenderTexture_getDefaultView(const sfRenderTexture* renderTexture)
{
CSFML_CHECK_RETURN(renderTexture, NULL);
CSFML_CHECK_RETURN(renderTexture, nullptr);
return &renderTexture->DefaultView;
}
@@ -296,7 +296,7 @@ void sfRenderTexture_resetGLStates(sfRenderTexture* renderTexture)
////////////////////////////////////////////////////////////
const sfTexture* sfRenderTexture_getTexture(const sfRenderTexture* renderTexture)
{
CSFML_CHECK_RETURN(renderTexture, NULL);
CSFML_CHECK_RETURN(renderTexture, nullptr);
return renderTexture->Target;
}
+3 -3
View File
@@ -372,7 +372,7 @@ void sfRenderWindow_setView(sfRenderWindow* renderWindow, const sfView* view)
////////////////////////////////////////////////////////////
const sfView* sfRenderWindow_getView(const sfRenderWindow* renderWindow)
{
CSFML_CHECK_RETURN(renderWindow, NULL);
CSFML_CHECK_RETURN(renderWindow, nullptr);
return &renderWindow->CurrentView;
}
@@ -381,7 +381,7 @@ const sfView* sfRenderWindow_getView(const sfRenderWindow* renderWindow)
////////////////////////////////////////////////////////////
const sfView* sfRenderWindow_getDefaultView(const sfRenderWindow* renderWindow)
{
CSFML_CHECK_RETURN(renderWindow, NULL);
CSFML_CHECK_RETURN(renderWindow, nullptr);
return &renderWindow->DefaultView;
}
@@ -529,7 +529,7 @@ void sfRenderWindow_resetGLStates(sfRenderWindow* renderWindow)
////////////////////////////////////////////////////////////
sfImage* sfRenderWindow_capture(const sfRenderWindow* renderWindow)
{
CSFML_CHECK_RETURN(renderWindow, NULL);
CSFML_CHECK_RETURN(renderWindow, nullptr);
sfImage* image = new sfImage;
image->This = renderWindow->This.capture();
+4 -4
View File
@@ -76,7 +76,7 @@ sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char*
if (!success)
{
delete shader;
shader = NULL;
shader = nullptr;
}
return shader;
@@ -126,7 +126,7 @@ sfShader* sfShader_createFromMemory(const char* vertexShader, const char* geomet
if (!success)
{
delete shader;
shader = NULL;
shader = nullptr;
}
return shader;
@@ -183,7 +183,7 @@ sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputSt
if (!success)
{
delete shader;
shader = NULL;
shader = nullptr;
}
return shader;
@@ -456,7 +456,7 @@ unsigned int sfShader_getNativeHandle(const sfShader* shader)
////////////////////////////////////////////////////////////
void sfShader_bind(const sfShader* shader)
{
sf::Shader::bind(shader ? &shader->This : NULL);
sf::Shader::bind(shader ? &shader->This : nullptr);
}
+2 -2
View File
@@ -169,7 +169,7 @@ sfTransform sfShape_getInverseTransform(const sfShape* shape)
////////////////////////////////////////////////////////////
void sfShape_setTexture(sfShape* shape, const sfTexture* texture, sfBool resetRect)
{
CSFML_CALL(shape, setTexture(texture ? texture->This : NULL, resetRect == sfTrue));
CSFML_CALL(shape, setTexture(texture ? texture->This : nullptr, resetRect == sfTrue));
shape->Texture = texture;
}
@@ -205,7 +205,7 @@ void sfShape_setOutlineThickness(sfShape* shape, float thickness)
////////////////////////////////////////////////////////////
const sfTexture* sfShape_getTexture(const sfShape* shape)
{
CSFML_CHECK_RETURN(shape, NULL);
CSFML_CHECK_RETURN(shape, nullptr);
return shape->Texture;
}
+3 -3
View File
@@ -37,7 +37,7 @@
sfSprite* sfSprite_create(void)
{
sfSprite* sprite = new sfSprite;
sprite->Texture = NULL;
sprite->Texture = nullptr;
return sprite;
}
@@ -46,7 +46,7 @@ sfSprite* sfSprite_create(void)
////////////////////////////////////////////////////////////
sfSprite* sfSprite_copy(const sfSprite* sprite)
{
CSFML_CHECK_RETURN(sprite, NULL);
CSFML_CHECK_RETURN(sprite, nullptr);
return new sfSprite(*sprite);
}
@@ -205,7 +205,7 @@ void sfSprite_setColor(sfSprite* sprite, sfColor color)
////////////////////////////////////////////////////////////
const sfTexture* sfSprite_getTexture(const sfSprite* sprite)
{
CSFML_CHECK_RETURN(sprite, NULL);
CSFML_CHECK_RETURN(sprite, nullptr);
return sprite->Texture;
}
+5 -5
View File
@@ -37,7 +37,7 @@
sfText* sfText_create(void)
{
sfText* text = new sfText;
text->Font = NULL;
text->Font = nullptr;
return text;
}
@@ -46,7 +46,7 @@ sfText* sfText_create(void)
////////////////////////////////////////////////////////////
sfText* sfText_copy(const sfText* text)
{
CSFML_CHECK_RETURN(text, NULL);
CSFML_CHECK_RETURN(text, nullptr);
return new sfText(*text);
}
@@ -261,7 +261,7 @@ void sfText_setOutlineThickness(sfText* text, float thickness)
////////////////////////////////////////////////////////////
const char* sfText_getString(const sfText* text)
{
CSFML_CHECK_RETURN(text, NULL);
CSFML_CHECK_RETURN(text, nullptr);
text->String = text->This.getString().toAnsiString();
@@ -272,7 +272,7 @@ const char* sfText_getString(const sfText* text)
////////////////////////////////////////////////////////////
const sfUint32* sfText_getUnicodeString(const sfText* text)
{
CSFML_CHECK_RETURN(text, NULL);
CSFML_CHECK_RETURN(text, nullptr);
return text->This.getString().getData();
}
@@ -281,7 +281,7 @@ const sfUint32* sfText_getUnicodeString(const sfText* text)
////////////////////////////////////////////////////////////
const sfFont* sfText_getFont(const sfText* text)
{
CSFML_CHECK_RETURN(text, NULL);
CSFML_CHECK_RETURN(text, nullptr);
return text->Font;
}
+17 -17
View File
@@ -42,7 +42,7 @@ sfTexture* sfTexture_create(unsigned int width, unsigned int height)
if (!texture->This->create(width, height))
{
delete texture;
texture = NULL;
texture = nullptr;
}
return texture;
@@ -61,7 +61,7 @@ sfTexture* sfTexture_createFromFile(const char* filename, const sfIntRect* area)
if (!texture->This->loadFromFile(filename, rect))
{
delete texture;
texture = NULL;
texture = nullptr;
}
return texture;
@@ -81,7 +81,7 @@ sfTexture* sfTexture_createSrgbFromFile(const char* filename, const sfIntRect* a
if (!texture->This->loadFromFile(filename, rect))
{
delete texture;
texture = NULL;
texture = nullptr;
}
return texture;
@@ -99,7 +99,7 @@ sfTexture* sfTexture_createFromMemory(const void* data, size_t sizeInBytes, cons
if (!texture->This->loadFromMemory(data, sizeInBytes, rect))
{
delete texture;
texture = NULL;
texture = nullptr;
}
return texture;
@@ -119,7 +119,7 @@ sfTexture* sfTexture_createSrgbFromMemory(const void* data, size_t sizeInBytes,
if (!texture->This->loadFromMemory(data, sizeInBytes, rect))
{
delete texture;
texture = NULL;
texture = nullptr;
}
return texture;
@@ -129,7 +129,7 @@ sfTexture* sfTexture_createSrgbFromMemory(const void* data, size_t sizeInBytes,
////////////////////////////////////////////////////////////
sfTexture* sfTexture_createFromStream(sfInputStream* stream, const sfIntRect* area)
{
CSFML_CHECK_RETURN(stream, NULL);
CSFML_CHECK_RETURN(stream, nullptr);
sfTexture* texture = new sfTexture;
@@ -141,7 +141,7 @@ sfTexture* sfTexture_createFromStream(sfInputStream* stream, const sfIntRect* ar
if (!texture->This->loadFromStream(sfmlStream, rect))
{
delete texture;
texture = NULL;
texture = nullptr;
}
return texture;
@@ -150,7 +150,7 @@ sfTexture* sfTexture_createFromStream(sfInputStream* stream, const sfIntRect* ar
////////////////////////////////////////////////////////////
sfTexture* sfTexture_createSrgbFromStream(sfInputStream* stream, const sfIntRect* area)
{
CSFML_CHECK_RETURN(stream, NULL);
CSFML_CHECK_RETURN(stream, nullptr);
sfTexture* texture = new sfTexture;
@@ -164,7 +164,7 @@ sfTexture* sfTexture_createSrgbFromStream(sfInputStream* stream, const sfIntRect
if (!texture->This->loadFromStream(sfmlStream, rect))
{
delete texture;
texture = NULL;
texture = nullptr;
}
return texture;
@@ -174,7 +174,7 @@ sfTexture* sfTexture_createSrgbFromStream(sfInputStream* stream, const sfIntRect
////////////////////////////////////////////////////////////
sfTexture* sfTexture_createFromImage(const sfImage* image, const sfIntRect* area)
{
CSFML_CHECK_RETURN(image, NULL);
CSFML_CHECK_RETURN(image, nullptr);
sfTexture* texture = new sfTexture;
@@ -185,7 +185,7 @@ sfTexture* sfTexture_createFromImage(const sfImage* image, const sfIntRect* area
if (!texture->This->loadFromImage(image->This, rect))
{
delete texture;
texture = NULL;
texture = nullptr;
}
return texture;
@@ -194,7 +194,7 @@ sfTexture* sfTexture_createFromImage(const sfImage* image, const sfIntRect* area
////////////////////////////////////////////////////////////
sfTexture* sfTexture_createSrgbFromImage(const sfImage* image, const sfIntRect* area)
{
CSFML_CHECK_RETURN(image, NULL);
CSFML_CHECK_RETURN(image, nullptr);
sfTexture* texture = new sfTexture;
@@ -207,7 +207,7 @@ sfTexture* sfTexture_createSrgbFromImage(const sfImage* image, const sfIntRect*
if (!texture->This->loadFromImage(image->This, rect))
{
delete texture;
texture = NULL;
texture = nullptr;
}
return texture;
@@ -216,7 +216,7 @@ sfTexture* sfTexture_createSrgbFromImage(const sfImage* image, const sfIntRect*
////////////////////////////////////////////////////////////
sfTexture* sfTexture_copy(const sfTexture* texture)
{
CSFML_CHECK_RETURN(texture, NULL);
CSFML_CHECK_RETURN(texture, nullptr);
return new sfTexture(*texture);
}
@@ -247,8 +247,8 @@ sfVector2u sfTexture_getSize(const sfTexture* texture)
////////////////////////////////////////////////////////////
sfImage* sfTexture_copyToImage(const sfTexture* texture)
{
CSFML_CHECK_RETURN(texture, NULL);
CSFML_CHECK_RETURN(texture->This, NULL);
CSFML_CHECK_RETURN(texture, nullptr);
CSFML_CHECK_RETURN(texture->This, nullptr);
sfImage* image = new sfImage;
image->This = texture->This->copyToImage();
@@ -367,7 +367,7 @@ unsigned int sfTexture_getNativeHandle(const sfTexture* texture)
////////////////////////////////////////////////////////////
void sfTexture_bind(const sfTexture* texture, sfTextureCoordinateType type)
{
sf::Texture::bind(texture ? texture->This : NULL, static_cast<sf::Texture::CoordinateType>(type));
sf::Texture::bind(texture ? texture->This : nullptr, static_cast<sf::Texture::CoordinateType>(type));
}
+1 -1
View File
@@ -50,7 +50,7 @@ struct sfTexture
sfTexture(const sfTexture& texture)
{
This = texture.This ? new sf::Texture(*texture.This) : NULL;
This = texture.This ? new sf::Texture(*texture.This) : nullptr;
OwnInstance = true;
}
+1 -1
View File
@@ -43,7 +43,7 @@ sfTransformable* sfTransformable_create(void)
////////////////////////////////////////////////////////////
sfTransformable* sfTransformable_copy(const sfTransformable* transformable)
{
CSFML_CHECK_RETURN(transformable, NULL);
CSFML_CHECK_RETURN(transformable, nullptr);
return new sfTransformable(*transformable);
}
+2 -2
View File
@@ -40,7 +40,7 @@ sfVertexArray* sfVertexArray_create(void)
////////////////////////////////////////////////////////////
sfVertexArray* sfVertexArray_copy(const sfVertexArray* vertexArray)
{
CSFML_CHECK_RETURN(vertexArray, NULL);
CSFML_CHECK_RETURN(vertexArray, nullptr);
return new sfVertexArray(*vertexArray);
}
@@ -63,7 +63,7 @@ size_t sfVertexArray_getVertexCount(const sfVertexArray* vertexArray)
////////////////////////////////////////////////////////////
sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, size_t index)
{
CSFML_CHECK_RETURN(vertexArray, NULL);
CSFML_CHECK_RETURN(vertexArray, nullptr);
// the cast is safe, sfVertex has to be binary compatible with sf::Vertex
return reinterpret_cast<sfVertex*>(&vertexArray->This[index]);
+1 -1
View File
@@ -38,7 +38,7 @@ sfVertexBuffer* sfVertexBuffer_create(unsigned int vertexCount, sfPrimitiveType
if (!buffer->This.create(vertexCount))
{
delete buffer;
buffer = NULL;
buffer = nullptr;
}
else
{
+1 -1
View File
@@ -50,7 +50,7 @@ sfView* sfView_createFromRect(sfFloatRect rectangle)
////////////////////////////////////////////////////////////
sfView* sfView_copy(const sfView* view)
{
CSFML_CHECK_RETURN(view, NULL);
CSFML_CHECK_RETURN(view, nullptr);
return new sfView(*view);
}
+2 -2
View File
@@ -35,7 +35,7 @@
#define CSFML_CHECK(object_) \
do \
{ \
if (object_ == NULL) \
if (object_ == nullptr) \
{ \
sf::err() << "SFML warning: trying to use a null " #object_ " object\n"; \
return; \
@@ -74,7 +74,7 @@
#define CSFML_CHECK_RETURN(object_, default_) \
do \
{ \
if (object_ == NULL) \
if (object_ == nullptr) \
{ \
sf::err() << "SFML warning: trying to use a null " #object_ " object\n"; \
return default_; \
+21 -21
View File
@@ -57,7 +57,7 @@ sfFtpStatus sfFtpListingResponse_getStatus(const sfFtpListingResponse* ftpListin
////////////////////////////////////////////////////////////
const char* sfFtpListingResponse_getMessage(const sfFtpListingResponse* ftpListingResponse)
{
CSFML_CHECK_RETURN(ftpListingResponse, NULL);
CSFML_CHECK_RETURN(ftpListingResponse, nullptr);
return ftpListingResponse->This.getMessage().c_str();
}
@@ -75,7 +75,7 @@ size_t sfFtpListingResponse_getCount(const sfFtpListingResponse* ftpListingRespo
////////////////////////////////////////////////////////////
const char* sfFtpListingResponse_getName(const sfFtpListingResponse* ftpListingResponse, size_t index)
{
CSFML_CHECK_RETURN(ftpListingResponse, NULL);
CSFML_CHECK_RETURN(ftpListingResponse, nullptr);
return ftpListingResponse->This.getListing()[index].c_str();
}
@@ -107,7 +107,7 @@ sfFtpStatus sfFtpDirectoryResponse_getStatus(const sfFtpDirectoryResponse* ftpDi
////////////////////////////////////////////////////////////
const char* sfFtpDirectoryResponse_getMessage(const sfFtpDirectoryResponse* ftpDirectoryResponse)
{
CSFML_CHECK_RETURN(ftpDirectoryResponse, NULL);
CSFML_CHECK_RETURN(ftpDirectoryResponse, nullptr);
return ftpDirectoryResponse->This.getMessage().c_str();
}
@@ -116,7 +116,7 @@ const char* sfFtpDirectoryResponse_getMessage(const sfFtpDirectoryResponse* ftpD
////////////////////////////////////////////////////////////
const char* sfFtpDirectoryResponse_getDirectory(const sfFtpDirectoryResponse* ftpDirectoryResponse)
{
CSFML_CHECK_RETURN(ftpDirectoryResponse, NULL);
CSFML_CHECK_RETURN(ftpDirectoryResponse, nullptr);
return ftpDirectoryResponse->This.getDirectory().c_str();
}
@@ -148,7 +148,7 @@ sfFtpStatus sfFtpResponse_getStatus(const sfFtpResponse* ftpResponse)
////////////////////////////////////////////////////////////
const char* sfFtpResponse_getMessage(const sfFtpResponse* ftpResponse)
{
CSFML_CHECK_RETURN(ftpResponse, NULL);
CSFML_CHECK_RETURN(ftpResponse, nullptr);
return ftpResponse->This.getMessage().c_str();
}
@@ -171,7 +171,7 @@ void sfFtp_destroy(sfFtp* ftp)
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_connect(sfFtp* ftp, sfIpAddress server, unsigned short port, sfTime timeout)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
sf::IpAddress SFMLServer(server.address);
@@ -182,7 +182,7 @@ sfFtpResponse* sfFtp_connect(sfFtp* ftp, sfIpAddress server, unsigned short port
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_loginAnonymous(sfFtp* ftp)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.login());
}
@@ -191,7 +191,7 @@ sfFtpResponse* sfFtp_loginAnonymous(sfFtp* ftp)
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* name, const char* password)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.login(name ? name : "", password ? password : ""));
}
@@ -200,7 +200,7 @@ sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* name, const char* password)
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_disconnect(sfFtp* ftp)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.disconnect());
}
@@ -209,7 +209,7 @@ sfFtpResponse* sfFtp_disconnect(sfFtp* ftp)
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_keepAlive(sfFtp* ftp)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.keepAlive());
}
@@ -218,7 +218,7 @@ sfFtpResponse* sfFtp_keepAlive(sfFtp* ftp)
////////////////////////////////////////////////////////////
sfFtpDirectoryResponse* sfFtp_getWorkingDirectory(sfFtp* ftp)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpDirectoryResponse(ftp->This.getWorkingDirectory());
}
@@ -227,7 +227,7 @@ sfFtpDirectoryResponse* sfFtp_getWorkingDirectory(sfFtp* ftp)
////////////////////////////////////////////////////////////
sfFtpListingResponse* sfFtp_getDirectoryListing(sfFtp* ftp, const char* directory)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpListingResponse(ftp->This.getDirectoryListing(directory ? directory : ""));
}
@@ -236,7 +236,7 @@ sfFtpListingResponse* sfFtp_getDirectoryListing(sfFtp* ftp, const char* director
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_changeDirectory(sfFtp* ftp, const char* directory)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.changeDirectory(directory ? directory : ""));
}
@@ -245,7 +245,7 @@ sfFtpResponse* sfFtp_changeDirectory(sfFtp* ftp, const char* directory)
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_parentDirectory(sfFtp* ftp)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.parentDirectory());
}
@@ -254,7 +254,7 @@ sfFtpResponse* sfFtp_parentDirectory(sfFtp* ftp)
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_createDirectory(sfFtp* ftp, const char* name)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.createDirectory(name ? name : ""));
}
@@ -263,7 +263,7 @@ sfFtpResponse* sfFtp_createDirectory(sfFtp* ftp, const char* name)
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_deleteDirectory(sfFtp* ftp, const char* name)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.deleteDirectory(name ? name : ""));
}
@@ -272,7 +272,7 @@ sfFtpResponse* sfFtp_deleteDirectory(sfFtp* ftp, const char* name)
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_renameFile(sfFtp* ftp, const char* file, const char* newName)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.renameFile(file ? file : "", newName ? newName : ""));
}
@@ -281,7 +281,7 @@ sfFtpResponse* sfFtp_renameFile(sfFtp* ftp, const char* file, const char* newNam
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_deleteFile(sfFtp* ftp, const char* name)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.deleteFile(name ? name : ""));
}
@@ -290,7 +290,7 @@ sfFtpResponse* sfFtp_deleteFile(sfFtp* ftp, const char* name)
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* remoteFile, const char* localPath, sfFtpTransferMode mode)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.download(remoteFile ? remoteFile : "",
localPath ? localPath : "",
@@ -301,7 +301,7 @@ sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* remoteFile, const char* lo
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remotePath, sfFtpTransferMode mode, sfBool append)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.upload(localFile ? localFile : "",
remotePath ? remotePath : "",
@@ -313,7 +313,7 @@ sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remot
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_sendCommand(sfFtp* ftp, const char* command, const char* parameter)
{
CSFML_CHECK_RETURN(ftp, NULL);
CSFML_CHECK_RETURN(ftp, nullptr);
return new sfFtpResponse(ftp->This.sendCommand(command ? command : "", parameter ? parameter : ""));
}
+5 -5
View File
@@ -91,9 +91,9 @@ void sfHttpResponse_destroy(sfHttpResponse* httpResponse)
////////////////////////////////////////////////////////////
const char* sfHttpResponse_getField(const sfHttpResponse* httpResponse, const char* field)
{
CSFML_CHECK_RETURN(httpResponse, NULL);
CSFML_CHECK_RETURN(httpResponse, nullptr);
if (!field)
return NULL;
return nullptr;
return httpResponse->This.getField(field).c_str();
}
@@ -125,7 +125,7 @@ unsigned int sfHttpResponse_getMinorVersion(const sfHttpResponse* httpResponse)
////////////////////////////////////////////////////////////
const char* sfHttpResponse_getBody(const sfHttpResponse* httpResponse)
{
CSFML_CHECK_RETURN(httpResponse, NULL);
CSFML_CHECK_RETURN(httpResponse, nullptr);
return httpResponse->This.getBody().c_str();
}
@@ -155,8 +155,8 @@ void sfHttp_setHost(sfHttp* http, const char* host, unsigned short port)
////////////////////////////////////////////////////////////
sfHttpResponse* sfHttp_sendRequest(sfHttp* http, const sfHttpRequest* request, sfTime timeout)
{
CSFML_CHECK_RETURN(http, NULL);
CSFML_CHECK_RETURN(request, NULL);
CSFML_CHECK_RETURN(http, nullptr);
CSFML_CHECK_RETURN(request, nullptr);
sfHttpResponse* response = new sfHttpResponse;
response->This = http->This.sendRequest(request->This, sf::microseconds(timeout.microseconds));
+2 -2
View File
@@ -40,7 +40,7 @@ sfPacket* sfPacket_create(void)
////////////////////////////////////////////////////////////
sfPacket* sfPacket_copy(const sfPacket* packet)
{
CSFML_CHECK_RETURN(packet, NULL);
CSFML_CHECK_RETURN(packet, nullptr);
return new sfPacket(*packet);
}
@@ -77,7 +77,7 @@ void sfPacket_clear(sfPacket* packet)
////////////////////////////////////////////////////////////
const void* sfPacket_getData(const sfPacket* packet)
{
CSFML_CALL_RETURN(packet, getData(), NULL);
CSFML_CALL_RETURN(packet, getData(), nullptr);
}
+1 -1
View File
@@ -43,7 +43,7 @@ sfSocketSelector* sfSocketSelector_create(void)
////////////////////////////////////////////////////////////
sfSocketSelector* sfSocketSelector_copy(const sfSocketSelector* selector)
{
CSFML_CHECK_RETURN(selector, NULL);
CSFML_CHECK_RETURN(selector, nullptr);
return new sfSocketSelector(*selector);
}
+1 -1
View File
@@ -88,7 +88,7 @@ sfSocketStatus sfTcpListener_accept(sfTcpListener* listener, sfTcpSocket** conne
if (status != sfSocketDone)
{
delete *connected;
*connected = NULL;
*connected = nullptr;
}
return status;
+2 -2
View File
@@ -55,6 +55,6 @@ size_t sfBuffer_getSize(const sfBuffer* buffer)
////////////////////////////////////////////////////////////
const sfUint8* sfBuffer_getData(const sfBuffer* buffer)
{
CSFML_CHECK_RETURN(buffer, NULL);
return !buffer->buffer.empty() ? &buffer->buffer[0] : NULL;
CSFML_CHECK_RETURN(buffer, nullptr);
return !buffer->buffer.empty() ? &buffer->buffer[0] : nullptr;
}
+1 -1
View File
@@ -40,7 +40,7 @@ sfClock* sfClock_create(void)
////////////////////////////////////////////////////////////
sfClock* sfClock_copy(const sfClock* clock)
{
CSFML_CHECK_RETURN(clock, NULL);
CSFML_CHECK_RETURN(clock, nullptr);
return new sfClock(*clock);
}
+2 -3
View File
@@ -38,7 +38,7 @@ sfCursor* sfCursor_createFromPixels(const sfUint8* pixels, sfVector2u size, sfVe
if (!cursor->This.loadFromPixels(pixels, sf::Vector2u(size.x, size.y), sf::Vector2u(hotspot.x, hotspot.y)))
{
delete cursor;
cursor = NULL;
cursor = nullptr;
}
return cursor;
@@ -53,7 +53,7 @@ sfCursor* sfCursor_createFromSystem(sfCursorType type)
if (!cursor->This.loadFromSystem(static_cast<sf::Cursor::Type>(type)))
{
delete cursor;
cursor = NULL;
cursor = nullptr;
}
return cursor;
@@ -65,4 +65,3 @@ void sfCursor_destroy(sfCursor* cursor)
{
delete cursor;
}
+1 -1
View File
@@ -65,7 +65,7 @@ const sfVideoMode* sfVideoMode_getFullscreenModes(size_t* count)
if (count)
*count = modes.size();
return !modes.empty() ? &modes[0] : NULL;
return !modes.empty() ? &modes[0] : nullptr;
}
+1 -1
View File
@@ -55,5 +55,5 @@ const char* const* sfVulkan_getGraphicsRequiredInstanceExtensions(size_t* count)
if (count)
*count = extensions.size();
return !extensions.empty() ? &extensions[0] : NULL;
return !extensions.empty() ? &extensions[0] : nullptr;
}