Updates to allow building on Ubuntu-22.04.2 with clang

This commit is contained in:
Craig Hackney 2023-07-10 15:55:47 -07:00 committed by pjft
parent f4c3815b44
commit f9542838c2
26 changed files with 99 additions and 66 deletions

View file

@ -23,14 +23,14 @@ endif(VLC_INCLUDE_DIR AND VLC_LIBRARIES)
# in the FIND_PATH() and FIND_LIBRARY() calls
if(NOT WIN32)
find_package(PkgConfig)
pkg_check_modules(VLC libvlc>=1.0.0)
pkg_check_modules(VLC libvlc>=3.0.0)
set(VLC_DEFINITIONS ${VLC_CFLAGS})
set(VLC_LIBRARIES ${VLC_LDFLAGS})
endif(NOT WIN32)
# TODO add argument support to pass version on find_package
include(MacroEnsureVersion)
macro_ensure_version(1.0.0 ${VLC_VERSION} VLC_VERSION_OK)
macro_ensure_version(3.0.0 ${VLC_VERSION} VLC_VERSION_OK)
if(VLC_VERSION_OK)
set(VLC_FOUND TRUE)
message(STATUS "VLC library found")

View file

@ -737,6 +737,10 @@ void CollectionSystemManager::populateAutoCollection(CollectionSystemData* sysDa
// we may still want to add files we don't want in auto collections in "favorites"
include = (*gameIt)->metadata.get("favorite") == "true";
break;
default:
// No-op to prevent compiler warnings
// Getting here means that the file is not part of a pre-defined collection.
break;
}
if (include) {

View file

@ -171,6 +171,9 @@ std::string FileFilterIndex::getIndexableKey(FileData* game, FilterIndexType typ
key = Utils::String::toUpper(game->metadata.get("kidgame"));
break;
}
default:
LOG(LogWarning) << "Unknown Filter type:" << type;
break;
}
key = Utils::String::trim(key);
if (key.empty() || (type == RATINGS_FILTER && key == "0 STARS")) {
@ -534,4 +537,4 @@ void FileFilterIndex::manageIndexEntry(std::map<std::string, int>* index, std::s
void FileFilterIndex::clearIndex(std::map<std::string, int> indexMap)
{
indexMap.clear();
}
}

View file

@ -148,6 +148,9 @@ void SystemData::indexAllGameFilters(const FileData* folder)
{
case GAME: { mFilterIndex->addToIndex(*it); } break;
case FOLDER: { indexAllGameFilters(*it); } break;
default:
LOG(LogInfo) << "Unknown type: " << (*it)->getType();
break;
}
}
}
@ -210,7 +213,9 @@ SystemData* SystemData::loadSystem(pugi::xml_node system)
// if there appears to be an actual platform ID supplied but it didn't match the list, warn
if (str != NULL && str[0] != '\0' && platformId == PlatformIds::PLATFORM_UNKNOWN)
{
LOG(LogWarning) << " Unknown platform for system \"" << name << "\" (platform \"" << str << "\" from list \"" << platformList << "\")";
}
else if (platformId != PlatformIds::PLATFORM_UNKNOWN)
platformIds.push_back(platformId);
}

View file

