1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Fix some of the new warnings from sonarcloud

This commit is contained in:
Ivan Savenko
2024-10-10 20:31:11 +00:00
parent 1fc0267ad1
commit a8e84c55f6
27 changed files with 66 additions and 84 deletions

View File

@@ -64,9 +64,9 @@ int CTrueTypeFont::getFontStyle(const JsonNode &config) const
CTrueTypeFont::CTrueTypeFont(const JsonNode & fontConfig):
data(loadData(fontConfig)),
font(loadFont(fontConfig), TTF_CloseFont),
dropShadow(!fontConfig["noShadow"].Bool()),
blended(true),
outline(fontConfig["outline"].Bool()),
blended(true)
dropShadow(!fontConfig["noShadow"].Bool())
{
assert(font);
@@ -95,14 +95,14 @@ size_t CTrueTypeFont::getLineHeightScaled() const
return TTF_FontHeight(font.get());
}
size_t CTrueTypeFont::getGlyphWidthScaled(const char *data) const
size_t CTrueTypeFont::getGlyphWidthScaled(const char *text) const
{
return getStringWidthScaled(std::string(data, TextOperations::getUnicodeCharacterSize(*data)));
return getStringWidthScaled(std::string(text, TextOperations::getUnicodeCharacterSize(*text)));
}
bool CTrueTypeFont::canRepresentCharacter(const char * data) const
bool CTrueTypeFont::canRepresentCharacter(const char * text) const
{
uint32_t codepoint = TextOperations::getUnicodeCodepoint(data, TextOperations::getUnicodeCharacterSize(*data));
uint32_t codepoint = TextOperations::getUnicodeCodepoint(text, TextOperations::getUnicodeCharacterSize(*text));
#if SDL_TTF_VERSION_ATLEAST(2, 0, 18)
return TTF_GlyphIsProvided32(font.get(), codepoint);
#elif SDL_TTF_VERSION_ATLEAST(2, 0, 12)
@@ -114,10 +114,10 @@ bool CTrueTypeFont::canRepresentCharacter(const char * data) const
#endif
}
size_t CTrueTypeFont::getStringWidthScaled(const std::string & data) const
size_t CTrueTypeFont::getStringWidthScaled(const std::string & text) const
{
int width;
TTF_SizeUTF8(font.get(), data.c_str(), &width, nullptr);
TTF_SizeUTF8(font.get(), text.c_str(), &width, nullptr);
return width;
}