Skip to content

Commit

Permalink
Merge pull request #820 from iratahack/Ubuntu-22.04
Browse files Browse the repository at this point in the history
Resolved compilation errors/warnings when building on Ubuntu 22.04.2 with clang
  • Loading branch information
pjft authored Aug 10, 2023
2 parents cda7de6 + 7a944ff commit c552292
Show file tree
Hide file tree
Showing 26 changed files with 97 additions and 64 deletions.
4 changes: 2 additions & 2 deletions CMake/Packages/FindVLC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions es-app/src/CollectionSystemManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion es-app/src/FileFilterIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down Expand Up @@ -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();
}
}
5 changes: 5 additions & 0 deletions es-app/src/SystemData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion es-app/src/SystemScreenSaver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion es-app/src/components/RatingComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RatingComponent : public GuiComponent
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;

Expand Down
6 changes: 3 additions & 3 deletions es-app/src/components/TextListComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TextListComponent : public IList<TextListData, T>
using IList<TextListData, T>::getTransform;
using IList<TextListData, T>::mSize;
using IList<TextListData, T>::mCursor;
using IList<TextListData, T>::Entry;
using IList<TextListData, T>::mEntry;

public:
using IList<TextListData, T>::size;
Expand Down Expand Up @@ -81,8 +81,8 @@ class TextListComponent : public IList<TextListData, T>
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;
Expand Down
2 changes: 1 addition & 1 deletion es-app/src/guis/GuiGameScraper.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GuiGameScraper : public GuiComponent
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:
Expand Down
2 changes: 1 addition & 1 deletion es-app/src/guis/GuiInfoPopup.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GuiInfoPopup : public GuiComponent, public Window::InfoPopup
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;
Expand Down
4 changes: 2 additions & 2 deletions es-app/src/views/gamelist/BasicGameListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class BasicGameListView : public ISimpleGameListView
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;
Expand Down
10 changes: 5 additions & 5 deletions es-app/src/views/gamelist/ISimpleGameListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ class ISimpleGameListView : public IGameListView
// 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 FileData* getCursor() override = 0;
virtual void setCursor(FileData*) 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

Expand Down
4 changes: 2 additions & 2 deletions es-core/src/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down
42 changes: 21 additions & 21 deletions es-core/src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions es-core/src/animations/Animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions es-core/src/components/GridTileComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GridTileComponent : public GuiComponent
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
Expand All @@ -41,7 +41,7 @@ class GridTileComponent : public GuiComponent

Vector3f getBackgroundPosition();

virtual void update(int deltaTime);
virtual void update(int deltaTime) override;

std::shared_ptr<TextureResource> getTexture();

Expand Down
2 changes: 2 additions & 0 deletions es-core/src/components/IList.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class IList : public GuiComponent
};

protected:
struct Entry mEntry;

int mCursor;

int mScrollTier;
Expand Down
6 changes: 5 additions & 1 deletion es-core/src/components/ImageGridComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ImageGridComponent : public IList<ImageGridData, T>
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:
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion es-core/src/components/SwitchComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SwitchComponent : public GuiComponent

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;
Expand Down
6 changes: 6 additions & 0 deletions es-core/src/components/TextComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion es-core/src/components/VideoComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class VideoComponent : public GuiComponent

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.
Expand Down
5 changes: 4 additions & 1 deletion es-core/src/components/VideoVlcComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "Settings.h"
#include <vlc/vlc.h>
#include <SDL_mutex.h>
#include <unistd.h>

#ifdef WIN32
#include <codecvt>
Expand Down Expand Up @@ -255,7 +256,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)
Expand Down
10 changes: 5 additions & 5 deletions es-core/src/components/VideoVlcComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ class VideoVlcComponent : public VideoComponent
// 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();
Expand Down
4 changes: 2 additions & 2 deletions es-core/src/guis/GuiTextEditPopup.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class GuiTextEditPopup : public GuiComponent
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:
Expand Down
5 changes: 5 additions & 0 deletions es-core/src/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Loading

0 comments on commit c552292

Please sign in to comment.