Skip to content

Commit

Permalink
Address some compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Oct 21, 2023
1 parent 5a0a6a1 commit 6aaf0b2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/modules/data/wrap_ByteData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int w_ByteData_setString(lua_State *L)
if (size == 0)
return 0;

if (offset < 0 || offset + size > (int64) t->getSize())
if (offset < 0 || offset + (int64) size > (int64) t->getSize())
return luaL_error(L, "The given string offset and size don't fit within the Data's size.");

memcpy((char *) t->getData() + (size_t) offset, str, size);
Expand Down
12 changes: 6 additions & 6 deletions src/modules/font/freetype/HarfbuzzShaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,18 @@ void HarfbuzzShaper::computeBufferRanges(const ColoredCodepoints &codepoints, Ra

hb_shape(hbFonts[rasti], hbb, nullptr, 0);

int glyphcount = (int)hb_buffer_get_length(hbb);
size_t glyphcount = (size_t)hb_buffer_get_length(hbb);
const hb_glyph_info_t *glyphinfos = hb_buffer_get_glyph_infos(hbb, nullptr);
hb_direction_t direction = hb_buffer_get_direction(hbb);

fallbackranges.clear();

for (int i = 0; i < glyphcount; i++)
for (size_t i = 0; i < glyphcount; i++)
{
if (isValidGlyph(glyphinfos[i].codepoint, codepoints.cps, glyphinfos[i].cluster))
{
if (bufferranges.empty() || bufferranges.back().index != rasti || bufferranges.back().range.getMax() + 1 != i)
bufferranges.push_back({(int)rasti, (int)glyphinfos[i].cluster, Range(i, 1)});
bufferranges.push_back({rasti, (int)glyphinfos[i].cluster, Range(i, 1)});
else
bufferranges.back().range.last++;
}
Expand Down Expand Up @@ -247,7 +247,7 @@ void HarfbuzzShaper::computeGlyphPositions(const ColoredCodepoints &codepoints,
// TODO: this doesn't handle situations where the user inserted a color
// change in the middle of some characters that get combined into a single
// cluster.
if (colors && colorindex < ncolors && codepoints.colors[colorindex].index == info.cluster)
if (colors && colorindex < ncolors && codepoints.colors[colorindex].index == (int)info.cluster)
{
colorToAdd.set(codepoints.colors[colorindex].color);
colorindex++;
Expand All @@ -273,7 +273,7 @@ void HarfbuzzShaper::computeGlyphPositions(const ColoredCodepoints &codepoints,
continue;

// This is a glyph index at this point, despite the name.
GlyphIndex gindex = { (int) info.codepoint, bufferrange.index };
GlyphIndex gindex = { (int) info.codepoint, (int)bufferrange.index };

if (clustercodepoint == '\t' && isUsingSpacesForTab())
{
Expand Down Expand Up @@ -390,7 +390,7 @@ int HarfbuzzShaper::computeWordWrapIndex(const ColoredCodepoints &codepoints, Ra
if (newwidth > wraplimit)
{
// If this is the first character, wrap from the next one instead of this one.
int wrapindex = info.cluster > (int) range.first ? info.cluster : (int) range.first + 1;
int wrapindex = (int)info.cluster > (int)range.first ? (int)info.cluster : (int)range.first + 1;

// Rewind to after the last seen space when wrapping.
if (firstindexafterspace != -1)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/font/freetype/HarfbuzzShaper.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class HarfbuzzShaper : public love::font::TextShaper

struct BufferRange
{
int index;
size_t index;
int codepointStart;
Range range;
};
Expand Down
1 change: 0 additions & 1 deletion src/modules/font/wrap_Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ static TrueTypeRasterizer::Settings luax_checktruetypesettings(lua_State* L, int
int w_newTrueTypeRasterizer(lua_State *L)
{
Rasterizer *t = nullptr;
TrueTypeRasterizer::Hinting hinting = TrueTypeRasterizer::HINTING_NORMAL;

if (lua_type(L, 1) == LUA_TNUMBER || lua_isnone(L, 1))
{
Expand Down
2 changes: 1 addition & 1 deletion src/modules/image/magpie/PVRHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ StrongRef<ByteData> PVRHandler::parseCompressed(Data *filedata, std::vector<Stro
PixelFormat cformat = convertFormat(pixelformat, channeltype);

if (header3.colorSpace == 1)
cformat == getSRGBPixelFormat(cformat);
cformat = getSRGBPixelFormat(cformat);

if (cformat == PIXELFORMAT_UNKNOWN)
throw love::Exception("Could not parse PVR file: unsupported image format.");
Expand Down
2 changes: 1 addition & 1 deletion src/modules/sensor/sdl/Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ std::vector<void*> Sensor::getHandles()
{
std::vector<void*> nativeSensor;

for (const std::pair<SensorType, SDL_Sensor*> &data: sensors)
for (std::pair<SensorType, SDL_Sensor*> data : sensors)
{
if (data.second)
nativeSensor.push_back(data.second);
Expand Down

0 comments on commit 6aaf0b2

Please sign in to comment.