diff --git a/CSFML/include/SFML/Audio/Music.h b/CSFML/include/SFML/Audio/Music.h index 41d809e7f..30f48ad05 100644 --- a/CSFML/include/SFML/Audio/Music.h +++ b/CSFML/include/SFML/Audio/Music.h @@ -52,7 +52,7 @@ CSFML_API sfMusic* sfMusic_CreateFromFile(const char* filename); /// \return A new sfMusic object (NULL if failed) /// //////////////////////////////////////////////////////////// -CSFML_API sfMusic* sfMusic_CreateFromMemory(const char* data, size_t sizeInBytes); +CSFML_API sfMusic* sfMusic_CreateFromMemory(const void* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Destroy an existing music diff --git a/CSFML/include/SFML/Audio/SoundBuffer.h b/CSFML/include/SFML/Audio/SoundBuffer.h index f8ee8e11f..e72920b53 100644 --- a/CSFML/include/SFML/Audio/SoundBuffer.h +++ b/CSFML/include/SFML/Audio/SoundBuffer.h @@ -51,7 +51,7 @@ CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* filename); /// \return A new sfSoundBuffer object (NULL if failed) /// //////////////////////////////////////////////////////////// -CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const char* data, size_t sizeInBytes); +CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const void* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Create a new sound buffer and load it from an array of diff --git a/CSFML/include/SFML/Graphics/Font.h b/CSFML/include/SFML/Graphics/Font.h index 7e64d0b9b..840c7d055 100644 --- a/CSFML/include/SFML/Graphics/Font.h +++ b/CSFML/include/SFML/Graphics/Font.h @@ -51,7 +51,7 @@ CSFML_API sfFont* sfFont_CreateFromFile(const char* filename); /// \return A new sfFont object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_API sfFont* sfFont_CreateFromMemory(const char* data, size_t sizeInBytes); +CSFML_API sfFont* sfFont_CreateFromMemory(const void* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Copy an existing font diff --git a/CSFML/include/SFML/Graphics/Image.h b/CSFML/include/SFML/Graphics/Image.h index 8575049ca..e098944f0 100644 --- a/CSFML/include/SFML/Graphics/Image.h +++ b/CSFML/include/SFML/Graphics/Image.h @@ -85,7 +85,7 @@ CSFML_API sfImage* sfImage_CreateFromFile(const char* filename); /// \return A new sfImage object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_API sfImage* sfImage_CreateFromMemory(const char* data, size_t sizeInBytes); +CSFML_API sfImage* sfImage_CreateFromMemory(const void* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Copy an existing image diff --git a/CSFML/src/SFML/Audio/Music.cpp b/CSFML/src/SFML/Audio/Music.cpp index 1d47618d7..9f513716d 100644 --- a/CSFML/src/SFML/Audio/Music.cpp +++ b/CSFML/src/SFML/Audio/Music.cpp @@ -50,7 +50,7 @@ sfMusic* sfMusic_CreateFromFile(const char* filename) //////////////////////////////////////////////////////////// /// Create a new music and load it from a file in memory //////////////////////////////////////////////////////////// -sfMusic* sfMusic_CreateFromMemory(const char* data, size_t sizeInBytes) +sfMusic* sfMusic_CreateFromMemory(const void* data, size_t sizeInBytes) { sfMusic* music = new sfMusic; diff --git a/CSFML/src/SFML/Audio/SoundBuffer.cpp b/CSFML/src/SFML/Audio/SoundBuffer.cpp index fe452a594..c5348e5d5 100644 --- a/CSFML/src/SFML/Audio/SoundBuffer.cpp +++ b/CSFML/src/SFML/Audio/SoundBuffer.cpp @@ -50,7 +50,7 @@ sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* filename) //////////////////////////////////////////////////////////// /// Create a new sound buffer and load it from a file in memory //////////////////////////////////////////////////////////// -sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const char* data, size_t sizeInBytes) +sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const void* data, size_t sizeInBytes) { sfSoundBuffer* buffer = new sfSoundBuffer; diff --git a/CSFML/src/SFML/Graphics/Font.cpp b/CSFML/src/SFML/Graphics/Font.cpp index ef6e9a113..1514a18f5 100644 --- a/CSFML/src/SFML/Graphics/Font.cpp +++ b/CSFML/src/SFML/Graphics/Font.cpp @@ -49,7 +49,7 @@ sfFont* sfFont_CreateFromFile(const char* filename) //////////////////////////////////////////////////////////// /// Create a new font from a file in memory //////////////////////////////////////////////////////////// -sfFont* sfFont_CreateFromMemory(const char* data, size_t sizeInBytes) +sfFont* sfFont_CreateFromMemory(const void* data, size_t sizeInBytes) { sfFont* font = new sfFont; if (!font->This.LoadFromMemory(data, sizeInBytes)) diff --git a/CSFML/src/SFML/Graphics/Image.cpp b/CSFML/src/SFML/Graphics/Image.cpp index e04cd7bba..1b37f1e23 100644 --- a/CSFML/src/SFML/Graphics/Image.cpp +++ b/CSFML/src/SFML/Graphics/Image.cpp @@ -94,7 +94,7 @@ sfImage* sfImage_CreateFromFile(const char* filename) //////////////////////////////////////////////////////////// /// Create a new image from a file in memory //////////////////////////////////////////////////////////// -sfImage* sfImage_CreateFromMemory(const char* data, size_t sizeInBytes) +sfImage* sfImage_CreateFromMemory(const void* data, size_t sizeInBytes) { sfImage* image = new sfImage; diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp index d0cb64ce2..0bbb98ecb 100644 --- a/include/SFML/Audio/Music.hpp +++ b/include/SFML/Audio/Music.hpp @@ -96,7 +96,7 @@ public : /// \see OpenFromFile /// //////////////////////////////////////////////////////////// - bool OpenFromMemory(const char* data, std::size_t sizeInBytes); + bool OpenFromMemory(const void* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// /// \brief Get the total duration of the music diff --git a/include/SFML/Audio/SoundBuffer.hpp b/include/SFML/Audio/SoundBuffer.hpp index af9a2c65c..1a0601831 100644 --- a/include/SFML/Audio/SoundBuffer.hpp +++ b/include/SFML/Audio/SoundBuffer.hpp @@ -98,7 +98,7 @@ public : /// \see LoadFromFile, LoadFromSamples, SaveToFile /// //////////////////////////////////////////////////////////// - bool LoadFromMemory(const char* data, std::size_t sizeInBytes); + bool LoadFromMemory(const void* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// /// \brief Load the sound buffer from an array of audio samples diff --git a/include/SFML/Graphics/Font.hpp b/include/SFML/Graphics/Font.hpp index 28ecf0ca5..a1611b658 100644 --- a/include/SFML/Graphics/Font.hpp +++ b/include/SFML/Graphics/Font.hpp @@ -108,7 +108,7 @@ public : /// \see LoadFromFile /// //////////////////////////////////////////////////////////// - bool LoadFromMemory(const char* data, std::size_t sizeInBytes); + bool LoadFromMemory(const void* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// /// \brief Retrieve a glyph of the font diff --git a/include/SFML/Graphics/Image.hpp b/include/SFML/Graphics/Image.hpp index 17d7257d6..a696db81b 100644 --- a/include/SFML/Graphics/Image.hpp +++ b/include/SFML/Graphics/Image.hpp @@ -87,7 +87,7 @@ public : /// \return True if loading was successful /// //////////////////////////////////////////////////////////// - bool LoadFromMemory(const char* data, std::size_t sizeInBytes); + bool LoadFromMemory(const void* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Load the image directly from an array of pixels diff --git a/include/SFML/Network/SocketTCP.hpp b/include/SFML/Network/SocketTCP.hpp index 4d5afa6b8..dcc5a245d 100644 --- a/include/SFML/Network/SocketTCP.hpp +++ b/include/SFML/Network/SocketTCP.hpp @@ -98,13 +98,13 @@ public : //////////////////////////////////////////////////////////// /// Send an array of bytes to the host (must be connected first) /// - /// \param data : Pointer to the bytes to send - /// \param size : Number of bytes to send + /// \param data : Pointer to the bytes to send + /// \param sizeInBytes : Number of bytes to send /// /// \return Status code /// //////////////////////////////////////////////////////////// - Socket::Status Send(const char* data, std::size_t size); + Socket::Status Send(const char* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Receive an array of bytes from the host (must be connected first). diff --git a/include/SFML/Network/SocketUDP.hpp b/include/SFML/Network/SocketUDP.hpp index 785e7a9fc..3c9b965a3 100644 --- a/include/SFML/Network/SocketUDP.hpp +++ b/include/SFML/Network/SocketUDP.hpp @@ -82,15 +82,15 @@ public : //////////////////////////////////////////////////////////// /// Send an array of bytes /// - /// \param data : Pointer to the bytes to send - /// \param size : Number of bytes to send - /// \param address : Address of the computer to send the packet to - /// \param port : Port to send the data to + /// \param data : Pointer to the bytes to send + /// \param sizeInBytes : Number of bytes to send + /// \param address : Address of the computer to send the packet to + /// \param port : Port to send the data to /// /// \return Status code /// //////////////////////////////////////////////////////////// - Socket::Status Send(const char* data, std::size_t size, const IPAddress& address, unsigned short port); + Socket::Status Send(const char* data, std::size_t sizeInBytes, const IPAddress& address, unsigned short port); //////////////////////////////////////////////////////////// /// Receive an array of bytes. diff --git a/src/SFML/Audio/Music.cpp b/src/SFML/Audio/Music.cpp index b73be31bc..9b71a8afb 100644 --- a/src/SFML/Audio/Music.cpp +++ b/src/SFML/Audio/Music.cpp @@ -81,7 +81,7 @@ bool Music::OpenFromFile(const std::string& filename) //////////////////////////////////////////////////////////// -bool Music::OpenFromMemory(const char* data, std::size_t sizeInBytes) +bool Music::OpenFromMemory(const void* data, std::size_t sizeInBytes) { // First stop the music if it was already running Stop(); diff --git a/src/SFML/Audio/SoundBuffer.cpp b/src/SFML/Audio/SoundBuffer.cpp index d5b56c7f6..d2415dcd3 100644 --- a/src/SFML/Audio/SoundBuffer.cpp +++ b/src/SFML/Audio/SoundBuffer.cpp @@ -108,7 +108,7 @@ bool SoundBuffer::LoadFromFile(const std::string& filename) //////////////////////////////////////////////////////////// -bool SoundBuffer::LoadFromMemory(const char* data, std::size_t sizeInBytes) +bool SoundBuffer::LoadFromMemory(const void* data, std::size_t sizeInBytes) { // Open the sound file priv::SoundFile file; diff --git a/src/SFML/Audio/SoundFile.cpp b/src/SFML/Audio/SoundFile.cpp index 7271460c5..5b1b462ae 100644 --- a/src/SFML/Audio/SoundFile.cpp +++ b/src/SFML/Audio/SoundFile.cpp @@ -100,7 +100,7 @@ bool SoundFile::OpenRead(const std::string& filename) //////////////////////////////////////////////////////////// -bool SoundFile::OpenRead(const char* data, std::size_t sizeInBytes) +bool SoundFile::OpenRead(const void* data, std::size_t sizeInBytes) { // If the file is already opened, first close it if (myFile) @@ -246,7 +246,7 @@ int SoundFile::GetFormatFromFilename(const std::string& filename) //////////////////////////////////////////////////////////// -SF_VIRTUAL_IO SoundFile::MemoryIO::Prepare(const char* data, std::size_t sizeInBytes) +SF_VIRTUAL_IO SoundFile::MemoryIO::Prepare(const void* data, std::size_t sizeInBytes) { // Setup the I/O functions SF_VIRTUAL_IO io; @@ -257,8 +257,8 @@ SF_VIRTUAL_IO SoundFile::MemoryIO::Prepare(const char* data, std::size_t sizeInB io.write = &SoundFile::MemoryIO::Write; // Initialize the memory data - myDataStart = data; - myDataPtr = data; + myDataStart = static_cast(data); + myDataPtr = myDataStart; myTotalSize = sizeInBytes; return io; diff --git a/src/SFML/Audio/SoundFile.hpp b/src/SFML/Audio/SoundFile.hpp index 2fa50d3b9..b30891d17 100644 --- a/src/SFML/Audio/SoundFile.hpp +++ b/src/SFML/Audio/SoundFile.hpp @@ -100,7 +100,7 @@ public : /// \return True if the file was successfully opened /// //////////////////////////////////////////////////////////// - bool OpenRead(const char* data, std::size_t sizeInBytes); + bool OpenRead(const void* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// /// \brief a the sound file for writing @@ -163,7 +163,7 @@ private : { public : - SF_VIRTUAL_IO Prepare(const char* data, std::size_t sizeInBytes); + SF_VIRTUAL_IO Prepare(const void* data, std::size_t sizeInBytes); private : diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index c2aa941bf..6441b8915 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -112,7 +112,7 @@ bool Font::LoadFromFile(const std::string& filename) //////////////////////////////////////////////////////////// -bool Font::LoadFromMemory(const char* data, std::size_t sizeInBytes) +bool Font::LoadFromMemory(const void* data, std::size_t sizeInBytes) { // Cleanup the previous resources Cleanup(); diff --git a/src/SFML/Graphics/Image.cpp b/src/SFML/Graphics/Image.cpp index eb5883010..819834208 100644 --- a/src/SFML/Graphics/Image.cpp +++ b/src/SFML/Graphics/Image.cpp @@ -116,7 +116,7 @@ bool Image::LoadFromFile(const std::string& filename) //////////////////////////////////////////////////////////// /// Load the image from a file in memory //////////////////////////////////////////////////////////// -bool Image::LoadFromMemory(const char* data, std::size_t sizeInBytes) +bool Image::LoadFromMemory(const void* data, std::size_t sizeInBytes) { // Check parameters if (!data || (sizeInBytes == 0)) diff --git a/src/SFML/Graphics/ImageLoader.cpp b/src/SFML/Graphics/ImageLoader.cpp index 07adac30c..d0d49c7eb 100644 --- a/src/SFML/Graphics/ImageLoader.cpp +++ b/src/SFML/Graphics/ImageLoader.cpp @@ -122,7 +122,7 @@ bool ImageLoader::LoadImageFromFile(const std::string& filename, std::vector& pixels, unsigned int& width, unsigned int& height) +bool ImageLoader::LoadImageFromMemory(const void* data, std::size_t sizeInBytes, std::vector& pixels, unsigned int& width, unsigned int& height) { // Clear the array (just in case) pixels.clear(); diff --git a/src/SFML/Graphics/ImageLoader.hpp b/src/SFML/Graphics/ImageLoader.hpp index dc08a7714..3cd3e0bc0 100644 --- a/src/SFML/Graphics/ImageLoader.hpp +++ b/src/SFML/Graphics/ImageLoader.hpp @@ -79,7 +79,7 @@ public : /// \return True if loading was successful /// //////////////////////////////////////////////////////////// - bool LoadImageFromMemory(const char* data, std::size_t sizeInBytes, std::vector& pixels, unsigned int& width, unsigned int& height); + bool LoadImageFromMemory(const void* data, std::size_t sizeInBytes, std::vector& pixels, unsigned int& width, unsigned int& height); //////////////////////////////////////////////////////////// /// Save pixels to an image file diff --git a/src/SFML/Network/SocketTCP.cpp b/src/SFML/Network/SocketTCP.cpp index 13ed552ae..e40c92445 100644 --- a/src/SFML/Network/SocketTCP.cpp +++ b/src/SFML/Network/SocketTCP.cpp @@ -232,18 +232,18 @@ Socket::Status SocketTCP::Accept(SocketTCP& connected, IPAddress* address) //////////////////////////////////////////////////////////// /// Send an array of bytes to the host (must be connected first) //////////////////////////////////////////////////////////// -Socket::Status SocketTCP::Send(const char* data, std::size_t size) +Socket::Status SocketTCP::Send(const char* data, std::size_t sizeInBytes) { // First check that socket is valid if (!IsValid()) return Socket::Error; // Check parameters - if (data && size) + if (data && sizeInBytes) { // Loop until every byte has been sent int sent = 0; - int sizeToSend = static_cast(size); + int sizeToSend = static_cast(sizeInBytes); for (int length = 0; length < sizeToSend; length += sent) { // Send a chunk of data diff --git a/src/SFML/Network/SocketUDP.cpp b/src/SFML/Network/SocketUDP.cpp index ee99ac30d..51f7b6828 100644 --- a/src/SFML/Network/SocketUDP.cpp +++ b/src/SFML/Network/SocketUDP.cpp @@ -115,14 +115,14 @@ bool SocketUDP::Unbind() //////////////////////////////////////////////////////////// /// Send an array of bytes //////////////////////////////////////////////////////////// -Socket::Status SocketUDP::Send(const char* data, std::size_t size, const IPAddress& address, unsigned short port) +Socket::Status SocketUDP::Send(const char* data, std::size_t sizeInBytes, const IPAddress& address, unsigned short port) { // Make sure the socket is valid if (!IsValid()) Create(); // Check parameters - if (data && size) + if (data && sizeInBytes) { // Build the target address sockaddr_in sockAddr; @@ -133,7 +133,7 @@ Socket::Status SocketUDP::Send(const char* data, std::size_t size, const IPAddre // Loop until every byte has been sent int sent = 0; - int sizeToSend = static_cast(size); + int sizeToSend = static_cast(sizeInBytes); for (int length = 0; length < sizeToSend; length += sent) { // Send a chunk of data