Changed the parameter of LoadFromMemory functions to be a const void* instead of a const char*

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1409 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-02-17 14:43:09 +00:00
parent b60fda48d9
commit 47d019098c
24 changed files with 38 additions and 38 deletions

View file

@ -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();

View file

@ -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;

View file

@ -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<const char*>(data);
myDataPtr = myDataStart;
myTotalSize = sizeInBytes;
return io;

View file

@ -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 :

View file

@ -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();

View file

@ -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))

View file

@ -122,7 +122,7 @@ bool ImageLoader::LoadImageFromFile(const std::string& filename, std::vector<Col
////////////////////////////////////////////////////////////
/// Load pixels from an image file in memory
////////////////////////////////////////////////////////////
bool ImageLoader::LoadImageFromMemory(const char* data, std::size_t sizeInBytes, std::vector<Color>& pixels, unsigned int& width, unsigned int& height)
bool ImageLoader::LoadImageFromMemory(const void* data, std::size_t sizeInBytes, std::vector<Color>& pixels, unsigned int& width, unsigned int& height)
{
// Clear the array (just in case)
pixels.clear();

View file

@ -79,7 +79,7 @@ public :
/// \return True if loading was successful
///
////////////////////////////////////////////////////////////
bool LoadImageFromMemory(const char* data, std::size_t sizeInBytes, std::vector<Color>& pixels, unsigned int& width, unsigned int& height);
bool LoadImageFromMemory(const void* data, std::size_t sizeInBytes, std::vector<Color>& pixels, unsigned int& width, unsigned int& height);
////////////////////////////////////////////////////////////
/// Save pixels to an image file

View file

@ -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<int>(size);
int sizeToSend = static_cast<int>(sizeInBytes);
for (int length = 0; length < sizeToSend; length += sent)
{
// Send a chunk of data

View file

@ -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<int>(size);
int sizeToSend = static_cast<int>(sizeInBytes);
for (int length = 0; length < sizeToSend; length += sent)
{
// Send a chunk of data