@ -314,7 +314,7 @@ void SystemScreenSaver::backgroundIndexing()
std::vector<FileData*> files = all->getRootFolder()->getFilesRecursive(GAME);
const auto startTs = std::chrono::system_clock::now();
for (lastIndex; lastIndex < files.size(); lastIndex++)
for ( ; lastIndex < files.size(); lastIndex++)
{
if(mExit)
break;

View file

@ -23,7 +23,7 @@ public:
void setValue(const std::string& value) override; // Should be a normalized float (in the range [0..1]) - if it's not, it will be clamped.
bool input(InputConfig* config, Input input) override;
void render(const Transform4x4f& parentTrans);
void render(const Transform4x4f& parentTrans) override;
void onSizeChanged() override;

View file

@ -31,7 +31,7 @@ protected:
using IList<TextListData, T>::mSize;
using IList<TextListData, T>::mCursor;
using IList<TextListData, T>::mViewportTop;
using IList<TextListData, T>::Entry;
using IList<TextListData, T>::mEntry;
public:
using IList<TextListData, T>::size;
@ -82,8 +82,8 @@ public:
inline void setLineSpacing(float lineSpacing) { mLineSpacing = lineSpacing; }
protected:
virtual void onScroll(int /*amt*/) { if(!mScrollSound.empty()) Sound::get(mScrollSound)->play(); }
virtual void onCursorChanged(const CursorState& state);
virtual void onScroll(int /*amt*/) override { if(!mScrollSound.empty()) Sound::get(mScrollSound)->play(); }
virtual void onCursorChanged(const CursorState& state) override;
private:
int mMarqueeOffset;

View file

@ -14,7 +14,7 @@ public:
void onSizeChanged() override;
bool input(InputConfig* config, Input input) override;
void update(int deltaTime);
void update(int deltaTime) override;
virtual std::vector<HelpPrompt> getHelpPrompts() override;
private:

View file

@ -14,7 +14,7 @@ public:
GuiInfoPopup(Window* window, std::string message, int duration, int fadein = 500, int fadeout = 500);
~GuiInfoPopup();
void render(const Transform4x4f& parentTrans) override;
inline void stop() { running = false; };
inline void stop() override { running = false; };
private:
std::string mMessage;
int mDuration;

View file

@ -11,9 +11,9 @@ public:
BasicGameListView(Window* window, FileData* root);
// Called when a FileData* is added, has its metadata changed, or is removed
virtual void onFileChanged(FileData* file, FileChangeType change);
virtual void onFileChanged(FileData* file, FileChangeType change) override;
virtual void onThemeChanged(const std::shared_ptr<ThemeData>& theme);
virtual void onThemeChanged(const std::shared_ptr<ThemeData>& theme) override;
virtual FileData* getCursor() override;
virtual void setCursor(FileData* file) override;

View file

@ -17,18 +17,18 @@ public:
// Called when a new file is added, a file is removed, a file's metadata changes, or a file's children are sorted.
// NOTE: FILE_SORTED is only reported for the topmost FileData, where the sort started.
// Since sorts are recursive, that FileData's children probably changed too.
virtual void onFileChanged(FileData* file, FileChangeType change);
virtual void onFileChanged(FileData* file, FileChangeType change) override;
// Called whenever the theme changes.
virtual void onThemeChanged(const std::shared_ptr<ThemeData>& theme);
virtual void onThemeChanged(const std::shared_ptr<ThemeData>& theme) override;
virtual FileData* getCursor() = 0;
virtual void setCursor(FileData*) = 0;
virtual int getViewportTop() = 0;
virtual void setViewportTop(int index) = 0;
virtual FileData* getCursor() override = 0;
virtual void setCursor(FileData*) override = 0;
virtual int getViewportTop() override = 0;
virtual void setViewportTop(int index) override = 0;
virtual bool input(InputConfig* config, Input input) override;
virtual void launch(FileData* game) = 0;
virtual void launch(FileData* game) override = 0;
static const int DOUBLE_PRESS_DETECTION_DURATION = 1500; // millis

View file

@ -5,8 +5,8 @@
#include <sstream>
#define LOG(level) \
if(level > Log::getReportingLevel()) ; \
else Log().get(level)
if(level <= Log::getReportingLevel()) \
Log().get(level)
enum LogLevel { LogError, LogWarning, LogInfo, LogDebug };

View file

@ -13,27 +13,27 @@ Settings* Settings::sInstance = NULL;
// these values are NOT saved to es_settings.xml
// since they're set through command-line arguments, and not the in-program settings menu
std::vector<const char*> settings_dont_save {
{ "Debug" },
{ "DebugGrid" },
{ "DebugText" },
{ "DebugImage" },
{ "ForceKid" },
{ "ForceKiosk" },
{ "IgnoreGamelist" },
{ "HideConsole" },
{ "ShowExit" },
{ "ConfirmQuit" },
{ "SplashScreen" },
{ "VSync" },
{ "FullscreenBorderless" },
{ "Windowed" },
{ "WindowWidth" },
{ "WindowHeight" },
{ "ScreenWidth" },
{ "ScreenHeight" },
{ "ScreenOffsetX" },
{ "ScreenOffsetY" },
{ "ScreenRotate" }
"Debug" ,
"DebugGrid" ,
"DebugText" ,
"DebugImage" ,
"ForceKid" ,
"ForceKiosk" ,
"IgnoreGamelist" ,
"HideConsole" ,
"ShowExit" ,
"ConfirmQuit" ,
"SplashScreen" ,
"VSync" ,
"FullscreenBorderless" ,
"Windowed" ,
"WindowWidth" ,
"WindowHeight" ,
"ScreenWidth" ,
"ScreenHeight" ,
"ScreenOffsetX" ,
"ScreenOffsetY" ,
"ScreenRotate"
};
Settings::Settings()

View file

@ -7,6 +7,7 @@ class Animation
public:
virtual int getDuration() const = 0;
virtual void apply(float t) = 0;
virtual ~Animation() = default;
};
#endif // ES_CORE_ANIMATIONS_ANIMATION_H

