Address some compiler warnings about implicit integer conversions.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-10-18 22:32:35 -03:00
parent 2e016810c9
commit 0653ec9564
23 changed files with 44 additions and 43 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ public:
virtual int getChannels() const = 0;
virtual int getFreeBufferCount() const = 0;
virtual bool queue(void *data, int length, int dataSampleRate, int dataBitDepth, int dataChannels) = 0;
virtual bool queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels) = 0;
virtual Type getType() const;
+1 -1
View File
@@ -222,7 +222,7 @@ int Source::getFreeBufferCount() const
return 0;
}
bool Source::queue(void *, int, int, int, int)
bool Source::queue(void *, size_t, int, int, int)
{
return false;
}
+1 -1
View File
@@ -77,7 +77,7 @@ public:
virtual int getChannels() const;
virtual int getFreeBufferCount() const;
virtual bool queue(void *data, int length, int dataSampleRate, int dataBitDepth, int dataChannels);
virtual bool queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels);
private:
+4 -4
View File
@@ -663,7 +663,7 @@ bool Source::isLooping() const
return looping;
}
bool Source::queue(void *data, int length, int dataSampleRate, int dataBitDepth, int dataChannels)
bool Source::queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels)
{
if (type != TYPE_QUEUE)
throw QueueTypeMismatchException();
@@ -883,7 +883,7 @@ bool Source::playAtomic(const std::vector<love::audio::Source*> &sources, const
}
alGetError();
alSourcePlayv(toPlay.size(), &toPlay[0]);
alSourcePlayv((ALsizei) toPlay.size(), &toPlay[0]);
bool success = alGetError() == AL_NO_ERROR;
for (auto &_source : sources)
@@ -912,7 +912,7 @@ void Source::stopAtomic(const std::vector<love::audio::Source*> &sources)
sourceIds.push_back(source->source);
}
alSourceStopv(sources.size(), &sourceIds[0]);
alSourceStopv((ALsizei) sources.size(), &sourceIds[0]);
for (auto &_source : sources)
{
@@ -936,7 +936,7 @@ void Source::pauseAtomic(const std::vector<love::audio::Source*> &sources)
sourceIds.push_back(source->source);
}
alSourcePausev(sources.size(), &sourceIds[0]);
alSourcePausev((ALsizei) sources.size(), &sourceIds[0]);
}
void Source::reset()
+1 -1
View File
@@ -142,7 +142,7 @@ public:
virtual int getChannels() const;
virtual int getFreeBufferCount() const;
virtual bool queue(void *data, int length, int dataSampleRate, int dataBitDepth, int dataChannels);
virtual bool queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels);
virtual bool queueAtomic(void *data, ALsizei length);
void prepareAtomic();
+4 -4
View File
@@ -101,10 +101,10 @@ static std::vector<Source*> readSourceList(lua_State *L, int n)
if (n < 0)
n += lua_gettop(L) + 1;
size_t items = lua_objlen(L, n);
int items = (int) lua_objlen(L, n);
std::vector<Source*> sources(items);
for (size_t i = 0; i < items; i++)
for (int i = 0; i < items; i++)
{
lua_rawgeti(L, n, i+1);
sources[i] = luax_checksource(L, -1);
@@ -147,8 +147,8 @@ int w_pause(lua_State *L)
{
auto sources = instance()->pause();
lua_createtable(L, sources.size(), 0);
for (size_t i = 0; i < sources.size(); i++)
lua_createtable(L, (int) sources.size(), 0);
for (int i = 0; i < (int) sources.size(); i++)
{
luax_pushtype(L, AUDIO_SOURCE_ID, sources[i]);
lua_rawseti(L, -2, i+1);
+5 -5
View File
@@ -344,10 +344,10 @@ int w_Source_queue(lua_State *L)
if (luax_istype(L, 2, SOUND_SOUND_DATA_ID))
{
love::sound::SoundData *s = luax_totype<love::sound::SoundData>(L, 2, SOUND_SOUND_DATA_ID);
auto s = luax_totype<love::sound::SoundData>(L, 2, SOUND_SOUND_DATA_ID);
int offset = 0;
int length = s->getSize();
size_t length = s->getSize();
if (lua_gettop(L) == 4)
{
@@ -357,12 +357,12 @@ int w_Source_queue(lua_State *L)
else if (lua_gettop(L) == 3)
length = luaL_checknumber(L, 3);
if (length > (int)s->getSize() - offset || offset < 0 || length < 0)
if (offset < 0 || length > s->getSize() - offset)
return luaL_error(L, "Data region out of bounds.");
luax_catchexcept(L, [&]() {
success = t->queue((void*)((uintptr_t)s->getData() + (uintptr_t)offset),
length, s->getSampleRate(), s->getBitDepth(), s->getChannels());
success = t->queue((unsigned char *)s->getData() + offset, length,
s->getSampleRate(), s->getBitDepth(), s->getChannels());
});
}
else if (lua_islightuserdata(L, 2))