diff --git a/build/codeblocks/SFML.workspace b/build/codeblocks/SFML.workspace index 49c0814b..e60f353a 100644 --- a/build/codeblocks/SFML.workspace +++ b/build/codeblocks/SFML.workspace @@ -1,10 +1,10 @@ - + - + diff --git a/include/SFML/Graphics/Matrix3.hpp b/include/SFML/Graphics/Matrix3.hpp index 5760568d..f2bc76c0 100644 --- a/include/SFML/Graphics/Matrix3.hpp +++ b/include/SFML/Graphics/Matrix3.hpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include namespace sf diff --git a/include/SFML/Graphics/Matrix3.inl b/include/SFML/Graphics/Matrix3.inl index 1b5c83e9..073cadeb 100644 --- a/include/SFML/Graphics/Matrix3.inl +++ b/include/SFML/Graphics/Matrix3.inl @@ -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(cos(angle)); - float sine = static_cast(sin(angle)); + float cosine = static_cast(std::cos(angle)); + float sine = static_cast(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(cos(angle)); - float sine = static_cast(sin(angle)); + float cosine = static_cast(std::cos(angle)); + float sine = static_cast(std::sin(angle)); float tx = -center.x * cosine - center.y * sine + center.x; float ty = center.x * sine - center.y * cosine + center.y; diff --git a/include/SFML/System/Utf.hpp b/include/SFML/System/Utf.hpp index d390c901..1c212e2e 100644 --- a/include/SFML/System/Utf.hpp +++ b/include/SFML/System/Utf.hpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include namespace sf diff --git a/src/SFML/Audio/SoundFile.cpp b/src/SFML/Audio/SoundFile.cpp index 9a91c08e..3f3d2ae5 100644 --- a/src/SFML/Audio/SoundFile.cpp +++ b/src/SFML/Audio/SoundFile.cpp @@ -27,7 +27,7 @@ //////////////////////////////////////////////////////////// #include #include -#include +#include 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(count)); + std::memcpy(ptr, self->myDataPtr, static_cast(count)); self->myDataPtr += count; diff --git a/src/SFML/Graphics/Drawable.cpp b/src/SFML/Graphics/Drawable.cpp index 60221a42..88fd6f1b 100644 --- a/src/SFML/Graphics/Drawable.cpp +++ b/src/SFML/Graphics/Drawable.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include namespace sf @@ -153,7 +153,7 @@ void Drawable::SetOrigin(const Vector2f& origin) //////////////////////////////////////////////////////////// void Drawable::SetRotation(float angle) { - myRotation = static_cast(fmod(angle, 360)); + myRotation = static_cast(std::fmod(angle, 360)); if (myRotation < 0) myRotation += 360.f; diff --git a/src/SFML/Graphics/Image.cpp b/src/SFML/Graphics/Image.cpp index d073271d..364a49ce 100644 --- a/src/SFML/Graphics/Image.cpp +++ b/src/SFML/Graphics/Image.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include 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; } diff --git a/src/SFML/Graphics/ImageLoader.cpp b/src/SFML/Graphics/ImageLoader.cpp index 6d5cd1be..122a5851 100644 --- a/src/SFML/Graphics/ImageLoader.cpp +++ b/src/SFML/Graphics/ImageLoader.cpp @@ -35,18 +35,16 @@ extern "C" #include #include } -#include +#include 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(tolower(*it)); - + for (std::string::iterator i = str.begin(); i != str.end(); ++i) + *i = static_cast(std::tolower(*i)); return str; } } diff --git a/src/SFML/Graphics/Shape.cpp b/src/SFML/Graphics/Shape.cpp index 8a5df02c..aa5a2c9f 100644 --- a/src/SFML/Graphics/Shape.cpp +++ b/src/SFML/Graphics/Shape.cpp @@ -27,7 +27,7 @@ //////////////////////////////////////////////////////////// #include #include -#include +#include 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; diff --git a/src/SFML/Network/Http.cpp b/src/SFML/Network/Http.cpp index 8b15dba8..be179d4e 100644 --- a/src/SFML/Network/Http.cpp +++ b/src/SFML/Network/Http.cpp @@ -26,7 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include -#include +#include #include #include #include @@ -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(tolower(*i)); + *i = static_cast(std::tolower(*i)); return str; } } diff --git a/src/SFML/Network/IpAddress.cpp b/src/SFML/Network/IpAddress.cpp index e85af844..39c04d7b 100644 --- a/src/SFML/Network/IpAddress.cpp +++ b/src/SFML/Network/IpAddress.cpp @@ -28,7 +28,6 @@ #include #include #include -#include namespace sf diff --git a/src/SFML/Network/Packet.cpp b/src/SFML/Network/Packet.cpp index fb87f29c..11cf5d58 100644 --- a/src/SFML/Network/Packet.cpp +++ b/src/SFML/Network/Packet.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include 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 diff --git a/src/SFML/Network/TcpSocket.cpp b/src/SFML/Network/TcpSocket.cpp index 19e90c4b..200270ee 100644 --- a/src/SFML/Network/TcpSocket.cpp +++ b/src/SFML/Network/TcpSocket.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #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); } } diff --git a/src/SFML/Network/UdpSocket.cpp b/src/SFML/Network/UdpSocket.cpp index fe46b4c6..ff80591f 100644 --- a/src/SFML/Network/UdpSocket.cpp +++ b/src/SFML/Network/UdpSocket.cpp @@ -31,7 +31,6 @@ #include #include #include -#include namespace sf diff --git a/src/SFML/Network/Win32/SocketImpl.cpp b/src/SFML/Network/Win32/SocketImpl.cpp index a7592cfc..95812f4e 100644 --- a/src/SFML/Network/Win32/SocketImpl.cpp +++ b/src/SFML/Network/Win32/SocketImpl.cpp @@ -26,7 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include -#include +#include 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); diff --git a/src/SFML/System/Err.cpp b/src/SFML/System/Err.cpp index 436cec65..52df5246 100644 --- a/src/SFML/System/Err.cpp +++ b/src/SFML/System/Err.cpp @@ -27,7 +27,7 @@ //////////////////////////////////////////////////////////// #include #include -#include +#include //////////////////////////////////////////////////////////// diff --git a/src/SFML/System/Randomizer.cpp b/src/SFML/System/Randomizer.cpp index aebd2bb8..d1c8e852 100644 --- a/src/SFML/System/Randomizer.cpp +++ b/src/SFML/System/Randomizer.cpp @@ -26,8 +26,8 @@ // Headers //////////////////////////////////////////////////////////// #include -#include -#include +#include +#include //////////////////////////////////////////////////////////// @@ -39,8 +39,8 @@ namespace // in milliseconds, so that it is always different unsigned int InitializeSeed() { - unsigned int seed = static_cast(time(NULL)); - srand(seed); + unsigned int seed = static_cast(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(rand()) / RAND_MAX * (end - begin) + begin; + return static_cast(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 diff --git a/src/SFML/System/String.cpp b/src/SFML/System/String.cpp index 2db3252e..2b4eba2c 100644 --- a/src/SFML/System/String.cpp +++ b/src/SFML/System/String.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include 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); diff --git a/src/SFML/System/Utf.cpp b/src/SFML/System/Utf.cpp index 798c7a51..cbe2a453 100644 --- a/src/SFML/System/Utf.cpp +++ b/src/SFML/System/Utf.cpp @@ -27,7 +27,6 @@ //////////////////////////////////////////////////////////// #include #include -#include //////////////////////////////////////////////////////////// diff --git a/src/SFML/Window/GlContext.cpp b/src/SFML/Window/GlContext.cpp index eaee1aed..3ec2214c 100644 --- a/src/SFML/Window/GlContext.cpp +++ b/src/SFML/Window/GlContext.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #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(bitsPerPixel - colorBits)) + - abs(static_cast(settings.DepthBits - depthBits)) + - abs(static_cast(settings.StencilBits - stencilBits)) + - abs(static_cast(settings.AntialiasingLevel - antialiasing)); + return std::abs(static_cast(bitsPerPixel - colorBits)) + + std::abs(static_cast(settings.DepthBits - depthBits)) + + std::abs(static_cast(settings.StencilBits - stencilBits)) + + std::abs(static_cast(settings.AntialiasingLevel - antialiasing)); } } // namespace priv