View file

@ -22,7 +22,7 @@ public:
GridTileComponent(Window* window);
void render(const Transform4x4f& parentTrans) override;
virtual void applyTheme(const std::shared_ptr<ThemeData>& theme, const std::string& view, const std::string& element, unsigned int properties);
virtual void applyTheme(const std::shared_ptr<ThemeData>& theme, const std::string& view, const std::string& element, unsigned int properties) override;
// Made this a static function because the ImageGridComponent need to know the default tile max size
// to calculate the grid dimension before it instantiate the GridTileComponents
@ -41,7 +41,7 @@ public:
Vector3f getBackgroundPosition();
virtual void update(int deltaTime);
virtual void update(int deltaTime) override;
std::shared_ptr<TextureResource> getTexture();

View file

@ -58,6 +58,8 @@ public:
};
protected:
struct Entry mEntry;
int mCursor;
int mViewportTop;

View file

@ -40,7 +40,7 @@ protected:
using IList<ImageGridData, T>::getTransform;
using IList<ImageGridData, T>::mSize;
using IList<ImageGridData, T>::mCursor;
using IList<ImageGridData, T>::Entry;
using IList<ImageGridData, T>::mEntry;
using IList<ImageGridData, T>::mWindow;
public:
@ -305,7 +305,9 @@ void ImageGridComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
std::string path = elem->get<std::string>("gameImage");
if (!ResourceManager::getInstance()->fileExists(path))
{
LOG(LogWarning) << "Could not replace default game image, check path: " << path;
}
else
{
std::string oldDefaultGameTexture = mDefaultGameTexture;
@ -326,7 +328,9 @@ void ImageGridComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
std::string path = elem->get<std::string>("folderImage");
if (!ResourceManager::getInstance()->fileExists(path))
{
LOG(LogWarning) << "Could not replace default folder image, check path: " << path;
}
else
{
std::string oldDefaultFolderTexture = mDefaultFolderTexture;

View file

@ -18,7 +18,7 @@ public:
bool getState() const;
void setState(bool state);
std::string getValue() const;
std::string getValue() const override;
void setValue(const std::string& statestring) override;
virtual std::vector<HelpPrompt> getHelpPrompts() override;

View file

@ -120,6 +120,9 @@ void TextComponent::render(const Transform4x4f& parentTrans)
case ALIGN_CENTER:
yOff = (getSize().y() - textSize.y()) / 2.0f;
break;
default:
LOG(LogError) << "Unknown vertical alignment: " << mVerticalAlignment;
break;
}
Vector3f off(0, yOff, 0);
@ -147,6 +150,9 @@ void TextComponent::render(const Transform4x4f& parentTrans)
case ALIGN_RIGHT:
Renderer::drawRect(mSize.x() - mTextCache->metrics.size.x(), 0.0f, mTextCache->metrics.size.x(), mTextCache->metrics.size.y(), 0x00000033, 0x00000033);
break;
default:
LOG(LogError) << "Unknown horizontal alignment: " << mHorizontalAlignment;
break;
}
}
mFont->renderTextCache(mTextCache.get());

View file

@ -56,7 +56,7 @@ public:
virtual std::vector<HelpPrompt> getHelpPrompts() override;
virtual void update(int deltaTime);
virtual void update(int deltaTime) override;
// Resize the video to fit this size. If one axis is zero, scale that axis to maintain aspect ratio.
// If both are non-zero, potentially break the aspect ratio. If both are zero, no resizing.

View file

