Skip to content

Commit

Permalink
Fix some warnings and win32 build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas committed Jun 5, 2024
1 parent 9ae69c0 commit bd2e112
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
11 changes: 6 additions & 5 deletions Thirdparty/ZWidget/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ include_directories(include)
# Internal include dirs for building zwidget
set(ZWIDGET_INCLUDE_DIRS include/zwidget src)

set(ZWIDGET_COMPILE_OPTIONS ${CMAKE_CXX_FLAGS})
set(ZWIDGET_COMPILE_OPTIONS)

if(WIN32)
set(ZWIDGET_SOURCES ${ZWIDGET_SOURCES} ${ZWIDGET_WIN32_SOURCES})
Expand All @@ -167,12 +167,12 @@ if(WIN32)
# Use all cores for compilation
set(ZWIDGET_COMPILE_OPTIONS ${ZWIDGET_COMPILE_OPTIONS} /MP)

# Don't slow down std containers in debug builds
set(ZWIDGET_COMPILE_OPTIONS ${ZWIDGET_COMPILE_OPTIONS} /D_ITERATOR_DEBUG_LEVEL=0)

# Ignore warnings
# Ignore specific warnings
#set(ZWIDGET_COMPILE_OPTIONS ${ZWIDGET_COMPILE_OPTIONS} /wd4244 /wd4267 /wd4005 /wd4018)

# Don't slow down std containers in debug builds
set(ZWIDGET_DEFINES ${ZWIDGET_DEFINES} -D_ITERATOR_DEBUG_LEVEL=0)

# Ignore warning about legacy CRT functions
#set(ZWIDGET_DEFINES ${ZWIDGET_DEFINES} -D_CRT_SECURE_NO_WARNINGS)
endif()
Expand All @@ -192,6 +192,7 @@ else()
set(ZWIDGET_DEFINES ${ZWIDGET_DEFINES} -DUSE_DBUS)
endif()
if (WAYLAND_FOUND)
set(ZWIDGET_SOURCES ${ZWIDGET_SOURCES} ${ZWIDGET_WAYLAND_SOURCES})
set(ZWIDGET_INCLUDE_DIRS ${ZWIDGET_INCLUDE_DIRS} ${WAYLAND_INCLUDE_DIRS})
set(ZWIDGET_LIBS ${ZWIDGET_LIBS} ${WAYLAND_LDFLAGS})
set(ZWIDGET_DEFINES ${ZWIDGET_DEFINES} -DUSE_WAYLAND)
Expand Down
4 changes: 2 additions & 2 deletions Thirdparty/ZWidget/src/core/pathfill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void PathFillRasterizer::Rasterize(const PathFillDesc& path, uint8_t* dest, int
height = block_height;

scanlines.resize(block_height);
first_scanline = scanlines.size();
first_scanline = (int)scanlines.size();
last_scanline = 0;
}

Expand Down Expand Up @@ -264,7 +264,7 @@ void PathFillRasterizer::Clear()
}
}

first_scanline = scanlines.size();
first_scanline = (int)scanlines.size();
last_scanline = 0;
}

