Replaced C standard headers (<xxx.h>) with their C++ version (<cxxx>)
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1545 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
41b29f45f8
commit
ff2c4f2ee7
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_workspace_file>
|
||||
<Workspace title="SFML workspace">
|
||||
<Project filename="sfml-system.cbp" />
|
||||
<Project filename="sfml-system.cbp" active="1" />
|
||||
<Project filename="sfml-window.cbp" />
|
||||
<Project filename="sfml-network.cbp" />
|
||||
<Project filename="sfml-graphics.cbp" active="1" />
|
||||
<Project filename="sfml-graphics.cbp" />
|
||||
<Project filename="sfml-audio.cbp" />
|
||||
<Project filename="sfml-main.cbp" />
|
||||
<Project filename="..\..\samples\build\codeblocks\ftp.cbp" />
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <SFML/Config.hpp>
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <SFML/Graphics/Rect.hpp>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
namespace sf
|
||||
|
@ -108,8 +108,8 @@ inline Matrix3 Matrix3::Transformation(const Vector2f& origin, const Vector2f& t
|
||||
{
|
||||
// Combine the transformations
|
||||
float angle = rotation * 3.141592654f / 180.f;
|
||||
float cosine = static_cast<float>(cos(angle));
|
||||
float sine = static_cast<float>(sin(angle));
|
||||
float cosine = static_cast<float>(std::cos(angle));
|
||||
float sine = static_cast<float>(std::sin(angle));
|
||||
float sxCos = scale.x * cosine;
|
||||
float syCos = scale.y * cosine;
|
||||
float sxSin = scale.x * sine;
|
||||
@ -129,8 +129,8 @@ inline Matrix3 Matrix3::Projection(const Vector2f& center, const Vector2f& size,
|
||||
{
|
||||
// Rotation components
|
||||
float angle = rotation * 3.141592654f / 180.f;
|
||||
float cosine = static_cast<float>(cos(angle));
|
||||
float sine = static_cast<float>(sin(angle));
|
||||
float cosine = static_cast<float>(std::cos(angle));
|
||||
float sine = static_cast<float>(std::sin(angle));
|
||||
float tx = -center.x * cosine - center.y * sine + center.x;
|
||||
float ty = center.x * sine - center.y * cosine + center.y;
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <algorithm>
|
||||
#include <locale>
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
namespace sf
|
||||
|
@ -27,7 +27,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Audio/SoundFile.hpp>
|
||||
#include <SFML/System/Err.hpp>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace sf
|
||||
@ -283,7 +283,7 @@ sf_count_t SoundFile::MemoryIO::Read(void* ptr, sf_count_t count, void* userData
|
||||
if (position + count >= self->myTotalSize)
|
||||
count = self->myTotalSize - position;
|
||||
|
||||
memcpy(ptr, self->myDataPtr, static_cast<std::size_t>(count));
|
||||
std::memcpy(ptr, self->myDataPtr, static_cast<std::size_t>(count));
|
||||
|
||||
self->myDataPtr += count;
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <SFML/Graphics/Drawable.hpp>
|
||||
#include <SFML/Graphics/Renderer.hpp>
|
||||
#include <SFML/Graphics/RenderTarget.hpp>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
namespace sf
|
||||
@ -153,7 +153,7 @@ void Drawable::SetOrigin(const Vector2f& origin)
|
||||
////////////////////////////////////////////////////////////
|
||||
void Drawable::SetRotation(float angle)
|
||||
{
|
||||
myRotation = static_cast<float>(fmod(angle, 360));
|
||||
myRotation = static_cast<float>(std::fmod(angle, 360));
|
||||
if (myRotation < 0)
|
||||
myRotation += 360.f;
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <SFML/System/Err.hpp>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace sf
|
||||
@ -144,7 +144,7 @@ bool Image::LoadFromPixels(unsigned int width, unsigned int height, const Uint8*
|
||||
|
||||
// Fill the pixel buffer with the specified raw data
|
||||
myPixels.resize(width * height * 4);
|
||||
memcpy(&myPixels[0], data, myPixels.size());
|
||||
std::memcpy(&myPixels[0], data, myPixels.size());
|
||||
|
||||
// We can create the texture
|
||||
if (CreateTexture())
|
||||
@ -312,7 +312,7 @@ void Image::Copy(const Image& source, unsigned int destX, unsigned int destY, co
|
||||
// Optimized copy ignoring alpha values, row by row (faster)
|
||||
for (int i = 0; i < rows; ++i)
|
||||
{
|
||||
memcpy(dstPixels, srcPixels, pitch);
|
||||
std::memcpy(dstPixels, srcPixels, pitch);
|
||||
srcPixels += srcStride;
|
||||
dstPixels += dstStride;
|
||||
}
|
||||
@ -709,7 +709,7 @@ void Image::EnsureArrayUpdate() const
|
||||
|
||||
for (unsigned int i = 0; i < myHeight; ++i)
|
||||
{
|
||||
memcpy(dst, src, dstPitch);
|
||||
std::memcpy(dst, src, dstPitch);
|
||||
src += srcPitch;
|
||||
dst += dstPitch;
|
||||
}
|
||||
|
@ -35,18 +35,16 @@ extern "C"
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
}
|
||||
#include <ctype.h>
|
||||
#include <cctype>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
std::string ToLower(const std::string& str)
|
||||
// Convert a string to lower case
|
||||
std::string ToLower(std::string str)
|
||||
{
|
||||
std::string lower = str;
|
||||
for (std::string::iterator it = lower.begin(); it != lower.end(); ++it)
|
||||
*it = static_cast<char>(tolower(*it));
|
||||
|
||||
for (std::string::iterator i = str.begin(); i != str.end(); ++i)
|
||||
*i = static_cast<char>(std::tolower(*i));
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Shape.hpp>
|
||||
#include <SFML/Graphics/Renderer.hpp>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
namespace sf
|
||||
@ -221,7 +221,7 @@ Shape Shape::Circle(const Vector2f& center, float radius, const Color& color, fl
|
||||
for (int i = 0; i < nbSegments; ++i)
|
||||
{
|
||||
float angle = i * 2 * 3.141592654f / nbSegments;
|
||||
Vector2f offset(cos(angle), sin(angle));
|
||||
Vector2f offset(std::cos(angle), std::sin(angle));
|
||||
|
||||
shape.AddPoint(center + offset * radius, color, outlineColor);
|
||||
}
|
||||
@ -366,7 +366,7 @@ bool Shape::ComputeNormal(const Vector2f& p1, const Vector2f& p2, Vector2f& norm
|
||||
normal.x = p1.y - p2.y;
|
||||
normal.y = p2.x - p1.x;
|
||||
|
||||
float len = sqrt(normal.x * normal.x + normal.y * normal.y);
|
||||
float len = std::sqrt(normal.x * normal.x + normal.y * normal.y);
|
||||
if (len == 0.f)
|
||||
return false;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Http.hpp>
|
||||
#include <ctype.h>
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
@ -41,7 +41,7 @@ namespace
|
||||
std::string ToLower(std::string str)
|
||||
{
|
||||
for (std::string::iterator i = str.begin(); i != str.end(); ++i)
|
||||
*i = static_cast<char>(tolower(*i));
|
||||
*i = static_cast<char>(std::tolower(*i));
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <SFML/Network/IpAddress.hpp>
|
||||
#include <SFML/Network/Http.hpp>
|
||||
#include <SFML/Network/SocketImpl.hpp>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
namespace sf
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <SFML/Network/Packet.hpp>
|
||||
#include <SFML/Network/SocketImpl.hpp>
|
||||
#include <SFML/System/String.hpp>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace sf
|
||||
@ -56,7 +56,7 @@ void Packet::Append(const void* data, std::size_t sizeInBytes)
|
||||
{
|
||||
std::size_t start = myData.size();
|
||||
myData.resize(start + sizeInBytes);
|
||||
memcpy(&myData[start], data, sizeInBytes);
|
||||
std::memcpy(&myData[start], data, sizeInBytes);
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ Packet& Packet::operator >>(char* data)
|
||||
if ((length > 0) && CheckSize(length))
|
||||
{
|
||||
// Then extract characters
|
||||
memcpy(data, GetData() + myReadPos, length);
|
||||
std::memcpy(data, GetData() + myReadPos, length);
|
||||
data[length] = '\0';
|
||||
|
||||
// Update reading position
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <SFML/Network/SocketImpl.hpp>
|
||||
#include <SFML/System/Err.hpp>
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4127) // "conditional expression is constant" generated by the FD_SET macro
|
||||
@ -340,7 +340,7 @@ Socket::Status TcpSocket::Receive(Packet& packet)
|
||||
{
|
||||
myPendingPacket.Data.resize(myPendingPacket.Data.size() + received);
|
||||
char* begin = &myPendingPacket.Data[0] + myPendingPacket.Data.size() - received;
|
||||
memcpy(begin, buffer, received);
|
||||
std::memcpy(begin, buffer, received);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <SFML/Network/SocketImpl.hpp>
|
||||
#include <SFML/System/Err.hpp>
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
namespace sf
|
||||
|
@ -26,7 +26,7 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Win32/SocketImpl.hpp>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace sf
|
||||
@ -37,7 +37,7 @@ namespace priv
|
||||
sockaddr_in SocketImpl::CreateAddress(unsigned long address, unsigned short port)
|
||||
{
|
||||
sockaddr_in addr;
|
||||
memset(addr.sin_zero, 0, sizeof(addr.sin_zero));
|
||||
std::memset(addr.sin_zero, 0, sizeof(addr.sin_zero));
|
||||
addr.sin_addr.s_addr = htonl(address);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
|
@ -27,7 +27,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Err.hpp>
|
||||
#include <streambuf>
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -26,8 +26,8 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Randomizer.hpp>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -39,8 +39,8 @@ namespace
|
||||
// in milliseconds, so that it is always different
|
||||
unsigned int InitializeSeed()
|
||||
{
|
||||
unsigned int seed = static_cast<unsigned int>(time(NULL));
|
||||
srand(seed);
|
||||
unsigned int seed = static_cast<unsigned int>(std::time(NULL));
|
||||
std::srand(seed);
|
||||
return seed;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ namespace sf
|
||||
////////////////////////////////////////////////////////////
|
||||
void Randomizer::SetSeed(unsigned int seed)
|
||||
{
|
||||
srand(seed);
|
||||
std::srand(seed);
|
||||
globalSeed = seed;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ float Randomizer::Random(float begin, float end)
|
||||
{
|
||||
// This is not the best algorithm, but it is fast and will be enough in most cases
|
||||
|
||||
return static_cast<float>(rand()) / RAND_MAX * (end - begin) + begin;
|
||||
return static_cast<float>(std::rand()) / RAND_MAX * (end - begin) + begin;
|
||||
}
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ int Randomizer::Random(int begin, int end)
|
||||
{
|
||||
// This is not the best algorithm, but it is fast and will be enough in most cases
|
||||
|
||||
return rand() % (end - begin + 1) + begin;
|
||||
return std::rand() % (end - begin + 1) + begin;
|
||||
}
|
||||
|
||||
} // namespace sf
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <SFML/System/String.hpp>
|
||||
#include <SFML/System/Utf.hpp>
|
||||
#include <iterator>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace sf
|
||||
@ -122,7 +122,7 @@ String::String(const wchar_t* wideString)
|
||||
{
|
||||
if (wideString)
|
||||
{
|
||||
std::size_t length = wcslen(wideString);
|
||||
std::size_t length = std::wcslen(wideString);
|
||||
if (length > 0)
|
||||
{
|
||||
myString.reserve(length + 1);
|
||||
|
@ -27,7 +27,6 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Utf.hpp>
|
||||
#include <exception>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <SFML/System/ThreadLocalPtr.hpp>
|
||||
#include <SFML/OpenGL.hpp>
|
||||
#include <SFML/Window/glext/glext.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
#if defined(SFML_SYSTEM_WINDOWS)
|
||||
@ -167,10 +167,10 @@ GlContext::GlContext()
|
||||
////////////////////////////////////////////////////////////
|
||||
int GlContext::EvaluateFormat(unsigned int bitsPerPixel, const ContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing)
|
||||
{
|
||||
return abs(static_cast<int>(bitsPerPixel - colorBits)) +
|
||||
abs(static_cast<int>(settings.DepthBits - depthBits)) +
|
||||
abs(static_cast<int>(settings.StencilBits - stencilBits)) +
|
||||
abs(static_cast<int>(settings.AntialiasingLevel - antialiasing));
|
||||
return std::abs(static_cast<int>(bitsPerPixel - colorBits)) +
|
||||
std::abs(static_cast<int>(settings.DepthBits - depthBits)) +
|
||||
std::abs(static_cast<int>(settings.StencilBits - stencilBits)) +
|
||||
std::abs(static_cast<int>(settings.AntialiasingLevel - antialiasing));
|
||||
}
|
||||
|
||||
} // namespace priv
|
||||
|
Loading…
Reference in New Issue
Block a user