fix some qualifiers dealing with loadFile()

This commit is contained in:
Josh Holtrop committed 2011-05-21 23:42:52 -04:00
1 parent 15c30e0d00
commit 07f4162581
3 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -259,7 +259,7 @@ AV::Sound::~Sound()
}
}
bool AV::Sound::load(unsigned char *data, unsigned int size)
bool AV::Sound::load(const unsigned char *data, unsigned int size)
{
m_data = new unsigned char[size];
memcpy(m_data, data, size);
+1 -1
View File
@@ -27,7 +27,7 @@ class AV
public:
Sound(AV & av);
~Sound();
bool load(unsigned char *data, unsigned int size);
bool load(const unsigned char *data, unsigned int size);
void play();
void resume();
void stop();
+3 -3
View File
@@ -636,11 +636,11 @@ int Engine::loadSound(const string & name)
refptr<AV::Sound> avs = m_av.createSound();
unsigned int size;
unsigned char *data = loadFile(nm.c_str(), &size);
const unsigned char *data = loadFile(nm.c_str(), &size);
if (data != NULL)
{
bool loaded = avs->load(data, size);
free(data);
delete[] data;
if (loaded)
return addSound(avs);
}
@@ -1283,7 +1283,7 @@ const unsigned char *Engine::loadFile(const char *fname, unsigned int *len)
FILE * fp = fopen(file_path.c_str(), "rb");
if (fp != NULL)
{
unsigned char *data = malloc(size);
unsigned char *data = new unsigned char[size];
int num_read = fread(data, size, 1, fp);
fclose(fp);
if (num_read > 0)