Expand Down
32 changes: 16 additions & 16 deletions Thirdparty/ZWidget/src/core/truetypefont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TrueTypeFont::TrueTypeFont(std::shared_ptr<TrueTypeFontFileData> initdata, int t
if (memcmp(versionTag.data(), "ttcf", 4) == 0) // TTC header
{
ttcHeader.Load(reader);
if (ttcFontIndex >= ttcHeader.numFonts)
if (ttcFontIndex >= (int)ttcHeader.numFonts)
throw std::runtime_error("TTC font index out of bounds");
reader.Seek(ttcHeader.tableDirectoryOffsets[ttcFontIndex]);
}
Expand Down Expand Up @@ -122,7 +122,7 @@ TrueTypeGlyph TrueTypeFont::LoadGlyph(uint32_t glyphIndex, double height) const
path.fill_mode = PathFillMode::winding;

int startPoint = 0;
int numberOfContours = g.endPtsOfContours.size();
int numberOfContours = (int)g.endPtsOfContours.size();
for (int i = 0; i < numberOfContours; i++)
{
int endPoint = g.endPtsOfContours[i];
Expand Down Expand Up @@ -310,7 +310,7 @@ void TrueTypeFont::LoadGlyph(TTF_SimpleGlyph& g, uint32_t glyphIndex, int compos

if (numberOfContours > 0) // Simple glyph
{
int pointsOffset = g.points.size();
int pointsOffset = (int)g.points.size();
for (ttf_uint16 i = 0; i < numberOfContours; i++)
g.endPtsOfContours.push_back(pointsOffset + reader.ReadUInt16());

Expand Down Expand Up @@ -339,15 +339,15 @@ void TrueTypeFont::LoadGlyph(TTF_SimpleGlyph& g, uint32_t glyphIndex, int compos
if (g.flags[i] & TTF_X_SHORT_VECTOR)
{
ttf_int16 x = reader.ReadUInt8();
g.points[i].x = (g.flags[i] & TTF_X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) ? x : -x;
g.points[i].x = (float)((g.flags[i] & TTF_X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) ? x : -x);
}
else if (g.flags[i] & TTF_X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)
{
g.points[i].x = 0;
g.points[i].x = 0.0f;
}
else
{
g.points[i].x = reader.ReadInt16();
g.points[i].x = (float)reader.ReadInt16();
}
}

Expand All @@ -356,15 +356,15 @@ void TrueTypeFont::LoadGlyph(TTF_SimpleGlyph& g, uint32_t glyphIndex, int compos
if (g.flags[i] & TTF_Y_SHORT_VECTOR)
{
ttf_int16 y = reader.ReadUInt8();
g.points[i].y = (g.flags[i] & TTF_Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) ? y : -y;
g.points[i].y = (float)((g.flags[i] & TTF_Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) ? y : -y);
}
else if (g.flags[i] & TTF_Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)
{
g.points[i].y = 0;
g.points[i].y = 0.0f;
}
else
{
g.points[i].y = reader.ReadInt16();
g.points[i].y = (float)reader.ReadInt16();
}
}

Expand All @@ -380,7 +380,7 @@ void TrueTypeFont::LoadGlyph(TTF_SimpleGlyph& g, uint32_t glyphIndex, int compos
if (compositeDepth == 8)
throw std::runtime_error("Composite glyph recursion exceeded");

int parentPointsOffset = g.points.size();
int parentPointsOffset = (int)g.points.size();

bool weHaveInstructions = false;
while (true)
Expand Down Expand Up @@ -420,7 +420,7 @@ void TrueTypeFont::LoadGlyph(TTF_SimpleGlyph& g, uint32_t glyphIndex, int compos
bool transform = true;
if (flags & TTF_WE_HAVE_A_SCALE)
{
ttf_F2DOT14 scale = F2DOT14_ToFloat(reader.ReadF2DOT14());
float scale = F2DOT14_ToFloat(reader.ReadF2DOT14());
mat2x2[0] = scale;
mat2x2[1] = 0;
mat2x2[2] = 0;
Expand All @@ -445,7 +445,7 @@ void TrueTypeFont::LoadGlyph(TTF_SimpleGlyph& g, uint32_t glyphIndex, int compos
transform = false;
}

int childPointsOffset = g.points.size();
int childPointsOffset = (int)g.points.size();
LoadGlyph(g, childGlyphIndex, compositeDepth + 1);

if (transform)
Expand All @@ -463,8 +463,8 @@ void TrueTypeFont::LoadGlyph(TTF_SimpleGlyph& g, uint32_t glyphIndex, int compos

if (flags & TTF_ARGS_ARE_XY_VALUES)
{
dx = argument1;
dy = argument2;
dx = (float)argument1;
dy = (float)argument2;

// Spec states we must fall back to TTF_UNSCALED_COMPONENT_OFFSET if both flags are set
if ((flags & (TTF_SCALED_COMPONENT_OFFSET | TTF_UNSCALED_COMPONENT_OFFSET)) == TTF_SCALED_COMPONENT_OFFSET)
Expand Down Expand Up @@ -976,8 +976,8 @@ void TTF_NamingTable::Load(TrueTypeFileReader& reader)
for (ttf_uint16 i = 0; i < langTagCount; i++)
{
LangTagRecord record;
ttf_uint16 length;
ttf_Offset16 langTagOffset;
record.length = reader.ReadUInt16();
record.langTagOffset = reader.ReadOffset16();
langTagRecord.push_back(record);
}
}
Expand Down

0 comments on commit bd2e112

Please sign in to comment.