@ -11,6 +11,7 @@
#endif
#include <vlc/vlc.h>
#include <SDL_mutex.h>
#include <unistd.h>
#ifdef WIN32
#include <codecvt>
@ -259,7 +260,9 @@ void VideoVlcComponent::startVideo()
{
unsigned track_count;
// Get the media metadata so we can find the aspect ratio
libvlc_media_parse(mMedia);
libvlc_media_parse_with_options(mMedia, libvlc_media_fetch_local, -1);
while (libvlc_media_get_parsed_status(mMedia) == 0)
;
libvlc_media_track_t** tracks;
track_count = libvlc_media_tracks_get(mMedia, &tracks);
for (unsigned track = 0; track < track_count; ++track)

View file

@ -40,23 +40,23 @@ public:
// If both are non-zero, potentially break the aspect ratio. If both are zero, no resizing.
// Can be set before or after a video is loaded.
// setMaxSize() and setResize() are mutually exclusive.
void setResize(float width, float height);
void setResize(float width, float height) override;
// Resize the video to be as large as possible but fit within a box of this size.
// Can be set before or after a video is loaded.
// Never breaks the aspect ratio. setMaxSize() and setResize() are mutually exclusive.
void setMaxSize(float width, float height);
void setMaxSize(float width, float height) override;
private:
// Calculates the correct mSize from our resizing information (set by setResize/setMaxSize).
// Used internally whenever the resizing parameters or texture change.
void resize();
// Start the video Immediately
virtual void startVideo();
virtual void startVideo() override;
// Stop the video
virtual void stopVideo();
virtual void stopVideo() override;
// Handle looping the video. Must be called periodically
virtual void handleLooping();
virtual void handleLooping() override;
void setupContext();
void freeContext();

View file

@ -15,8 +15,8 @@ public:
GuiTextEditPopup(Window* window, const std::string& title, const std::string& initValue,
const std::function<void(const std::string&)>& okCallback, bool multiLine, const char* acceptBtnText = "OK");
bool input(InputConfig* config, Input input);
void onSizeChanged();
bool input(InputConfig* config, Input input) override;
void onSizeChanged() override;
std::vector<HelpPrompt> getHelpPrompts() override;
private:

View file

@ -85,5 +85,10 @@ void processQuitMode()
touch("/tmp/es-shutdown");
runShutdownCommand();
break;
default:
// No-op to prevent compiler warnings
// If we reach here, it is not a RESTART, REBOOT,
// or SHUTDOWN. Basically a normal exit.
break;
}
}

View file

@ -604,12 +604,12 @@ float Font::getNewlineStartOffset(const std::string& text, const unsigned int& c
return 0;
case ALIGN_CENTER:
{
unsigned int endChar = (unsigned int)text.find('\n', charStart);
size_t endChar = text.find('\n', charStart);
return (xLen - sizeText(text.substr(charStart, endChar != std::string::npos ? endChar - charStart : endChar)).x()) / 2.0f;
}
case ALIGN_RIGHT:
{
unsigned int endChar = (unsigned int)text.find('\n', charStart);
size_t endChar = text.find('\n', charStart);
return xLen - (sizeText(text.substr(charStart, endChar != std::string::npos ? endChar - charStart : endChar)).x());
}
default:

View file

@ -22,23 +22,23 @@ namespace Utils
else if((c & 0xE0) == 0xC0) // 110xxxxx, two byte character
{
// 110xxxxx 10xxxxxx
result = ((_string[_cursor++] & 0x1F) << 6) |
((_string[_cursor++] & 0x3F) );
result = (_string[_cursor++] & 0x1F) << 6;
result |= (_string[_cursor++] & 0x3F);
}
else if((c & 0xF0) == 0xE0) // 1110xxxx, three byte character
{
// 1110xxxx 10xxxxxx 10xxxxxx
result = ((_string[_cursor++] & 0x0F) << 12) |
((_string[_cursor++] & 0x3F) << 6) |
((_string[_cursor++] & 0x3F) );
result = (_string[_cursor++] & 0x0F) << 12;
result |= (_string[_cursor++] & 0x3F) << 6;
result |= (_string[_cursor++] & 0x3F);
}
else if((c & 0xF8) == 0xF0) // 11110xxx, four byte character
{
// 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
result = ((_string[_cursor++] & 0x07) << 18) |
((_string[_cursor++] & 0x3F) << 12) |
((_string[_cursor++] & 0x3F) << 6) |
((_string[_cursor++] & 0x3F) );
result = (_string[_cursor++] & 0x07) << 18;
result |= (_string[_cursor++] & 0x3F) << 12;
result |= (_string[_cursor++] & 0x3F) << 6;
result |= (_string[_cursor++] & 0x3F);
}
else
{